sub:assertion {
sub:get-upcoming-and-ongoing-events dct:description "Returns all upcoming and ongoing events that are defined as Spaces, ordered by start date." ;
dct:license <
http://www.apache.org/licenses/LICENSE-2.0> ;
a grlc:grlc-query ;
rdfs:label "Get upcoming and ongoing events" ;
grlc:endpoint <
https://w3id.org/np/l/nanopub-query-1.1/repo/type/8ad572d99071cc1ba0c16e54087b43594bdd9e8b2cfb62d2a0b16945fc49e53c> ;
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 ?event ?event_label ?date ?description ?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 .
}
graph ?a {
?event a gen:Space .
?event a gen:Event .
?event rdfs:label ?event_label .
?event schema:startDate ?datetime .
optional { ?event schema:endDate ?endDatetime . }
optional { ?event dct:description ?description . }
}
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) }
filter(?date >= ?today || (bound(?endDate) && ?endDate >= ?today))
} order by ?date""" .
}