@prefix this: . @prefix sub: . @prefix np: . @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:list-preset-assignments a ; dct:description "Lists the currently active presets assigned to a resource, for the About page, filtered to assignments signed by an admin or maintainer of the owning space, or by the affected user themselves. An assignment is identified by the assigned preset's stable KIND (dct:isVersionOf) and the resource, mirroring view displays, which the client dedups by view kind (nanodash issue #607): among the assignments of one preset kind for one resource only the latest by dct:created counts, so assigning another version of the same preset replaces the earlier assignment instead of adding a second, competing row; a version declaring no kind keys on itself, and the preset listed is the version that assignment pinned. Deactivated assignments (and assignments with a newer one for the same pair) are excluded. Shows each assigned preset, who added it, the date, and the source nanopub. The deactivatePreset column feeds the per-row deactivate action. The version column reports whether the assigned version is still current: version_label is what the cell shows (latest, or an up-arrow plus update available) and version carries the dates behind it as the hover tooltip -- that way round because the renderer displays a literal column's _label companion and puts the principal value in the tooltip. updatePreset holds the version the update action pre-fills. All three are derived from the newest non-invalidated version of the same kind, restricted to versions published by the same agent as the assigned version, so an unrelated agent cannot advertise a version of someone else's preset here. Presets never auto-update -- adopting the newer version stays an explicit, admin-signed act."; dct:license ; rdfs:label "List preset assignments"; ; """prefix rdfs: prefix dct: prefix np: prefix npa: prefix npx: prefix gen: select distinct ?preset ?preset_label ?version ?version_label (str(?preset) as ?deactivatePreset) (?user as ?added_by) (?date as ?date_added) ?updatePreset ?np (\"^\" as ?np_label) where { values ?_resource_multi_iri {} service { graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . } { graph ?stateG { ?_resource_multi_iri npa:isMaintainedBy? ?space . ?ri a gen:RoleInstantiation ; npa:forSpace ?space ; npa:forAgent ?authAgent ; (npa:inverseProperty|npa:regularProperty) ?roleProp . ?authAcct a npa:AccountState ; npa:agent ?authAgent ; npa:pubkey ?pubkey . } optional { graph npa:spacesGraph { ?rd a npa:RoleDeclaration ; npa:forSpace ?space ; npa:hasRoleType gen:MaintainerRole ; (npa:inverseProperty|npa:regularProperty) ?roleProp . bind(true as ?isMaintainer) } } filter(?roleProp = gen:hasAdmin || bound(?isMaintainer)) } union { graph ?stateG { ?selfAcct a npa:AccountState ; npa:agent ?_resource_multi_iri ; npa:pubkey ?pubkey . } } } graph npa:graph { ?np npx:hasNanopubType gen:PresetAssignment ; npa:hasValidSignatureForPublicKeyHash ?pubkey ; dct:created ?date ; npx:embeds ?assignment ; np:hasAssertion ?a . filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . } optional { ?np npx:signedBy ?user } } graph ?a { ?assignment gen:isAssignmentFor ?_resource_multi_iri ; gen:isAssignmentOfPreset ?preset . optional { values ?mode { gen:ActivatedPresetAssignment gen:DeactivatedPresetAssignment } ?assignment a ?mode . } } # The assigned preset version: its label, its stable kind, its author and its date. optional { graph npa:graph { ?presetNp npx:embeds ?preset ; np:hasAssertion ?pa . optional { ?presetNp npx:signedBy ?presetSigner } optional { ?presetNp dct:created ?presetDate } } graph ?pa { optional { ?preset rdfs:label ?preset_label . } optional { ?preset dct:isVersionOf ?presetKindOptional . } } } # Assignment identity is (preset KIND, resource) -- as for view displays, where the # client dedups by view kind -- so assigning another version of the same preset # replaces the earlier assignment instead of adding a second, competing one. A # version that declares no kind keys on itself. bind(coalesce(?presetKindOptional, ?preset) as ?presetKey) filter(!bound(?mode) || !contains(str(?mode), \"Deactivated\")) filter not exists { graph npa:graph { ?np2 npx:hasNanopubType gen:PresetAssignment ; npa:hasValidSignatureForPublicKeyHash ?pubkey2 ; dct:created ?date2 ; npx:embeds ?assignment2 ; np:hasAssertion ?a2 . filter not exists { ?npx2 npx:invalidates ?np2 ; npa:hasValidSignatureForPublicKeyHash ?pubkey2 . } } graph ?a2 { ?assignment2 gen:isAssignmentFor ?_resource_multi_iri ; gen:isAssignmentOfPreset ?preset2 . } optional { graph npa:graph { ?presetNp2 npx:embeds ?preset2 ; np:hasAssertion ?pa2 . } graph ?pa2 { ?preset2 dct:isVersionOf ?presetKind2 . } } filter(coalesce(?presetKind2, ?preset2) = ?presetKey) filter(?date2 > ?date || (?date2 = ?date && str(?np2) > str(?np))) } # Newest version of the assigned preset's kind, restricted to versions published by # the same agent as the assigned version, so an unrelated agent cannot advertise a # version of someone else's preset here (issue #607). Presets never auto-update: # this only surfaces the newer version and pre-fills the update action with it. optional { { select (?versionKind as ?presetKey) (?versionSigner as ?presetSigner) (iri(strafter(max(concat(str(?vDate), \">\", str(?vPreset))), \">\")) as ?latestVersion) (max(?vDate) as ?latestDate) where { graph npa:graph { ?vNp npx:hasNanopubType gen:Preset ; npa:hasValidSignatureForPublicKeyHash ?vPubkey ; dct:created ?vDate ; npx:signedBy ?versionSigner ; npx:embeds ?vPreset ; np:hasAssertion ?vA . filter not exists { ?vInv npx:invalidates ?vNp ; npa:hasValidSignatureForPublicKeyHash ?vPubkey . } } graph ?vA { ?vPreset a gen:Preset ; dct:isVersionOf ?versionKind . } } group by ?versionKind ?versionSigner } } bind(bound(?latestVersion) && ?latestVersion != ?preset && ?latestDate > ?presetDate as ?hasUpdate) # The version column. NOTE the renderer's convention for a literal column with an # \"x_label\" companion: the LABEL is what the cell displays and the principal value # becomes its hover tooltip -- so the short verdict goes in ?version_label and the # dates behind it in ?version. Both are blank when the assigned version's own # nanopub could not be read, rather than claiming \"latest\" without having checked. bind(if(?hasUpdate, \"⬆️ update available\", \"latest\") as ?verdict) bind(if(?hasUpdate, concat(\"Assigned version of \", substr(str(?presetDate), 1, 10), \"; version of \", substr(str(?latestDate), 1, 10), \" is newer\"), concat(\"Assigned version of \", substr(str(?presetDate), 1, 10))) as ?detail) bind(if(bound(?presetDate), ?verdict, \"\") as ?version_label) bind(if(bound(?presetDate), ?detail, \"\") as ?version) bind(if(?hasUpdate, str(?latestVersion), \"\") as ?updatePreset) } order by 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-09-09T08:02:41Z"^^xsd:dateTime; dct:creator orcid:0000-0002-1267-0234; dct:license ; npx:embeds sub:list-preset-assignments; npx:supersedes ; rdfs:label "List preset assignments"; nt:wasCreatedFromProvenanceTemplate ; nt:wasCreatedFromPubinfoTemplate , , ; nt:wasCreatedFromTemplate . sub:sig npx:hasAlgorithm "RSA"; npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB"; npx:hasSignature "e9mHqXW43BaUgJgZCyI+nZpdFW5Xw4V1XnvOHgBM8nML1yiX+oFg5SOjJORhBLxwNEi3UwILUaSEfd6xbVIz7sT+ibyVisK/x/Z0qpOcWqU8auHeKITv9saiBr3vi2h8Owah5vdwBN2bnjbSvglwJQWh0+rvQwuj0uxK8crJcYw="; npx:hasSignatureTarget this:; npx:signedBy orcid:0000-0002-1267-0234 . }