Search code examples
sparqlrdfowltopbraid-composer

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!


Solution

  • 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:)))
    }