[ { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ/Head", "@graph": [ { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ", "http://www.nanopub.org/nschema#hasAssertion": [ { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ/assertion" } ], "http://www.nanopub.org/nschema#hasProvenance": [ { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ/provenance" } ], "http://www.nanopub.org/nschema#hasPublicationInfo": [ { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ/pubinfo" } ], "@type": [ "http://www.nanopub.org/nschema#Nanopublication" ] } ] }, { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ/provenance", "@graph": [ { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ/assertion", "http://www.w3.org/ns/prov#wasAttributedTo": [ { "@id": "https://orcid.org/0000-0002-1267-0234" } ] } ] }, { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ/pubinfo", "@graph": [ { "@id": "https://orcid.org/0000-0002-1267-0234", "http://xmlns.com/foaf/0.1/name": [ { "@value": "Tobias Kuhn" } ] }, { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ", "http://purl.org/dc/terms/created": [ { "@value": "2026-08-26T09:34:49Z", "@type": "http://www.w3.org/2001/XMLSchema#dateTime" } ], "http://purl.org/dc/terms/creator": [ { "@id": "https://orcid.org/0000-0002-1267-0234" } ], "http://purl.org/dc/terms/license": [ { "@id": "https://creativecommons.org/publicdomain/zero/1.0/" } ], "http://purl.org/nanopub/x/embeds": [ { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ/get-class-landscape-svg" } ], "http://purl.org/nanopub/x/supersedes": [ { "@id": "https://w3id.org/np/RAU9jhzt-Dhht4Q4cY62prqCnCW7OCQpVMOjVKUcJdQHM" } ], "http://www.w3.org/2000/01/rdf-schema#label": [ { "@value": "Get the class landscape of an ontology as SVG" } ], "https://w3id.org/np/o/ntemplate/wasCreatedFromProvenanceTemplate": [ { "@id": "https://w3id.org/np/RA7lSq6MuK_TIC6JMSHvLtee3lpLoZDOqLJCLXevnrPoU" } ], "https://w3id.org/np/o/ntemplate/wasCreatedFromPubinfoTemplate": [ { "@id": "https://w3id.org/np/RACJ58Gvyn91LqCKIO9zu1eijDQIeEff28iyDrJgjSJF8" }, { "@id": "https://w3id.org/np/RAoTD7udB2KtUuOuAe74tJi1t3VzK0DyWS7rYVAq1GRvw" }, { "@id": "https://w3id.org/np/RAukAcWHRDlkqxk7H2XNSegc1WnHI569INvNr-xdptDGI" } ], "https://w3id.org/np/o/ntemplate/wasCreatedFromTemplate": [ { "@id": "https://w3id.org/np/RAEFAt-QcFK0ZhqfvlsmS10BnzGJA0xwOICZXkO-ai87k" } ] }, { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ/sig", "http://purl.org/nanopub/x/hasAlgorithm": [ { "@value": "RSA" } ], "http://purl.org/nanopub/x/hasPublicKey": [ { "@value": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB" } ], "http://purl.org/nanopub/x/hasSignature": [ { "@value": "P6kbLRAaxJEPOVWlcoDP+xnelW6lyVP9lt8QBYOURQFN4RWp5E65sGivpMzjMVCeHRKoYhXyEXwp6lkwzpZr9LU5D46uEGuLd3VOmNCToLx5veiZhPvaFXMc844J1fsB/Rfx29OAqmH57gRNxuotqCd+UDCxOJDF9SjQJO1X7A0=" } ], "http://purl.org/nanopub/x/hasSignatureTarget": [ { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ" } ], "http://purl.org/nanopub/x/signedBy": [ { "@id": "https://orcid.org/0000-0002-1267-0234" } ] } ] }, { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ/assertion", "@graph": [ { "@id": "https://w3id.org/np/RA8ZHeRMAJToRTMM6VYdUPm5noZ7ACSqeeUW6SAk66jKQ/get-class-landscape-svg", "http://purl.org/dc/terms/description": [ { "@value": "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 three sets it belongs to and coloured by its chemical group. The three 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 carries a metabolite or isomer link (peh:isMetaboliteOf / peh:isIsomerOf), and whether it has a chemical role (obo:RO_0000087). The three sets are drawn as overlapping rounded rectangles rather than circles, so that each of the resulting regions holds an exactly aligned grid of dots; a class in none of the three sets sits in the surrounding 'universe' frame. Each region is annotated with its own count, each set with its total, and the frame with the overall total; the figure carries no heading of its own, since the view it is shown in supplies the title. Every dot is a link to the class's part page and carries an SVG title element, so hovering shows the class label together with its group, its metabolite/isomer link and its role identifiers, and clicking opens it. Dot colour encodes the eight largest chemical groups (ranked by number of member classes, resolved at query time rather than hard-coded), with separate shades for a smaller named group and for no group at all; the legend is generated from the same ranking. The class set is exactly the one shown by the 'Get the approved classes of an ontology from space members' query and the corresponding view: the latest non-invalidated definition per class, published by an admin, maintainer or member of the maintaining space, not withdrawn, and approved either explicitly or via the auto-approved helper role. Positions are computed as absolute coordinates from rank sub-selects (the number of same-region classes sorting before this one, by label then URI), never from the order of a group_concat, which RDF4J does not preserve. The colour rank is looked up from a single-row string table rather than joined, because an OPTIONAL around a sub-select does not reliably left-join on a key bound outside it. The figure is intended for a gen:SvgView, which sanitises and embeds the markup; the SVG uses only the static element subset that survives that sanitisation. Its width is given as a percentage so that it fills the width of the panel it is shown in (Nanodash styles an SVG view's figure with max-width 100% and height auto, so a fixed pixel width would only ever cap it); the viewBox keeps the diagram's natural coordinate system, so the whole figure scales with the panel." } ], "http://purl.org/dc/terms/license": [ { "@id": "http://www.apache.org/licenses/LICENSE-2.0" } ], "@type": [ "https://w3id.org/kpxl/grlc/grlc-query" ], "http://www.w3.org/2000/01/rdf-schema#label": [ { "@value": "Get the class landscape of an ontology as SVG" } ], "https://w3id.org/kpxl/grlc/endpoint": [ { "@id": "https://w3id.org/np/l/nanopub-query-1.1/repo/type/e8cc5bb29ec5597303f8f101c65c545dc124ee0df68ce733764b03adc3237184" } ], "https://w3id.org/kpxl/grlc/sparql": [ { "@value": "prefix owl: \nprefix rdfs: \nprefix dct: \nprefix np: \nprefix npa: \nprefix npx: \nprefix gen: \nprefix peh: \nprefix obo: \nprefix foaf: \nprefix xsd: \n\nselect ?svg where {\n {\n select (group_concat(?block; separator=\"\") as ?body)\n (sum(?rcount) as ?total)\n (sum(if(substr(?region, 1, 1) = \"1\", ?rcount, 0)) as ?nGroup)\n (sum(if(substr(?region, 2, 1) = \"1\", ?rcount, 0)) as ?nLink)\n (sum(if(substr(?region, 3, 1) = \"1\", ?rcount, 0)) as ?nRole) where {\n {\n select ?region ?x0 ?y0 ?cols (count(?class) as ?rcount)\n (group_concat(?dot; separator=\"\") as ?dots) where {\n {\n select ?class ?label ?region ?parent ?roleIds ?parentLabel (count(?o2) - 1 as ?rank) where {\n { select ?class ?label ?region ?parent (min(?sortkey_) as ?sortkey)\n (group_concat(distinct ?roleShort; separator=\", \") as ?roleIds)\n (min(?parentLabel_) as ?parentLabel) where {\n values ?_ontology_multi_iri {}\n service {\n select (group_concat(?mpk; separator=\" \") as ?memberPubkeys) where {\n graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . }\n values ?_ontology_multi_iri {}\n graph ?stateG {\n ?_ontology_multi_iri npa:isMaintainedBy? ?space .\n ?ri a gen:RoleInstantiation ; npa:forSpace ?space ; npa:forAgent ?agent ; npa:hasRoleType ?rt .\n filter(?rt in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole))\n ?acct a npa:AccountState ; npa:agent ?agent ; npa:pubkey ?mpk .\n }\n }\n }\n graph npa:graph {\n ?np npx:hasNanopubType owl:Class ; npa:hasValidSignatureForPublicKeyHash ?pubkey ;\n dct:created ?date ; npx:introduces ?class ; np:hasAssertion ?a .\n filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . }\n }\n filter(contains(?memberPubkeys, ?pubkey))\n graph ?a { ?class dct:isPartOf|dct:partOf ?_ontology_multi_iri . }\n filter not exists { graph ?a { ?class a gen:WithdrawnTerm } }\n filter not exists {\n graph npa:graph {\n ?np2 npx:hasNanopubType owl:Class ; npa:hasValidSignatureForPublicKeyHash ?pubkey2 ;\n dct:created ?date2 ; npx:introduces ?class ; np:hasAssertion ?a2 .\n filter not exists { ?np2x npx:invalidates ?np2 ; npa:hasValidSignatureForPublicKeyHash ?pubkey2 . }\n }\n filter(contains(?memberPubkeys, ?pubkey2))\n graph ?a2 { ?class dct:isPartOf|dct:partOf ?_ontology_multi_iri . }\n filter(?date2 > ?date || (?date2 = ?date && str(?np2) > str(?np)))\n }\n {\n select (group_concat(distinct ?apV; separator=\" \") as ?approvedNps)\n (group_concat(distinct ?disV; separator=\" \") as ?disapprovedNps) where {\n {\n select ?vTarget (max(concat(str(?vDate), \">\", str(?vNp), \">\", ?vMark)) as ?vWin) where {\n values ?_ontology_multi_iri {}\n service {\n select (group_concat(?vpk; separator=\" \") as ?vMemberPubkeys) where {\n graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?vStateG . }\n values ?_ontology_multi_iri {}\n graph ?vStateG {\n ?_ontology_multi_iri npa:isMaintainedBy? ?vSpace .\n ?vRi a gen:RoleInstantiation ; npa:forSpace ?vSpace ; npa:forAgent ?vMember ;\n npa:hasRoleType ?vRt .\n filter(?vRt in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole))\n ?vAcct a npa:AccountState ; npa:agent ?vMember ; npa:pubkey ?vpk .\n }\n }\n }\n service {\n select distinct ?vTarget ?vNp ?vDate ?vPubkey ?vMark where {\n graph npa:graph {\n ?vTarget npx:hasNanopubType owl:Class ; npx:signedBy ?targetAgent .\n ?vNp npx:signedBy ?vAgent ; npa:hasValidSignatureForPublicKeyHash ?vPubkey ;\n dct:created ?vDate ; np:hasAssertion ?vA .\n filter not exists { ?vInv npx:invalidates ?vNp ; npa:hasValidSignatureForPublicKeyHash ?vPubkey . }\n }\n graph ?vA { ?vAgent ?vPred ?vTarget . }\n values ?vPred { npx:approvesOf npx:disapprovesOf }\n filter(?vAgent != ?targetAgent)\n bind(if(?vPred = npx:approvesOf, \"a\", \"d\") as ?vMark)\n }\n }\n filter(contains(?vMemberPubkeys, ?vPubkey))\n } group by ?vTarget\n }\n bind(if(strends(?vWin, \"a\"), str(?vTarget), \"\") as ?apV)\n bind(if(strends(?vWin, \"d\"), str(?vTarget), \"\") as ?disV)\n }\n }\n {\n select (sample(?helperPubkeys_) as ?helperPubkeys) where {\n service {\n select (group_concat(?hpk; separator=\" \") as ?helperPubkeys_) where {\n graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?hStateG . }\n values ?_ontology_multi_iri {}\n graph ?hStateG {\n ?_ontology_multi_iri npa:isMaintainedBy? ?hSpace .\n ?hRi a gen:RoleInstantiation ; npa:forSpace ?hSpace ; npa:forAgent ?hAgent ;\n gen:hasRole .\n ?hAcct a npa:AccountState ; npa:agent ?hAgent ; npa:pubkey ?hpk .\n }\n }\n }\n }\n }\n bind(contains(concat(\" \", ?approvedNps, \" \"), concat(\" \", str(?np), \" \")) as ?explicitApproved)\n bind(contains(concat(\" \", ?disapprovedNps, \" \"), concat(\" \", str(?np), \" \")) as ?explicitDisapproved)\n bind(contains(?helperPubkeys, ?pubkey) as ?isAutoApproved)\n filter(?explicitApproved || (?isAutoApproved && !?explicitDisapproved))\n optional { graph ?a { ?class rdfs:label ?label . filter(lang(?label) = \"\") } }\n optional { select ?class (min(str(?p)) as ?parent) where {\n values ?_ontology_multi_iri {}\n graph npa:graph { ?pnp npx:hasNanopubType owl:Class ; npx:introduces ?class ; np:hasAssertion ?pa . }\n graph ?pa { ?class dct:isPartOf|dct:partOf ?_ontology_multi_iri ; rdfs:subClassOf ?p .\n filter(?p != peh:BioChemEntity) }\n } group by ?class }\n bind(bound(?parent) as ?g)\n bind(exists { graph ?a { ?class peh:isMetaboliteOf|peh:isIsomerOf ?y } } as ?l)\n bind(exists { graph ?a { ?class obo:RO_0000087 ?ro } } as ?r)\n bind(concat(if(?g,\"1\",\"0\"), if(?l,\"1\",\"0\"), if(?r,\"1\",\"0\")) as ?region)\n optional { graph ?a { ?class obo:RO_0000087 ?roleIri . }\n bind(replace(replace(str(?roleIri), \"^.*[/#]\", \"\"), \"_\", \":\") as ?roleShort) }\n optional {\n select ?class (min(concat(str(?p), \" ~|~ \", coalesce(?pl, \"\"))) as ?parentCombo) where {\n values ?_ontology_multi_iri {}\n graph npa:graph { ?pnp npx:hasNanopubType owl:Class ; npx:introduces ?class ; np:hasAssertion ?pa .\n filter not exists { ?pgx npx:invalidates ?pnp } }\n graph ?pa { ?class dct:isPartOf|dct:partOf ?_ontology_multi_iri ; rdfs:subClassOf ?p .\n filter(?p != peh:BioChemEntity) }\n optional {\n graph npa:graph { ?plnp npx:hasNanopubType owl:Class ; npx:introduces ?p ; np:hasAssertion ?pla . }\n graph ?pla { ?p rdfs:label ?pl . filter(lang(?pl) = \"\") }\n }\n } group by ?class\n }\n bind(strafter(?parentCombo, \" ~|~ \") as ?parentLabel_)\n bind(concat(lcase(coalesce(?label, \"zzzz\")), \"~\", str(?class)) as ?sortkey_)\n} group by ?class ?label ?region ?parent }\n { select (?class as ?o2) (?region as ?oregion) (?sortkey as ?osortkey) where { select ?class ?region (min(?sortkey_) as ?sortkey) where {\n values ?_ontology_multi_iri {}\n service {\n select (group_concat(?mpk; separator=\" \") as ?memberPubkeys) where {\n graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . }\n values ?_ontology_multi_iri {}\n graph ?stateG {\n ?_ontology_multi_iri npa:isMaintainedBy? ?space .\n ?ri a gen:RoleInstantiation ; npa:forSpace ?space ; npa:forAgent ?agent ; npa:hasRoleType ?rt .\n filter(?rt in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole))\n ?acct a npa:AccountState ; npa:agent ?agent ; npa:pubkey ?mpk .\n }\n }\n }\n graph npa:graph {\n ?np npx:hasNanopubType owl:Class ; npa:hasValidSignatureForPublicKeyHash ?pubkey ;\n dct:created ?date ; npx:introduces ?class ; np:hasAssertion ?a .\n filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . }\n }\n filter(contains(?memberPubkeys, ?pubkey))\n graph ?a { ?class dct:isPartOf|dct:partOf ?_ontology_multi_iri . }\n filter not exists { graph ?a { ?class a gen:WithdrawnTerm } }\n filter not exists {\n graph npa:graph {\n ?np2 npx:hasNanopubType owl:Class ; npa:hasValidSignatureForPublicKeyHash ?pubkey2 ;\n dct:created ?date2 ; npx:introduces ?class ; np:hasAssertion ?a2 .\n filter not exists { ?np2x npx:invalidates ?np2 ; npa:hasValidSignatureForPublicKeyHash ?pubkey2 . }\n }\n filter(contains(?memberPubkeys, ?pubkey2))\n graph ?a2 { ?class dct:isPartOf|dct:partOf ?_ontology_multi_iri . }\n filter(?date2 > ?date || (?date2 = ?date && str(?np2) > str(?np)))\n }\n {\n select (group_concat(distinct ?apV; separator=\" \") as ?approvedNps)\n (group_concat(distinct ?disV; separator=\" \") as ?disapprovedNps) where {\n {\n select ?vTarget (max(concat(str(?vDate), \">\", str(?vNp), \">\", ?vMark)) as ?vWin) where {\n values ?_ontology_multi_iri {}\n service {\n select (group_concat(?vpk; separator=\" \") as ?vMemberPubkeys) where {\n graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?vStateG . }\n values ?_ontology_multi_iri {}\n graph ?vStateG {\n ?_ontology_multi_iri npa:isMaintainedBy? ?vSpace .\n ?vRi a gen:RoleInstantiation ; npa:forSpace ?vSpace ; npa:forAgent ?vMember ;\n npa:hasRoleType ?vRt .\n filter(?vRt in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole))\n ?vAcct a npa:AccountState ; npa:agent ?vMember ; npa:pubkey ?vpk .\n }\n }\n }\n service {\n select distinct ?vTarget ?vNp ?vDate ?vPubkey ?vMark where {\n graph npa:graph {\n ?vTarget npx:hasNanopubType owl:Class ; npx:signedBy ?targetAgent .\n ?vNp npx:signedBy ?vAgent ; npa:hasValidSignatureForPublicKeyHash ?vPubkey ;\n dct:created ?vDate ; np:hasAssertion ?vA .\n filter not exists { ?vInv npx:invalidates ?vNp ; npa:hasValidSignatureForPublicKeyHash ?vPubkey . }\n }\n graph ?vA { ?vAgent ?vPred ?vTarget . }\n values ?vPred { npx:approvesOf npx:disapprovesOf }\n filter(?vAgent != ?targetAgent)\n bind(if(?vPred = npx:approvesOf, \"a\", \"d\") as ?vMark)\n }\n }\n filter(contains(?vMemberPubkeys, ?vPubkey))\n } group by ?vTarget\n }\n bind(if(strends(?vWin, \"a\"), str(?vTarget), \"\") as ?apV)\n bind(if(strends(?vWin, \"d\"), str(?vTarget), \"\") as ?disV)\n }\n }\n {\n select (sample(?helperPubkeys_) as ?helperPubkeys) where {\n service {\n select (group_concat(?hpk; separator=\" \") as ?helperPubkeys_) where {\n graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?hStateG . }\n values ?_ontology_multi_iri {}\n graph ?hStateG {\n ?_ontology_multi_iri npa:isMaintainedBy? ?hSpace .\n ?hRi a gen:RoleInstantiation ; npa:forSpace ?hSpace ; npa:forAgent ?hAgent ;\n gen:hasRole .\n ?hAcct a npa:AccountState ; npa:agent ?hAgent ; npa:pubkey ?hpk .\n }\n }\n }\n }\n }\n bind(contains(concat(\" \", ?approvedNps, \" \"), concat(\" \", str(?np), \" \")) as ?explicitApproved)\n bind(contains(concat(\" \", ?disapprovedNps, \" \"), concat(\" \", str(?np), \" \")) as ?explicitDisapproved)\n bind(contains(?helperPubkeys, ?pubkey) as ?isAutoApproved)\n filter(?explicitApproved || (?isAutoApproved && !?explicitDisapproved))\n optional { graph ?a { ?class rdfs:label ?label . filter(lang(?label) = \"\") } }\n optional { select ?class (min(str(?p)) as ?parent) where {\n values ?_ontology_multi_iri {}\n graph npa:graph { ?pnp npx:hasNanopubType owl:Class ; npx:introduces ?class ; np:hasAssertion ?pa . }\n graph ?pa { ?class dct:isPartOf|dct:partOf ?_ontology_multi_iri ; rdfs:subClassOf ?p .\n filter(?p != peh:BioChemEntity) }\n } group by ?class }\n bind(bound(?parent) as ?g)\n bind(exists { graph ?a { ?class peh:isMetaboliteOf|peh:isIsomerOf ?y } } as ?l)\n bind(exists { graph ?a { ?class obo:RO_0000087 ?ro } } as ?r)\n bind(concat(if(?g,\"1\",\"0\"), if(?l,\"1\",\"0\"), if(?r,\"1\",\"0\")) as ?region)\n bind(concat(lcase(coalesce(?label, \"zzzz\")), \"~\", str(?class)) as ?sortkey_)\n} group by ?class ?region } }\n filter(?oregion = ?region && ?osortkey <= ?sortkey)\n } group by ?class ?label ?region ?parent ?roleIds ?parentLabel\n }\n { select (group_concat(concat(\"[\", ?parentKey, \">\", str(?grank), \"]\"); separator=\"\") as ?groupTable) where { select (str(?p) as ?parentKey) (min(?plabel) as ?glabel) (count(?o) - 1 as ?grank) where {\n { select ?p (count(distinct ?c) as ?psize) (min(?pl) as ?plabel) where {\n values ?_ontology_multi_iri {}\n graph npa:graph { ?gnp npx:hasNanopubType owl:Class ; npx:introduces ?c ; np:hasAssertion ?ga .\n filter not exists { ?gx npx:invalidates ?gnp } }\n graph ?ga { ?c dct:isPartOf|dct:partOf ?_ontology_multi_iri ; rdfs:subClassOf ?p .\n filter(?p != peh:BioChemEntity) }\n optional {\n graph npa:graph { ?lnp npx:hasNanopubType owl:Class ; npx:introduces ?p ; np:hasAssertion ?la . }\n graph ?la { ?p rdfs:label ?pl . filter(lang(?pl) = \"\") }\n }\n } group by ?p }\n { select (?p as ?o) (?psize as ?opsize) where {\n select ?p (count(distinct ?c) as ?psize) where {\n values ?_ontology_multi_iri {}\n graph npa:graph { ?gnp2 npx:hasNanopubType owl:Class ; npx:introduces ?c ; np:hasAssertion ?ga2 .\n filter not exists { ?gx2 npx:invalidates ?gnp2 } }\n graph ?ga2 { ?c dct:isPartOf|dct:partOf ?_ontology_multi_iri ; rdfs:subClassOf ?p .\n filter(?p != peh:BioChemEntity) }\n } group by ?p } }\n filter(?opsize > ?psize || (?opsize = ?psize && str(?o) <= str(?p)))\n } group by ?p } }\n bind(coalesce(strbefore(strafter(?groupTable, concat(\"[\", ?parent, \">\")), \"]\"), \"\") as ?grankStr)\n bind(coalesce(xsd:integer(?grankStr), 99) as ?grank_)\n bind(if(?grank_ = 99, 9, if(?grank_ < 8, ?grank_, 8)) as ?colorIdx)\n bind(if(?colorIdx = 9, \"#C9C9C9\", if(?colorIdx = 0, \"#3C6DB0\", if(?colorIdx = 1, \"#E07B39\", if(?colorIdx = 2, \"#3F9E5C\", if(?colorIdx = 3, \"#C0392B\", if(?colorIdx = 4, \"#7D6BB5\", if(?colorIdx = 5, \"#8A6A4F\", if(?colorIdx = 6, \"#D46FB8\", if(?colorIdx = 7, \"#B39200\", \"#8A8A8A\"))))))))) as ?fill)\n values (?rg ?x0 ?y0 ?cols) {\n (\"010\" 64 54 42) (\"011\" 382 54 6) (\"001\" 432 54 42)\n (\"110\" 158 120 30) (\"111\" 382 120 6) (\"101\" 432 120 30)\n (\"100\" 162 162 68) (\"000\" 26 262 106)\n }\n filter(?rg = ?region)\n bind(floor(?rank / ?cols) as ?row)\n bind(?x0 + (?rank - ?cols * ?row) * 7 as ?cx)\n bind(?y0 + ?row * 7 as ?cy)\n bind(concat(\n replace(replace(replace(coalesce(?label, \"(no label)\"), \"&\", \"&\"), \"<\", \"<\"), \">\", \">\"),\n if(coalesce(?parentLabel, \"\") = \"\", \"\", concat(\" | group: \", replace(replace(replace(?parentLabel, \"&\", \"&\"), \"<\", \"<\"), \">\", \">\"))),\n if(substr(?region, 2, 1) = \"1\", \" | metabolite/isomer link\", \"\"),\n if(?roleIds = \"\", \"\", concat(\" | role: \", replace(replace(replace(?roleIds, \"&\", \"&\"), \"<\", \"<\"), \">\", \">\")))\n ) as ?tip)\n bind(concat('',\n ?tip, '') as ?dot)\n } group by ?region ?x0 ?y0 ?cols\n }\n bind(concat(?dots,\n 'n = ', str(?rcount), '') as ?block)\n }\n }\n {\n select (group_concat(?leg; separator=\"\") as ?legend) where {\n { select (str(?p) as ?parentKey) (min(?plabel) as ?glabel) (count(?o) - 1 as ?grank) where {\n { select ?p (count(distinct ?c) as ?psize) (min(?pl) as ?plabel) where {\n values ?_ontology_multi_iri {}\n graph npa:graph { ?gnp npx:hasNanopubType owl:Class ; npx:introduces ?c ; np:hasAssertion ?ga .\n filter not exists { ?gx npx:invalidates ?gnp } }\n graph ?ga { ?c dct:isPartOf|dct:partOf ?_ontology_multi_iri ; rdfs:subClassOf ?p .\n filter(?p != peh:BioChemEntity) }\n optional {\n graph npa:graph { ?lnp npx:hasNanopubType owl:Class ; npx:introduces ?p ; np:hasAssertion ?la . }\n graph ?la { ?p rdfs:label ?pl . filter(lang(?pl) = \"\") }\n }\n } group by ?p }\n { select (?p as ?o) (?psize as ?opsize) where {\n select ?p (count(distinct ?c) as ?psize) where {\n values ?_ontology_multi_iri {}\n graph npa:graph { ?gnp2 npx:hasNanopubType owl:Class ; npx:introduces ?c ; np:hasAssertion ?ga2 .\n filter not exists { ?gx2 npx:invalidates ?gnp2 } }\n graph ?ga2 { ?c dct:isPartOf|dct:partOf ?_ontology_multi_iri ; rdfs:subClassOf ?p .\n filter(?p != peh:BioChemEntity) }\n } group by ?p } }\n filter(?opsize > ?psize || (?opsize = ?psize && str(?o) <= str(?p)))\n } group by ?p }\n filter(?grank < 8)\n bind(20 + (?grank - 3 * floor(?grank / 3)) * 258 as ?lx)\n bind(378 + floor(?grank / 3) * 17 as ?ly)\n bind(if(?grank = 9, \"#C9C9C9\", if(?grank = 0, \"#3C6DB0\", if(?grank = 1, \"#E07B39\", if(?grank = 2, \"#3F9E5C\", if(?grank = 3, \"#C0392B\", if(?grank = 4, \"#7D6BB5\", if(?grank = 5, \"#8A6A4F\", if(?grank = 6, \"#D46FB8\", if(?grank = 7, \"#B39200\", \"#8A8A8A\"))))))))) as ?lfill)\n bind(concat('',\n '', replace(replace(replace(coalesce(?glabel, \"(unnamed group)\"), \"&\", \"&\"), \"<\", \"<\"), \">\", \">\"), '') as ?leg)\n }\n }\n bind(concat(\n '',\n 'Each dot is one class of the vocabulary, placed by which of the three sets it belongs to ',\n 'and coloured by its chemical group.',\n '',\n '',\n '',\n '',\n '',\n 'has metabolite / isomer link (', str(?nLink), ')',\n 'has a chemical role (', str(?nRole), ')',\n 'in a chemical group (', str(?nGroup), ')',\n 'all classes in this vocabulary (', str(?total), ')',\n ?body,\n 'chemical groups (largest first)',\n ?legend,\n '',\n 'another group',\n '',\n 'no chemical group',\n '') as ?svg)\n}" } ] } ] } ]