Reputation: 53
I have ontology URI and I need to know all the properties and classes belongs to this ontology. the URI of the ontology Prefix Names: http://data.Ordanancesurvery.cor.uk/ontology/OpenName#. It is hosted by ordnance survey and The API is: https://data.ordnancesurvey.co.uk/datasets/os-linked-data/explorer/sparql I need Sparql query which can retrieve all the classes and properties from the ontology.
PREFIX Names: <http://data.ordnancesurvey.co.uk/ontology/OpenNames/>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl:<http://www.w3.org/2002/07/owl#>
SELECT ?s ?p ?o
WHERE {
?s ?p ?o
Filter (regex (?o,"OpenNames"))
}
I am trying to retrieve all the classes and properties, belong to the ontology OpenNames under the uri : http://data.ordnancesurvey.co.uk/ontology/OpenNames/
Upvotes: 0
Views: 733
Reputation: 16630
URIs are not strings. Conversion is not automatic. Use str(?o)
regex (str(?o),"OpenNames")
or CONTAINS(str(?o),"OpenNames")
Better is
STRSTARTS(str(?o), str(Names:))
Prefixes are expanded during parsing so
str(Names:)
is the same as writing
str(<http://data.ordnancesurvey.co.uk/ontology/OpenNames/>)
then STRSTARTS
does a leading string test.
Upvotes: 1