Using the Wikidata SPARQL service, I would like to get the list of the 50 states and include the District of Columbia from Wikidata. I have come up with a kludgy query to do so:
#-- wdt:P31 = instance of; wd:Q35657 = list of states
SELECT ?state ?stateLabel
WHERE {
{?state wdt:P31 wd:Q35657} UNION
{?state wdt:P3403 wd:Q3551781} . #-- coextensive with District of Columbia
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
My query works but the way I extract DC into the results is ugly. (It's possible that future changes to data in Wikidata will break this query.) What I'd like to be able to say is something like
UNION {?state == wd:Q61}
to directly include Washington, D.C. (Q61). However, as a SPARQL newbie, I can't figure out the SPARQL syntax for doing so. I'd be grateful for any help to rewrite this query to directly pull in wd:Q61
.