What is {shares border with} of {Nazi Germany} that is {end time} is {1939-0-0} ?
Which country bordered Germany until 1939?
Which country shared border with Nazi Germany until 1939?
SELECT ?t WHERE { ?w property:shares_border_with ?t . FILTER ( CONTAINS ( YEAR ( ?v ) , '1939' ) ) . resource:Nazi_Germany property:shares_border_with ?w . ?w property:end_time ?v }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q7318> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P47> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .
?statement <http://www.wikidata.org/entity/P582> <1939-0-0>
} 

SELECT ?obj WHERE { wd:Q7318 p:P47 ?s . ?s ps:P47 ?obj . ?s pq:P582 ?x filter(contains(YEAR(?x),'1939')) }