Search code examples
javascriptsparqlrdf

SPARQL Query - can't resolve prefix


I have a web-based ontology that I want to query with SPARQL. I'm using JavaScript, so I set up a query engine with Comunica and got it to work: the select * where {?s ?p ?o} query did return what I expected it to return. However, I'm having issues with resolving the prefix for my ontology. It just doesn't seem to work. The following query returns an empty array:

PREFIX lab2: <http://kalenav.github.io/ontology.rdf>

SELECT ?firearm
WHERE {
    ?firearm rdf:type/rdfs:subClassOf* lab2:Firearm .
}

While the following query returns the expected array of individuals:

SELECT ?firearm
WHERE {
    ?firearmClass rdfs:label "Firearm"@en .
    ?firearm rdf:type/rdfs:subClassOf* ?firearmClass .
}

I tried passing the following as the link for the prefix:

All of those (except for the relative path) yielded an empty array, which leads me to believe that the prefix is not being resolved correctly.


Solution

  • Answered by UninformedUser in the comments. The issue was that, for some reason, the class IRIs were assigned OWLClass and some hash string instead of their labels, which prevented me from accessing the desired class via lab2:{label} in SPARQL.