What is {member of sports team} of {Magic Johnson} that is {end time} is {1991-0-0} ?
Magic Johnson belonged to which team until the beginning of 1991?
What sports team did Magic Johnson belong to until the beginning of 1991?
SELECT ?n WHERE { resource:Magic_Johnson property:member_of_sports_team ?b . FILTER ( CONTAINS ( YEAR ( ?v ) , '1991' ) ) . ?b property:end_time ?v . ?b property:member_of_sports_team ?n }
select distinct ?obj  where {
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://wikidata.dbpedia.org/resource/Q134183> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.wikidata.org/entity/P54> .
?statement <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> ?obj .
?statement <http://www.wikidata.org/entity/P582> <1991-0-0>
} 

SELECT ?obj WHERE { wd:Q134183 p:P54 ?s . ?s ps:P54 ?obj . ?s pq:P582 ?x filter(contains(YEAR(?x),'1991')) }