@prefix this: . @prefix sub: . @prefix np: . @prefix grlc: . @prefix dct: . @prefix nt: . @prefix npx: . @prefix xsd: . @prefix rdfs: . @prefix orcid: . @prefix prov: . @prefix foaf: . sub:Head { this: a np:Nanopublication; np:hasAssertion sub:assertion; np:hasProvenance sub:provenance; np:hasPublicationInfo sub:pubinfo . } sub:assertion { sub:get-nanosuggestions-for-assignee a grlc:grlc-query; dct:description "Returns the nanosuggestions currently assigned to a given agent, for that agent's user page: title, kind, current status, the spaces the nanosuggestion is relevant for, who assigned it and when. Only the most recent assignment of each nanosuggestion counts, so a reassignment moves the entry to the new assignee instead of leaving it with both. Unlike the space-page listing, this query is not gated on space membership: a user page has no space to resolve membership against, so every assignment naming the agent is shown."; dct:license ; rdfs:label "Get the nanosuggestions assigned to an agent"; grlc:endpoint ; grlc:sparql """ prefix rdf: prefix rdfs: prefix dct: prefix foaf: prefix np: prefix npa: prefix npx: prefix schema: prefix gen: prefix nsug: select distinct ?item_multi_iri ?item_label_multi ?kind ?status ?spaces_multi_iri ?spaces_label_multi ?assigned_by ?assigned_by_label ?date ?suggestion ?np ?status_active ?status_done ?status_rejected where { # the most recent assignment nanopub for each nanosuggestion { select ?suggestion (max(concat(?ad, ' ', str(?anp))) as ?apick) where { graph npa:graph { ?anp npa:hasValidSignatureForPublicKeyHash ?apk ; np:hasAssertion ?aa ; dct:created ?adate . filter not exists { ?anpi npx:invalidates ?anp ; npa:hasValidSignatureForPublicKeyHash ?apk . } } graph ?aa { ?suggestion schema:agent ?ag . } bind(str(?adate) as ?ad) } group by ?suggestion } bind(iri(strafter(?apick, ' ')) as ?assignNp) # ...and it must name this agent, so a later reassignment removes the entry graph npa:graph { ?assignNp np:hasAssertion ?assignA ; dct:created ?date . optional { ?assignNp dct:creator ?assigned_by } } graph ?assignA { ?suggestion schema:agent ?_resource_multi_iri . } # the declaring nanopub carries the title and kind graph npa:graph { ?np npa:hasValidSignatureForPublicKeyHash ?pubkey ; np:hasAssertion ?a . filter not exists { ?npi npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . } } graph ?a { ?suggestion a nsug:Nanosuggestion ; rdfs:label ?title . optional { ?suggestion a ?k . filter(?k != nsug:Nanosuggestion && ?k != schema:Statement) } } # current status: no space to anchor to on a user page, so the most recent one overall optional { { select ?suggestion (max(concat(?sd, ' ', str(?s))) as ?pick) where { graph npa:graph { ?snp npa:hasValidSignatureForPublicKeyHash ?spk ; np:hasAssertion ?sa ; dct:created ?sdate . filter not exists { ?snpi npx:invalidates ?snp ; npa:hasValidSignatureForPublicKeyHash ?spk . } } graph ?sa { ?suggestion schema:actionStatus ?s . } bind(str(?sdate) as ?sd) } group by ?suggestion } } bind(coalesce(iri(strafter(?pick, ' ')), schema:PotentialActionStatus) as ?st) bind(if(?st = schema:CompletedActionStatus, 'done', if(?st = schema:FailedActionStatus, 'rejected', if(?st = schema:ActiveActionStatus, 'in progress', 'open'))) as ?status) # which spaces the nanosuggestion is relevant for optional { { select ?suggestion (group_concat(distinct str(?sp); separator=' ') as ?spaces_multi_iri) (group_concat(distinct ?splabel; separator=' ') as ?spaces_label_multi) where { graph npa:graph { ?lnp npa:hasValidSignatureForPublicKeyHash ?lpk ; np:hasAssertion ?la . filter not exists { ?lnpi npx:invalidates ?lnp ; npa:hasValidSignatureForPublicKeyHash ?lpk . } } graph ?la { ?suggestion gen:isRelevantFor ?sp . } optional { ?sp rdfs:label ?spl . filter(lang(?spl) = '') } bind(coalesce(?spl, replace(str(?sp), '^.*/', '')) as ?splabel) } group by ?suggestion } } optional { ?assigned_by foaf:name ?assigned_by_label } bind(?suggestion as ?item_multi_iri) bind(?title as ?item_label_multi) bind(coalesce(lcase(strafter(str(?k), 'RA5BAdUvlxLWMWFQN3UVKoIQEB_MYTiAoLH1klXJ7z-XI/')), '') as ?kind) bind(schema:ActiveActionStatus as ?status_active) bind(schema:CompletedActionStatus as ?status_done) bind(schema:FailedActionStatus as ?status_rejected) bind(if(?st in (schema:CompletedActionStatus, schema:FailedActionStatus), '2', '1') as ?openRank) } order by ?openRank desc(?date) """ . } 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-26T14:55:57Z"^^xsd:dateTime; dct:creator orcid:0000-0002-1267-0234; dct:license ; npx:embeds sub:get-nanosuggestions-for-assignee; rdfs:label "Get the nanosuggestions assigned to an agent"; nt:wasCreatedFromProvenanceTemplate ; nt:wasCreatedFromPubinfoTemplate , ; nt:wasCreatedFromTemplate . sub:sig npx:hasAlgorithm "RSA"; npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB"; npx:hasSignature "hGapuoajrUu7wPtqIQPVxtbzEE5woGkbzS7odtBh5KFq6rVdzD6mpqIFfkY3mWki3hrjxkyZpyfYp0sY++B9A3Qay6wFTN7zNswaBpxREva0bZeq8rb80w1UZN0A1JTjd0wtgYefp6Dc11hNFjY0ffp1DlJZqqLv+3xW199LrLY="; npx:hasSignatureTarget this:; npx:signedBy orcid:0000-0002-1267-0234 . }