@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-paragraph-related a grlc:grlc-query; dct:description "Paragraphs linked to one documentation paragraph with rdfs:seeAlso in either direction by a member of the maintaining space, with each related paragraph's current title and the topic it belongs to. Related paragraphs whose newest version marks them as removed are left out."; dct:license ; rdfs:label "Get the paragraphs related to a documentation paragraph"; grlc:endpoint ; grlc:sparql """prefix rdf: prefix rdfs: prefix dct: prefix np: prefix npa: prefix npx: prefix schema: prefix schemas: prefix gen: # Paragraphs related to ONE documentation paragraph, in either direction of rdfs:seeAlso, # where the link was published by a member of the maintaining space. ?related is the related # paragraph with its current title as label, ?chapter the chapter it belongs to with the title # declared for this documentation, ?np the linking nanopublication (also the edit target). select ?related ?related_label ?chapter ?chapter_label ?date (str(?np) as ?override_target) ?np (\"^\" as ?np_label) where { { select ?paragraph ?np ?date (min(?t) as ?title) (min(?topicLabel) as ?chapterLabel) (min(str(?topic)) as ?chapterStr) where { service { select (group_concat(?mpk; separator=\" \") as ?memberPubkeys) where { graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . } values ?__context_multi_iri {} graph ?stateG { ?__context_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 ?la . filter not exists { ?x npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?k . } } filter(contains(?memberPubkeys, ?k)) graph ?la { { ?_resource_multi_iri rdfs:seeAlso ?paragraph . } union { ?paragraph rdfs:seeAlso ?_resource_multi_iri . } } filter(?paragraph != ?_resource_multi_iri) # the related paragraph's current (newest member-signed) title and chapter; a paragraph whose # newest version is a removal (gen:DeactivatedParagraph) has no current title and is left out graph npa:graph { ?pnp npa:hasValidSignatureForPublicKeyHash ?pk ; dct:created ?pdate ; np:hasAssertion ?pa . filter not exists { ?y npx:invalidates ?pnp ; npa:hasValidSignatureForPublicKeyHash ?pk . } } filter(contains(?memberPubkeys, ?pk)) graph ?pa { ?paragraph rdf:type gen:Paragraph ; schema:title|schemas:title ?t ; schema:about|schemas:about|schema:isPartOf|schemas:isPartOf ?topic . } filter not exists { graph npa:graph { ?pnp2 npa:hasValidSignatureForPublicKeyHash ?pk2 ; dct:created ?pdate2 ; np:hasAssertion ?pa2 . filter not exists { ?z npx:invalidates ?pnp2 ; npa:hasValidSignatureForPublicKeyHash ?pk2 . } } graph ?pa2 { ?paragraph rdf:type ?ptype2 . } values ?ptype2 { gen:Paragraph gen:DeactivatedParagraph } filter(?pdate2 > ?pdate) filter(contains(?memberPubkeys, ?pk2)) } # the chapter's title as declared for THIS documentation, not any label the anchor IRI has elsewhere values ?__context_multi_iri {} optional { graph ?tg { ?topic rdfs:label ?topicLabel ; gen:isRelevantFor ?__context_multi_iri . } } } group by ?paragraph ?np ?date } bind(?paragraph as ?related) bind(?title as ?related_label) bind(iri(?chapterStr) as ?chapter) bind(coalesce(?chapterLabel, ?chapterStr) as ?chapter_label) } order by ?related_label""" . } 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-paragraph-related; 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 "lpGvLeNT8qXH3A7BG8aPkTjAj7ID7QTjNgKYPWyfXXc6oStlgYtabt7h/p1u0MqXk147UYiX2Ije9ztGN7QC21FTc7WMhaD7AV6weSiJOgUDLZguMe7kme7I99s7DzDGyAkzO5pXfEc+6w2dZg8VwjO/vVHOolbXeVhO0azGCrOI6Gr6tK/d6fQ4dRGNr3hgEZ1YxesQEPMcTZAgBheWTRaB9gAHh4TcU3h3LWQjpaPkfcFC2zyBI8NPPC7KACEMZtWj7z5DLV4ahOPCzPwqoUGSuWN2JMM1VGgU6mwJf/lDqMvL4trGODeRkyhO9g+uDxc3e+re1tPVe630hnCASg=="; npx:hasSignatureTarget this:; npx:signedBy . }