What is {located in the administrative territorial entity} of {Orenburg} that is {end time} is {1782-0-0} ?
What was located in Orenburg until 1782?
What was located in the territory of Orenburg until 1782?
SELECT ?o WHERE { ?i property:end_time ?p . resource:Orenburg property:located_in_the_administrative_territorial_entity ?i . FILTER ( CONTAINS ( YEAR ( ?p ) , '1782' ) ) . ?i property:located_in_the_administrative_territorial_entity ?o }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q5337> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P131> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .
?statement <http://www.wikidata.org/entity/P582> <1782-0-0>
} 

SELECT ?obj WHERE { wd:Q5337 p:P131 ?s . ?s ps:P131 ?obj . ?s pq:P582 ?x filter(contains(YEAR(?x),'1782')) }