sparql-examples

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

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

Query_125

rq turtle/ttl

Count of publications referenced by publication type

Use at


PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?pub_type (count(?cl) as ?cnt) where {
  ?pub_type rdfs:subClassOf* cello:Publication .
  optional {?cl rdf:type ?pub_type. }
}
group by ?pub_type
order by desc(count(*))
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?_anon_39b94405334d4c98a94d4349b2e252706")
  v2("?cl"):::projected 
  v4("?cnt")
  v1("?pub_type"):::projected 
  a1((" "))
  c2(["cello:Publication"]):::iri 
  v1 --"rdfs:subClassOf"-->  c2
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."a".->  v1
  end
  bind2[/"count(*)"/]
  bind2 --as--o v3
  bind3[/"count(?cl)"/]
  v2 --o bind3
  bind3 --as--o v4