Grapheneer
Grapheneer

Reputation: 947

SPARQL-Query for all objects with a specific prefix?

I created an ontology with different prefixes (rdf, rdfs, owl, example, car, bike, ...). I use them to demarcate different domains and examples.

How can I query for all objects with the profix i.e. "car"?

Thank you in advance!

Upvotes: 2

Views: 1990

Answers (1)

UninformedUser
UninformedUser

Reputation: 8465

For the future, providing a minimal sample of the data will help in providing a working query on the data. With no further detailsand assuming that you mean by "objects" the objects of triples (and indeed untested) :

PREFIX car: <TODO_ADD_URI_OF_NAMESPACE_HERE>
SELECT * {
 ?s ?p ?o .
 FILTER(isUri(?o) && STRSTARTS(STR(?o), STR(car:)))
}

Upvotes: 7

Related Questions