query-5495dbb5a0712c5c21bcfeaea1130829
rugby league groundsI'm trying to create a list of rugby league grounds in the UK ordered by club and the dates each club used each ground. I can get the clubs, grounds and dates but I can't work out how to insert the ground name and co-ordinates. This is what I have so far:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?clubLabel ?stadiumLabel ?coord (year(?inuse) as ?startyear) (year(?oou) as ?endyear) WHERE {
?club wdt:P463 wd:Q1127622. #find clubs that are members (P463) of the RFL (Q1127622)
?club p:P115 ?stadium. #items that have stadium(s)...
OPTIONAL {?stadium pq:P580 ?inuse.} #... with start date qualifier
OPTIONAL {?stadium pq:P582 ?oou.} #... with end date qualifier
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}ORDER BY ASC(?itemLabel) DESC(?startyear)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?club")
v7("?endyear")
v5("?inuse"):::projected
v1("?itemLabel")
v6("?oou"):::projected
v4("?stadium")
v7("?startyear")
c7(["bd:serviceParam"]):::iri
c2(["wd:Q1127622"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v3 --"p:direct/P463"--> c2
v3 --"p:P115"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P580".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P582".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind0[/"year-from-dateTime(?inuse)"/]
v5 --o bind0
bind0 --as--o v7
bind1[/"year-from-dateTime(?oou)"/]
v6 --o bind1
bind1 --as--o v7