what is the {start time} for {Ganja} has {located in the administrative territorial entity} as {Azerbaijan} ?
During which time period was Ganja a part of Azerbaijan?
When was Ganja a part of Azerbaijan?
SELECT ?a WHERE { ?y property:located_in_the_administrative_territorial_entity resource:Azerbaijan . resource:Ganja property:located_in_the_administrative_territorial_entity ?y . ?y property:start_time ?a }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q131290> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P131> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://wikidata.dbpedia.org/resource/Q227> .
?statement <http://www.wikidata.org/entity/P580> ?value. 
} 

SELECT ?value WHERE { wd:Q131290 p:P131 ?s . ?s ps:P131 wd:Q227 . ?s pq:P580 ?value}