query-5738460535e76ef91de9375aa52dceab
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 bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?place ?placeLabel ?fips ?gnis
WHERE
{
{ SELECT DISTINCT ?place { ?place wdt:P131* wd:Q759 } } OPTIONAL { ?place wdt:P774 ?fips }
OPTIONAL { ?place wdt:P590 ?gnis }
FILTER (BOUND(?fips) || BOUND(?gnis))
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY ASC(?placeLabel)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?fips"):::projected
v3("?gnis"):::projected
v4("?place"):::projected
v1("?placeLabel"):::projected
c6(["bd:serviceParam"]):::iri
c8(["en"]):::literal
c2(["wd:Q759"]):::iri
f0[["(bound(?fips) || bound(?gnis))"]]
f0 --> v2
f0 --> v3
v4 --"wdt:P131"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P774".-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P590".-> v3
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c6 --"wikibase:language"--> c8
end