A set of SPARQL examples that are used in different SIB resources
Retrieve pairwise orthologous genes of the Cyanobacterium-aponinum psb27- gene that are found in the MBGD database but are not present in OMA
PREFIX oma: <http://omabrowser.org/ontology/oma#>
PREFIX orth: <http://purl.org/net/orth#>
PREFIX sio: <http://semanticscience.org/resource/>
PREFIX lscr: <http://purl.org/lscr#>
PREFIX mbgd: <http://purl.jp/bio/11/mbgd#>
SELECT ?protein2 ?species WHERE {
SERVICE <http://sparql.nibb.ac.jp/sparql> {
SELECT ?protein2 ?species WHERE {
?cluster_mbgd a orth:OrthologsCluster ;
orth:hasHomologous ?node1_mbgd ;
orth:hasHomologous ?node2_mbgd .
?node1_mbgd orth:hasHomologous* ?gene1 .
?node2_mbgd orth:hasHomologous* ?gene2 .
?gene1 mbgd:uniprot <http://purl.uniprot.org/uniprot/K9Z723> .
?gene2 mbgd:uniprot ?protein2 ;
mbgd:organism ?taxon .
OPTIONAL {
?taxon mbgd:species ?species .
}
FILTER (?node1_mbgd != ?node2_mbgd)
}
}
FILTER NOT EXISTS { # keep only those that do not exist in OMA
?cluster a orth:OrthologsCluster ;
orth:hasHomologousMember ?node1 ;
orth:hasHomologousMember ?node2 .
?node1 orth:hasHomologousMember* ?protein_OMA_1.
?node2 orth:hasHomologousMember* ?protein_OMA_2.
?protein_OMA_1 lscr:xrefUniprot <http://purl.uniprot.org/uniprot/K9Z723>.
?protein_OMA_2 lscr:xrefUniprot ?protein2.
FILTER (?node1 != ?node2)
}
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?cluster")
v9("?cluster_mbgd")
v10("?gene1")
v11("?gene2")
v1("?node1")
v7("?node1_mbgd")
v2("?node2")
v8("?node2_mbgd")
v6("?protein2"):::projected
v4("?protein_OMA_1")
v5("?protein_OMA_2")
v13("?species"):::projected
v12("?taxon")
c2(["orth:OrthologsCluster"]):::iri
c5([http://purl.uniprot.org/uniprot/K9Z723]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0f0[["?node1 != ?node2"]]
e0f0 --> e0v1
e0f0 --> e0v2
e0v3 --"a"--> e0c2
e0v3 --"orth:hasHomologousMember"--> e0v1
e0v3 --"orth:hasHomologousMember"--> e0v2
e0v1 --"orth:hasHomologousMember"--> e0v4
e0v2 --"orth:hasHomologousMember"--> e0v5
e0v4 --"lscr:xrefUniprot"--> e0c5
e0v5 --"lscr:xrefUniprot"--> e0v6
e0v3("?cluster"):::projected
e0v1("?node1"):::projected
e0v2("?node2"):::projected
e0v6("?protein2"):::projected
e0v4("?protein_OMA_1"):::projected
e0v5("?protein_OMA_2"):::projected
e0c2(["orth:OrthologsCluster"]):::iri
e0c5([http://purl.uniprot.org/uniprot/K9Z723]):::iri
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> v2
f0 --> v3
f0 --> c1
f0 --> c2
f0 --> c3
f0 --> v4
f0 --> v5
f0 --> c4
f0 --> c5
f0 --> v6
f1[["?node1 != ?node2"]]
f1 --> v1
f1 --> v2
v3 --"a"--> c2
v3 --"orth:hasHomologousMember"--> v1
v3 --"orth:hasHomologousMember"--> v2
v1 --"orth:hasHomologousMember"--> v4
v2 --"orth:hasHomologousMember"--> v5
v4 --"lscr:xrefUniprot"--> c5
v5 --"lscr:xrefUniprot"--> v6
subgraph s1["http://sparql.nibb.ac.jp/sparql"]
style s1 stroke-width:4px;
f2[["?node1_mbgd != ?node2_mbgd"]]
f2 --> v7
f2 --> v8
v9 --"a"--> c2
v9 --"orth:hasHomologous"--> v7
v9 --"orth:hasHomologous"--> v8
v7 --"orth:hasHomologous"--> v10
v8 --"orth:hasHomologous"--> v11
v10 --http://purl.jp/bio/11/mbgd#uniprot--> c5
v11 --http://purl.jp/bio/11/mbgd#uniprot--> v6
v11 --http://purl.jp/bio/11/mbgd#organism--> v12
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v12 -.http://purl.jp/bio/11/mbgd#species.-> v13
end
end