what is the {end time} for {Lublin} has {country} as {Kingdom of Poland} ?
In what year did Lublin stop being a Polish kingdom?
When did Lublin cease to be a Kingdom of Poland?
SELECT ?m WHERE { ?q property:country resource:Kingdom_of_Poland . ?q property:end_time ?m . resource:Lublin property:country ?q }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q37333> .
?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/Q696908> .
?statement <http://www.wikidata.org/entity/P582> ?value. 
} 

SELECT ?value WHERE { wd:Q37333 p:P17 ?s . ?s ps:P17 wd:Q696908 . ?s pq:P582 ?value}