sparql-examples

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

View the Project on GitHub sib-swiss/sparql-examples

84_taxonomy_hierarchy

Find all taxonomic records that describe species of the genus Homo.

Use at

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT 
  ?species 
  ?genus 
WHERE {
  BIND(taxon:9605 AS ?genus)
  ?species a up:Taxon ;
           up:rank up:Species ;
           rdfs:subClassOf ?genus .
  ?genus a up:Taxon ;
         up:rank up:Genus .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?genus"):::projected 
  v2("?species"):::projected 
  c6(["up:Genus"]):::iri 
  c2(["up:Taxon"]):::iri 
  c4(["up:Species"]):::iri 
  bind0[/"'taxon:9605'"/]
  bind0 --as--o v1
  v2 --"a"-->  c2
  v2 --"up:rank"-->  c4
  v2 --"rdfs:subClassOf"-->  v1
  v1 --"a"-->  c2
  v1 --"up:rank"-->  c6