I want to retrieve from DBpedia all the states and territories in India as well as all the cities contained in them. I have a long query that does a UNION and returns the territories but not any states or cities. For brevity, I'm just including the part of the query that should return states and cities and I'm not including any prefixes:
SELECT ?state ?stateLabel ?city ?cityLabel
WHERE {{?state rdf:type dbo:State ;
rdfs:label ?stateLabel ;
dbo:country dbr:India.
FILTER (lang(?stateLabel) = "en")}
OPTIONAL {?city rdf:type dbo:City ;
rdfs:label ?cityLabel ;
dbo:isPartOf ?state .
FILTER (lang(?cityLabel) = "en")}}
This query returns no results when I execute it (with the prefixes) at: https://dbpedia.org/sparql/ The part of the query that works looks identical to the state query except it matches for dbo:AdministrativeRegion rather than for dbo:State. It seems to return all the Indian territories (but none of the cities in them).
In addition I could use some pointers on where to find good documentation about the DBpedia ontology for similar queries. All of the documentation I've found either explains things I already know (e.g., what Linked Data is) or that I don't care about (e.g., how DBpedia scrapes data from Wikipedia).