Returns the whole comment thread of a nanosuggestion: every Nanoarguments content node that replies to it via as:inReplyTo at any depth, with its text, author and date, oldest first. Replies to replies show what they are replying to.
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 foaf: <http://xmlns.com/foaf/0.1/> prefix np: <http://www.nanopub.org/nschema#> prefix npa: <http://purl.org/nanopub/admin/> prefix npx: <http://purl.org/nanopub/x/> prefix schema: <https://schema.org/> prefix as: <https://www.w3.org/ns/activitystreams#> select distinct ?comment ?by ?by_label ?date ?in_reply_to ?reply_target ?np where { # The thread: everything replying to this nanosuggestion, at any depth. Kept in a # sub-select so the optimizer cannot start from the unconstrained "?c a schema:Statement" # pattern, which scans every statement on the network (RDF4J: "Queue full"). # distinct here and in the outer select: the repo holds each nanopub's triples in # several graph contexts, so the path join multiplies rows without it. { select distinct ?c ?parent ?root where { ?c as:inReplyTo+ ?_suggestion_iri . ?c as:inReplyTo ?parent . bind(?_suggestion_iri as ?root) } } graph npa:graph { ?np npa:hasValidSignatureForPublicKeyHash ?pubkey ; np:hasAssertion ?a ; dct:created ?date . filter not exists { ?npi npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . } optional { ?np dct:creator ?by } } graph ?a { ?c a schema:Statement ; rdf:value ?comment . } bind(?c as ?reply_target) optional { ?by foaf:name ?by_label } optional { ?parent rdf:value ?pv } bind(if(?parent = ?root, '', coalesce(substr(str(?pv), 1, 60), str(?parent))) as ?in_reply_to) } order by ?date