Wikidata:WikiProject Clinical Trials/Query

From Wikidata
Jump to navigation Jump to search

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)  View with Reasonator View with SQID, medical condition treated (P2175)  View with Reasonator View with SQID
    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)  View with Reasonator View with SQID, research intervention (P4844)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    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:

Clinical trials with Julie McElrath as principal investigator[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, principal investigator (P8329)  View with Reasonator View with SQID
    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]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, funder (P8324)  View with Reasonator View with SQID, sponsor (P859)  View with Reasonator View with SQID
    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)  View with Reasonator View with SQID, medical condition (P1050)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    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)  View with Reasonator View with SQID, research intervention (P4844)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    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)  View with Reasonator View with SQID, research site (P6153)  View with Reasonator View with SQID, parent organization (P749)  View with Reasonator View with SQID
    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)  View with Reasonator View with SQID

#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)  View with Reasonator View with SQID, sponsor (P859)  View with Reasonator View with SQID, funder (P8324)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    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)  View with Reasonator View with SQID

#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)  View with Reasonator View with SQID, sponsor (P859)  View with Reasonator View with SQID, funder (P8324)  View with Reasonator View with SQID
    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:

  • Properties: instance of (P31)  View with Reasonator View with SQID, principal investigator (P8329)  View with Reasonator View with SQID, sex or gender (P21)  View with Reasonator View with SQID
    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:

  • Properties: instance of (P31)  View with Reasonator View with SQID, principal investigator (P8329)  View with Reasonator View with SQID, occupation (P106)  View with Reasonator View with SQID
    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:

  • Properties: subclass of (P279)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID
    # 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:

  • Properties: instance of (P31)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    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)  View with Reasonator View with SQID, subclass of (P279)  View with Reasonator View with SQID
    #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)  View with Reasonator View with SQID, used by (P1535)  View with Reasonator View with SQID, Wikidata item of this property (P1629)  View with Reasonator View with SQID
    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.