sparql-examples

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

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

120_for_taxon_find_reference_proteomes

rq turtle/ttl

For a ncbi taxon identifier as a digit find it's reference proteome(s) if they exist

Use at


PREFIX up:<http://purl.uniprot.org/core/>
PREFIX taxon:<http://purl.uniprot.org/taxonomy/>

SELECT ?taxon ?reference_proteome
WHERE
{
  VALUES (?taxid) {
    (623) # Shigella flexneri
    (633) # Yersinia pseudotuberculosis
  } 
  # Convert the digit to a correct IRI
  BIND(IRI(CONCAT(STR(taxon:), ?taxid)) AS ?taxon)
  ?taxon up:scientificName ?taxonName .
  OPTIONAL {
    ?reference_proteome a up:Reference_Proteome .
    ?reference_proteome up:organism ?taxon .
  }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?reference_proteome"):::projected 
  v1("?taxid")
  v2("?taxon"):::projected 
  v3("?taxonName")
  c3(["up:Reference_Proteome"]):::iri 
  bind0[/VALUES ?taxid/]
  bind0-->v1
  bind00(["623^^xsd:integer"])
  bind00 --> bind0
  bind01(["633^^xsd:integer"])
  bind01 --> bind0
  bind1[/"concat(str('taxon:'),?taxid)"/]
  v1 --o bind1
  bind1 --as--o v2
  v2 --"up:scientificName"-->  v3
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v4 -."a".->  c3
    v4 --"up:organism"-->  v2
  end