query-9ef869e091883e48cd277a9d1b72855d
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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#>
SELECT ?team ?teamLabel ?homeVenueQCode ?homeVenueQCodeLabel ?start ?end WHERE {
VALUES ?team { wd:Q272220}
OPTIONAL { ?team p:P115 ?stat .
?stat ps:P115 ?homeVenueQCode.
OPTIONAL {?stat pq:P580 ?start .}
OPTIONAL {?stat pq:P582 ?end .}
}
bind(if(!bound(?end),"2020-02-01"^^xsd:date,?end) as ?end1)
FILTER("2020-02-01"^^xsd:date >= ?start && "2020-02-01"^^xsd:date <= ?end1).
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} order by ?start
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?end"):::projected
v7("?end1")
v5("?homeVenueQCode"):::projected
v1("?start"):::projected
v4("?stat")
v3("?team"):::projected
c7(["bd:serviceParam"]):::iri
c9(["en"]):::literal
f0[["'2020-02-01^^xsd:date' >= ?start'2020-02-01^^xsd:date' <= ?end1"]]
f0 --> v1
f0 --> v7
bind1[/VALUES ?team/]
bind1-->v3
bind10(["wd:Q272220"])
bind10 --> bind1
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:P115".-> v4
v4 --"p:statement/P115"--> v5
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P580".-> v1
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P582".-> v6
end
end
bind2[/"if(not bound(?end),'2020-02-01^^xsd:date',?end)"/]
v6 --o bind2
bind2 --as--o v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end