sparql-examples

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

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

2

rq turtle/ttl

Find all clades, i.e. taxonomic levels where orthologous groups were built on, with their Latin names and ranks underneath Bacteria, sorted alphabetically by rank, then name

Use at

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

SELECT * WHERE {
    ?taxon a :Clade ;
        rdfs:subClassOf+ taxon:2 ;
        up:scientificName ?name ;
        up:rank ?rank .
} ORDER BY ?rank ?name
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?name"):::projected 
  v1("?rank"):::projected 
  v3("?taxon"):::projected 
  c4(["taxon:2"]):::iri 
  c2([":Clade"]):::iri 
  v3 --"a"-->  c2
  v3 --"rdfs:subClassOf"-->  c4
  v3 --"up:scientificName"-->  v2
  v3 --"up:rank"-->  v1