Nanopublication

< Home

ID

https://w3id.org/np/RADjwb3jEpw_WkU7VCDygvkabnHmmKwmLylRtbXamFItM

Formats

.trig | .trig.txt | .jelly | .jelly.txt | .jsonld | .jsonld.txt | .nq | .nq.txt | .xml | .xml.txt

Content

@prefix this: <https://w3id.org/np/RADjwb3jEpw_WkU7VCDygvkabnHmmKwmLylRtbXamFItM> .
@prefix sub: <https://w3id.org/np/RADjwb3jEpw_WkU7VCDygvkabnHmmKwmLylRtbXamFItM/> .
@prefix np: <http://www.nanopub.org/nschema#> .
@prefix grlc: <https://w3id.org/kpxl/grlc/> .
@prefix dct: <http://purl.org/dc/terms/> .
@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:list-view-displays-space a grlc:grlc-query;
    dct:description "Space-scoped view displays for a single space ref. Derived from list-view-displays (RAfGpyfUX8qjSMN5-aRWOPeVqHajs3f6zUzcnMuRibk1g) but specialised for gen:Space resources: the authority gate keeps only the governing-space-ref hop -- issue #130's reflexive self-edge already exposes the space's own admins/maintainers there -- and drops the agent-self UNION branch, leaving a single non-UNION join under the variable state graph. This avoids the RDF4J planner timeout documented in nanopub-query doc/sparql-quirks.md (variable hasCurrentSpaceState pointer + multi-join + UNION => intermittent 504) that made the space View-displays view fail intermittently. ?ownClass is folded to the constant gen:Space. Takes the same two concrete inputs (resource = space IRI, root_np = ref root) and returns the same columns as list-view-displays. The outer SELECT collapses multiple attach rows per view deterministically: ?displayed_here via max() (shown if any live path displays it), every other column pinned to the single newest (date_added, np) row via argmax -- replacing the old non-deterministic sample() aggregates.";
    dct:license <http://www.apache.org/licenses/LICENSE-2.0>;
    rdfs:label "List view displays (space)";
    grlc:endpoint <https://w3id.org/np/l/nanopub-query-1.1/repo/type/11daee46fdfff957dc17b46f5dc1a618045afd4f5634d5334ce9db19c3689a3c>;
    grlc:sparql """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
       (?view_label_g as ?view_label)
       (?displayed_here_g as ?displayed_here)
       (?position_g as ?position)
       (substr(?position_g, 1, 3) as ?position_label)
       (if(strlen(?via_preset_g) > 0, iri(?via_preset_g), ?undef_vp) as ?via_preset)
       (?via_preset_label_g as ?via_preset_label)
       (if(strlen(?added_by_g) > 0, iri(?added_by_g), ?undef_ab) as ?added_by)
       (?deactivateView_g as ?deactivateView)
       (?date_added_g as ?date_added)
       (?np_g as ?np)
       (?np_label_g as ?np_label) where {
# Collapse to one deterministic row per ?view. The page can reach a view through several
# rows (a direct ViewDisplay AND a preset, multiple display nanopubs, class+namespace targets);
# group by ?view picks ONE. ?displayed_here uses max() = \"shown if displayed via any live path\"
# (\"\" < the check mark, so max yields the check when any path shows it) and is order-stable.
# Every other column is pinned to the single newest row via an argmax over (date_added, np) --
# the same trick already used for ?np -- so the detail columns stay mutually consistent
# (no value mixed in from a different source row) instead of independently SAMPLE()d at random.
select ?view
       (min(?view_label) as ?view_label_g)
       (max(?displayed_here) as ?displayed_here_g)
       (strafter(strafter(max(concat(str(?date_added), \"\\\\t\", str(?np), \"\\\\t\", str(?position))), \"\\\\t\"), \"\\\\t\") as ?position_g)
       (strafter(strafter(max(concat(str(?date_added), \"\\\\t\", str(?np), \"\\\\t\", coalesce(str(?via_preset), \"\"))), \"\\\\t\"), \"\\\\t\") as ?via_preset_g)
       (strafter(strafter(max(concat(str(?date_added), \"\\\\t\", str(?np), \"\\\\t\", coalesce(str(?via_preset_label), \"\"))), \"\\\\t\"), \"\\\\t\") as ?via_preset_label_g)
       (strafter(strafter(max(concat(str(?date_added), \"\\\\t\", str(?np), \"\\\\t\", coalesce(str(?added_by), \"\"))), \"\\\\t\"), \"\\\\t\") as ?added_by_g)
       (strafter(strafter(max(concat(str(?date_added), \"\\\\t\", str(?np), \"\\\\t\", str(?deactivateView))), \"\\\\t\"), \"\\\\t\") as ?deactivateView_g)
       (max(?date_added) as ?date_added_g)
       (iri(strafter(max(concat(str(?date_added), \"\\\\t\", str(?np))), \"\\\\t\")) as ?np_g)
       (\"^\" as ?np_label_g) 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 ?vTarget where {
      values ?_resource_multi_iri {}
      values ?_root_np_multi_iri {}
      service <https://w3id.org/np/l/nanopub-query-1.1/repo/spaces> {
        graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?stateG . }
        graph npa:spacesGraph { ?passedRef npa:rootNanopub ?_root_np_multi_iri . }
        # Authority gate (space-scoped, no-UNION variant of list-view-displays): a single
        # mandatory hop through the governing space ref. For a gen:Space resource, issue #130's
        # reflexive self-edge (?space npa:hasGoverningSpaceRef ?ownRef) already exposes the
        # space's own admins/maintainers through this same hop, so the agent-self UNION branch
        # carried by the general list-view-displays is redundant here and is dropped. That leaves
        # a single non-UNION join under the variable ?stateG, avoiding the RDF4J planner timeout
        # documented in nanopub-query doc/sparql-quirks.md (variable hasCurrentSpaceState pointer
        # + multi-join + UNION => intermittent 504). ?ownClass is the constant gen:Space (this
        # query only backs gen:Space views), so the two ownClass exists-probes are folded away too.
        graph ?stateG {
          ?_resource_multi_iri npa:hasGoverningSpaceRef ?passedRef .
          ?ri a gen:RoleInstantiation ; npa:forSpaceRef ?passedRef ; npa:hasRoleType ?roleType ; npa:forAgent ?authAgent .
          filter(?roleType = gen:AdminRole || ?roleType = gen:MaintainerRole)
          ?authAcct a npa:AccountState ; npa:agent ?authAgent ; npa:pubkey ?pubkey .
        }
        bind(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 {
          service <https://w3id.org/np/l/nanopub-query-1.1/repo/full> {
            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 {
        service <https://w3id.org/np/l/nanopub-query-1.1/repo/type/ec6722efa3b44e0a18aa63afe5964158a1fdb7f0413ea5f23bfddf5c03ca0221> {
          graph npa:graph { ?vnp npx:embeds ?viewRef . }
          { select ?vnp (max(?hDate) as ?headDate) where {
              graph npa:networkGraph { ?h (npx:supersedes)* ?vnp . }
              graph npa:graph {
                ?vnp npa:hasValidSignatureForPublicKey ?k .
                ?h npa:hasValidSignatureForPublicKey ?k ; dct:created ?hDate .
                filter not exists { ?i npx:invalidates ?h ; npa:hasValidSignatureForPublicKey ?k . }
              }
            } group by ?vnp }
          graph npa:networkGraph { ?headNp (npx:supersedes)* ?vnp . }
          graph npa:graph {
            ?vnp npa:hasValidSignatureForPublicKey ?vKey .
            ?headNp npa:hasValidSignatureForPublicKey ?vKey ; dct:created ?headDate ;
                    npx:embeds ?viewLatest ; np:hasAssertion ?hva .
            filter not exists { ?i2 npx:invalidates ?headNp ; npa:hasValidSignatureForPublicKey ?vKey . }
          }
          graph ?hva { ?viewLatest dct:title ?view_label . }
          optional { graph ?hva { ?viewLatest gen:hasStructuralPosition ?viewPos . } }
          optional { graph ?hva { ?viewLatest (gen:appliesToInstancesOf|gen:appliesToNamespace) ?vTarget . } }
        }
      }
      bind(coalesce(?dispPos, ?viewPos, \"\") 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(?vTarget), 1, 0) as ?fVHasTarget)
  bind(if(coalesce(str(?vTarget) = str(?ownClass), false) || coalesce(strstarts(str(?_resource_multi_iri), str(?vTarget)), false), 1, 0) as ?fVMatch)
  bind(coalesce(?dTarget, ?vTarget) as ?targetIri)
  bind(replace(str(?targetIri), \"^.*[/#]\", \"\") as ?targetLocalName)
  bind(if(coalesce(strlen(?targetLocalName) > 0, false), ?targetLocalName, str(?targetIri)) as ?targetLabel)
  bind(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""" .
}

