@prefix ex:<https://purl.expasy.org/sparql-examples/neXtProt/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix spex:<https://purl.expasy.org/sparql-examples/ontology#> .

ex:NXQ_00095 a sh:SPARQLExecutable, sh:SPARQLSelectExecutable ;
  sh:prefixes _:sparql_examples_prefixes ;
  rdfs:comment '''Proteins which are targets of antipsychotic drugs and highly expressed in brain'''@en ;
  schema:keywords "drug", "expression", "federated query" ;
  schema:target <https://sparql.nextprot.org/sparql> ;
  sh:select '''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.
}''' ;
  spex:federatesWith <http://drugbank.bio2rdf.org/sparql> .
