Tutorial

Tutorial at a glance

Our data set provides the sparql endpoint, so you can use any programming language to query, based on the HTTP protocol.

Here, we provide examples of online queries or queries using a programming language such as Python, Java ...

Online Query

First, Open the website

Second, Enter your own query statement in the input box. By the way, you can use the examples we provide at the bottom.

Next, you can get the results below.

Coding by yourself

No matter what language you use, you can send a post request to the endpoint with the unique parameter query, and you can get the answer.

Sparql Endpoint Url (Request URL) : http://pdd.wangmengsd.com/pdd/query
Request Method : post
Parameter : query (Your Sparql query)

Python example:

python example

SPARQL Query Examples

1. The amount of patients who suffered from Sepsis (ICD9CM ID: 995.91)


        SELECT  (COUNT (?subject) AS ?amount)
        WHERE {
            ?subject ?predicate <http://purl.bioontology.org/ontology/ICD9CM/995.91>
        }
    

2. Returning drugs that Sepsis patients had taken


    SELECT ?subject ?drugid
    WHERE {
      ?subject ?predicate <http://purl.bioontology.org/ontology/ICD9CM/995.91>.
      ?subject <http://pdd.wangmengsd.com/property/take_drugbank_id> ?drugid
    }
    

3. Return patients that suffered from Sepsis and took Insulin Human (DrugBank ID: DB00030)


    SELECT ?subject
    WHERE {
      ?subject ?predicate <http://purl.bioontology.org/ontology/ICD9CM/995.91>.
      ?subject <http://pdd.wangmengsd.com/property/take_drugbank_id> <http://bio2rdf.org/drugbank:DB00030>
    }
    

4. The amount of drugs that each patient Sepsis suffered had taken


    SELECT ?subject (COUNT (?drugid)AS ?amount)
    WHERE {
      ?subject ?predicate <http://purl.bioontology.org/ontology/ICD9CM/995.91>.
      ?subject <http://pdd.wangmengsd.com/property/take_drugbank_id> ?drugid
    }
    GROUP BY ?subject
    

5. Drug-drug interactions taken records with the same start date


SELECT *
WHERE {
  ?patient <http://pdd.wangmengsd.com/property/has_prescription> ?pres1.
  ?patient <http://pdd.wangmengsd.com/property/has_prescription> ?pres2.
  ?pres1 <http://pdd.wangmengsd.com/property/start_date> ?date1.
  ?pres2 <http://pdd.wangmengsd.com/property/start_date> ?date2.
  ?pres1 <http://pdd.wangmengsd.com/property/take_drugbank_id> ?drug1.	
  ?pres2 <http://pdd.wangmengsd.com/property/take_drugbank_id> ?drug2.
  ?drug1 <http://pdd.wangmengsd.com/property/interact> ?drug2
  filter(?date1=?date2 && ?pres1!=?pres2).
}
limit 30