Get the colour-coded class landscape of an ontology as SVG
type: Nanopublication
has assertion: assertion
has provenance: provenance
has publication info: pubinfo
created: 2026-08-26T13:57:49Z
creator: Tobias Kuhn
license: https://creativecommons.org/publicdomain/zero/1.0/
embeds: Get the colour-coded class landscape of an ontology as SVG

Get the colour-coded class landscape of an ontology as SVG
type: grlc-query
description: Renders the classes of the given ontology or vocabulary as an inline SVG figure: an Euler ('Venn-style') diagram in which every class is one small dot, positioned by which of four sets it belongs to and coloured by a chosen facet. The four sets are: whether the class sits in a chemical group (it declares an rdfs:subClassOf other than the vocabulary's top class peh:BioChemEntity), whether it is a metabolite of another entity (peh:isMetaboliteOf), whether it is an isomer of another entity (peh:isIsomerOf), and whether it has a role (obo:RO_0000087). Metabolite and isomer are disjoint in this data and every isomer is also in a chemical group, so the isomer set is drawn nested inside the chemical-group set; the sets are drawn as overlapping rounded rectangles rather than circles, so that each resulting region holds an exactly aligned grid of dots, and a class in none of the four sets sits in the surrounding 'universe' frame. Each region is annotated with its own count and each set with its total. The optional colourby parameter selects what the dot colour means: with colourby=role the dots are coloured by the class's role, and with the parameter left out (the default) they are coloured by its chemical group. Either way the eight largest values get their own colour, ranked at query time, with separate shades for a smaller value and for classes that have none, and the legend is generated from the same ranking and gives each value's full size in the vocabulary. The legend ends with a link that switches to the other colouring: it points at this view's own full-screen result page with the opposite colourby value, so a reader can move between the two colourings in one click. It is an ordinary SVG anchor with a root-relative href, which is what the rendering instance's sanitiser allows -- an in-place toggle is not possible, since neither scripting nor styling survives that sanitisation. This is the simpler sibling of 'Get the class landscape of an ontology as SVG', which inste…
license: LICENSE-2.0
sparql: prefix owl: <http://www.w3.org/2002/07/owl#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix dct: <http://purl.org/dc/terms/> prefix np: <http://www.nanopub.org/nschema#> prefix npa: <http://purl.org/nanopub/admin/> prefix npx: <http://purl.org/nanopub/x/> prefix gen: <https://w3id.org/kpxl/gen/terms/> prefix peh: <https://w3id.org/peh/terms/> prefix obo: <http://purl.obolibrary.org/obo/> prefix foaf: <http://xmlns.com/foaf/0.1/> prefix xsd: <http://www.w3.org/2001/XMLSchema#> select ?svg where { { select (group_concat(?cellBlock; separator="") as ?body) (sum(?ccount) as ?total) (sum(if(contains(?sets, "G"), ?ccount, 0)) as ?nGroup) (sum(if(contains(?sets, "M"), ?ccount, 0)) as ?nMet) (sum(if(contains(?sets, "I"), ?ccount, 0)) as ?nIso) (sum(if(contains(?sets, "R"), ?ccount, 0)) as ?nRole) where { { select ?sets ?x0 ?y0 ?cols (count(?class) as ?ccount) (group_concat(?dot; separator="") as ?dots) where { { select ?class ?label ?sets ?groupKey ?roleKey ?parentLabel (count(?o2) - 1 as ?rank) where { { select ?class ?label (?sets_ as ?sets) (?groupKey_ as ?groupKey) (?roleKey_ as ?roleKey) (?parentLabel_ as ?parentLabel) (min(?sortkey_) as ?sortkey) where { values ?_ontology_multi_iri {} service <https://w3id.org/np/l/nanopub-query-1.1/repo/spaces> { select (group_concat(?mpk; separator=" ") as ?memberPubkeys) where { graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . } values ?_ontology_multi_iri {} graph ?stateG { ?_ontology_multi_iri npa:isMaintainedBy? ?space . ?ri a gen:RoleInstantiation ; npa:forSpace ?space ; npa:forAgent ?agent ; npa:hasRoleType ?rt . filter(?rt in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole)) ?acct a npa:AccountState ; npa:agent ?agent ; npa:pubkey ?mpk . } } } graph npa:graph { ?np npx:hasNanopubType owl:Class ; npa:hasValidSignatureForPublicKeyHash ?pubkey ; dct:created ?date ; npx:introduces ?class ; np:hasAssertion ?a . filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pu…

sig
has algorithm: RSA
signed by: Tobias Kuhn