query-56fc973d4c1e916d5032548625207114
Clifflandis(P3831)object of statement has role (Q105528942)next level in hierarchy Mahir256
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 ?organization ?organizationLabel ?street_address ?coordinate_location
?phone_number ?e_mail_address ?website ?Facebook_ID ?Twitter_username ?county
WHERE
{
{
{
SELECT ?organization ?located_in_the_administrative_territorial_entity ?county
WHERE
{
{
SELECT DISTINCT ?organization ?located_in_the_administrative_territorial_entity ?county
WHERE
{
VALUES (?located_in_the_administrative_territorial_entity ?county) {
(wd:Q486843 "Bleckley County")
(wd:Q498301 "Pulaski County")
(wd:Q486791 "Wilcox County")
(wd:Q115272 "Dodge County")
(wd:Q691614 "Telfair County")
(wd:Q498332 "Wheeler County")
(wd:Q493125 "Montgomery County")
(wd:Q376822 "Toombs County")
(wd:Q505310 "Tattnall County")
(wd:Q111867 "Ben Hill County")
(wd:Q492057 "Irwin County")
(wd:Q156503 "Coffee County")
(wd:Q493071 "Jeff Davis County")
(wd:Q488186 "Appling County")
(wd:Q488219 "Bacon County")
(wd:Q488868 "Berrien County")
(wd:Q488194 "Atkinson County")
(wd:Q498353 "Ware County")
(wd:Q492070 "Lanier County")
(wd:Q493029 "Echols County")
(wd:Q486167 "Clinch County")
}
?organization wdt:P131+ ?located_in_the_administrative_territorial_entity .
FILTER NOT EXISTS { ?organization wdt:P576 [] . }
VALUES ?instance_of {
wd:Q473972
wd:Q3152824
wd:Q210272
wd:Q570116
wd:Q57660343
wd:Q2668072
wd:Q188913
wd:Q15243209
wd:Q2867476
wd:Q635719
wd:Q7840289
wd:Q42998
wd:Q41710
wd:Q51369558
}
?organization wdt:P31/wdt:P279* ?instance_of .
}
} # The administrative unit (here county) is mentioned directly in the organization item
FILTER EXISTS { ?organization wdt:P131 ?located_in_the_administrative_territorial_entity . }
}
}}
UNION
{
{
SELECT ?organization ?located_in_the_administrative_territorial_entity ?county
WHERE
{
{
SELECT DISTINCT ?organization ?located_in_the_administrative_territorial_entity ?county
WHERE
{
VALUES (?located_in_the_administrative_territorial_entity ?county) {
(wd:Q486843 "Bleckley County")
(wd:Q498301 "Pulaski County")
(wd:Q486791 "Wilcox County")
(wd:Q115272 "Dodge County")
(wd:Q691614 "Telfair County")
(wd:Q498332 "Wheeler County")
(wd:Q493125 "Montgomery County")
(wd:Q376822 "Toombs County")
(wd:Q505310 "Tattnall County")
(wd:Q111867 "Ben Hill County")
(wd:Q492057 "Irwin County")
(wd:Q156503 "Coffee County")
(wd:Q493071 "Jeff Davis County")
(wd:Q488186 "Appling County")
(wd:Q488219 "Bacon County")
(wd:Q488868 "Berrien County")
(wd:Q488194 "Atkinson County")
(wd:Q498353 "Ware County")
(wd:Q492070 "Lanier County")
(wd:Q493029 "Echols County")
(wd:Q486167 "Clinch County")
}
?organization wdt:P131+ ?located_in_the_administrative_territorial_entity .
FILTER NOT EXISTS { ?organization wdt:P576 [] . }
VALUES ?instance_of {
wd:Q473972
wd:Q3152824
wd:Q210272
wd:Q570116
wd:Q57660343
wd:Q2668072
wd:Q188913
wd:Q15243209
wd:Q2867476
wd:Q635719
wd:Q7840289
wd:Q42998
wd:Q41710
wd:Q51369558
}
?organization wdt:P31/wdt:P279* ?instance_of .
}
} # The administrative unit (here county) is deeper in the P131 hierarchy
# AND there is no "next level in hierarchy" qualifier in another P131 statement
FILTER EXISTS
{
?organization p:P131 ?P131_statement .
?P131_statement ps:P131 ?first_level_adm_unit .
?first_level_adm_unit wdt:P131+ ?located_in_the_administrative_territorial_entity .
FILTER NOT EXISTS
{
?organization p:P131 ?another_P131_statement .
FILTER (?another_P131_statement != ?P131_statement)
?another_P131_statement pq:P3831 wd:Q105528942 .
}
}
}
}}
OPTIONAL { ?organization wdt:P6375 ?street_address . }
OPTIONAL { ?organization wdt:P625 ?coordinate_location . }
OPTIONAL { ?organization wdt:P1329 ?phone_number . }
OPTIONAL { ?organization wdt:P968 ?e_mail_address . }
OPTIONAL { ?organization wdt:P856 ?website . }
OPTIONAL { ?organization wdt:P2013 ?Facebook_ID . }
OPTIONAL { ?organization wdt:P2002 ?Twitter_username . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY (?organization)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v13("?Facebook_ID"):::projected
v6("?P131_statement")
v14("?Twitter_username"):::projected
v5("?another_P131_statement")
v9("?coordinate_location"):::projected
v8("?county"):::projected
v11("?e_mail_address"):::projected
v7("?first_level_adm_unit")
v8("?instance_of")
v8("?located_in_the_administrative_territorial_entity")
v1("?organization"):::projected
v10("?phone_number"):::projected
v8("?street_address"):::projected
v12("?website"):::projected
a1((" "))
a3((" "))
a2((" "))
a4((" "))
c19(["en"]):::literal
c7(["wd:Q105528942"]):::iri
c17(["bd:serviceParam"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
f0[[" "]]
subgraph f0e0["Exists Clause"]
e0f0[["not "]]
subgraph e0f0e0e0["Exists Clause"]
e0e0f0[["?another_P131_statement != ?P131_statement"]]
e0e0f0 --> e0e0v1
e0e0f0 --> e0e0v2
e0e0v3 --"p:P131"--> e0e0v1
e0e0v1 --"p:qualifier/P3831"--> e0e0c3
e0e0v2("?P131_statement"):::projected
e0e0v1("?another_P131_statement"):::projected
e0e0v3("?organization"):::projected
e0e0c3(["wd:Q105528942"]):::iri
end
e0f0--EXISTS--> e0f0e0e0
e0f0 --> e0v1
e0f0 --> e0v2
e0f0 --> e0v3
e0f0 --> e0c1
e0f0 --> e0c2
e0f0 --> e0c3
e0f1[["?another_P131_statement != ?P131_statement"]]
e0f1 --> e0v1
e0f1 --> e0v2
e0v3 --"p:P131"--> e0v1
e0v1 --"p:qualifier/P3831"--> e0c3
e0v3 --"p:P131"--> e0v2
e0v2 --"p:statement/P131"--> e0v4
e0v4 --"p:direct/P131"--> e0v5
e0v2("?P131_statement"):::projected
e0v1("?another_P131_statement"):::projected
e0v4("?first_level_adm_unit"):::projected
e0v5("?located_in_the_administrative_territorial_entity"):::projected
e0v3("?organization"):::projected
e0c3(["wd:Q105528942"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v5
f0 --> v6
f0 --> v1
f0 --> c5
f0 --> c6
f0 --> c7
f0 --> c8
f0 --> v7
f0 --> c1
f0 --> v8
f1[["not "]]
subgraph f1e1["Exists Clause"]
e1f0[["?another_P131_statement != ?P131_statement"]]
e1f0 --> e1v1
e1f0 --> e1v2
e1v3 --"p:P131"--> e1v1
e1v1 --"p:qualifier/P3831"--> e1c3
e1v2("?P131_statement"):::projected
e1v1("?another_P131_statement"):::projected
e1v3("?organization"):::projected
e1c3(["wd:Q105528942"]):::iri
end
f1--EXISTS--> f1e1
f1 --> v5
f1 --> v6
f1 --> v1
f1 --> c5
f1 --> c6
f1 --> c7
f2[["?another_P131_statement != ?P131_statement"]]
f2 --> v5
f2 --> v6
v1 --"p:P131"--> v5
v5 --"p:qualifier/P3831"--> c7
v1 --"p:P131"--> v6
v6 --"p:statement/P131"--> v7
v7 --"p:direct/P131"--> v8
f3[["not "]]
subgraph f3e2["Exists Clause"]
e2v1 --"p:direct/P576"--> e2a1
e2v1("?organization"):::projected
e2a1((" ")):::projected
end
f3--EXISTS--> f3e2
f3 --> v1
f3 --> c2
f3 --> a3
v1 --"p:direct/P576"--> a3
bind4[/VALUES ?county ?located_in_the_administrative_territorial_entity/]
bind4-->v8
bind4-->v8
bind40(["wd:Q486843"])
bind40 --> bind4
bind41(["Bleckley County"])
bind41 --> bind4
bind42(["wd:Q498301"])
bind42 --> bind4
bind43(["Pulaski County"])
bind43 --> bind4
bind44(["wd:Q486791"])
bind44 --> bind4
bind45(["Wilcox County"])
bind45 --> bind4
bind46(["wd:Q115272"])
bind46 --> bind4
bind47(["Dodge County"])
bind47 --> bind4
bind48(["wd:Q691614"])
bind48 --> bind4
bind49(["Telfair County"])
bind49 --> bind4
bind410(["wd:Q498332"])
bind410 --> bind4
bind411(["Wheeler County"])
bind411 --> bind4
bind412(["wd:Q493125"])
bind412 --> bind4
bind413(["Montgomery County"])
bind413 --> bind4
bind414(["wd:Q376822"])
bind414 --> bind4
bind415(["Toombs County"])
bind415 --> bind4
bind416(["wd:Q505310"])
bind416 --> bind4
bind417(["Tattnall County"])
bind417 --> bind4
bind418(["wd:Q111867"])
bind418 --> bind4
bind419(["Ben Hill County"])
bind419 --> bind4
bind420(["wd:Q492057"])
bind420 --> bind4
bind421(["Irwin County"])
bind421 --> bind4
bind422(["wd:Q156503"])
bind422 --> bind4
bind423(["Coffee County"])
bind423 --> bind4
bind424(["wd:Q493071"])
bind424 --> bind4
bind425(["Jeff Davis County"])
bind425 --> bind4
bind426(["wd:Q488186"])
bind426 --> bind4
bind427(["Appling County"])
bind427 --> bind4
bind428(["wd:Q488219"])
bind428 --> bind4
bind429(["Bacon County"])
bind429 --> bind4
bind430(["wd:Q488868"])
bind430 --> bind4
bind431(["Berrien County"])
bind431 --> bind4
bind432(["wd:Q488194"])
bind432 --> bind4
bind433(["Atkinson County"])
bind433 --> bind4
bind434(["wd:Q498353"])
bind434 --> bind4
bind435(["Ware County"])
bind435 --> bind4
bind436(["wd:Q492070"])
bind436 --> bind4
bind437(["Lanier County"])
bind437 --> bind4
bind438(["wd:Q493029"])
bind438 --> bind4
bind439(["Echols County"])
bind439 --> bind4
bind440(["wd:Q486167"])
bind440 --> bind4
bind441(["Clinch County"])
bind441 --> bind4
v1 --"p:direct/P131"--> v8
bind5[/VALUES ?instance_of/]
bind5-->v8
bind50(["wd:Q473972"])
bind50 --> bind5
bind51(["wd:Q3152824"])
bind51 --> bind5
bind52(["wd:Q210272"])
bind52 --> bind5
bind53(["wd:Q570116"])
bind53 --> bind5
bind54(["wd:Q57660343"])
bind54 --> bind5
bind55(["wd:Q2668072"])
bind55 --> bind5
bind56(["wd:Q188913"])
bind56 --> bind5
bind57(["wd:Q15243209"])
bind57 --> bind5
bind58(["wd:Q2867476"])
bind58 --> bind5
bind59(["wd:Q635719"])
bind59 --> bind5
bind510(["wd:Q7840289"])
bind510 --> bind5
bind511(["wd:Q42998"])
bind511 --> bind5
bind512(["wd:Q41710"])
bind512 --> bind5
bind513(["wd:Q51369558"])
bind513 --> bind5
v1 --"p:direct/P31"--> a4
a4 --"p:direct/P279"--> v8
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f6[[" "]]
subgraph f6e3["Exists Clause"]
e3v1 --"p:direct/P131"--> e3v2
e3v2("?located_in_the_administrative_territorial_entity"):::projected
e3v1("?organization"):::projected
end
f6--EXISTS--> f6e3
f6 --> v1
f6 --> c1
f6 --> v8
v1 --"p:direct/P131"--> v8
f7[["not "]]
subgraph f7e4["Exists Clause"]
e4v1 --"p:direct/P576"--> e4a1
e4v1("?organization"):::projected
e4a1((" ")):::projected
end
f7--EXISTS--> f7e4
f7 --> v1
f7 --> c2
f7 --> a1
v1 --"p:direct/P576"--> a1
bind8[/VALUES ?county ?located_in_the_administrative_territorial_entity/]
bind8-->v8
bind8-->v8
bind80(["wd:Q486843"])
bind80 --> bind8
bind81(["Bleckley County"])
bind81 --> bind8
bind82(["wd:Q498301"])
bind82 --> bind8
bind83(["Pulaski County"])
bind83 --> bind8
bind84(["wd:Q486791"])
bind84 --> bind8
bind85(["Wilcox County"])
bind85 --> bind8
bind86(["wd:Q115272"])
bind86 --> bind8
bind87(["Dodge County"])
bind87 --> bind8
bind88(["wd:Q691614"])
bind88 --> bind8
bind89(["Telfair County"])
bind89 --> bind8
bind810(["wd:Q498332"])
bind810 --> bind8
bind811(["Wheeler County"])
bind811 --> bind8
bind812(["wd:Q493125"])
bind812 --> bind8
bind813(["Montgomery County"])
bind813 --> bind8
bind814(["wd:Q376822"])
bind814 --> bind8
bind815(["Toombs County"])
bind815 --> bind8
bind816(["wd:Q505310"])
bind816 --> bind8
bind817(["Tattnall County"])
bind817 --> bind8
bind818(["wd:Q111867"])
bind818 --> bind8
bind819(["Ben Hill County"])
bind819 --> bind8
bind820(["wd:Q492057"])
bind820 --> bind8
bind821(["Irwin County"])
bind821 --> bind8
bind822(["wd:Q156503"])
bind822 --> bind8
bind823(["Coffee County"])
bind823 --> bind8
bind824(["wd:Q493071"])
bind824 --> bind8
bind825(["Jeff Davis County"])
bind825 --> bind8
bind826(["wd:Q488186"])
bind826 --> bind8
bind827(["Appling County"])
bind827 --> bind8
bind828(["wd:Q488219"])
bind828 --> bind8
bind829(["Bacon County"])
bind829 --> bind8
bind830(["wd:Q488868"])
bind830 --> bind8
bind831(["Berrien County"])
bind831 --> bind8
bind832(["wd:Q488194"])
bind832 --> bind8
bind833(["Atkinson County"])
bind833 --> bind8
bind834(["wd:Q498353"])
bind834 --> bind8
bind835(["Ware County"])
bind835 --> bind8
bind836(["wd:Q492070"])
bind836 --> bind8
bind837(["Lanier County"])
bind837 --> bind8
bind838(["wd:Q493029"])
bind838 --> bind8
bind839(["Echols County"])
bind839 --> bind8
bind840(["wd:Q486167"])
bind840 --> bind8
bind841(["Clinch County"])
bind841 --> bind8
v1 --"p:direct/P131"--> v8
bind9[/VALUES ?instance_of/]
bind9-->v8
bind90(["wd:Q473972"])
bind90 --> bind9
bind91(["wd:Q3152824"])
bind91 --> bind9
bind92(["wd:Q210272"])
bind92 --> bind9
bind93(["wd:Q570116"])
bind93 --> bind9
bind94(["wd:Q57660343"])
bind94 --> bind9
bind95(["wd:Q2668072"])
bind95 --> bind9
bind96(["wd:Q188913"])
bind96 --> bind9
bind97(["wd:Q15243209"])
bind97 --> bind9
bind98(["wd:Q2867476"])
bind98 --> bind9
bind99(["wd:Q635719"])
bind99 --> bind9
bind910(["wd:Q7840289"])
bind910 --> bind9
bind911(["wd:Q42998"])
bind911 --> bind9
bind912(["wd:Q41710"])
bind912 --> bind9
bind913(["wd:Q51369558"])
bind913 --> bind9
v1 --"p:direct/P31"--> a2
a2 --"p:direct/P279"--> v8
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P6375".-> v8
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P625".-> v9
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P1329".-> v10
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P968".-> v11
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P856".-> v12
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P2013".-> v13
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v1 -."p:direct/P2002".-> v14
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c17 --"wikibase:language"--> c19
end