Wikidata:WikiProject Clinical Trials/Query

Home

 

Model

 

Query

 

Curate

 

About

 

Discuss

 

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:

Clinical trials at Vanderbilt University

edit

The following query uses these:

Clinical trials with Julie McElrath as principal investigator

edit

The following query uses these:

Clinical trials funded by Patient-Centered Outcomes Research Institute

edit

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:

  • 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:

  • 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:

  • 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:

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:

  • 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:

Clinical trials where principal investigator has Vanderbilt University affiliation

edit

The following query uses these:

Chart of organizations by count of clinical trials

edit

The following query uses these:

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:

  • 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
Try it!

Clinical trials where the principal investigator is female

edit

The following query uses these:

Principal investigators by occupation

edit

The following query uses these:

  • 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:

Count of clinical trials

edit

The following query uses these:

Most common properties applied to clinical trials

edit

The following query uses these:

  • 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:

  • 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.