65_Number_of_reaction_participants_per_reaction_side

rq turtle/ttl

Histogram of reaction sides by their number of participants - across all approved Rhea reactions, how many sides have exactly 1, 2, 3... participants (e.g. is a side with 11 distinct participants an outlier)

Use at

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

SELECT
  ?participantCount
  (COUNT(*) AS ?sideCount)
WHERE {
  {
    SELECT ?side (COUNT(DISTINCT ?participant) AS ?participantCount)
    WHERE {
      ?reaction rdfs:subClassOf rh:Reaction ;
        rh:status rh:Approved ;
        rh:side ?side .
      ?side rh:contains ?participant .
    }
    GROUP BY ?side
  }
}
GROUP BY ?participantCount
ORDER BY ?participantCount

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?participant")
  v5("?participantCount"):::projected 
  v2("?reaction")
  v3("?side")
  v5("?sideCount")
  c4(["rh:Approved"]):::iri 
  c2(["rh:Reaction"]):::iri 
  v2 --"rdfs:subClassOf"-->  c2
  v2 --"rh:status"-->  c4
  v2 --"rh:side"-->  v3
  v3 --"rh:contains"-->  v4
  bind1[/"count(?participant)"/]
  v4 --o bind1
  bind1 --as--o v5
  bind3[/"count(*)"/]
  bind3 --as--o v5