A set of SPARQL examples that are used in different SIB resources
Retrieve drugs that target human enzymes involved in sterol metabolism (federated query with Rhea and ChEMBL via IDSM/Elixir czech republic).
PREFIX CHEBI: <http://purl.obolibrary.org/obo/CHEBI_>
PREFIX cco: <http://rdf.ebi.ac.uk/terms/chembl#>
PREFIX chebihash: <http://purl.obolibrary.org/obo/chebi#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX up: <http://purl.uniprot.org/core/>
SELECT
DISTINCT
?protein
?proteinFullName
?activityType
?standardActivityValue
?standardActivityUnit
?chemblMolecule
?chemlbMoleculePrefLabel
WHERE
{
# ChEBI: retrieve members of the ChEBI class ChEBI:15889 (sterol)
# Rhea: retrieve the reactions involving these ChEBI as participants
SERVICE <https://sparql.rhea-db.org/sparql> {
?reaction rdfs:subClassOf rh:Reaction ;
rh:status rh:Approved ;
rh:side ?reactionSide .
?reactionSide
rh:contains ?participant .
?participant rh:compound ?compound
{
?compound rh:chebi ?chebi .
?chebi (rdfs:subClassOf)+ CHEBI:15889
} UNION {
?compound rh:chebi ?chebi .
?chebi2 rdfs:subClassOf ?chebiRestriction .
?chebiRestriction
a owl:Restriction ;
owl:onProperty chebihash:has_major_microspecies_at_pH_7_3 ;
owl:someValuesFrom ?chebi .
?chebi2 (rdfs:subClassOf)+ CHEBI:15889
}
}
# UniProt: retrieve the human (taxid:9606) enzymes catalyzing these Rhea reactions
?ca up:catalyzedReaction ?reaction .
?a up:catalyticActivity ?ca .
?protein up:annotation ?a ;
up:organism taxon:9606 ;
up:recommendedName ?proteinRecName .
?proteinRecName
up:fullName ?proteinFullName .
# Find drugs in wikidata that interact with the UniProt Proteins
# ChEMBL: retrieve the corresponding targets and with drugs in clinical phase 4
# Via https://idsm.elixir-czech.cz/sparql/
SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/idsm> {
?activity a cco:Activity ;
cco:hasMolecule ?chemblMolecule ;
cco:hasAssay ?assay ;
cco:standardType ?activityType ;
cco:standardValue ?standardActivityValue ;
cco:standardUnits ?standardActivityUnit .
?chemblMolecule cco:highestDevelopmentPhase ?highestDevelopmentPhase ;
rdfs:label ?chemblMoleculeLabel ;
skos:prefLabel ?chemlbMoleculePrefLabel .
FILTER (?highestDevelopmentPhase > 3)
?assay cco:hasTarget ?target .
?target cco:hasTargetComponent/cco:targetCmptXref ?protein .
?protein a cco:UniprotRef .
}
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?a")
v14("?activity")
v17("?activityType"):::projected
v16("?assay")
v8("?ca")
v5("?chebi")
v6("?chebi2")
v7("?chebiRestriction")
v15("?chemblMolecule"):::projected
v20("?chemblMoleculeLabel")
v21("?chemlbMoleculePrefLabel"):::projected
v4("?compound")
v13("?highestDevelopmentPhase")
v3("?participant")
v10("?protein"):::projected
v12("?proteinFullName"):::projected
v11("?proteinRecName")
v1("?reaction")
v2("?reactionSide")
v19("?standardActivityUnit"):::projected
v18("?standardActivityValue"):::projected
v22("?target")
a1((" "))
c5(["rh:Approved"]):::iri
c10(["CHEBI:15889"]):::iri
c12(["owl:Restriction"]):::iri
c14(["chebihash:has_major_microspecies_at_pH_7_3"]):::iri
c3(["rh:Reaction"]):::iri
c37(["cco:UniprotRef"]):::iri
c20(["taxon:9606"]):::iri
c25(["cco:Activity"]):::iri
subgraph s1["https://sparql.rhea-db.org/sparql"]
style s1 stroke-width:4px;
v1 --"rdfs:subClassOf"--> c3
v1 --"rh:status"--> c5
v1 --"rh:side"--> v2
v2 --"rh:contains"--> v3
v3 --"rh:compound"--> v4
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v4 --"rh:chebi"--> v5
v6 --"rdfs:subClassOf"--> v7
v7 --"a"--> c12
v7 --"owl:onProperty"--> c14
v7 --"owl:someValuesFrom"--> v5
v6 --"rdfs:subClassOf"--> c10
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"rh:chebi"--> v5
v5 --"rdfs:subClassOf"--> c10
end
union0r <== or ==> union0l
end
end
v8 --"up:catalyzedReaction"--> v1
v9 --"up:catalyticActivity"--> v8
v10 --"up:annotation"--> v9
v10 --"up:organism"--> c20
v10 --"up:recommendedName"--> v11
v11 --"up:fullName"--> v12
subgraph s2["https://idsm.elixir-czech.cz/sparql/endpoint/idsm"]
style s2 stroke-width:4px;
f0[["?highestDevelopmentPhase > '3^^xsd:integer'"]]
f0 --> v13
v14 --"a"--> c25
v14 --"cco:hasMolecule"--> v15
v14 --"cco:hasAssay"--> v16
v14 --"cco:standardType"--> v17
v14 --"cco:standardValue"--> v18
v14 --"cco:standardUnits"--> v19
v15 --"cco:highestDevelopmentPhase"--> v13
v15 --"rdfs:label"--> v20
v15 --"skos:prefLabel"--> v21
v16 --"cco:hasTarget"--> v22
v22 --"cco:hasTargetComponent"--> a1
a1 --"cco:targetCmptXref"--> v10
v10 --"a"--> c37
end