Im have a problem trying to do a sparql query using subClasses.
I have the following ontology:
where Quesos is a SubClassOf Ingrediente as you can see in the next image and Quesos have some other members too.
I want to have some recipes back from some ingredients. For example:
I want to have all the recipes that contains tomato, salt and cheese (where cheese could be any cheese) and I want to have back all the recipes than contains those ingredients.
Here is the problem: If i put the ingredient (like salt or tomato) then the query works fine, but if I put "Quesos" then I've got no answer. I don´t know how to play with the subclasses in a sparql query.
So far I have the following query:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rec:<http://www.receta.org#>
SELECT ?r ?cal ?tiempo ?dif (COUNT (?i) as ?cantIng)(GROUP_CONCAT(DISTINCT ?listaIngredientes) as ?listaIng)(GROUP_CONCAT(DISTINCT ?modoPreparacion) as ?Preparacion)
WHERE {
?x rdf:type rec:Receta .
?x rdfs:label ?r.
?x rec:Ingrediente rec:Sal.
?x rec:Ingrediente rec:Tomate.
?x rec:Calorias ?cal.
?x rec:tiempoPreparacion ?tiempo.
?x rec:dificultad ?dif.
?x rec:listaIngredientes ?listaIngredientes.
?x rec:modoPreparacion ?modoPreparacion.
}
GROUP BY ?r ?cal ?tiempo ?dif
ORDER BY ?cantIng
And I need to add the "subclassOf" line, but I cant find the way. Anyone can help? thank you!