Wikidata:WikiProject Clinical Trials/Query
These example queries for the Wikidata Query Service can assist with accessing Wikidata's clinical trials data.
Model profiles[edit]
Each of these queries generates a list of clinical trials associated with another concept.
Clinical trials for Zika fever[edit]
The following query uses these:
- Properties: instance of (P31) , medical condition treated (P2175)
SELECT ?trial ?trialLabel WHERE { ?trial wdt:P31 wd:Q30612 . { ?trial wdt:P2175 wd:Q8071861. } UNION { ?trial wdt:P2175 wd:Q27043680. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Clinical trials using COVID-19 vaccine[edit]
The following query uses these:
- Properties: instance of (P31) , research intervention (P4844) , subclass of (P279)
SELECT ?trial ?trialLabel WHERE { ?trial wdt:P31 wd:Q30612 . ?trial wdt:P4844 ?intervention. ?intervention wdt:P31/wdt:P279* wd:Q87719492 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Clinical trials at Vanderbilt University[edit]
The following query uses these:
- Properties: instance of (P31) , research site (P6153) , parent organization (P749)
SELECT ?trial ?trialLabel WHERE { ?trial wdt:P31 wd:Q30612 . { ?trial wdt:P6153 [ wdt:P749* wd:Q29052 ] .} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Clinical trials with Julie McElrath as principal investigator[edit]
The following query uses these:
- Properties: instance of (P31) , principal investigator (P8329)
SELECT ?trial ?trialLabel WHERE { ?trial wdt:P31 wd:Q30612 . { ?trial wdt:P8329 wd:Q22006776 .} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Clinical trials funded by Patient-Centered Outcomes Research Institute[edit]
- examples:
- draft query:
The following query uses these:
- Properties: instance of (P31) , funder (P8324) , sponsor (P859)
SELECT ?trial ?trialLabel ?link WHERE { ?trial wdt:P31 wd:Q30612 . { ?trial wdt:P8324 wd:Q7144950 .} UNION { ?trial wdt:P859 wd:Q7144950 .} ?trial ?link wd:Q7144950 . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Topics by count of clinical trials[edit]
Medical conditions[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: subclass of (P279) , medical condition (P1050) , instance of (P31)
SELECT DISTINCT ?condition ?conditionLabel (COUNT(?trial) AS ?count) WHERE { ?trial p:P31/ps:P31/wdt:P279* wd:Q30612. ?trial wdt:P1050 ?condition . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?condition ?conditionLabel ?count ORDER BY DESC(?count)
Research interventions[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: subclass of (P279) , research intervention (P4844) , instance of (P31)
SELECT DISTINCT ?intervention ?interventionLabel (COUNT(?trial) AS ?count) WHERE { ?trial p:P31/ps:P31/wdt:P279* wd:Q30612. ?trial wdt:P4844 ?intervention . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?intervention ?interventionLabel ?count ORDER BY DESC(?count)
Research sites[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: instance of (P31) , research site (P6153) , parent organization (P749)
SELECT DISTINCT ?research_site ?research_siteLabel ?count WITH { SELECT ?research_site (COUNT(?trial) AS ?count) WHERE { ?trial wdt:P31 wd:Q30612 . { ?trial wdt:P6153 ?research_site . } UNION { ?trial wdt:P6153 [wdt:P749 ?research_site] . } } GROUP BY ?research_site } AS %sites WHERE { INCLUDE %sites SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?research_site ?research_siteLabel ?count ORDER BY DESC(?count)
Principal investigators[edit]
Bubble chart version:
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: instance of (P31) , principal investigator (P8329) , employer (P108) , affiliation (P1416)
Features: BubbleChart (Q24515280)
#defaultView:BubbleChart
SELECT (COUNT(DISTINCT ?trial) AS ?count) ?PI ?PILabel
WHERE {
?trial wdt:P31 wd:Q30612 .
{ ?trial wdt:P8329 ?PI .}
{ ?PI wdt:P108 ?org }
UNION
{ ?PI wdt:P1416 ?org }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?PI ?PILabel
ORDER BY DESC(?count)
Funders[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: subclass of (P279) , sponsor (P859) , funder (P8324) , instance of (P31)
SELECT DISTINCT ?funder ?funderLabel (COUNT(?trial) AS ?count) WHERE { ?trial p:P31/ps:P31/wdt:P279* wd:Q30612. { ?trial wdt:P859 ?funder .} UNION { ?trial wdt:P8324 ?funder .} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?funder ?funderLabel ?count ORDER BY DESC(?count)
Organizational affiliations[edit]
Clinical trials with principal investigator and their affiliation[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: instance of (P31) , principal investigator (P8329) , employer (P108) , affiliation (P1416)
SELECT ?trial ?trialLabel ?PI ?PILabel ?org ?orgLabel WHERE { ?trial wdt:P31 wd:Q30612 . { ?trial wdt:P8329 ?PI .} { ?PI wdt:P108 ?org } UNION { ?PI wdt:P1416 ?org } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Clinical trials where principal investigator has Vanderbilt University affiliation[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: instance of (P31) , principal investigator (P8329) , employer (P108) , parent organization (P749) , affiliation (P1416)
# Q29052 is Vanderbilt University PREFIX target: <http://www.wikidata.org/entity/Q29052> SELECT ?trial ?trialLabel ?PI ?PILabel WHERE { ?trial wdt:P31 wd:Q30612 . { ?trial wdt:P8329 ?PI .} { ?PI wdt:P108 [ wdt:P749* target: ] } UNION { ?PI wdt:P1416 [ wdt:P749* target: ] } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Chart of organizations by count of clinical trials[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: instance of (P31) , principal investigator (P8329) , employer (P108) , affiliation (P1416)
Features: BubbleChart (Q24515280)
#defaultView:BubbleChart
SELECT (COUNT(DISTINCT ?trial) AS ?count) ?org ?orgLabel
WHERE {
?trial wdt:P31 wd:Q30612 .
{ ?trial wdt:P8329 ?PI .}
{ ?PI wdt:P108 ?org }
UNION
{ ?PI wdt:P1416 ?org }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?org ?orgLabel
ORDER BY DESC(?count)
Clinical trials where the sponsor was Pfizer[edit]
The following query uses these:
- Items: clinical trial (Q30612) , Pfizer (Q206921)
- Properties: instance of (P31) , sponsor (P859) , funder (P8324)
SELECT ?trial ?trialLabel WHERE { ?trial wdt:P31 wd:Q30612 . { ?trial wdt:P859 wd:Q206921 .} UNION { ?trial wdt:P8324 wd:Q206921 .} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Researcher demographics[edit]
Count of principal investigators by gender[edit]
SELECT (COUNT(?trial) AS ?count) ?gender ?genderLabel WHERE {
?trial wdt:P31 wd:Q30612 .
?trial wdt:P8329 ?pi .
?pi wdt:P21 ?gender .
?pi wikibase:sitelinks ?sl .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?count ?gender ?genderLabel
Clinical trials where the principal investigator is female[edit]
The following query uses these:
- Items: clinical trial (Q30612) , female (Q6581072)
- Properties: instance of (P31) , principal investigator (P8329) , sex or gender (P21)
SELECT ?trial ?trialLabel ?pi ?piLabel ?sl WHERE { ?trial wdt:P31 wd:Q30612 . ?trial wdt:P8329 ?pi . ?pi wdt:P21 wd:Q6581072 . ?pi wikibase:sitelinks ?sl . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Principal investigators by occupation[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: instance of (P31) , principal investigator (P8329) , occupation (P106)
SELECT DISTINCT ?occupation ?occupationLabel (COUNT(?trial) AS ?count) ?sl WHERE { ?trial wdt:P31 wd:Q30612 . ?trial wdt:P8329 ?pi . ?pi wdt:P106 ?occupation . ?occupation wikibase:sitelinks ?sl . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?count ?occupation ?occupationLabel ?sl ORDER BY DESC(?count)
Scope of Wikidata's clinical trials content[edit]
List of clinical trials[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: subclass of (P279) , ClinicalTrials.gov ID (P3098) , start time (P580) , end time (P582) , clinical trial phase (P6099) , number of participants (P1132) , instance of (P31)
# List of clinical trials SELECT ?item ?nct_id ?itemLabel ?phaseLabel ?enrollment ?start_date ?primary_completion_date WHERE { ?item p:P31/ps:P31/wdt:P279* wd:Q30612. ?item wdt:P3098 ?nct_id . OPTIONAL { ?item wdt:P580 ?start_date } OPTIONAL { ?item wdt:P582 ?primary_completion_date } OPTIONAL { ?item wdt:P6099 ?phase } OPTIONAL { ?item wdt:P1132 ?enrollment } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Count of clinical trials[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: subclass of (P279) , instance of (P31)
# Count clinical trials SELECT (count(distinct ?item) as ?count) WHERE {?item p:P31/ps:P31/wdt:P279* wd:Q30612}
Most common properties applied to clinical trials[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: instance of (P31) , subclass of (P279)
SELECT DISTINCT ?property ?propertyLabel ?count WITH { SELECT DISTINCT ?item WHERE { ?item wdt:P31*/wdt:P279* wd:Q30612 . } LIMIT 400000 } AS %items WITH { SELECT DISTINCT ?property (COUNT(*) AS ?count) WHERE { INCLUDE %items. ?item ?p [ ] . ?property a wikibase:Property; wikibase:claim ?p. } GROUP BY ?property LIMIT 200 } AS %results WHERE { INCLUDE %results. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY DESC(?count) LIMIT 200
Count of statements in clinical trial records[edit]
The following query uses these:
- Items: clinical trial (Q30612)
- Properties: instance of (P31) , subclass of (P279)
#defaultView:AreaChart SELECT ?st ?ct { { BIND (0 AS ?ct) BIND (0 AS ?st) } UNION { SELECT ?st (COUNT(*) as ?ct) { ?item wdt:P31*/wdt:P279* wd:Q30612 ; wikibase:statements ?st } GROUP BY ?st ORDER BY ?st } }
Count of trial records in Wikidata per clinical trial registry[edit]
The following query uses these:
- Properties: instance of (P31) , used by (P1535) , Wikidata item of this property (P1629)
SELECT DISTINCT ?registry ?registryLabel ?count WITH { SELECT DISTINCT ?item WHERE { ?item wdt:P31 wd:Q30612 ; } LIMIT 400000 } AS %items WITH { SELECT DISTINCT ?registry ?registryIDitem WHERE { ?registry wdt:P31 wd:Q2138567 . ?registryIDitem wdt:P1535 ?registry . } GROUP BY ?registry ?registryIDitem LIMIT 100 } AS %registries WITH { SELECT DISTINCT ?registry (COUNT(*) AS ?count) WHERE { INCLUDE %items. INCLUDE %registries. ?item ?p [ ] . ?property wdt:P1629 ?registryIDitem; wikibase:claim ?p. ?property wikibase:propertyType wikibase:ExternalId . } GROUP BY ?registry LIMIT 100 } AS %results WHERE { INCLUDE %results. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } ORDER BY DESC(?count) LIMIT 100
Scholia queries[edit]
Scholia can display clinical trial-related information.