https://w3id.org/np/RAF1X7AZlesaHCSnLcMoA6UgQRj9Sxa-Fu_L64rGPHDKg
.trig | .trig.txt | .jelly | .jelly.txt | .jsonld | .jsonld.txt | .nq | .nq.txt | .xml | .xml.txt
@prefix this: <https://w3id.org/np/RAF1X7AZlesaHCSnLcMoA6UgQRj9Sxa-Fu_L64rGPHDKg> .
@prefix sub: <https://w3id.org/np/RAF1X7AZlesaHCSnLcMoA6UgQRj9Sxa-Fu_L64rGPHDKg/> .
@prefix np: <http://www.nanopub.org/nschema#> .
@prefix grlc: <https://w3id.org/kpxl/grlc/> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix nt: <https://w3id.org/np/o/ntemplate/> .
@prefix npx: <http://purl.org/nanopub/x/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix orcid: <https://orcid.org/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
sub:Head {
this: a np:Nanopublication;
np:hasAssertion sub:assertion;
np:hasProvenance sub:provenance;
np:hasPublicationInfo sub:pubinfo .
}
sub:assertion {
sub:get-replies a grlc:grlc-query;
dct:description "This query returns the whole reply thread below a given discourse contribution, following the Nanoarguments model: not only the contributions that reply directly to it, but also the replies to those replies, and so on to any depth. Replies are found through as:inReplyTo chains, which are followed across nanopublications; a reply that targets a whole nanopublication instead of the contribution node inside it is followed as well, so threads that mix both conventions stay connected. Each row gives the nesting level (1 for a direct reply), the text of the reply, the CiTO stance it takes toward its target where it declares one, the contribution it replies to, and its author and date. Rows are ordered so that each direct reply is followed by its own sub-thread, oldest first, and the text is prefixed with an arrow marker per nesting level. Retracted and superseded nanopublications are excluded; example nanopublications are kept, since they are part of the thread they were published into.";
dct:license <http://www.apache.org/licenses/LICENSE-2.0>;
rdfs:label "Get replies to a discourse contribution";
grlc:endpoint <https://w3id.org/np/l/nanopub-query-1.1/repo/full>;
grlc:sparql """prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
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 prov: <http://www.w3.org/ns/prov#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix as: <https://www.w3.org/ns/activitystreams#>
select ?level ?reply ?reply_label ?stance ?in_reply_to ?in_reply_to_label ?by ?by_label ?date ?reply_target ?np ?np_label
where {
{
select ?st ?np ?created ?by ?parentnode
(coalesce(min(?value), min(?stlabel), str(?st)) as ?text)
(min(?stancelabel) as ?stance)
(coalesce(min(?parentvalue), min(?parentlabel), str(?parentnode)) as ?parenttext)
(coalesce(min(?byname), str(?by)) as ?byfull)
where {
{ values ?_resource_multi_iri {}
?st (as:inReplyTo|np:hasAssertion)+ ?_resource_multi_iri }
union
{ values ?_resource_multi_iri {}
graph npa:graph { ?rootnp npx:introduces ?_resource_multi_iri }
?st (as:inReplyTo|np:hasAssertion)+ ?rootnp }
graph npa:graph {
?np np:hasAssertion ?a ; np:hasProvenance ?prov ; np:hasPublicationInfo ?pi ;
npa:hasValidSignatureForPublicKeyHash ?pubkey ; dct:created ?created .
filter not exists {
?npi npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey .
}
}
graph ?a { ?st as:inReplyTo ?parent }
optional { graph ?a { ?st rdf:value ?value } }
optional { graph ?a { ?st rdfs:label ?stlabel } }
optional {
graph ?a { ?st ?stancep ?parent }
filter(strstarts(str(?stancep), \"http://purl.org/spar/cito/\"))
bind(lcase(replace(strafter(str(?stancep), \"http://purl.org/spar/cito/\"), \"([a-z])([A-Z])\", \"$1 $2\")) as ?stancelabel)
}
optional { graph ?prov { ?a prov:wasAttributedTo ?by } }
optional { graph ?pi { ?by foaf:name ?byname } }
optional { graph npa:graph { ?parent np:hasAssertion ?parentassertion } }
bind(coalesce(?parentassertion, ?parent) as ?parentnode)
optional {
graph npa:graph {
?parentnp np:hasAssertion ?parentg ; npa:hasValidSignatureForPublicKeyHash ?parentkey .
filter not exists {
?parentnpi npx:invalidates ?parentnp ; npa:hasValidSignatureForPublicKeyHash ?parentkey .
}
}
graph ?parentg { ?parentnode rdf:value ?parentvalue }
}
optional {
graph npa:graph {
?parentnp2 np:hasAssertion ?parentg2 ; npa:hasValidSignatureForPublicKeyHash ?parentkey2 .
filter not exists {
?parentnpi2 npx:invalidates ?parentnp2 ; npa:hasValidSignatureForPublicKeyHash ?parentkey2 .
}
}
graph ?parentg2 { ?parentnode rdfs:label ?parentlabel }
}
}
group by ?st ?np ?created ?by ?parentnode
}
{
select (str(?lst) as ?lkey) (count(distinct ?lanc) as ?level) (min(?lancdate) as ?sortkey) where {
{ values ?_resource_multi_iri {}
?lanc (as:inReplyTo|np:hasAssertion)+ ?_resource_multi_iri }
union
{ values ?_resource_multi_iri {}
graph npa:graph { ?lrootnp npx:introduces ?_resource_multi_iri }
?lanc (as:inReplyTo|np:hasAssertion)+ ?lrootnp }
?lst (as:inReplyTo|np:hasAssertion)* ?lanc .
graph npa:graph { ?lancnp np:hasAssertion ?lancg ; dct:created ?lancdate }
graph ?lancg { ?lanc as:inReplyTo ?lancparent }
}
group by ?lst
}
filter(str(?st) = ?lkey)
bind(?st as ?reply)
bind(concat(if(?level = 1, \"\", if(?level = 2, \"↳ \", if(?level = 3, \"↳↳ \", if(?level = 4, \"↳↳↳ \", \"↳↳↳↳ \")))), ?text) as ?reply_label)
bind(?parentnode as ?in_reply_to)
bind(if(strlen(?parenttext) > 70, concat(substr(?parenttext, 1, 70), \"…\"), ?parenttext) as ?in_reply_to_label)
bind(?byfull as ?by_label)
bind(substr(str(?created), 1, 10) as ?date)
bind(str(?st) as ?reply_target)
bind(\"^\" as ?np_label)
}
order by ?sortkey ?date ?reply_label""" .
}
sub:provenance {
sub:assertion prov:wasAttributedTo orcid:0000-0002-1267-0234 .
}
sub:pubinfo {
orcid:0000-0002-1267-0234 foaf:name "Tobias Kuhn" .
this: dct:created "2026-08-28T09:48:03Z"^^xsd:dateTime;
dct:creator orcid:0000-0002-1267-0234;
dct:license <https://creativecommons.org/licenses/by/4.0/>;
npx:embeds sub:get-replies;
rdfs:label "Get replies to a discourse contribution";
nt:wasCreatedFromProvenanceTemplate <https://w3id.org/np/RA7lSq6MuK_TIC6JMSHvLtee3lpLoZDOqLJCLXevnrPoU>;
nt:wasCreatedFromPubinfoTemplate <https://w3id.org/np/RACJ58Gvyn91LqCKIO9zu1eijDQIeEff28iyDrJgjSJF8>,
<https://w3id.org/np/RAoTD7udB2KtUuOuAe74tJi1t3VzK0DyWS7rYVAq1GRvw>, <https://w3id.org/np/RAukAcWHRDlkqxk7H2XNSegc1WnHI569INvNr-xdptDGI>;
nt:wasCreatedFromTemplate <https://w3id.org/np/RAEFAt-QcFK0ZhqfvlsmS10BnzGJA0xwOICZXkO-ai87k> .
sub:sig npx:hasAlgorithm "RSA";
npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB";
npx:hasSignature "HB3nR2eXKchH2T3giig0BovLkual/U+tKQwHxrFDAspDz2Zt2ougjeRiq8dkWTKIE76DMNFlylCn7GDdqmNcQQDZy6Q7UKQ7pxSV9/0tjDPf87QkshUZSkuSLeB7d4OFeSZJeABjxa2ycwBpmiYZ/OFkdo8O3/s+uHRMv12otF4=";
npx:hasSignatureTarget this:;
npx:signedBy orcid:0000-0002-1267-0234 .
}