query-ca3c758b66ae57f0327f1108b0a5e7ab
TODO
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 DISTINCT ?municip ?municipLabel ?statutLabel ?mrcLabel ?regionLabel
WHERE
{
?municip p:P31 ?statement.
{?statement ps:P31/wdt:P279* wd:Q3327873} union {?statement ps:P31 wd:Q3518810}
FILTER NOT EXISTS {?statement pq:P582 ?pqfin . }
?municip wdt:P31 ?statut .
?municip wdt:P131 ?mrc .
?mrc wdt:P131 ?region .
?region wdt:P131 wd:Q176 .
Optional {?municip wdt:P2100 ?ctq .}
FILTER NOT EXISTS { ?municip wdt:P2100 ?x }
FILTER NOT EXISTS { ?municip wdt:P576 ?dissolu}
FILTER NOT EXISTS { ?municip wdt:P582 ?end }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en","fr" .
}
}
ORDER BY ?regionLabel ?mrcLabel ?municipLabel
LIMIT 1000
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v13("?ctq")
v6("?dissolu")
v5("?end")
v11("?mrc")
v2("?mrcLabel"):::projected
v4("?municip"):::projected
v3("?municipLabel"):::projected
v9("?pqfin")
v12("?region")
v1("?regionLabel"):::projected
v8("?statement")
v10("?statut")
v7("?x")
a1((" "))
c16(["en"]):::literal
c17(["fr"]):::literal
c8(["wd:Q3327873"]):::iri
c9(["wd:Q3518810"]):::iri
c14(["bd:serviceParam"]):::iri
c12(["wd:Q176"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"p:direct/P582"--> e0v2
e0v2("?end"):::projected
e0v1("?municip"):::projected
end
f0--EXISTS--> f0e0
f0 --> v4
f0 --> c1
f0 --> v5
v4 --"p:direct/P582"--> v5
f1[["not "]]
subgraph f1e1["Exists Clause"]
e1v1 --"p:direct/P576"--> e1v2
e1v2("?dissolu"):::projected
e1v1("?municip"):::projected
end
f1--EXISTS--> f1e1
f1 --> v4
f1 --> c2
f1 --> v6
v4 --"p:direct/P576"--> v6
f2[["not "]]
subgraph f2e2["Exists Clause"]
e2v1 --"p:direct/P2100"--> e2v2
e2v1("?municip"):::projected
e2v2("?x"):::projected
end
f2--EXISTS--> f2e2
f2 --> v4
f2 --> c3
f2 --> v7
v4 --"p:direct/P2100"--> v7
f3[["not "]]
subgraph f3e3["Exists Clause"]
e3v1 --"p:qualifier/P582"--> e3v2
e3v2("?pqfin"):::projected
e3v1("?statement"):::projected
end
f3--EXISTS--> f3e3
f3 --> v8
f3 --> c4
f3 --> v9
v8 --"p:qualifier/P582"--> v9
v4 --"p:P31"--> v8
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v8 --"p:statement/P31"--> c9
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v8 --"p:statement/P31"--> a1
a1 --"p:direct/P279"--> c8
end
union0r <== or ==> union0l
end
v4 --"p:direct/P31"--> v10
v4 --"p:direct/P131"--> v11
v11 --"p:direct/P131"--> v12
v12 --"p:direct/P131"--> c12
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P2100".-> v13
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
c14 --"wikibase:language"--> c17
end