What is {country} of {Transylvania} that is {end time} is {1804-0-0} ?
What's the name of the Transylvanian country that only existed up to 1804?
What Transylvanian country ended in 1804?
SELECT ?b WHERE { ?k property:end_time ?s . FILTER ( CONTAINS ( YEAR ( ?s ) , '1804' ) ) . ?k property:country ?b . resource:Transylvania property:country ?k }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q39473> .
?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> <1804-0-0>
} 

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