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_00283

Proteins with no reported mitochondrial localization but interacting with 20 or more mitochondrial proteins ('gold' quality)

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX nextprot_cv: <http://nextprot.org/rdf/terminology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?entry (str(?gen) as ?gene) (count(distinct ?mitopartner) as ?mitcount) (count(distinct ?partner) as ?itcount) WHERE {
values ?mitloc {nextprot_cv:GO_0005739 nextprot_cv:SL-0173} # GO and SL values for mitochondrion
 ?entry :isoform ?iso.
 ?entry :gene / :recommendedName / rdfs:label ?gen.
 filter not exists { ?iso :cellularComponent /:term / :childOf ?mitloc }
 ?iso :binaryInteraction ?it, ?it2.
 ?it :interactant ?mitopartner; :quality :GOLD .
 ?mitopartner :isoform / :cellularComponent ?loc .
 ?loc :quality :GOLD; :term / :childOf ?mitloc .
 ?it2 :interactant ?partner; :quality :GOLD .
} group by ?entry ?gen ?mitcnt having (count(distinct ?mitopartner) >= 20)
order by desc(?mitcnt)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v11("?_anon_524857e97b124dceaa8a4ecc8d1a18273112")
  v4("?entry"):::projected 
  v5("?gen"):::projected 
  v12("?gene")
  v2("?iso")
  v6("?it")
  v7("?it2")
  v14("?itcount")
  v9("?loc")
  v1("?mitcnt")
  v13("?mitcount")
  v4("?mitloc")
  v8("?mitopartner"):::projected 
  v10("?partner"):::projected 
  a4((" "))
  a5((" "))
  a2((" "))
  a3((" "))
  a6((" "))
  a7((" "))
  a1((" "))
  c12([":GOLD"]):::iri 
  f0[[" >= '20^^xsd:integer'"]]
  f0 --> a1
  f1[["not  "]]
  subgraph f1e0["Exists Clause"]
    e0v1 --":cellularComponent"-->  e0a1
    e0a1 --":term"-->  e0a2
    e0a2 --":childOf"-->  e0v2
    e0v1("?iso"):::projected 
    e0v2("?mitloc"):::projected 
    e0a1((" ")):::projected 
    e0a2((" ")):::projected 
  end
  f1--EXISTS--> f1e0
  f1 --> v2
  f1 --> c2
  f1 --> a2
  f1 --> c3
  f1 --> a3
  f1 --> c4
  f1 --> v4
  v2 --":cellularComponent"-->  a2
  a2 --":term"-->  a3
  a3 --":childOf"-->  v4
  bind2[/VALUES ?mitloc/]
  bind2-->v4
  bind20([":terminology/GO_0005739"])
  bind20 --> bind2
  bind21([":terminology/SL-0173"])
  bind21 --> bind2
  v4 --":isoform"-->  v2
  v4 --":gene"-->  a4
  a4 --":recommendedName"-->  a5
  a5 --"rdfs:label"-->  v5
  v2 --":binaryInteraction"-->  v6
  v2 --":binaryInteraction"-->  v7
  v6 --":interactant"-->  v8
  v6 --":quality"-->  c12
  v8 --":isoform"-->  a6
  a6 --":cellularComponent"-->  v9
  v9 --":quality"-->  c12
  v9 --":term"-->  a7
  a7 --":childOf"-->  v4
  v7 --":interactant"-->  v10
  v7 --":quality"-->  c12
  bind6[/"count(?mitopartner)"/]
  v8 --o bind6
  bind6 --as--o v11
  bind7[/"str(?gen)"/]
  v5 --o bind7
  bind7 --as--o v12
  bind8[/"count(?mitopartner)"/]
  v8 --o bind8
  bind8 --as--o v13
  bind9[/"count(?partner)"/]
  v10 --o bind9
  bind9 --as--o v14