What is {capital of} of {Nanjing} that is {end time} is {936-0-0} ?
What was the capital of Nanjing in 936 AD?
In 936 AD, what was the capital of Nanjing?
SELECT ?g WHERE { ?i property:end_time ?r . FILTER ( CONTAINS ( ?r , '936-0-0' ) ) . ?i property:capital_of ?g . resource:Nanjing property:capital_of ?i }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q16666> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P1376> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .
?statement <http://www.wikidata.org/entity/P582> <936-0-0>
} 

SELECT ?obj WHERE { wd:Q16666 p:P1376 ?s . ?s ps:P1376 ?obj . ?s pq:P582 ?x filter(contains(?x , '936-0-0')) }