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_00124

What are the 25 most frequent families with member count

Use at

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

select (str(?famlab) as ?familylabel) (count(distinct(?member)) as ?membercnt) where{
 ?member :familyName /:term /:childOf / rdfs:label ?famlab .
} group by ?famlab
order by desc(?membercnt)
limit 25
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?familylabel")
  v3("?famlab"):::projected 
  v2("?member"):::projected 
  v5("?membercnt")
  a1((" "))
  a2((" "))
  a3((" "))
  v2 --":familyName"-->  a1
  a1 --":term"-->  a2
  a2 --":childOf"-->  a3
  a3 --"rdfs:label"-->  v3
  bind1[/"str(?famlab)"/]
  v3 --o bind1
  bind1 --as--o v4
  bind2[/"count(?member)"/]
  v2 --o bind2
  bind2 --as--o v5