query-a49d2fbac7ca8ae7781bdc11c9138652

rq turtle/ttl

title:Booker Prize statements with multiple point-in-time qualifiers SELECT ?item ?itemLabel ?awardLabel ?time1 (MIN(?time2) AS ?othertime) WHERE { VALUES ?award{wd:Q160082 wd:Q2052291} ?item p:P166|p:P1411 ?s. ?s ps:P166|ps:P1411 ?award . ?s pq:P585 ?time1. ?s pq:P585 ?time2 FILTER(?time1 > ?time2) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } } GROUP BY ?item ?itemLabel ?awardLabel ?time1 ORDER BY ?itemLabel

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Booker Prize statements with multiple point-in-time qualifiers
SELECT ?item ?itemLabel ?awardLabel ?time1 (MIN(?time2) AS ?othertime) WHERE {
  VALUES ?award{wd:Q160082 wd:Q2052291}
?item p:P166|p:P1411 ?s. ?s ps:P166|ps:P1411 ?award .
  ?s pq:P585 ?time1. ?s pq:P585 ?time2 FILTER(?time1 > ?time2)
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} GROUP BY ?item ?itemLabel ?awardLabel ?time1
ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?award") v5("?item"):::projected v1("?itemLabel"):::projected v7("?othertime") v6("?s") v2("?time1"):::projected v3("?time2"):::projected c7(["bd:serviceParam"]):::iri c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?time1 > ?time2"]] f0 --> v2 f0 --> v3 bind1[/VALUES ?award/] bind1-->v4 bind10(["wd:Q160082"]) bind10 --> bind1 bind11(["wd:Q2052291"]) bind11 --> bind1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v5 --"p:P1411"--> v6 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v5 --"p:P166"--> v6 end union0r <== or ==> union0l end subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v6 --"p:statement/P1411"--> v4 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v6 --"p:statement/P166"--> v4 end union1r <== or ==> union1l end v6 --"p:qualifier/P585"--> v2 v6 --"p:qualifier/P585"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end bind3[/"min(?time2)"/] v3 --o bind3 bind3 --as--o v7