A set of SPARQL examples that are used in different TGX resources
License: https://www.gnu.org/licenses/gpl-3.0
Uses method in: https://github.com/WDscholia/scholia/tree/master/scholia/app/templates/disease_clinical-trials.sparql
Disease aspect: clinical trials
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://wikidata.org/entity/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX target: <http://www.wikidata.org/entity/Q917357>
SELECT
DISTINCT
?start_date
?trial ?trialLabel
?intervention ?interventionLabel
?sponsor ?sponsorLabel
WHERE {
?trial wdt:P31 wd:Q30612 ;
wdt:P1050 / wdt:P279* target: .
OPTIONAL {
?trial wdt:P580 ?starttime
BIND(SUBSTR(STR(?starttime), 0, 11) AS ?start_date)
}
OPTIONAL { ?trial wdt:P4844 ?intervention }
OPTIONAL { ?trial wdt:P859 ?sponsor }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY DESC(?starttime)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?intervention"):::projected
v5("?sponsor"):::projected
v3("?start_date"):::projected
v1("?starttime")
v2("?trial"):::projected
a1((" "))
c2([http://wikidata.org/entity/Q30612]):::iri
c5(["wd:Q917357"]):::iri
c10([http://www.bigdata.com/rdf#serviceParam]):::iri
c12(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal
v2 --"p:direct/P31"--> c2
v2 --"p:direct/P1050"--> a1
a1 --"p:direct/P279"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P580".-> v1
bind0[/"substring(str(?starttime),'0^^xsd:integer','11^^xsd:integer')"/]
v1 --o bind0
bind0 --as--o v3
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P4844".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."p:direct/P859".-> v5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end