2

I'm trying to query PubChem disease data from their Turtle file in GraphDb. The standard query returns all the ?s ?p ?o rows as expected. But I just want the ?s and skos:prefLabel.

Example disease data: https://pubchem.ncbi.nlm.nih.gov/rest/rdf/disease/DZID8805.html

This returns 100 rows as expected. One row shown below.

select * 
FROM <http://localhost:7200/diseases>  
where { 
   ?s ?p ?o .
} limit 100 

disease:DZID1364 / rdf:type / obo:DOID_4

I tried various queries with no results. This is the latest attempt. It's from a named graph that contains all the data locally. I'm new to SPARQL and RDF and this just looks like it should work.

prefix skos: <http://www.w3.org/2004/02/skos/core#/>  
prefix disease: <http://rdf.ncbi.nlm.nih.gov/pubchem/disease/>

SELECT ?label
FROM <http://localhost:7200/diseases>  
WHERE { 
    ?disease skos:prefLabel ?label
} limit 100

Expected row below.

disease:DZID1364 / White platelet syndrome

From TTL file:

disease:DZID1364  skos:prefLabel  "White platelet syndrome" .
Sam B
  • 119
  • 2
  • 8
  • 1
    your `skos:` prefix declaration is broken. Remove the trailing `/` - it's usually either `#` or `/`, but not both. In the SKOS case it is a trailing `#` – UninformedUser Apr 07 '23 at 09:09
  • @UninformedUser that did it! I'll keep that in mind going forward. Thank you! – Sam B Apr 07 '23 at 14:39

1 Answers1

0

As stated by @UninformedUser, I removed the trailing / from the skos prefix declaration and it resolved the issue.

Sam B
  • 119
  • 2
  • 8