I am struggling creating a correct SPARQL query which will produce the right format so that I can open in it Protege. Our ontology is about cocktails, we want to have all DBPedia cocktails in our database, including the ingredients (dbp:ingredients
) and recipe (dbp:prep
). Getting the cocktail in the database works fine, but the ingredients and recipe not. I have now the following query:
CONSTRUCT {?drink dct:subject ?category.
?drink dbp:prep ?recipe.
?drink dbp:ingredients ?ingredients.
?drink rdf:type owl:NamedIndividual .
?category rdf:type owl:Class.
dct:subject rdf:type owl:ObjectProperty.
dbp:prep rdf:type owl:ObjectProperty.
dbp:ingredient rdf:type owl:Objectproperty.
}
WHERE {
?drink dct:subject ?category.
?drink dbp:prep ?recipe.
?drink dbp:ingredients ?ingredients.}
Since ?ingredients and ?recipe are now not declared, it does not show in the individuals tab in Protege. But when I add this to the CONSTRUCT part of the query:
?recipe rdf:type owl:NamedIndividual.
?ingredients rdf:type owl:NamedIndividual.
I get an error:
Virtuoso RDF01 Error Bad variable value in CONSTRUCT: "*5 cL vodka *10 cL orange juice" (tag 246 box flags 0) is not a valid subject, only object of a triple can be a literal
I think because the prep and ingredients on dbpedia are just a string, no linked data. However, how do I make this work so that it does show in Protege?