What is {position held} of {Abdülmecid I} that is {start time} is {1839-7-2} ?
What was Abdulmecid I's title on July 2, 1839?
What position did Abdülmecid I hold on July, 2 1839?
SELECT ?y WHERE { ?l property:position_held ?y . resource:Abdülmecid_I property:position_held ?l . ?l property:start_time ?p . FILTER ( CONTAINS ( YEAR ( ?p ) , '1839' ) ) }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q174772> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P39> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .
?statement <http://www.wikidata.org/entity/P580> <1839-7-2>
} 

SELECT ?obj WHERE { wd:Q174772 p:P39 ?s . ?s ps:P39 ?obj . ?s pq:P580 ?x filter(contains(YEAR(?x),'1839')) }