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_09433

Check there are no entries with an xref to an ENSP but no xref to an ENST

Use at

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

select distinct ?entry where {
  ?entry a :Entry.
  filter exists {
    ?entry :reference ?x.
    ?x :provenance db:Ensembl ; :accession ?ac.
    filter (regex(?ac,'^ENSP'))
  }
  filter not exists {
    ?entry :reference ?x.
    ?x :provenance db:Ensembl ; :accession ?ac.
    filter (regex(?ac,'^ENST'))
  }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?ac")
  v2("?entry"):::projected 
  v3("?x")
  c8([":Entry"]):::iri 
  c4([":db/Ensembl"]):::iri 
  f0[["not  "]]
  subgraph f0e0["Exists Clause"]
    e0f0[["regex(?ac,'^ENST')"]]
    e0f0 --> e0v1
    e0v2 --":reference"-->  e0v3
    e0v3 --":provenance"-->  e0c4
    e0v3 --":accession"-->  e0v1
    e0v1("?ac"):::projected 
    e0v2("?entry"):::projected 
    e0v3("?x"):::projected 
    e0c4([":db/Ensembl"]):::iri 
  end
  f0--EXISTS--> f0e0
  f0 --> v1
  f0 --> v2
  f0 --> c2
  f0 --> v3
  f0 --> c3
  f0 --> c4
  f0 --> c5
  f1[["regex(?ac,'^ENST')"]]
  f1 --> v1
  v2 --":reference"-->  v3
  v3 --":provenance"-->  c4
  v3 --":accession"-->  v1
  f2[[" "]]
  subgraph f2e1["Exists Clause"]
    e1f0[["regex(?ac,'^ENSP')"]]
    e1f0 --> e1v1
    e1v2 --":reference"-->  e1v3
    e1v3 --":provenance"-->  e1c4
    e1v3 --":accession"-->  e1v1
    e1v1("?ac"):::projected 
    e1v2("?entry"):::projected 
    e1v3("?x"):::projected 
    e1c4([":db/Ensembl"]):::iri 
  end
  f2--EXISTS--> f2e1
  f2 --> v1
  f2 --> v2
  f2 --> c2
  f2 --> v3
  f2 --> c3
  f2 --> c4
  f2 --> c5
  f3[["regex(?ac,'^ENSP')"]]
  f3 --> v1
  v2 --":reference"-->  v3
  v3 --":provenance"-->  c4
  v3 --":accession"-->  v1
  v2 --"a"-->  c8