What is {capital} of {Alabama} that is {end time} is {1846-0-0} ?
Until the end of 1846, what was Alabama's capital?
What was the capital of Alabama through 1846?
SELECT ?l WHERE { ?v property:end_time ?f . resource:Alabama property:capital ?v . ?v property:capital ?l . FILTER ( CONTAINS ( YEAR ( ?f ) , '1846' ) ) }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q173> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P36> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .
?statement <http://www.wikidata.org/entity/P582> <1846-0-0>
} 

SELECT ?obj WHERE { wd:Q173 p:P36 ?s . ?s ps:P36 ?obj . ?s pq:P582 ?x filter(contains(YEAR(?x),'1846')) }