sparql-examples

A set of SPARQL examples that are used in different ERDERA resources

View the Project on GitHub ERDERA/sparql-examples

006

This query retrieves a list of rare diseases along with their human-readable labels and the number of database cross-references (hasDbXref) associated with each disease. It ranks the diseases in descending order of the number of mappings, helping identify which diseases are most extensively linked to external biomedical databases.

Use at

PREFIX ORDO: <http://www.orpha.net/ORDO/>
PREFIX oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?disease ?label (count(?dbxref) as ?mappings) WHERE {
  ?disease oboInOwl:hasDbXref ?dbxref ;
           rdfs:label ?label .
}
GROUP BY ?disease ?label
ORDER BY DESC(?mappings)

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?dbxref"):::projected 
  v2("?disease"):::projected 
  v4("?label"):::projected 
  v5("?mappings")
  v2 --"oboInOwl:hasDbXref"-->  v3
  v2 --"rdfs:label"-->  v4
  bind1[/"count(?dbxref)"/]
  v3 --o bind1
  bind1 --as--o v5