sparql-examples

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

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

2

Select all bacterial taxa and their scientific name from the UniProt taxonomy

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 ?taxon ?name
WHERE
{
    ?taxon a up:Taxon .
    ?taxon up:scientificName ?name .
    # Taxon subclasses are materialized, do not use rdfs:subClassOf+
    ?taxon rdfs:subClassOf taxon:2 .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?name"):::projected 
  v1("?taxon"):::projected 
  c5(["taxon:2"]):::iri 
  c2(["up:Taxon"]):::iri 
  v1 --"a"-->  c2
  v1 --"up:scientificName"-->  v2
  v1 --"rdfs:subClassOf"-->  c5