Is it possible to query a filter a SPARQL query by the class of one of its properties? I have an ontology which describes films, and I wish to display all films which were filmed in Europe.
The current SPARQL query is as below:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX cinema: <http://example.com/ontologies/cinemachain#>
SELECT ?film ?location
WHERE {
?film rdf:type cinema:Film .
?film cinema:wasFilmedAt ?location .
FILTER(?location rdfs:subClassOf cinema:Europe) .
}
The first two lines of the where clause give me a list of all films and their locations. How can I use the filter to return me results where the location is a subclass of cinema:Europe?