Reputation: 1716
I have this query to return eras for philosophers that works:
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dbpprop: <http://dbpedia.org/property/>
SELECT ?philosopher ?era
WHERE {
?philosopher a dbpedia-owl:Philosopher ;
dbpprop:era ?era .
}
Example values of ?era
returned are:
I would like to return only eras that are resources. I tried:
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dbpprop: <http://dbpedia.org/property/>
SELECT ?philosopher ?era
WHERE {
?philosopher a dbpedia-owl:Philosopher ;
dbpprop:era ?era .
?era a <http://dbpedia.org/resource>
}
but this returns nothing. How can I filter out non-resource eras?
Upvotes: 4
Views: 337
Reputation: 28675
Rather than adding an additional triple pattern you actually want to use a FILTER
with the ISURI
function e.g.,
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dbpprop: <http://dbpedia.org/property/>
SELECT ?philosopher ?era
WHERE {
?philosopher a dbpedia-owl:Philosopher ;
dbpprop:era ?era .
FILTER(ISURI(?era))
}
Upvotes: 4