What is {spouse} of {Fred Perry} that is {end time} is {1940-1-1} ?
Who was Fred Perry married to in 1940?
Who was Fred Perry's wife in 1940?
SELECT ?k WHERE { FILTER ( CONTAINS ( YEAR ( ?p ) , '1940' ) ) . ?z property:spouse ?k . resource:Fred_Perry property:spouse ?z . ?z property:end_time ?p }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q312639> .
?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> <1940-1-1>
} 

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