What is {located in the administrative territorial entity} of {Toronto} that is {end time} is {1840-0-0} ?
which locations are administrative territorial entity of Toranto during 1840?
What was located in the administrative territorial entity of Toranto during 1840?
SELECT ?f WHERE { FILTER ( CONTAINS ( YEAR ( ?g ) , '1840' ) ) . ?j property:located_in_the_administrative_territorial_entity ?f . ?j property:end_time ?g . resource:Toronto property:located_in_the_administrative_territorial_entity ?j }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q172> .
?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> <1840-0-0>
} 

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