@prefix this: . @prefix sub: . @prefix np: . @prefix grlc: . @prefix dct: . @prefix nt: . @prefix npx: . @prefix xsd: . @prefix rdfs: . @prefix orcid: . @prefix prov: . sub:Head { this: a np:Nanopublication; np:hasAssertion sub:assertion; np:hasProvenance sub:provenance; np:hasPublicationInfo sub:pubinfo . } sub:assertion { sub:get-questions a grlc:grlc-query; dct:description "This query returns the questions asked about a resource (a space, a maintained resource, or any other entity, including part-level resources), together with who asked them and when, and their answers and other follow-up contributions. Questions are schema:Question nodes anchored to the resource via schema:about, following the Nanoarguments discourse model; answers are discourse contributions (schema:Statement) targeting the question via as:inReplyTo. Answers published by an admin, maintainer, or member of the space that maintains the resource are marked with a check mark; the maintaining space and its validated member public-key hashes are resolved server-side from the spaces repo (/repo/spaces). Retracted nanopublications and example nanopublications are excluded."; dct:license ; rdfs:label "Get questions and answers about a resource"; grlc:endpoint ; grlc:sparql """prefix rdf: prefix dct: prefix np: prefix npa: prefix npx: prefix prov: prefix foaf: prefix schema: prefix as: prefix gen: select ?question ?question_label ?asked_by (min(?asked_byName) as ?asked_by_label) ?date (group_concat(distinct ?ans; separator=\" \") as ?answers_multi_iri) (group_concat(?ansLabel; separator=\"\\n\") as ?answers_label_multi) (str(?question) as ?reply_target) ?np ?np_label where { graph npa:graph { ?np npa:hasValidSignatureForPublicKeyHash ?pubkey . filter not exists { ?npi npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . } ?np np:hasAssertion ?qa ; np:hasProvenance ?qprov ; np:hasPublicationInfo ?qpi ; dct:created ?date . } graph ?qa { ?question a schema:Question ; rdf:value ?question_label . values ?_resource_multi_iri {} ?question schema:about ?_resource_multi_iri . } filter not exists { graph ?qpi { ?np npx:hasNanopubType npx:ExampleNanopub } } optional { graph ?qprov { ?qa prov:wasAttributedTo ?asked_by } } optional { graph ?qpi { ?asked_by foaf:name ?asked_byName } } optional { select ?question ?ans (min(?lbl) as ?ansLabel) 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 ?magent ; npa:hasRoleType ?rt . filter(?rt in (gen:AdminRole, gen:MaintainerRole, gen:MemberRole)) ?acct a npa:AccountState ; npa:agent ?magent ; npa:pubkey ?mpk . } } } graph ?qa2 { ?question a schema:Question . values ?_resource_multi_iri {} ?question schema:about ?_resource_multi_iri . } graph npa:graph { ?anp npa:hasValidSignatureForPublicKeyHash ?apubkey . filter not exists { ?anpi npx:invalidates ?anp ; npa:hasValidSignatureForPublicKeyHash ?apubkey . } ?anp np:hasAssertion ?aa ; np:hasProvenance ?aprov ; np:hasPublicationInfo ?api ; dct:created ?adate . } graph ?aa { ?ans as:inReplyTo ?question ; rdf:value ?ansText . } filter not exists { graph ?api { ?anp npx:hasNanopubType npx:ExampleNanopub } } optional { graph ?aprov { ?aa prov:wasAttributedTo ?answerer } } optional { graph ?api { ?answerer foaf:name ?aname } } bind(concat( if(contains(?memberPubkeys, ?apubkey), \"✓ \", \"\"), replace(replace(str(?ansText), \"\\\\\\\\\", \"\\\\\\\\\\\\\\\\\"), \"[\\r\\n]+\", \"\\\\\\\\n\"), \" — \", coalesce(?aname, str(?answerer), \"unknown\"), \", \", substr(str(?adate), 1, 10) ) as ?lbl) } group by ?question ?ans } bind(\"^\" as ?np_label) } group by ?question ?question_label ?asked_by ?date ?np ?np_label order by desc(?date)""" . } sub:provenance { sub:assertion prov:wasAttributedTo orcid:0000-0002-1267-0234 . } sub:pubinfo { this: dct:created "2026-08-14T14:21:59Z"^^xsd:dateTime; dct:creator orcid:0000-0002-1267-0234; dct:license ; npx:embeds sub:get-questions; rdfs:label "Get questions and answers about a resource"; nt:wasCreatedFromProvenanceTemplate ; nt:wasCreatedFromPubinfoTemplate , , ; nt:wasCreatedFromTemplate . sub:sig npx:hasAlgorithm "RSA"; npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB"; npx:hasSignature "Odm995rvyr/jhrEPKPavrLcyPfE3R8MteYkhpUhoaRW8tUxfbpTETYVueYYjpyevRcptzbyuRDTpTTj4KszQXQIHqIoGNMl7podQ2fIsY3ulj3DmdER1uhuPvsXjFttEASPKbQU2IinPicWwI0bOb/PVRSLI9g/1PtnBM+bbqkA="; npx:hasSignatureTarget this:; npx:signedBy orcid:0000-0002-1267-0234 . }