query-1ec8c969205302638f9d5119a60b84db

rq turtle/ttl

14:25, 22 November 2021 (UTC)) talk (Nthep all the entries get duplicated. ?club wdt:P625 ?coord.If I add in any lines like : I think this is what you're after...Nthep@

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
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#>
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)
# using the p prefix to access qualifiers
  ?club p:P115 ?stadium_statement . #items that have stadium(s)...
# note we use ps to get the actual value and pq for the qualifiers
  ?stadium_statement ps:P115 ?stadium . # ?stadium now holds the actual Q value
  OPTIONAL {?stadium_statement pq:P580 ?inuse.} #... with start date qualifier
  OPTIONAL {?stadium_statement pq:P582 ?oou.} #... with end date qualifier
  OPTIONAL {?stadium wdt:P625 ?coord } # assuming you want the stadium coordinates
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}ORDER BY ASC(?clubLabel) DESC(?startyear)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?club") v1("?clubLabel"):::projected v8("?coord"):::projected v9("?endyear") v6("?inuse"):::projected v7("?oou"):::projected v5("?stadium") v4("?stadium_statement") v9("?startyear") c9(["bd:serviceParam"]):::iri c2(["wd:Q1127622"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en"]):::literal v3 --"p:direct/P463"--> c2 v3 --"p:P115"--> v4 v4 --"p:statement/P115"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P580".-> v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P582".-> v7 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:direct/P625".-> v8 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind0[/"year-from-dateTime(?inuse)"/] v6 --o bind0 bind0 --as--o v9 bind1[/"year-from-dateTime(?oou)"/] v7 --o bind1 bind1 --as--o v9