2

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!

Grapheneer
  • 897
  • 8
  • 25

1 Answers1

6

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:)))
}
UninformedUser
  • 8,397
  • 1
  • 14
  • 23
  • Great, thank you. This version would work too: PREFIX car: SELECT * { ?s ?p ?o . FILTER(STRSTARTS(STR(?o), STR(car:))) } – Grapheneer Dec 12 '17 at 11:34