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_00146

Proteins having at least 2 proteotypic peptides of 7 or 8aa but no proteotypic peptide >= 9 aa

Use at

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

SELECT DISTINCT ?entry WHERE {
?entry :isoform / :peptideMapping ?pm.
?pm :proteotypic true .
?pm :peptideName ?pepid .
#?pm :start ?pos1 ; :end ?pos2 .
#filter((?pos2 - ?pos1 + 1) >= 7) # This is not absolutely required for current query since 7 is the minimum length for accepted proteotypic peptides
filter not exists {
 ?entry :isoform / :peptideMapping ?pm2.
 ?pm2 :start ?p1 ; :end ?p2 .
 ?pm2 :proteotypic true .
 filter((?p2 - ?p1 + 1) >= 9)
 }
}
group by ?entry having(count (distinct ?pepid) >= 2)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v7("?_anon_aaf95e3c346c4c97af230d5bcfeba8ab1678")
  v3("?entry"):::projected 
  v2("?p1")
  v1("?p2")
  v6("?pepid")
  v5("?pm")
  v4("?pm2")
  a3((" "))
  a2((" "))
  a1((" "))
  c9(["true^^xsd:boolean"]):::literal 
  f0[[" >= '2^^xsd:integer'"]]
  f0 --> a1
  f1[["not  "]]
  subgraph f1e0["Exists Clause"]
    e0f0[["?p2 - ?p1 + '1^^xsd:integer' >= '9^^xsd:integer'"]]
    e0f0 --> e0v1
    e0f0 --> e0v2
    e0v3 --":isoform"-->  e0a1
    e0a1 --":peptideMapping"-->  e0v4
    e0v4 --":start"-->  e0v2
    e0v4 --":end"-->  e0v1
    e0v4 --":proteotypic"-->  e0c8
    e0v3("?entry"):::projected 
    e0v2("?p1"):::projected 
    e0v1("?p2"):::projected 
    e0v4("?pm2"):::projected 
    e0a1((" ")):::projected 
    e0c8(["true^^xsd:boolean"]):::literal 
  end
  f1--EXISTS--> f1e0
  f1 --> v1
  f1 --> v2
  f1 --> v3
  f1 --> c4
  f1 --> a2
  f1 --> c5
  f1 --> v4
  f1 --> c6
  f1 --> c7
  f1 --> c8
  f1 --> c9
  f2[["?p2 - ?p1 + '1^^xsd:integer' >= '9^^xsd:integer'"]]
  f2 --> v1
  f2 --> v2
  v3 --":isoform"-->  a2
  a2 --":peptideMapping"-->  v4
  v4 --":start"-->  v2
  v4 --":end"-->  v1
  v4 --":proteotypic"-->  c9
  v3 --":isoform"-->  a3
  a3 --":peptideMapping"-->  v5
  v5 --":proteotypic"-->  c9
  v5 --":peptideName"-->  v6
  bind4[/"count(?pepid)"/]
  v6 --o bind4
  bind4 --as--o v7