user6822657
user6822657

Reputation:

SPARQL - write a query to get uris refering to DBpedia ontology

My current query looks like this:

SELECT DISTINCT ?pred WHERE {
  ?pred a rdf:Property
}
ORDER BY ?pred

which returns predicates like http://dbpedia.org/ontology/birthYear and http://dbpedia.org/property/abandoned . How may I modify my query in order to get results with the prefix "http://dbpedia.org/ontology/" only?

Upvotes: 0

Views: 252

Answers (1)

TallTed
TallTed

Reputation: 9434

@AKSW provided one possible solution in comments, which may indeed get you what you want --

SELECT ?pred 
WHERE
 { VALUES ?type {owl:ObjectProperty owl:DatatypeProperty } 
   ?pred a ?type
 }
ORDER BY ?pred

That said, your question was specific in a way not answered by the above, so possibly this might be what you want --

SELECT ?pred 
WHERE
 { 
   ?pred a rdf:Property
   FILTER ( REGEX ( STR (?pred), "http://dbpedia.org/ontology/", "i" ) )
 }
ORDER BY ?pred 

Upvotes: 2

Related Questions