sparql-examples

A set of SPARQL examples that are used in different TGX resources

View the Project on GitHub BiGCAT-UM/sparql-examples

003

rq turtle/ttl

Count the number of data points for vorinostat binding to histone deacetylases.

Use at

PREFIX chembl: <http://rdf.ebi.ac.uk/terms/chembl#>

SELECT distinct ?targetLabel ?tType ?molLabel (count(DISTINCT ?value) as ?cnt) WHERE {

  ?assay  chembl:hasTarget ?target.
  
  ?target chembl:targetType ?tType.
  FILTER(?tType = "SINGLE PROTEIN")

  ?activity chembl:hasAssay  ?assay.
  ?activity chembl:hasMolecule ?molecule .
  
  #?assay chembl:hasCellLine ?cellLine.

  ?target rdfs:label ?targetLabel.
  ?molecule rdfs:label ?molLabel.
  ?assay  rdfs:label ?assayLabel.
  
  FILTER(strstarts(?targetLabel, STR("Histone deacetylase")))
  FILTER(?molLabel = "VORINOSTAT")
  
  ?activity chembl:type ?type.
  ?activity chembl:standardValue ?value.
} 
GROUP BY ?targetLabel ?tType ?molLabel ?type
HAVING(count(DISTINCT ?value) > 30)
limit 100
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v11("?_anon_cfe45fbc6220414591d973f564e3a127923")
  v6("?activity")
  v4("?assay")
  v8("?assayLabel")
  v12("?cnt")
  v1("?molLabel"):::projected 
  v7("?molecule")
  v3("?tType"):::projected 
  v5("?target")
  v2("?targetLabel"):::projected 
  v9("?type")
  v10("?value"):::projected 
  a1((" "))
  f0[[" > '30^^xsd:integer'"]]
  f0 --> a1
  f1[["?molLabel = 'VORINOSTAT'"]]
  f1 --> v1
  f2[["starts-with(?targetLabel,str('Histone deacetylase'))"]]
  f2 --> v2
  f3[["?tType = 'SINGLE PROTEIN'"]]
  f3 --> v3
  v4 --http://rdf.ebi.ac.uk/terms/chembl#hasTarget-->  v5
  v5 --http://rdf.ebi.ac.uk/terms/chembl#targetType-->  v3
  v6 --http://rdf.ebi.ac.uk/terms/chembl#hasAssay-->  v4
  v6 --http://rdf.ebi.ac.uk/terms/chembl#hasMolecule-->  v7
  v5 --"rdfs:label"-->  v2
  v7 --"rdfs:label"-->  v1
  v4 --"rdfs:label"-->  v8
  v6 --http://rdf.ebi.ac.uk/terms/chembl#type-->  v9
  v6 --http://rdf.ebi.ac.uk/terms/chembl#standardValue-->  v10
  bind6[/"count(?value)"/]
  v10 --o bind6
  bind6 --as--o v11
  bind7[/"count(?value)"/]
  v10 --o bind7
  bind7 --as--o v12