Lists the currently active view displays of a resource for the About page (standalone + preset-contributed, deactivations applied, latest version, one row per resolved view keeping the latest). displayed_here flags whether the view is shown on this resource's own page. Ordered shown-here first, then by structural position. Space-governed versions (gen:governedBy, nanodash docs/views-and-presets-as-maintained-resources.md): a referenced version declaring gen:governedBy resolves to the newest version of its (kind, space) pair signed by a current member+ (admin/maintainer/member) of that space -- with the kind validated as a maintained resource of the space -- taking precedence over the supersedes-based head; without a valid governed candidate the pinned version stands. Federation footprint (2026-08-20): endpoint rebased onto repo/full, so the former SERVICE hops to repo/full (preset branch) and to the ResourceView type repo (latest-version resolution, governed-version candidates and metadata) are local patterns; only the space-state lookups remain federated, to repo/spaces. The latest-version resolution was rewritten from a run-once repo-wide max-date sub-select (which cannot see outer bindings and would enumerate the whole repository on repo/full, timing out) to bound per-view lookups choosing the same-key, non-invalidated supersedes-head with no newer such sibling -- same heads, ties preserved. In the governed-resolution sub-select the candidate block is wrapped in a projecting sub-select; this wrapper is load-bearing on rdf4j 6.0.0, where bindings from raw local patterns are silently not joined into a following SERVICE clause. Validated result-identical to the previous version across spaces, refs, user and resource pages (columns produced by sample(), non-deterministic by definition, may vary as they already did between runs of the previous version). The per-hop loopback federation was an amplifier of the rdf4j connection-pool deadlock behind the fleet-wide /api wedges.
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 gen: <https://w3id.org/kpxl/gen/terms/> select ?view (sample(?view_label) as ?view_label) (sample(?displayed_here) as ?displayed_here) (sample(?position) as ?position) (substr(sample(?position), 1, 3) as ?position_label) (sample(?via_preset) as ?via_preset) (sample(?via_preset_label) as ?via_preset_label) (sample(?added_by) as ?added_by) (sample(?deactivateView) as ?deactivateView) (max(?date_added) as ?date_added) (iri(strafter(max(concat(str(?date_added), "\t", str(?np))), "\t")) as ?np) ("^" as ?np_label) where { select ?view ?view_label ?displayed_here ?position (if(?displayed_here = "", ?target_multi_iri_raw, "") as ?target_multi_iri) (if(?displayed_here = "", ?target_label_multi_raw, "") as ?target_label_multi) ?via_preset ?via_preset_label ?added_by ?date_added ?deactivateView ?np ?np_label where { select ?view ?view_label ?position (if(bound(?presetScope), ?presetScope, if(bound(?preset), if(?aVHasTarget > 0, if(?aVMatch > 0, "✓", ""), "✓"), if(?aDApplyHere > 0, "✓", if(?aDHasTarget > 0, if(?aDMatch > 0, "✓", ""), if(?aDHasApply > 0, "", if(?aVHasTarget > 0, if(?aVMatch > 0, "✓", ""), "✓")))))) as ?displayed_here) ?target_multi_iri_raw ?target_label_multi_raw (?preset as ?via_preset) (?preset_label as ?via_preset_label) (?user as ?added_by) (?date as ?date_added) ?deactivateView ?np ("^" as ?np_label) where { select ?view ?view_label ?position ?preset ?preset_label ?presetScope ?user ?date ?deactivateView ?np (max(?fDApplyHere) as ?aDApplyHere) (max(?fDHasApply) as ?aDHasApply) (max(?fDHasTarget) as ?aDHasTarget) (max(?fDMatch) as ?aDMatch) (max(?fVHasTarget) as ?aVHasTarget) (max(?fVMatch) as ?aVMatch) (group_concat(distinct ?targetIri; separator=" ") as ?target_multi_iri_raw) (group_concat(distinct ?targetLabel; separator="\n") as ?target_label_multi_raw) where { { select ?_resource_multi_iri ?viewRef ?viewLatest ?view_label ?position ?preset ?preset_label ?presetScope ?user ?date ?np ?ownClass ?dApply ?dTarget ?effVTarget ?pinSpace ?governedLatest where { values ?_resource_multi_iri {} service <https://w3id.org/np/l/nanopub-query-1.1/repo/spaces> { graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . } { # Authority gate (issue #130 / nanodash#510): a single mandatory hop through the # governing space ref, which covers both a maintained resource and a space itself # (the reflexive self-edge), keyed on the role tier materialized on the # RoleInstantiation since #125. Replaces the old bare-IRI isMaintainedBy? hop and # the dead RoleDeclaration maintainer join. Non-ref variant: any ref claiming the # IRI, so authority merges across refs (the ref variant pins a single ?passedRef). graph ?stateG { ?_resource_multi_iri npa:hasGoverningSpaceRef ?spaceRef . ?ri a gen:RoleInstantiation ; npa:forSpaceRef ?spaceRef ; npa:hasRoleType ?roleType ; npa:forAgent ?authAgent . filter(?roleType = gen:AdminRole || ?roleType = gen:MaintainerRole) ?authAcct a npa:AccountState ; npa:agent ?authAgent ; npa:pubkey ?pubkey . } } union { graph ?stateG { ?selfAcct a npa:AccountState ; npa:agent ?_resource_multi_iri ; npa:pubkey ?pubkey . } } bind(if(exists { graph ?stateG { ?_resource_multi_iri npa:isMaintainedBy ?anyMaintainer } }, gen:MaintainedResource, if(exists { graph ?stateG { ?ownAcc a npa:AccountState ; npa:agent ?_resource_multi_iri } }, gen:IndividualAgent, gen:Space)) as ?ownClass) } { graph npa:graph { ?np npx:hasNanopubType gen:ViewDisplay ; npa:hasValidSignatureForPublicKeyHash ?pubkey ; dct:created ?date ; npx:embeds ?display ; np:hasAssertion ?a . filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . } optional { ?np npx:signedBy ?user } } graph ?a { ?display gen:isDisplayOfView ?viewRef ; gen:isDisplayFor ?_resource_multi_iri . optional { values ?displayMode { gen:ActivatedViewDisplay gen:DeactivatedViewDisplay } ?display a ?displayMode . } optional { ?display gen:appliesTo ?dApply . } optional { ?display (gen:appliesToInstancesOf|gen:appliesToNamespace) ?dTarget . } } } union { select ?viewRef ?displayMode ?preset ?preset_label ?presetScope ?user ?date ?np ?pubkey ?_resource_multi_iri { { # was: service repo/full — now local on the repo/full endpoint 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 ?displayMode { gen:ActivatedPresetAssignment gen:DeactivatedPresetAssignment } ?assignment a ?displayMode . } } 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 a gen:DeactivatedPresetAssignment ; gen:isAssignmentFor ?_resource_multi_iri ; gen:isAssignmentOfPreset ?preset . } filter(?date2 > ?date) } graph npa:graph { ?presetNp npx:embeds ?preset ; np:hasAssertion ?pa . } graph ?pa { ?preset a gen:Preset . optional { ?preset rdfs:label ?preset_label . } { ?preset gen:hasTopLevelView ?viewRef . bind("✓" as ?presetScope) } union { ?preset gen:hasView ?viewRef } } } } } optional { graph npa:graph { ?np np:hasAssertion ?npAssertion . } graph ?npAssertion { ?npDisplay gen:hasStructuralPosition ?dispPos . } } filter(!bound(?displayMode) || !contains(str(?displayMode), "Deactivated")) filter not exists { graph npa:graph { ?np2 npx:hasNanopubType gen:ViewDisplay ; npa:hasValidSignatureForPublicKeyHash ?pubkey2 ; dct:created ?date2 ; npx:embeds ?display2 ; np:hasAssertion ?a2 . filter not exists { ?npx2 npx:invalidates ?np2 ; npa:hasValidSignatureForPublicKeyHash ?pubkey2 . } } graph ?a2 { ?display2 a gen:DeactivatedViewDisplay ; gen:isDisplayOfView ?viewRef ; gen:isDisplayFor ?_resource_multi_iri . } filter(?date2 > ?date) } optional { # Resolve ?viewRef to its latest same-key non-invalidated version. Was a # service on the ResourceView type shard with a run-once max-date sub-select; # a sub-select cannot see outer bindings, so localized on repo/full it would # enumerate the whole repository (measured: times out >10s). Rewritten as # BOUND point lookups per ?viewRef: the head is the supersedes-connected, # same-key, non-invalidated version with no newer such sibling (ties kept, # matching the old max+join). Filters stay OUTSIDE graph blocks (rdf4j # planner trap). graph npa:graph { ?vnp npx:embeds ?viewRef ; npa:hasValidSignatureForPublicKey ?vKey . } graph npa:networkGraph { ?headNp (npx:supersedes)* ?vnp . } graph npa:graph { ?headNp npa:hasValidSignatureForPublicKey ?vKey ; dct:created ?headDate ; npx:embeds ?viewLatest ; np:hasAssertion ?hva . } filter not exists { graph npa:graph { ?i2 npx:invalidates ?headNp ; npa:hasValidSignatureForPublicKey ?vKey . } } filter not exists { graph npa:networkGraph { ?h2 (npx:supersedes)* ?vnp . } graph npa:graph { ?h2 npa:hasValidSignatureForPublicKey ?vKey ; dct:created ?h2Date . } filter not exists { graph npa:graph { ?i3 npx:invalidates ?h2 ; npa:hasValidSignatureForPublicKey ?vKey . } } filter(?h2Date > ?headDate) } graph ?hva { ?viewLatest dct:title ?supLabel . } optional { graph ?hva { ?viewLatest gen:hasStructuralPosition ?viewPos . } } optional { graph ?hva { ?viewLatest (gen:appliesToInstancesOf|gen:appliesToNamespace) ?vTarget . } } } # Space-governed resolution (gen:governedBy; nanodash docs/views-and-presets-as- # maintained-resources.md): if the pinned version declares a governing space, the # newest version of its (kind, space) pair signed by a current member+ of that # space wins, with the kind validated as maintained by the space. Run-once # sub-select over all governed versions network-wide (gen:governedBy is highly # selective), joined back per pin. No valid candidate -> the pin stands. optional { # Pin lookup — was a type-shard service, now local bound point lookups. graph npa:graph { ?pinNp npx:embeds ?viewRef ; np:hasAssertion ?pinA . } graph ?pinA { ?viewRef dct:isVersionOf ?pinKind ; gen:governedBy ?pinSpace . } { select ?pinKind ?pinSpace (iri(strafter(max(concat(str(?cDate), ">", str(?cver))), ">")) as ?governedLatest) where { # Candidate versions — was a type-shard service, now local. The # sub-select wrapper is LOAD-BEARING: on rdf4j 6.0.0, bindings from # raw local patterns are silently NOT joined into a following # SERVICE clause (the spaces lookup below); a projecting sub-select # restores the join (verified empirically, 2026-08-20). { select ?pinKind ?pinSpace ?cver ?cpk ?cDate where { graph npa:graph { ?cnp dct:created ?cDate ; npa:hasValidSignatureForPublicKeyHash ?cpk ; npx:embeds ?cver ; np:hasAssertion ?ca . filter not exists { ?ci npx:invalidates ?cnp ; npa:hasValidSignatureForPublicKeyHash ?cpk . } } graph ?ca { ?cver dct:isVersionOf ?pinKind ; gen:governedBy ?pinSpace . } } } service <https://w3id.org/np/l/nanopub-query-1.1/repo/spaces> { graph npa:graph { <http://purl.org/nanopub/admin/thisRepo> npa:hasCurrentSpaceState ?gsg . } graph ?gsg { ?pinKind npa:isMaintainedBy ?pinSpace ; npa:hasGoverningSpaceRef ?gref . ?gri a gen:RoleInstantiation ; npa:forSpace ?pinSpace ; npa:forSpaceRef ?gref ; npa:hasRoleType ?gtier ; npa:forAgent ?gag . filter(?gtier = gen:AdminRole || ?gtier = gen:MaintainerRole || ?gtier = gen:MemberRole) ?gacct a npa:AccountState ; npa:agent ?gag ; npa:pubkey ?cpk . } } } group by ?pinKind ?pinSpace } # Governed-winner metadata — was a type-shard service, now local. graph npa:graph { ?gnp npx:embeds ?governedLatest ; np:hasAssertion ?gva . } graph ?gva { ?governedLatest dct:title ?gTitle . } optional { graph ?gva { ?governedLatest gen:hasStructuralPosition ?gPos . } } optional { graph ?gva { ?governedLatest (gen:appliesToInstancesOf|gen:appliesToNamespace) ?gTarget . } } } bind(if(bound(?governedLatest), ?gTitle, ?supLabel) as ?view_label) bind(if(bound(?governedLatest), ?gPos, ?viewPos) as ?effViewPos) bind(if(bound(?governedLatest), ?gTarget, ?vTarget) as ?effVTarget) bind(coalesce(?dispPos, ?effViewPos, "") as ?position) } } bind(if(coalesce(str(?dApply) = str(?_resource_multi_iri), false), 1, 0) as ?fDApplyHere) bind(if(bound(?dApply), 1, 0) as ?fDHasApply) bind(if(bound(?dTarget), 1, 0) as ?fDHasTarget) bind(if(coalesce(str(?dTarget) = str(?ownClass), false) || coalesce(strstarts(str(?_resource_multi_iri), str(?dTarget)), false), 1, 0) as ?fDMatch) bind(if(bound(?effVTarget), 1, 0) as ?fVHasTarget) bind(if(coalesce(str(?effVTarget) = str(?ownClass), false) || coalesce(strstarts(str(?_resource_multi_iri), str(?effVTarget)), false), 1, 0) as ?fVMatch) bind(coalesce(?dTarget, ?effVTarget) as ?targetIri) bind(replace(str(?targetIri), "^.*[/#]", "") as ?targetLocalName) bind(if(coalesce(strlen(?targetLocalName) > 0, false), ?targetLocalName, str(?targetIri)) as ?targetLabel) bind(if(bound(?pinSpace), coalesce(?governedLatest, ?viewRef), coalesce(?viewLatest, ?viewRef)) as ?view) bind(str(?viewRef) as ?deactivateView) } group by ?view ?view_label ?position ?preset ?preset_label ?presetScope ?user ?date ?deactivateView ?np } } } group by ?view order by desc(?displayed_here) ?position