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_00232

Proteins with sequences 100% identical to other proteins, grouped

Use at

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

SELECT DISTINCT ?entry (group_concat(distinct substr(str(?entry2),34); separator = ",") as ?sameseq) WHERE {
 ?entry :isoform / :sequence / :chain ?chain1.
 ?entry2 :isoform / :sequence / :chain ?chain2.
 filter ( (?chain1 = ?chain2) && (?entry != ?entry2))
}
group by ?entry
order by ?entry
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?chain1")
  v3("?chain2")
  v1("?entry"):::projected 
  v4("?entry2"):::projected 
  v5("?sameseq")
  a1((" "))
  a2((" "))
  a3((" "))
  a4((" "))
  f0[["?chain1 = ?chain2?entry != ?entry2"]]
  f0 --> v2
  f0 --> v3
  f0 --> v1
  f0 --> v4
  v1 --":isoform"-->  a1
  a1 --":sequence"-->  a2
  a2 --":chain"-->  v2
  v4 --":isoform"-->  a3
  a3 --":sequence"-->  a4
  a4 --":chain"-->  v3
  bind2[/"substring(str(?entry2),'34^^xsd:integer')"/]
  v4 --o bind2
  bind2 --as--o v5