sparql-examples

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

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

070

rq turtle/ttl

Event-series aspect: acceptance rate

Use at

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 wikibase: <http://wikiba.se/ontology#>
#defaultView:LineChart

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

SELECT 
  ?year
  ?acceptance_rate 
  ?trackLabel
WHERE {
  ?event wdt:P179 target: ;
         wdt:P580 ?datetime ;
         p:P5822 ?acceptance_rate_statement .
  ?acceptance_rate_statement ps:P5822 ?acceptance_rate .
  OPTIONAL { ?acceptance_rate_statement pq:P518 ?track_ . }
  BIND(COALESCE(?track_, "total") AS ?track)
  
  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;
  v5("?acceptance_rate"):::projected 
  v4("?acceptance_rate_statement")
  v3("?datetime")
  v2("?event")
  v7("?track")
  v6("?track_")
  v8("?year"):::projected 
  c8([http://www.bigdata.com/rdf#serviceParam]):::iri 
  c2([http://www.wikidata.org/entity/Q47501052]):::iri 
  c10(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  v2 --"p:direct/P179"-->  c2
  v2 --"p:direct/P580"-->  v3
  v2 --"p:P5822"-->  v4
  v4 --"p:statement/P5822"-->  v5
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v4 -."p:qualifier/P518".->  v6
  end
  bind0[/"?track_'total'"/]
  v6 --o bind0
  bind0 --as--o v7
  bind1[/"str(year-from-dateTime(?datetime))"/]
  v3 --o bind1
  bind1 --as--o v8
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c8 --"wikibase:language"-->  c10
  end