SPARQL examples for the EMI
View the Project on GitHub earth-metabolome-initiative/sparql-examples
Select all UniProtKB entries, and their organism and amino acid sequences (including isoforms), for E. coli K12 and all its strains
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
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 ?protein ?organism ?isoform ?sequence
WHERE
{
?protein a up:Protein .
?protein up:organism ?organism .
# Taxon subclasses are materialized, do not use rdfs:subClassOf+
?organism rdfs:subClassOf taxon:83333 .
?protein up:sequence ?isoform .
?isoform rdf:value ?sequence .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?isoform"):::projected
v2("?organism"):::projected
v1("?protein"):::projected
v4("?sequence"):::projected
c5(["taxon:83333"]):::iri
c2(["up:Protein"]):::iri
v1 --"a"--> c2
v1 --"up:organism"--> v2
v2 --"rdfs:subClassOf"--> c5
v1 --"up:sequence"--> v3
v3 --"rdf:value"--> v4