-
Notifications
You must be signed in to change notification settings - Fork 1
/
wikidata-chemical-id-mapping.rq
47 lines (45 loc) · 1.82 KB
/
wikidata-chemical-id-mapping.rq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#+ summary: Known mappings from wikidata to other chemical databases
#+ endpoint: https://query.wikidata.org/sparql
#+ method: GET
#+ pagination: 50
#+ tags:
#+ - mappings
#+ defaults:
#+ - wdID: http://www.wikidata.org/entity/Q18216
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?CASnumber ?chebiID ?chemblID ?chemblIRI ?chemblURL ?chemspiderID ?drugbankID ?drugbankIRI ?drugbankURL ?gtpID ?pubchemID
WHERE {
OPTIONAL {?_wdID_iri wdt:P231 ?CASnumber .}
OPTIONAL {?_wdID_iri wdt:P683 ?chebiID .}
OPTIONAL {?_wdID_iri wdt:P592 ?chemblID .
VALUES ?ChEMBLIDdir { wdt:P592 }
OPTIONAL {
?ChEMBLIDpred wikibase:directClaim ?ChEMBLIDdir .
?ChEMBLIDpred wdt:P1630 ?ChEMBLformatterurl .
}
OPTIONAL {
?ChEMBLIDpred wdt:P1921 ?ChEMBLformatteriri .
}
BIND(IRI(REPLACE(?ChEMBLformatterurl, '\\$1', str(?chemblID))) AS ?chemblURL).
BIND(IRI(REPLACE(?ChEMBLformatteriri, '\\$1', str(?chemblID))) AS ?chemblIRI).
}
OPTIONAL {?_wdID_iri wdt:P661 ?chemspiderID .}
OPTIONAL {?_wdID_iri wdt:P715 ?drugbankID .
VALUES ?drugbankDir { wdt:P715 }
OPTIONAL {
?drugbankPred wikibase:directClaim ?drugbankDir .
?drugbankPred wdt:P1630 ?drugbankFormatterurl .
}
OPTIONAL {
?drugbankPred wdt:P1921 ?drugbankFormatteriri .
}
BIND(IRI(REPLACE(?drugbankFormatterurl, '\\$1', str(?drugbankID))) AS ?drugbankURL).
BIND(IRI(REPLACE(?drugbankFormatteriri, '\\$1', str(?drugbankID))) AS ?drugbankIRI).
}
OPTIONAL {?_wdID_iri wdt:P595 ?gtpID .}
OPTIONAL {?_wdID_iri wdt:P662 ?pubchemID .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}