What is {head of government} of {Brunswick} that is {end time} is {2001-10-31} ?
I want to know the name of the head of government in Brunswick until 2001!
Who was the head of government in Brunswick until 2001-10-31?
SELECT ?y WHERE { ?r property:end_time ?g . ?r property:head_of_government ?y . resource:Brunswick property:head_of_government ?r . FILTER ( CONTAINS ( YEAR ( ?g ) , '2001' ) ) }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q2773> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P6> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .
?statement <http://www.wikidata.org/entity/P582> <2001-10-31>
} 

SELECT ?obj WHERE { wd:Q2773 p:P6 ?s . ?s ps:P6 ?obj . ?s pq:P582 ?x filter(contains(YEAR(?x),'2001')) }