What is {located in the administrative territorial entity} of {Wrocław} that is {start time} is {1138-0-0} ?
Wroclaw belonged to what territory during 1138?
What territory was Wrocław a part of during 1138?
SELECT ?q WHERE { resource:Wrocław property:located_in_the_administrative_territorial_entity ?p . FILTER ( CONTAINS ( YEAR ( ?m ) , '1138' ) ) . ?p property:start_time ?m . ?p property:located_in_the_administrative_territorial_entity ?q }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q1799> .
?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/P580> <1138-0-0>
} 

SELECT ?obj WHERE { wd:Q1799 p:P131 ?s . ?s ps:P131 ?obj . ?s pq:P580 ?x filter(contains(YEAR(?x),'1138')) }