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_00264

Proteins with ENV polyprotein domains and matching viral species

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX cv: <http://nextprot.org/rdf/terminology/>
PREFIX db: <http://nextprot.org/rdf/db/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

PREFIX orth: <http://purl.orthodb.org/>
PREFIX interpro: <http://www.ebi.ac.uk/interpro/entry/>
PREFIX up: <http://purl.uniprot.org/core/>

select distinct ?entry (str(?ipac) AS ?ipacSTR) (group_concat(?taxlab ; SEPARATOR = ",") AS ?taxlab1) where {
  VALUES ?ipac {"IPR018154"^^xsd:string "IPR008981"^^xsd:string }. # Interpro patterns for TLV/ENV coat polyprotein
  bind (iri(CONCAT("http://www.ebi.ac.uk/interpro/entry/",str(?ipac))) as ?ipref) .
  SERVICE <https://sparql.orthodb.org/sparql/> {
   select distinct ?ipref ?taxlab where {
   ?taxon a orth:Species; rdfs:subClassOf+  ?clade.
   ?clade a orth:Clade; up:scientificName 'Viruses'.
   ?gene_v up:organism / a ?taxon; orth:xref [a orth:Xref; orth:xrefResource ?ipref].
   ?taxon up:scientificName ?taxlab .
   }
  }
  ?entry a :Entry .
  ?entry :reference ?ref .
  ?ref a :Xref ; :provenance db:InterPro; :accession ?ipac .
} group by ?entry ?ipac
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?clade")
  v7("?entry"):::projected 
  v5("?gene_v")
  v1("?ipac"):::projected 
  v9("?ipacSTR")
  v2("?ipref")
  v8("?ref")
  v6("?taxlab"):::projected 
  v10("?taxlab1")
  v3("?taxon")
  a1((" "))
  a2((" "))
  c14([":Xref"]):::iri 
  c9([http://purl.orthodb.org/Xref]):::iri 
  c16([":db/InterPro"]):::iri 
  c7(["Viruses"]):::literal 
  c12([":Entry"]):::iri 
  c3([http://purl.orthodb.org/Species]):::iri 
  c5([http://purl.orthodb.org/Clade]):::iri 
  bind0[/VALUES ?ipac/]
  bind0-->v1
  bind00(["IPR018154"])
  bind00 --> bind0
  bind01(["IPR008981"])
  bind01 --> bind0
  bind1[/"concat('http://www.ebi.ac.uk/interpro/entry/',str(?ipac))"/]
  v1 --o bind1
  bind1 --as--o v2
  subgraph s1["https://sparql.orthodb.org/sparql/"]
    style s1 stroke-width:4px;
    v3 --"a"-->  c3
    v3 --"rdfs:subClassOf"-->  v4
    v4 --"a"-->  c5
    v4 --"up:scientificName"-->  c7
    v5 --"up:organism"-->  a1
    a1 --"a"-->  v3
    a2 --"a"-->  c9
    a2 --http://purl.orthodb.org/xrefResource-->  v2
    v5 --http://purl.orthodb.org/xref-->  a2
    v3 --"up:scientificName"-->  v6
  end
  v7 --"a"-->  c12
  v7 --":reference"-->  v8
  v8 --"a"-->  c14
  v8 --":provenance"-->  c16
  v8 --":accession"-->  v1
  bind3[/"str(?ipac)"/]
  v1 --o bind3
  bind3 --as--o v9
  bind4[/"?taxlab"/]
  v6 --o bind4
  bind4 --as--o v10