What is {country} of {Beersheba} that is {end time} is {1917-10-31} ?
There is a country in Beersheba that has am end time of 1917-10-31, which one is it?
which country in Beersheba  has am end time of 1917-10-31?
SELECT ?o WHERE { FILTER ( CONTAINS ( YEAR ( ?d ) , '1917' ) ) . ?j property:end_time ?d . resource:Beersheba property:country ?j . ?j property:country ?o }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q41843> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P17> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .
?statement <http://www.wikidata.org/entity/P582> <1917-10-31>
} 

SELECT ?obj WHERE { wd:Q41843 p:P17 ?s . ?s ps:P17 ?obj . ?s pq:P582 ?x filter(contains(YEAR(?x),'1917')) }