Search code examples
namespacesurisparql

URI works in a SPARQL query, but the Namespace does not


I am querying the NIFSTD ontology. I have loaded it into Fuseki, a local triple store/ sparql server.

When querying for the synonyms of the 'hippocampus', the below code with the namespace does not return any answers:

prefix nifstdr: <http://uri.neuinfo.org/nif/nifstd/readable>
prefix rdf: <...>
.
.   
SELECT distinct ?s ?synonyms
    {?s rdfs:label "Hippocampus" ;
        nifstd:synonym ?synonyms .}

While using the URI works and returns correct answers:

prefix rdfs: ...    
prefix rdf: ...

SELECT distinct ?s ?synonyms
    {?s rdfs:label "Hippocampus" ;
        <http://uri.neuinfo.org/nif/nifstd/readable/synonym> ?synonyms .}

Another similar (but opposite) instance to this one was when I was querying the local graph for IDs of the concepts as below:

PREFIX oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
select distinct ?id
where{
  graph <http://localhost:3030/myDataset/data/nif>{
  ?s oboInOwl:id ?id.  
  }
}
limit 100

This code returned results.

However, using URI within the code as below, returned no results at all!

select distinct ?id
where{
  graph <http://localhost:3030/myDataset/data/nif>{
  ?s <http://www.geneontology.org/formats/oboInOwl/id> ?id.  
  }
}
limit 100

So, this time it was the other way around!

I thought maybe this is because the local triple store has a URI that I previously used for this dataset in its cache, so I gave it a different name, but the problem still persists.

Why does this happen?


Solution

  • In the updated question,

    The full URI in the query is http://www.geneontology.org/formats/oboInOwl/id but oboInOwl:id expands to a different URI: http://www.geneontology.org/formats/oboInOwl#id

    The difference is the #-/ .

    nifstd:synonym becomes http://uri.neuinfo.org/nif/nifstd/readablesynomyn not .../readable/synomyn.