@prefix this: . @prefix sub: . @prefix np: . @prefix grlc: . @prefix dct: . @prefix nt: . @prefix npx: . @prefix xsd: . @prefix rdfs: . @prefix prov: . sub:Head { this: a np:Nanopublication; np:hasAssertion sub:assertion; np:hasProvenance sub:provenance; np:hasPublicationInfo sub:pubinfo . } sub:assertion { sub:get-docs-topics a grlc:grlc-query; dct:description "The topics of a documentation collection in reading order, each with its description and the number of its paragraphs. A topic's newest member-signed declaration counts; a newer removal (gen:DeactivatedDocumentationTopic) hides it. Paragraph counts include only current, member-signed paragraphs, so moved and removed ones are not counted."; dct:license ; rdfs:label "Get the table of contents of a documentation collection"; grlc:endpoint ; grlc:sparql """prefix rdf: prefix rdfs: prefix dct: prefix np: prefix npa: prefix npx: prefix gen: prefix schema: prefix schemas: # The table of contents of a documentation collection: each topic's newest declaration by a # member of the maintaining space, in reading order (position, then label), with its description # and the number of paragraphs it has. Shaped for a paragraph view: ?paragraph is the topic's own # IRI (so the heading links to the topic page), ?title its label, ?content the description and # paragraph count. select ?paragraph ?title ?content (str(?np) as ?override_target) ?np (\"^\" as ?np_label) where { { select ?topic ?np ?date (min(?l) as ?title) (min(?pos) as ?position) (min(?d) as ?description) where { service { select (group_concat(?mpk; separator=\" \") as ?memberPubkeys) where { graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . } values ?_resource_multi_iri {} graph ?stateG { ?_resource_multi_iri npa:isMaintainedBy? ?space . ?ri a gen:RoleInstantiation ; npa:forSpace ?space ; npa:forAgent ?agent ; npa:hasRoleType ?roleType . ?acct a npa:AccountState ; npa:agent ?agent ; npa:pubkey ?mpk . } filter(?roleType in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole)) } } values ?_resource_multi_iri {} graph npa:graph { ?np npa:hasValidSignatureForPublicKeyHash ?k ; dct:created ?date ; np:hasAssertion ?a . filter not exists { ?x npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?k . } } filter(contains(?memberPubkeys, ?k)) graph ?a { ?topic gen:isRelevantFor ?_resource_multi_iri ; rdfs:label ?l . optional { ?topic gen:hasPositionString ?pos . } optional { ?topic dct:description ?d . } } filter not exists { graph npa:graph { ?np2 npa:hasValidSignatureForPublicKeyHash ?k2 ; dct:created ?date2 ; np:hasAssertion ?a2 . filter not exists { ?y npx:invalidates ?np2 ; npa:hasValidSignatureForPublicKeyHash ?k2 . } } # a newer declaration, or a newer removal (gen:DeactivatedDocumentationTopic), replaces this one graph ?a2 { { ?topic gen:isRelevantFor ?_resource_multi_iri . } union { ?topic rdf:type gen:DeactivatedDocumentationTopic . } } filter(?date2 > ?date) filter(contains(?memberPubkeys, ?k2)) } } group by ?topic ?np ?date } # number of paragraphs about the topic: member-signed, newest version of each paragraph only, # so moved and removed paragraphs are not counted { select ?topic (count(distinct ?p) as ?n) where { service { select (group_concat(?mpk2; separator=\" \") as ?memberPubkeys2) where { graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG2 . } values ?_resource_multi_iri {} graph ?stateG2 { ?_resource_multi_iri npa:isMaintainedBy? ?space2 . ?ri2 a gen:RoleInstantiation ; npa:forSpace ?space2 ; npa:forAgent ?agent2 ; npa:hasRoleType ?roleType2 . ?acct2 a npa:AccountState ; npa:agent ?agent2 ; npa:pubkey ?mpk2 . } filter(?roleType2 in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole)) } } values ?_resource_multi_iri {} graph ?tg { ?topic gen:isRelevantFor ?_resource_multi_iri . } graph npa:graph { ?pnp npa:hasValidSignatureForPublicKeyHash ?pk ; dct:created ?pdate ; np:hasAssertion ?pa . filter not exists { ?z npx:invalidates ?pnp ; npa:hasValidSignatureForPublicKeyHash ?pk . } } filter(contains(?memberPubkeys2, ?pk)) graph ?pa { ?p rdf:type gen:Paragraph ; schema:about|schemas:about ?topic . } filter not exists { graph npa:graph { ?pnp2 npa:hasValidSignatureForPublicKeyHash ?pk2 ; dct:created ?pdate2 ; np:hasAssertion ?pa2 . filter not exists { ?w npx:invalidates ?pnp2 ; npa:hasValidSignatureForPublicKeyHash ?pk2 . } } graph ?pa2 { ?p rdf:type ?ptype2 . } values ?ptype2 { gen:Paragraph gen:DeactivatedParagraph } filter(?pdate2 > ?pdate) filter(contains(?memberPubkeys2, ?pk2)) } } group by ?topic } bind(?topic as ?paragraph) bind(concat(\"

\", coalesce(?description, \"\"), \"

\", str(?n), \" paragraph\", if(?n = 1, \"\", \"s\"), \"

\") as ?content) } order by ?position ?title""" . } sub:provenance { sub:assertion prov:wasAttributedTo . } sub:pubinfo { this: dct:created "2026-09-16T15:13:48Z"^^xsd:dateTime; dct:creator ; dct:license ; npx:embeds sub:get-docs-topics; npx:supersedes ; nt:wasCreatedFromProvenanceTemplate ; nt:wasCreatedFromPubinfoTemplate , ; nt:wasCreatedFromTemplate . sub:sig npx:hasAlgorithm "RSA"; npx:hasPublicKey "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl8cMusqtNyKA6UIsi3f7BAcZmHQXWxU0qk0PLsboMWQxYrGBfGgHTgRHJrBRxL+Zn9kJHKVmz2smDcjCBptXi/OwWy80gjsx+Pbe6IWz3zFPWF1UoFIKfPnC0slV67CQgdM853zW7Bmk9/uflCtK4EtZKmPdRGtUHVC7DTVvDBMDzLRGdE2KCBVN29EbM5GGVNvijYbaZQ9OFQPBkQshayqSIyGRr6rreJdkrRVLIzu3uuAjKYydaeXZWSN2JLnVBwrClKUxaEdCwhb5nXpMtKOMD+R+LgaXLeJUWM8BdRSYnta9ZqI5pHY4y3v+eW7J+HHeTvRbHvlik+Z4hFUXmQIDAQAB"; npx:hasSignature "IgKwrbHi1oSzEwbCkjvCNkPhGG5XLD7MAYQyPe7QJogiVQDbtgpp/AdWVNOzIzA9IX2aDjIjI2COC8Ofb4F8YRmG9RInUVGZ4JvAPLD3wkGuIhrcmpb+5oU6trVyf8nGtt8qMN9btBIYA8D0MfXfU3znsuvOHDQq/rehc5PuusF8sXLRdNv6cFvgmcpNTfl9g+1dpZ2sC7Wo74fOF2mgH+zsQxOgeTnhx6Moc8KBexFdLgghqUnxefFiaNomlTt6a3muSxXtS/GO1R4M4xbSuemAhEAJRgjpzeLJNTu61ibdsVZ1DTmLEZ7JmivsJtaT1HFUqAiYWLgTaHsbcOg0ow=="; npx:hasSignatureTarget this:; npx:signedBy . }