sparql-examples

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

View the Project on GitHub sib-swiss/sparql-examples

neXtProt/NXQ_00095

Proteins which are targets of antipsychotic drugs and highly expressed in brain

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX cv: <http://nextprot.org/rdf/terminology/>

select distinct ?entry where {
  SERVICE <http://drugbank.bio2rdf.org/sparql> {
    select distinct ?uniprot WHERE {
    ?drug <http://bio2rdf.org/drugbank_vocabulary:category> ?drugCat .
	?drug <http://bio2rdf.org/drugbank_vocabulary:target> ?drugTarget .
    ?drugTarget <http://bio2rdf.org/drugbank_vocabulary:x-uniprot> ?uniprot .
	filter(!contains(str(?uniprot),"_"))
	filter(contains(str(?drugCat),"Antipsychotic"))
    }
  }
  BIND (IRI(CONCAT("http://nextprot.org/rdf/entry/NX_",substr(str(?uniprot),28,6))) as ?entry) # cast drugbank id to neXtprot entry
  ?entry :isoform/:expressionProfile ?expr.
  ?expr :term/:childOf cv:TS-0095.
  ?expr :evidence / :expressionLevel :High.
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?drug")
  v1("?drugCat")
  v4("?drugTarget")
  v5("?entry"):::projected 
  v6("?expr")
  v2("?uniprot")
  a1((" "))
  a2((" "))
  a3((" "))
  c14([":High"]):::iri 
  c11([":terminology/TS-0095"]):::iri 
  subgraph s1["http://drugbank.bio2rdf.org/sparql"]
    style s1 stroke-width:4px;
    f0[["contains(str(?drugCat),'Antipsychotic')"]]
    f0 --> v1
    f1[["not contains(str(?uniprot),'_')"]]
    f1 --> v2
    v3 --http://bio2rdf.org/drugbank_vocabulary:category-->  v1
    v3 --http://bio2rdf.org/drugbank_vocabulary:target-->  v4
    v4 --http://bio2rdf.org/drugbank_vocabulary:x-uniprot-->  v2
  end
  bind2[/"concat('http://nextprot.org/rdf/entry/NX_',substring(str(?uniprot),'28^^xsd:integer','6^^xsd:integer'))"/]
  v2 --o bind2
  bind2 --as--o v5
  v5 --":isoform"-->  a1
  a1 --":expressionProfile"-->  v6
  v6 --":term"-->  a2
  a2 --":childOf"-->  c11
  v6 --":evidence"-->  a3
  a3 --":expressionLevel"-->  c14