query-b6b21f7d6825dc7b45db88f105e14ffa
Propertiesinstance of (P31)subclass of (P279)headquarters location (P159)place of publication (P291)located in the administrative territorial entity (P131)population (P1082)inception (P571)P573
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 bd: <http://www.bigdata.com/rdf#>
#defaultView:Timeline
SELECT DISTINCT ?subj ?subjLabel ?pubplace1Label ?pubplace2Label ?startdt
WHERE
{
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
VALUES ?bustypes {
wd:Q11032 #wd:Q2302208 #wd:Q1002697 #
}
?subj wdt:P31/wdt:P279* ?bustypes .
OPTIONAL {?subj wdt:P159 ?pubplace1.}
OPTIONAL {?subj wdt:P291 ?pubplace2.}
{
SELECT DISTINCT ?town WHERE
{
VALUES ?typesOfPlaces { wd:Q3957 wd:Q515 wd:Q532 wd:Q7543008 wd:Q3257686 }
?town (wdt:P31/(wdt:P279*)) ?typesOfPlaces.
?town wdt:P131 ?cooncil.
{
SELECT DISTINCT ?cooncil WHERE
{
?cooncil wdt:P31 wd:Q15060255.
}
}
?town wdt:P1082 ?population.
FILTER (?population >3000).
}
}
{ ?subj wdt:P159 ?town} UNION { ?subj wdt:P291 ?town}.
OPTIONAL {?subj wdt:P571 ?startdt.}.
#OPTIONAL {?subj wdt:P573 ?enddt.}.
} ORDER BY ?subjLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?bustypes")
v9("?cooncil")
v6("?population")
v4("?pubplace1")
v5("?pubplace2")
v10("?startdt"):::projected
v3("?subj"):::projected
v1("?subjLabel"):::projected
v8("?town")
v7("?typesOfPlaces")
a1((" "))
a2((" "))
c11(["wd:Q15060255"]):::iri
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
bind0[/VALUES ?bustypes/]
bind0-->v2
bind00(["wd:Q11032"])
bind00 --> bind0
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P159".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P291".-> v5
end
f1[["?population > '3000^^xsd:integer'"]]
f1 --> v6
bind2[/VALUES ?typesOfPlaces/]
bind2-->v7
bind20(["wd:Q3957"])
bind20 --> bind2
bind21(["wd:Q515"])
bind21 --> bind2
bind22(["wd:Q532"])
bind22 --> bind2
bind23(["wd:Q7543008"])
bind23 --> bind2
bind24(["wd:Q3257686"])
bind24 --> bind2
v8 --"wdt:P31"--> a2
a2 --"wdt:P279"--> v7
v8 --"wdt:P131"--> v9
v9 --"wdt:P31"--> c11
v8 --"wdt:P1082"--> v6
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P291"--> v8
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P159"--> v8
end
union0r <== or ==> union0l
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P571".-> v10
end