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_00025

Proteins with at least 50 interactors that are not associated with a disease

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX nextprot_cv: <http://nextprot.org/rdf/terminology/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?entry WHERE {
 ?entry :isoform ?iso.
 ?iso :binaryInteraction/:interactant ?interactant.

 # with no disease
 filter not exists {
 {
 ?iso :medical / rdf:type :Disease.
 } union {
 ?iso :uniprotKeyword / :term ?kw .
 ?kw :termType "Disease"^^xsd:string
 filter (?kw != nextprot_cv:KW-0656)
 }
 }

} group by ?entry ?iso having (count(?interactant) >= 50)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?_anon_aaf95e3c346c4c97af230d5bcfeba8ab3786")
  v3("?entry"):::projected 
  v4("?interactant")
  v1("?iso")
  v2("?kw")
  a4((" "))
  a2((" "))
  a3((" "))
  a1((" "))
  c9(["Disease"]):::literal 
  c4([":Disease"]):::iri 
  f0[[" >= '50^^xsd:integer'"]]
  f0 --> a1
  f1[["not  "]]
  subgraph f1e0["Exists Clause"]
    subgraph unione00[" Union "]
    subgraph unione00l[" "]
      style unione00l fill:#abf,stroke-dasharray: 3 3;
      e0f0[["?kw != ':terminology/KW-0656'"]]
      e0f0 --> e0v2
      e0v1 --":uniprotKeyword"-->  e0a2
      e0a2 --":term"-->  e0v2
      e0v2 --":termType"-->  e0c8
    end
    subgraph unione00r[" "]
      style unione00r fill:#abf,stroke-dasharray: 3 3;
      e0v1 --":medical"-->  e0a1
      e0a1 --"a"-->  e0c3
    end
    unione00r <== or ==> unione00l
    end
    e0v1("?iso"):::projected 
    e0v2("?kw"):::projected 
    e0a1((" ")):::projected 
    e0a2((" ")):::projected 
    e0c8(["Disease"]):::literal 
    e0c3([":Disease"]):::iri 
  end
  f1--EXISTS--> f1e0
  f1 --> v1
  f1 --> c2
  f1 --> a2
  f1 --> c3
  f1 --> c4
  f1 --> v2
  f1 --> c6
  f1 --> a3
  f1 --> c7
  f1 --> c8
  f1 --> c9
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    f2[["?kw != ':terminology/KW-0656'"]]
    f2 --> v2
    v1 --":uniprotKeyword"-->  a3
    a3 --":term"-->  v2
    v2 --":termType"-->  c9
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v1 --":medical"-->  a2
    a2 --"a"-->  c4
  end
  union0r <== or ==> union0l
  end
  v3 --":isoform"-->  v1
  v1 --":binaryInteraction"-->  a4
  a4 --":interactant"-->  v4
  bind4[/"count(?interactant)"/]
  v4 --o bind4
  bind4 --as--o v5