2
votes

Im trying to do a SPARQL query in the Wine ontology and by a given wine name find all its properties (hasMaker, locatedIn, hasBody etc).

Is this possible at all? I cant really figure out how to form the query.

Wine ontology: www.w3.org/TR/owl-guide/wine.rdf

1

1 Answers

4
votes

If I understand your question correctly it is quite easy.

Here is an example on how to do it (without PREFIXES). Here I presume that you have the wine URI.

select distinct ?p where {
    vin:MountadamChardonnay ?p ?a .
}

Here you return all properties that your wine has.

If you do not have the wine URI, you can add a check for label or name of the wine before fetching rest of the properties. Below is an example. (If there is another name property just change it with rdfs:label, rdf:id etc). This example is more relevant if you had any other idetifier inside each wine resource.

select distinct ?p where {
    ?wine rdfs:label <wine name> .
    ?wine ?p ?a .
}