query-920ec49b16ddba7f7b9dd7a4047a7a08
Submission from MisterSynergyYeah, clearly no SPARQL-only solution from me. It asks for too many things at once, particularly stuff that is difficult to get done in SPARQL. So I did not even consider to go this way. Instead, I chose Python again. Querying was fairly simple, since the data has a relatively simple structure/model, so it does not require in-depth SPARQL-, Wikidata-, nor domain knowledge. I simply queried via script:
Use at
- https://query.wikidata.org/sparql
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/>
SELECT ?item ?start ?end WHERE {
?s ps:P39 wd:Q77685926 .
OPTIONAL { ?s pq:P580 ?start }
OPTIONAL { ?s pq:P582 ?end }
?item p:P39 ?s .
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?end"):::projected
v4("?item"):::projected
v1("?s")
v2("?start"):::projected
c2(["wd:Q77685926"]):::iri
v1 --"p:statement/P39"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:qualifier/P580".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:qualifier/P582".-> v3
end
v4 --"p:P39"--> v1