what is the {start time} for {Riga} has {country} as {Latvia} ?
November 18, 1918
When did Riga become the capital of Latvia?
SELECT ?p WHERE { ?r property:start_time ?p . ?r property:country resource:Latvia . resource:Riga property:country ?r }
select distinct ?value  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q1773> .
?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/Q211> .
?statement <http://www.wikidata.org/entity/P580> ?value. 
} 

SELECT ?value WHERE { wd:Q1773 p:P17 ?s . ?s ps:P17 wd:Q211 . ?s pq:P580 ?value}