A set of SPARQL examples that are used in different TGX resources
License: https://www.gnu.org/licenses/gpl-3.0
Uses method in: https://github.com/WDscholia/scholia/tree/master/scholia/app/templates/event_upcoming-deadlines.sparql
Event aspect: upcoming deadlines
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://wikidata.org/entity/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT
?date
?deadline ?deadlineLabel
?short_name
?event ?eventLabel (CONCAT("/event/", SUBSTR(STR(?event), 32)) AS ?eventUrl)
?location ?locationLabel (CONCAT("/location/", SUBSTR(STR(?location), 32)) AS ?locationUrl)
WITH {
SELECT
?datetime ?deadline ?event
(SAMPLE(?location_) AS ?location)
(SAMPLE(?short_name_) AS ?short_name)
WHERE {
?event p:P793 ?key_event_statement .
?key_event_statement ps:P793 ?deadline ;
pq:P585 ?datetime .
?deadline wdt:P279* wd:Q2404808 .
# Subtract a day from now to get events on the now date
FILTER (NOW() - "P1DT0H0M0.000S"^^xsd:duration < ?datetime)
OPTIONAL { ?event wdt:P276 ?location_ }
OPTIONAL { ?event wdt:P1813 ?short_name_ }
}
GROUP BY ?datetime ?deadline ?event
ORDER BY(?datetime)
LIMIT 200
} AS %events
WHERE {
INCLUDE %events
BIND(xsd:date(?datetime) AS ?date)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en,da,de,es,fr,jp,nl,no,ru,sv,zh". }
}
ORDER BY(?date)
graph TD