sub:provenance {
  sub:assertion prov:wasAttributedTo orcid:0000-0002-1267-0234;
    prov:wasDerivedFrom <https://w3id.org/np/RAfGpyfUX8qjSMN5-aRWOPeVqHajs3f6zUzcnMuRibk1g> .
}

sub:pubinfo {
  orcid:0000-0002-1267-0234 foaf:name "Tobias Kuhn" .
  
  this: dct:created "2026-06-29T13:26:01Z"^^xsd:dateTime;
    dct:creator orcid:0000-0002-1267-0234;
    dct:license <https://creativecommons.org/licenses/by/4.0/>;
    npx:embeds sub:list-view-displays-space;
    npx:supersedes <https://w3id.org/np/RAI2pgurjHyHhUuo0PFqWNd1_BCLkl3bPNLhsVvHOqhck> .
  
  sub:sig npx:hasAlgorithm "RSA";
    npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB";
    npx:hasSignature "LpHRF74/EIZKVIPP8qoMT6LlLQFDQ2I9BALZENVuCwwQgK8QO8uzbkr+y3Fs2Sqz6kFrLAk9/p5uoL7YKzA2QT2+nmFKlWxw8UTigQJGl/tFLmXW5xW+TtBDTF8aDH2uIla7J/cSqBboD5QiOj9T4m5CXhy6Xzg2xaJ98ica4c8=";
    npx:hasSignatureTarget this:;
    npx:signedBy orcid:0000-0002-1267-0234 .
}