What is {spouse} of {Bohdan Khmelnytsky} that is {end time} is {1651-0-0} ?
Who is Bohdan Khmelnytsky's wife?
Who is the spouse of Bohdan Khmelnytsky before 1651-0-0?
SELECT ?a WHERE { resource:Bohdan_Khmelnytskyi property:spouse ?b . ?b property:spouse ?a . FILTER ( CONTAINS ( YEAR ( ?o ) , '1651' ) ) . ?b property:end_time ?o }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q203808> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P26> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .
?statement <http://www.wikidata.org/entity/P582> <1651-0-0>
} 

SELECT ?obj WHERE { wd:Q203808 p:P26 ?s . ?s ps:P26 ?obj . ?s pq:P582 ?x filter(contains(YEAR(?x),'1651')) }