What is {position held} of {Ramsay MacDonald} and {elected in}
What function is held through Ramsay MacDonald and when was once he elected?
What position is held by Ramsay MacDonald and when was he elected?
SELECT ?v ?c WHERE { ?p property:position_held ?c . resource:Ramsay_MacDonald property:position_held ?p . ?p property:elected_in ?v . }
select distinct ?dataprop1 ?obj where { ?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q166646> . ?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> ?dataprop1 . } 
SELECT ?value1 ?obj WHERE { wd:Q166646 p:P39 ?s . ?s ps:P39 ?obj . ?s pq:P2715 ?value1 . }