@prefix this: <https://w3id.org/np/RAPthUMRDXiJeD2BrOsZigTsbA0LktBc-HC4alDSfVNKM> .
@prefix sub: <https://w3id.org/np/RAPthUMRDXiJeD2BrOsZigTsbA0LktBc-HC4alDSfVNKM/> .
@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/> .

<https://w3id.org/np/RAPthUMRDXiJeD2BrOsZigTsbA0LktBc-HC4alDSfVNKM> a np:Nanopublication;
  np:hasAssertion sub:assertion;
  np:hasProvenance sub:provenance;
  np:hasPublicationInfo sub:pubinfo;
  dct:created "2026-06-17T06:44:57Z"^^xsd:dateTime;
  dct:creator orcid:0000-0002-1267-0234;
  dct:license <https://creativecommons.org/licenses/by/4.0/>;
  npx:embeds sub:list-maintained-resources .

sub:list-maintained-resources a grlc:grlc-query;
  dct:description "Lists the maintained resources of a given space ref (space IRI + root definition) with a link to the source nanopublication. Label comes from each resource's definition assertion; resources whose definitions are all retracted or otherwise invalidated are filtered out. Ordered alphabetically by label. Pass the ref's root nanopub (root_np); the query resolves the ref via npa:rootNanopub and scopes the maintained-resource edges by the ref-level npa:hasMaintainedResource (subject = the ref), so it shows only that one ref's resources rather than merging all refs claiming the IRI. Ref-scoped variant of list-maintained-resources (which is IRI-keyed via npa:hasMaintainedResource on the space IRI).";
  dct:license <http://www.apache.org/licenses/LICENSE-2.0>;
  rdfs:label "List maintained resources of a space (ref-scoped)";
  grlc:endpoint <https://w3id.org/np/l/nanopub-query-1.1/repo/spaces>;
  grlc:sparql """prefix np: <http://www.nanopub.org/nschema#>
prefix npx: <http://purl.org/nanopub/x/>
prefix npa: <http://purl.org/nanopub/admin/>
prefix gen: <https://w3id.org/kpxl/gen/terms/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>

select ?resource ?resource_label ?np (\"^\" as ?np_label) where {
  {
    select ?resource
           (sample(?label) as ?resource_label)
           (sample(?viaNp) as ?np)
    where {
      values ?_root_np_multi_iri {}
      graph npa:spacesGraph { ?spaceRef npa:rootNanopub ?_root_np_multi_iri ; npa:spaceIri ?spaceIri . }
      graph npa:graph { npa:thisRepo npa:hasCurrentSpaceState ?g . }
      graph ?g { ?spaceRef npa:hasMaintainedResource ?resource . }
      graph ?ag { ?resource a gen:MaintainedResource ; rdfs:label ?label . }
      graph npa:graph {
        ?defNp np:hasAssertion ?ag ; npa:hasValidSignatureForPublicKey ?pubkey .
        filter not exists { ?inv npx:invalidates ?defNp ; npa:hasValidSignatureForPublicKey ?pubkey . }
      }
      optional { graph npa:spacesGraph { ?d a npa:MaintainedResourceDeclaration ; npa:resourceIri ?resource ; npa:maintainerSpace ?spaceIri ; npa:viaNanopub ?viaNp } }
    }
    group by ?resource
  }
}
order by lcase(str(?resource_label))""" .

sub:assertion prov:wasAttributedTo orcid:0000-0002-1267-0234 .

orcid:0000-0002-1267-0234 foaf:name "Tobias Kuhn" .

sub:sig npx:hasAlgorithm "RSA";
  npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB";
  npx:hasSignature "l8+LSUZzs4BnIi65QFm5WYdzc6lUPH6bWmjr35f5umUsY9Z933b2I6Qjurzk9XB2pEGcyGsUWUFtDUoFONPLmQcT372xrSm37Wbq62iVA8OGkn1Z97lnCNPY/WSO6AAR2+vrbkzBGS9MWdsui/ruL71IdcnLzfNlfCPfZ3hg3Yw=";
  npx:hasSignatureTarget <https://w3id.org/np/RAPthUMRDXiJeD2BrOsZigTsbA0LktBc-HC4alDSfVNKM>;
  npx:signedBy orcid:0000-0002-1267-0234 .

