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_00280

Proteins interacting with at least 10 members of a protein family

Use at

PREFIX : <http://nextprot.org/rdf/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?entry (str(?gen) as ?gene) (str(?xlab) as ?itfamily) ?itcnt ?membercnt ((xsd:float(?itcnt) / xsd:float(?membercnt)) as ?ratio) WHERE {
 {
 select ?xterm ?xlab (count(distinct ?member) as ?membercnt) WHERE {
 ?member :isoform? / :familyName /:term /:childOf ?xterm.
 ?xterm rdfs:label ?xlab .
 } group by ?xterm ?xlab
 }
 {
 select ?xterm ?entry ?gen (count (distinct ?interactant) as ?itcnt) WHERE {
 ?entry :isoform ?iso; :gene / :name / rdfs:label ?gen .
 ?iso :interaction ?it.
 ?it :quality :GOLD; :interactant ?interactant.
 ?interactant :familyName /:term /:childOf ?xterm .
 } group by ?xterm ?entry ?gen having (count (distinct ?interactant) >= 10)
 }
}
order by desc(?ratio)
limit 60
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v11("?_anon_524857e97b124dceaa8a4ecc8d1a18273293")
  v6("?entry"):::projected 
  v8("?gen"):::projected 
  v13("?gene")
  v10("?interactant")
  v7("?iso")
  v9("?it")
  v12("?itcnt"):::projected 
  v14("?itfamily")
  v2("?member")
  v5("?membercnt"):::projected 
  v15("?ratio")
  v4("?xlab"):::projected 
  v3("?xterm")
  a1((" "))
  a2((" "))
  a3((" "))
  a5((" "))
  a6((" "))
  a7((" "))
  a8((" "))
  a4((" "))
  c11([":GOLD"]):::iri 
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    v2 --":isoform"-->  a1
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
  end
  union0r <== or ==> union0l
  end
  a1 --":familyName"-->  a2
  a2 --":term"-->  a3
  a3 --":childOf"-->  v3
  v3 --"rdfs:label"-->  v4
  bind1[/"count(?member)"/]
  v2 --o bind1
  bind1 --as--o v5
  f2[[" >= '10^^xsd:integer'"]]
  f2 --> a4
  v6 --":isoform"-->  v7
  v6 --":gene"-->  a5
  a5 --":name"-->  a6
  a6 --"rdfs:label"-->  v8
  v7 --":interaction"-->  v9
  v9 --":quality"-->  c11
  v9 --":interactant"-->  v10
  v10 --":familyName"-->  a7
  a7 --":term"-->  a8
  a8 --":childOf"-->  v3
  bind5[/"count(?interactant)"/]
  v10 --o bind5
  bind5 --as--o v11
  bind6[/"count(?interactant)"/]
  v10 --o bind6
  bind6 --as--o v12
  bind7[/"str(?gen)"/]
  v8 --o bind7
  bind7 --as--o v13
  bind8[/"str(?xlab)"/]
  v4 --o bind8
  bind8 --as--o v14
  bind9[/"http://www.w3.org/2001/XMLSchema#float(?itcnt) / http://www.w3.org/2001/XMLSchema#float(?membercnt)"/]
  v12 --o bind9
  v5 --o bind9
  bind9 --as--o v15