@prefix this: <https://w3id.org/np/RAheGTEIYh394SfNZx9MUKa0a4h7AIvoPnNS7Q-MP6cgk> .
@prefix sub: <https://w3id.org/np/RAheGTEIYh394SfNZx9MUKa0a4h7AIvoPnNS7Q-MP6cgk/> .
@prefix grlc: <https://w3id.org/kpxl/grlc/> .
@prefix np: <http://www.nanopub.org/nschema#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix nt: <https://w3id.org/np/o/ntemplate/> .
@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 ns1: <http://purl.org/np/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

<https://w3id.org/np/RAheGTEIYh394SfNZx9MUKa0a4h7AIvoPnNS7Q-MP6cgk> a np:Nanopublication;
  np:hasAssertion sub:assertion;
  np:hasProvenance sub:provenance;
  np:hasPublicationInfo sub:pubinfo;
  dct:created "2026-05-30T08:00:00Z"^^xsd:dateTime;
  dct:creator orcid:0000-0002-1267-0234;
  dct:license <https://creativecommons.org/licenses/by/4.0/>;
  npx:introduces sub:get-parts-view;
  nt:wasCreatedFromProvenanceTemplate ns1:RANwQa4ICWS5SOjw7gp99nBpXBasapwtZF1fIM3H2gYTM;
  nt:wasCreatedFromPubinfoTemplate ns1:RAA2MfqdBCzmz9yVWjKLXNbyfBNcwsMmOqcNUxkk1maIM,
    ns1:RAh1gm83JiG5M6kDxXhaYT1l49nCzyrckMvTzcPn-iv90, ns1:RAjpBMlw3owYhJUBo3DtsuDlXsNAJ8cnGeWAutDVjuAuI;
  nt:wasCreatedFromTemplate <https://w3id.org/np/RAYvkQOT9-zrcql5lzMW9OpiPjA9UvSh-RezaVwYmWvns> .

sub:get-parts-view a grlc:grlc-query;
  dct:description "Returns the things denoted as parts of the given thing, with view-friendly columns (part / part_label). Used by the /explore page as a resource view (the 'Has parts' list).";
  dct:license <http://www.apache.org/licenses/LICENSE-2.0>;
  rdfs:label "Get parts of a thing (view)";
  grlc:endpoint <https://w3id.org/np/l/nanopub-query-1.1/repo/full>;
  grlc:sparql """prefix dct: <http://purl.org/dc/terms/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix np: <http://www.nanopub.org/nschema#>
prefix npa: <http://purl.org/nanopub/admin/>
prefix npx: <http://purl.org/nanopub/x/>
prefix nt: <https://w3id.org/np/o/ntemplate/>

select ?part (sample(?partLabel) as ?part_label) where {
  { graph ?g {
      ?_thing_iri dct:hasPart ?part .
    }
    filter not exists {
      graph npa:graph {
        ?part npx:hasNanopubType npx:NanopubIndex .
      }
    }
  } union
  { graph ?g {
      ?part dct:partOf ?_thing_iri .
    }
  } union
  { graph ?gx {
      ?_thing_iri dct:hasPart ?index .
    }
    graph npa:graph {
      ?index npx:hasNanopubType npx:NanopubIndex .
      ?index np:hasAssertion ?a .
    }
    graph ?a {
      ?index npx:includesElement ?np .
    }
    graph npa:graph {
      ?np npx:introduces ?part .
    }
  }
  graph npa:graph {
    ?np npa:hasGraph ?g .
    ?np npa:hasValidSignatureForPublicKey ?pubkey .
    filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKey ?pubkey . }
    ?np np:hasPublicationInfo ?i .
  }
  optional { graph ?g {  ?part rdfs:label ?partLabel1 . } }
  optional { graph ?g {  ?part dct:title ?partLabel2 . } }
  optional { graph ?i {  ?part rdfs:label ?partLabel3 . } }
  optional { graph ?i {  ?part nt:hasLabelFromApi ?partLabel4 . } }
  optional { graph ?x { ?part rdfs:label ?partLabel5 . } }
  bind(coalesce(?partLabel1, ?partLabel2, ?partLabel3, ?partLabel4, ?partLabel5) as ?partLabel)
}
group by ?part
limit 1000""" .

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 "ZlEa/6/dsKaSgajiHU7cbiND+dkyfeNjQZ8jH4Tsel02wLV9xYjjxVYkca+ajSo8ZkjZmLwqv4BFcohCAJzTUl8+XgHVDGuPwMlkpBULt+o/9Iuk09ROvxNhu3/eFhf3gum76t5Kx0+vJgKxznxzBbYbl5WpI95+HYrq06UjKrs=";
  npx:hasSignatureTarget <https://w3id.org/np/RAheGTEIYh394SfNZx9MUKa0a4h7AIvoPnNS7Q-MP6cgk>;
  npx:signedBy orcid:0000-0002-1267-0234 .

