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_00002

Proteins that are located in both the nucleus and in the cytoplasm

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX nextprot_cv: <http://nextprot.org/rdf/terminology/>

SELECT DISTINCT ?entry WHERE {
 values ?cytoloc {nextprot_cv:GO_0005737 nextprot_cv:SL-0086} # GO and SL values for cytoplasm
 values ?nucloc {nextprot_cv:GO_0005634 nextprot_cv:SL-0191} # GO and SL values for nucleus
 ?entry :isoform ?iso.
 ?iso :cellularComponent ?loc1, ?loc2 .
 ?loc1 :term /:childOf ?cytoloc .
 ?loc2 :term /:childOf ?nucloc .
 filter not exists {?loc1 :negativeEvidence ?negev} # No negative localization evidence
 filter not exists {?loc2 :negativeEvidence ?negev} # No negative localization evidence
}

# Note the dot "." at the end of statements.
# If missing, you will get a syntax error.
#
# Use a comma to retrieve two localizations in:
# ?iso :cellularComponent ?loc1, ?loc2 .
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?cytoloc")
  v6("?entry"):::projected 
  v7("?iso")
  v3("?loc1")
  v1("?loc2")
  v2("?negev")
  v5("?nucloc")
  a1((" "))
  a2((" "))
  f0[["not  "]]
  subgraph f0e0["Exists Clause"]
    e0v1 --":negativeEvidence"-->  e0v2
    e0v1("?loc2"):::projected 
    e0v2("?negev"):::projected 
  end
  f0--EXISTS--> f0e0
  f0 --> v1
  f0 --> c1
  f0 --> v2
  v1 --":negativeEvidence"-->  v2
  f1[["not  "]]
  subgraph f1e1["Exists Clause"]
    e1v1 --":negativeEvidence"-->  e1v2
    e1v1("?loc1"):::projected 
    e1v2("?negev"):::projected 
  end
  f1--EXISTS--> f1e1
  f1 --> v3
  f1 --> c1
  f1 --> v2
  v3 --":negativeEvidence"-->  v2
  bind2[/VALUES ?cytoloc/]
  bind2-->v4
  bind20([":terminology/GO_0005737"])
  bind20 --> bind2
  bind21([":terminology/SL-0086"])
  bind21 --> bind2
  bind3[/VALUES ?nucloc/]
  bind3-->v5
  bind30([":terminology/GO_0005634"])
  bind30 --> bind3
  bind31([":terminology/SL-0191"])
  bind31 --> bind3
  v6 --":isoform"-->  v7
  v7 --":cellularComponent"-->  v3
  v7 --":cellularComponent"-->  v1
  v3 --":term"-->  a1
  a1 --":childOf"-->  v4
  v1 --":term"-->  a2
  a2 --":childOf"-->  v5