@prefix this: <https://w3id.org/np/RAdwV588EdTzQ6UhsYX_hmg5GvOJbKvFjMOcEIpVNxyLg> .
@prefix sub: <https://w3id.org/np/RAdwV588EdTzQ6UhsYX_hmg5GvOJbKvFjMOcEIpVNxyLg/> .
@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#> .
sub:Head {
  this: np:hasAssertion sub:assertion ;
    np:hasProvenance sub:provenance ;
    np:hasPublicationInfo sub:pubinfo ;
    a np:Nanopublication .
}
sub:assertion {
  sub:get-future-planned-event-attendances dct:description "This query returns the future events the given user plans to attend." ;
    dct:license <http://www.apache.org/licenses/LICENSE-2.0> ;
    a grlc:grlc-query ;
    rdfs:label "Get future planned event attendances" ;
    grlc:endpoint <https://w3id.org/np/l/nanopub-query-1.1/repo/type/e0c10d8a3e60586806c4b357bb4767f6c71c162e061be85cfe165eaf18b13f2f> ;
    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/>
prefix schema: <http://schema.org/>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>

select distinct ?event ?event_label ?date ?np (\"^\" as ?np_label) where {
  graph npa:graph {
    ?np npx:hasNanopubType gen:plansToAttend .
    ?np npa:hasValidSignatureForPublicKeyHash ?pubkey .
    filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . }
    ?np npx:signedBy ?_user_iri .
    ?np np:hasAssertion ?a .
  }
  graph ?a {
    ?_user_iri gen:plansToAttend ?event .
    optional { ?event rdfs:label ?event_label }
    optional { ?event dct:date ?date1 }
  }
  optional {
    bind(iri(concat(\"https://w3id.org/np/l/nanopub-query-1.1/repo/type/\", sha256(str(gen:Space)))) as ?space_repo)
    service ?space_repo {
      graph npa:graph {
        ?nps npx:introduces ?event .
        ?nps npa:hasValidSignatureForPublicKeyHash ?pks .
        filter not exists { ?npsx npx:invalidates ?nps ; npa:hasValidSignatureForPublicKeyHash ?pks . }
        ?nps np:hasAssertion ?as .
      }
      graph ?as {
        ?event schema:startDate ?datetime .
        bind(xsd:date(substr(str(?datetime), 0, 11)) as ?date2)
      }
    }
  }
  bind(coalesce(?date1, ?date2) as ?date)
  filter(?date >= xsd:date(substr(str(now()), 0, 11)))
} order by ?date""" .
}
sub:provenance {
  sub:assertion prov:wasAttributedTo orcid:0000-0002-1267-0234 .
}
sub:pubinfo {
  this: dct:created "2026-03-16T12:00:00Z"^^xsd:dateTime ;
    dct:creator orcid:0000-0002-1267-0234 ;
    dct:license <https://creativecommons.org/licenses/by/4.0/> ;
    npx:embeds sub:get-future-planned-event-attendances ;
    npx:wasCreatedAt <https://nanodash.knowledgepixels.com/> .
  sub:sig npx:hasAlgorithm "RSA" ;
    npx:hasPublicKey "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCwUtewGCpT5vIfXYE1bmf/Uqu1ojqnWdYxv+ySO80ul8Gu7m8KoyPAwuvaPj0lvPtHrg000qMmkxzKhYknEjq8v7EerxZNYp5B3/3+5ZpuWOYAs78UnQVjbHSmDdmryr4D4VvvNIiUmd0yxci47dTFUj4DvfHnGd6hVe5+goqdcwIDAQAB" ;
    npx:hasSignature "SXdYRW0GfRyFfjB/qb2oCkssqNjurwLcG2cZYklIAByeiocYrd6I4Lez5V/b4J/Ytgn1Y6oslbID0TgNwgPJ1TM21CnnczGLe85wg9Nrk1DN3dB/NUnUsv7DnnG4gSM1txI6v2JhPytWDWWrPYE6cmeVlA+4Hb6W8dwTpfQxO+4=" ;
    npx:hasSignatureTarget this: ;
    npx:signedBy orcid:0000-0002-1267-0234 .
}