📌 Nanopublication
Get recent and upcoming events
grlc-query
This is a local identifier minted within the nanopublication.
https://w3id.org/np/RA1PkOy-Jh.../get-recent-and-upcoming-events
https://w3id.org/kpxl/grlc/sparql
has the query
(this is a literal)
"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 ?event ?event_label ?status ?date ?np ("^" as ?np_label) where {
graph npa:graph {
?np npa:hasValidSignatureForPublicKeyHash ?pubkey .
filter not exists { ?npx npx:invalidates ?np ; npa:hasValidSignatureForPublicKeyHash ?pubkey . }
filter not exists { ?np npx:hasNanopubType npx:ExampleNanopub . }
?np npx:introduces ?event .
?np np:hasAssertion ?a .
?np dct:created ?npDate .
filter not exists {
?np2 npx:introduces ?event .
?np2 npa:hasValidSignatureForPublicKeyHash ?pubkey2 .
filter not exists { ?npx2 npx:invalidates ?np2 ; npa:hasValidSignatureForPublicKeyHash ?pubkey2 . }
?np2 dct:created ?npDate2 .
filter(?npDate2 > ?npDate)
}
}
graph ?a {
?event a gen:Space .
?event a gen:Event .
?event rdfs:label ?event_label .
?event schema:startDate ?datetime .
optional { ?event schema:endDate ?endDatetime . }
}
bind(xsd:date(substr(str(?datetime), 0, 11)) as ?date)
bind(xsd:date(substr(str(now()), 0, 11)) as ?today)
optional { bind(xsd:date(substr(str(?endDatetime), 0, 11)) as ?endDate) }
bind(if(bound(?endDate), ?endDate, ?date) as ?effectiveEnd)
filter(?date >= ?today || ?effectiveEnd >= ?today - "P7D"^^xsd:duration)
bind(if(?effectiveEnd < ?today, 1, if(?date > ?today, 3, 2)) as ?statusOrder)
bind(if(?date > ?today, "upcoming", if(?effectiveEnd >= ?today, "ongoing", "recently concluded")) as ?status)
} order by ?statusOrder ?date"
.
Tobias Kuhn,
20 Mar 2026, 19:35:34 UTC
run this query
Raw formats
TriG(txt),
JSON-LD(txt),
N-Quads(txt),
XML(txt)