sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

20

rq turtle/ttl

Find how often an article in PubMed was used in an evidence tag in a human protein (ordered by most used to least)

Use at

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT 
    ?source 
    (COUNT(?attribution) AS ?attribitions)
WHERE
{
        ?protein a up:Protein ;
            up:organism taxon:9606 ;
            up:annotation ?annotation .
        ?linkToEvidence rdf:object ?annotation ;
                        up:attribution ?attribution .
        ?attribution up:source ?source .
        ?source a up:Journal_Citation .
} GROUP BY ?source ORDER BY DESC(COUNT(?attribution))
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?_anon_39b94405334d4c98a94d4349b2e252701951")
  v2("?annotation")
  v7("?attribitions")
  v4("?attribution"):::projected 
  v3("?linkToEvidence")
  v1("?protein")
  v5("?source"):::projected 
  a1((" "))
  c9(["up:Journal_Citation"]):::iri 
  c2(["up:Protein"]):::iri 
  c4(["taxon:9606"]):::iri 
  v1 --"a"-->  c2
  v1 --"up:organism"-->  c4
  v1 --"up:annotation"-->  v2
  v3 --"rdf:object"-->  v2
  v3 --"up:attribution"-->  v4
  v4 --"up:source"-->  v5
  v5 --"a"-->  c9
  bind2[/"count(?attribution)"/]
  v4 --o bind2
  bind2 --as--o v6
  bind3[/"count(?attribution)"/]
  v4 --o bind3
  bind3 --as--o v7