what is the {end time} for {Bergen} has {country} as {Union between Sweden and Norway} ?
Name the time at which Bergen was no longer controlled by a Sweden/Norway union.
When did Bergen stop being controlled by a union between Sweden and Norway?
SELECT ?g WHERE { resource:Bergen property:country ?o . ?o property:country resource:Union_between_Sweden_and_Norway . ?o property:end_time ?g }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q26793> .
?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> <http://wikidata.dbpedia.org/resource/Q62589> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q26793 p:P17 ?s . ?s ps:P17 wd:Q62589 . ?s pq:P582 ?value}