query-8dd05d97a83127487f8a799c1f6bd6fe
Robertsilen
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 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 ?item ?itemLabel ?instanceofLabel ?fdkommunLabel ?fdk_end ?kommunLabel ?landskapLabel
WHERE
{
?item wdt:P131 ?kommun. ?kommun wdt:P31 wd:Q856076. ?kommun wdt:P37 wd:Q9027.
OPTIONAL
{
?item p:P131 ?fdk_stm .
?fdk_stm a wikibase:BestRank .
?fdk_stm ps:P131 ?fdkommun .
?fdkommun wdt:P31 wd:Q17468533 .
?fdk_stm pq:P582 ?fdk_end .
}
FILTER NOT EXISTS
{
?item p:P131 ?fdk_stm2 .
?fdk_stm2 a wikibase:BestRank .
?fdk_stm2 ps:P131/wdt:P31 wd:Q17468533 .
?fdk_stm2 pq:P582 ?fdk_end2 .
FILTER (?fdk_end2 < ?fdk_end)
}
OPTIONAL{?kommun wdt:P131 ?landskap. ?landskap wdt:P31 wd:Q193512.}
OPTIONAL{?item wdt:P31 ?instanceof.}
SERVICE wikibase:label { bd:serviceParam wikibase:language "sv,fi,en,de". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?fdk_end"):::projected
v1("?fdk_end2")
v6("?fdk_stm")
v4("?fdk_stm2")
v7("?fdkommun")
v9("?instanceof")
v3("?item"):::projected
v5("?kommun")
v8("?landskap")
a1((" "))
c9(["wd:Q856076"]):::iri
c3(["wikibase:BestRank"]):::iri
c6(["wd:Q17468533"]):::iri
c16(["sv,fi,en,de"]):::literal
c11(["wd:Q9027"]):::iri
c14(["bd:serviceParam"]):::iri
c12(["wd:Q193512"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0f0[["?fdk_end2 < ?fdk_end"]]
e0f0 --> e0v1
e0f0 --> e0v2
e0v3 --"p:P131"--> e0v4
e0v4 --"a"--> e0c3
e0v4 --"p:statement/P131"--> e0a1
e0a1 --"p:direct/P31"--> e0c6
e0v4 --"p:qualifier/P582"--> e0v1
e0v2("?fdk_end"):::projected
e0v1("?fdk_end2"):::projected
e0v4("?fdk_stm2"):::projected
e0v3("?item"):::projected
e0a1((" ")):::projected
e0c3(["wikibase:BestRank"]):::iri
e0c6(["wd:Q17468533"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> v2
f0 --> v3
f0 --> c1
f0 --> v4
f0 --> c2
f0 --> c3
f0 --> c4
f0 --> a1
f0 --> c5
f0 --> c6
f0 --> c7
f1[["?fdk_end2 < ?fdk_end"]]
f1 --> v1
f1 --> v2
v3 --"p:P131"--> v4
v4 --"a"--> c3
v4 --"p:statement/P131"--> a1
a1 --"p:direct/P31"--> c6
v4 --"p:qualifier/P582"--> v1
v3 --"p:direct/P131"--> v5
v5 --"p:direct/P31"--> c9
v5 --"p:direct/P37"--> c11
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:P131".-> v6
v6 --"a"--> c3
v6 --"p:statement/P131"--> v7
v7 --"p:direct/P31"--> c6
v6 --"p:qualifier/P582"--> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P131".-> v8
v8 --"p:direct/P31"--> c12
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P31".-> v9
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end