sparql-examples

A set of SPARQL examples that are used in different TGX resources

View the Project on GitHub BiGCAT-UM/sparql-examples

073

rq turtle/ttl

Event-series aspect: number of participants

Use at

PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
#defaultView:LineChart

PREFIX target: <http://www.wikidata.org/entity/Q47501052>

SELECT 
  ?year
  ?number_of_participants
WHERE {
  ?event wdt:P179 target: ;
         wdt:P580 ?datetime ;
         wdt:P1132 ?number_of_participants .
  
  BIND(STR(YEAR(?datetime)) AS ?year)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
ORDER BY ?year

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?datetime")
  v2("?event")
  v4("?number_of_participants"):::projected 
  v5("?year"):::projected 
  c6([http://www.bigdata.com/rdf#serviceParam]):::iri 
  c2([http://www.wikidata.org/entity/Q47501052]):::iri 
  c8(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  v2 --"p:direct/P179"-->  c2
  v2 --"p:direct/P580"-->  v3
  v2 --"p:direct/P1132"-->  v4
  bind0[/"str(year-from-dateTime(?datetime))"/]
  v3 --o bind0
  bind0 --as--o v5
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c6 --"wikibase:language"-->  c8
  end