I'm trying to execute a very simple SPARQL query to retrieve information about a specific disease using https://bioportal.bioontology.org/ontologies/SNOMEDCT/?p=classes&conceptid=root (in Java) based on a name passed in the query string, and I don't understand why it's not working. Here are the relevant code:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT *
FROM <http://bioportal.bioontology.org/ontologies/SNOMEDCT>
FROM <http://bioportal.bioontology.org/ontologies/globals>
WHERE
{
?x rdfs:label ?label .
FILTER (CONTAINS ( UCASE(str(?label)), "MELANOMA") )
}
The only occurrence of rdfs:label
in SNOMED-CT on BioPortal is snomed-term: rdfs:label "SNOMEDCT"
. BioPortal uses skos:prefLabel
(which is a subproperty of rdfs:label
) instead.
Try this query:
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX snomed-term: <http://purl.bioontology.org/ontology/SNOMEDCT/>
SELECT DISTINCT *
FROM <http://bioportal.bioontology.org/ontologies/SNOMEDCT>
FROM <http://bioportal.bioontology.org/ontologies/globals>
WHERE {
?x skos:prefLabel ?label .
FILTER (CONTAINS ( UCASE(str(?label)), "MELANOMA") )
}
There should be 10 results.
If you need to restrict results to diseases, probably you'd have to add ?x rdfs:subClassOf+ snomed-term:64572001
to your query. But unfortunately, it seems that the BioPortal SPARQL endpoint doesn't support SPARQL 1.1 property paths.