PREFIX rdfs: <htp://ww.w3.org/2000/01/rdf-schema#>
PREFIX recipe: <htp://linkedrecipes.org/schema/>
SELECT ?label ?recipe
WHERE{
?food rdfs:label ?label2 .
?food recipe:ingredient_of ?recipe .
?recipe a recipe:Recipe .
?recipe rdfs:label ?label.
FILTER (REGEX(STR(?label2), 'curry', 'i'))
}
但是我怎么能找到咖喱和鸡肉的食谱呢?
答案 0 :(得分:1)
这应该找到咖喱和鸡肉:
PREFIX rdfs: <htp://ww.w3.org/2000/01/rdf-schema#>
PREFIX recipe: <htp://linkedrecipes.org/schema/>
SELECT ?label ?recipe {
?recipe a recipe:Recipe .
?recipe rdfs:label ?label.
?curry recipe:ingredient_of ?recipe .
?curry rdfs:label ?curry_label .
FILTER (REGEX(STR(?curry_label), 'curry', 'i'))
?chicken recipe:ingredient_of ?recipe .
?chicken rdfs:label ?chicken_label .
FILTER (REGEX(STR(?chicken_label), 'chicken', 'i'))
}