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_00091

Proteins which are targets of drugs for cardiac therapy

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:target> ?drugTarget .
	?drug <http://bio2rdf.org/drugbank_vocabulary:x-atc> ?atcCode.
    ?drugTarget <http://bio2rdf.org/drugbank_vocabulary:x-uniprot> ?uniprot .
	filter(!contains(str(?uniprot),"_"))
	filter(contains(str(?atcCode), "atc:C01" )) # ATC starting with C01 means therapeutic subgroup for cardiac therapy
    }
  }
  BIND (IRI(CONCAT("http://nextprot.org/rdf/entry/NX_",substr(str(?uniprot),28,6))) as ?entry) # cast drugbank id to neXtprot entry
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?atcCode")
  v3("?drug")
  v4("?drugTarget")
  v5("?entry"):::projected 
  v2("?uniprot")
  subgraph s1["http://drugbank.bio2rdf.org/sparql"]
    style s1 stroke-width:4px;
    f0[["contains(str(?atcCode),'atc:C01')"]]
    f0 --> v1
    f1[["not contains(str(?uniprot),'_')"]]
    f1 --> v2
    v3 --http://bio2rdf.org/drugbank_vocabulary:target-->  v4
    v3 --http://bio2rdf.org/drugbank_vocabulary:x-atc-->  v1
    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