what is the {end time} for {Pisa} has {country} as {Grand Duchy of Tuscany} ?
When did the Grand Duchy of Tuscany cease in Pisa?
When did Pisa stop having the Grand Duchy of Tuscany?
SELECT ?a WHERE { ?z property:end_time ?a . resource:Pisa property:country ?z . ?z property:country resource:Grand_Duchy_of_Tuscany }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q13375> .
?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/Q154849> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q13375 p:P17 ?s . ?s ps:P17 wd:Q154849 . ?s pq:P582 ?value}