sparql-examples

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

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

NXQ_00264

rq turtle/ttl

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
https://sparql.orthodb.org/sparql/
as
a
rdfs:subClassOf
a
up:scientificName
up:organism
a
a
http://purl.orthodb.org/xrefResource
http://purl.orthodb.org/xref
up:scientificName
a
:reference
a
:provenance
:accession
as
as
http://purl.orthodb.org/Species
?taxon
?clade
http://purl.orthodb.org/Clade
Viruses
?gene_v
http://purl.orthodb.org/Xref
?ipref
?taxlab
?entry
?ipac
?ipacSTR
?ref
?taxlab1
:Xref
:db/InterPro
:Entry
VALUES ?ipac
IPR018154
IPR008981
concat('http://www.ebi.ac.uk/interpro/entry/',str(?ipac))
str(?ipac)
?taxlab