sparql-examples

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

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

205

rq turtle/ttl

Venue aspect: Author awards for a specific venue

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#>
PREFIX target: <http://www.wikidata.org/entity/Q6294930>

# title: Author awards for a specific venue
SELECT DISTINCT
  ?year 
  ?author ?authorLabel
  ?award ?awardLabel ?awardDescription
WHERE {
  [] wdt:P1433 target: ;
     wdt:P50 ?author .
  ?author p:P166 ?award_statement .
  ?award_statement ps:P166 ?award .
  OPTIONAL {
    { ?award_statement pq:P585 ?time }
    UNION
    { ?award_statement pq:P580 ?time }
    BIND(YEAR(?time) AS ?year)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }  
}
ORDER BY DESC(?year)
LIMIT 500

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?author"):::projected 
  v4("?award"):::projected 
  v3("?award_statement")
  v5("?time")
  v6("?year"):::projected 
  a1((" "))
  c2([http://www.wikidata.org/entity/Q6294930]):::iri 
  c9([http://www.bigdata.com/rdf#serviceParam]):::iri 
  c11(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  a1 --"p:direct/P1433"-->  c2
  a1 --"p:direct/P50"-->  v2
  v2 --"p:P166"-->  v3
  v3 --"p:statement/P166"-->  v4
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    subgraph union0[" Union "]
    subgraph union0l[" "]
      style union0l fill:#abf,stroke-dasharray: 3 3;
      v3 -."p:qualifier/P580".->  v5
    end
    subgraph union0r[" "]
      style union0r fill:#abf,stroke-dasharray: 3 3;
      v3 --"p:qualifier/P585"-->  v5
    end
    union0r <== or ==> union0l
    end
    bind0[/"year-from-dateTime(?time)"/]
    v5 --o bind0
    bind0 --as--o v6
  end
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c9 --"wikibase:language"-->  c11
  end