sparql-examples

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

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

19_draft_human_metabolome

Generate a draft human metabolome

Use at

PREFIX chebislash: <http://purl.obolibrary.org/obo/chebi/>
PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT
  ?uniprot ?mnemonic ?rhea ?chebi ?smiles ?inchiKey
WHERE
{
  ?rhea rh:side/rh:contains/rh:compound ?compound .
  ?compound (rh:chebi|(rh:reactivePart/rh:chebi)|(rh:underlyingChebi/rh:chebi)) ?chebi .
  ?chebi chebislash:smiles ?smiles ;
          chebislash:inchikey ?inchiKey .
  SERVICE <https://sparql.uniprot.org/sparql> {
     ?uniprot up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea ;
                                             up:organism taxon:9606 ;
                                             up:mnemonic ?mnemonic .

   }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?chebi"):::projected 
  v2("?compound")
  v5("?inchiKey"):::projected 
  v7("?mnemonic"):::projected 
  v1("?rhea"):::projected 
  v4("?smiles"):::projected 
  v6("?uniprot"):::projected 
  a1((" "))
  a2((" "))
  a3((" "))
  a4((" "))
  a5((" "))
  a6((" "))
  c14(["taxon:9606"]):::iri 
  v1 --"rh:side"-->  a1
  a1 --"rh:contains"-->  a2
  a2 --"rh:compound"-->  v2
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    subgraph union1[" Union "]
    subgraph union1l[" "]
      style union1l fill:#abf,stroke-dasharray: 3 3;
      v2 --"rh:underlyingChebi"-->  a4
      a4 --"rh:chebi"-->  v3
    end
    subgraph union1r[" "]
      style union1r fill:#abf,stroke-dasharray: 3 3;
      v2 --"rh:reactivePart"-->  a3
      a3 --"rh:chebi"-->  v3
    end
    union1r <== or ==> union1l
    end
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v2 --"rh:chebi"-->  v3
  end
  union0r <== or ==> union0l
  end
  v3 --"chebislash:smiles"-->  v4
  v3 --"chebislash:inchikey"-->  v5
  subgraph s1["https://sparql.uniprot.org/sparql"]
    style s1 stroke-width:4px;
    v6 --"up:annotation"-->  a5
    a5 --"up:catalyticActivity"-->  a6
    a6 --"up:catalyzedReaction"-->  v1
    v6 --"up:organism"-->  c14
    v6 --"up:mnemonic"-->  v7
  end