query-3053aa0846defdedd289b0bad1f491ff
PropertiesInChIKey (P235)
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>
SELECT DISTINCT ?metabolite ?wikidata ?inchikey ?charge WHERE {
{
SELECT ?metabolite ?wikidata WHERE {
SERVICE <http://sparql.wikipathways.org/sparql> {
?metabolite a wp:Metabolite ;
wp:bdbWikidata ?wikidata .
}
}
} ?wikidata wdt:P235 ?inchikey .
bind(
if(substr(?inchikey,27) = "N", "0"^^xsd:integer,
if(substr(?inchikey,27) = "M", "-1"^^xsd:integer,
if(substr(?inchikey,27) = "O", "+1"^^xsd:integer,
if(substr(?inchikey,27) = "L", "-2"^^xsd:integer,
if(substr(?inchikey,27) = "P", "+2"^^xsd:integer,
if(substr(?inchikey,27) = "K", "-3"^^xsd:integer,
if(substr(?inchikey,27) = "J", "-4"^^xsd:integer,
if(substr(?inchikey,27) = "I", "-5"^^xsd:integer,
if(substr(?inchikey,27) = "F", "-8"^^xsd:integer,
"999"^^xsd:integer # ERROR
)
)
)
)
)
)
)
)
)
as ?charge
)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?charge"):::projected
v3("?inchikey"):::projected
v1("?metabolite"):::projected
v2("?wikidata"):::projected
c7(["bd:serviceParam"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3([http://vocabularies.wikipathways.org/wp#Metabolite]):::iri
subgraph s1["http://sparql.wikipathways.org/sparql"]
style s1 stroke-width:4px;
v1 --"a"--> c3
v1 --http://vocabularies.wikipathways.org/wp#bdbWikidata--> v2
end
v2 --"wdt:P235"--> v3
bind0[/"if(substring(?inchikey,'27^^xsd:integer') = 'N','0^^xsd:integer',if(substring(?inchikey,'27^^xsd:integer') = 'M','-1^^xsd:integer',if(substring(?inchikey,'27^^xsd:integer') = 'O','+1^^xsd:integer',if(substring(?inchikey,'27^^xsd:integer') = 'L','-2^^xsd:integer',if(substring(?inchikey,'27^^xsd:integer') = 'P','+2^^xsd:integer',if(substring(?inchikey,'27^^xsd:integer') = 'K','-3^^xsd:integer',if(substring(?inchikey,'27^^xsd:integer') = 'J','-4^^xsd:integer',if(substring(?inchikey,'27^^xsd:integer') = 'I','-5^^xsd:integer',if(substring(?inchikey,'27^^xsd:integer') = 'F','-8^^xsd:integer','999^^xsd:integer')))))))))"/]
v3 --o bind0
bind0 --as--o v4
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c7 --"wikibase:language"--> c9
end