sparql-examples

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

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

1

Retrieve the MNXref metabolite with name N,N-dimethyl-beta-alanine, together with molecular information.

Use at

PREFIX mnx: <https://rdf.metanetx.org/schema/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?metabolite ?label ?source ?formula ?charge ?inchi ?inchikey ?smiles
FROM <https://rdf.metanetx.org/> WHERE {
    ?metabolite a mnx:CHEM .
    ?metabolite rdfs:label ?label .
    ?metabolite rdfs:comment 'N,N-dimethyl-beta-alanine' .
    ?metabolite mnx:chemSource ?source
    OPTIONAL { ?metabolite mnx:formula  ?formula }
    OPTIONAL { ?metabolite mnx:charge   ?charge }
    OPTIONAL { ?metabolite mnx:inchi    ?inchi }
    OPTIONAL { ?metabolite mnx:inchikey ?inchikey }
    OPTIONAL { ?metabolite mnx:smiles   ?smiles }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?charge"):::projected 
  v4("?formula"):::projected 
  v6("?inchi"):::projected 
  v7("?inchikey"):::projected 
  v2("?label"):::projected 
  v1("?metabolite"):::projected 
  v8("?smiles"):::projected 
  v3("?source"):::projected 
  c5(["N,N-dimethyl-beta-alanine"]):::literal 
  c2(["mnx:CHEM"]):::iri 
  v1 --"a"-->  c2
  v1 --"rdfs:label"-->  v2
  v1 --"rdfs:comment"-->  c5
  v1 --"mnx:chemSource"-->  v3
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."mnx:formula".->  v4
  end
  subgraph optional1["(optional)"]
  style optional1 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."mnx:charge".->  v5
  end
  subgraph optional2["(optional)"]
  style optional2 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."mnx:inchi".->  v6
  end
  subgraph optional3["(optional)"]
  style optional3 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."mnx:inchikey".->  v7
  end
  subgraph optional4["(optional)"]
  style optional4 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."mnx:smiles".->  v8
  end