PREFIX list: PREFIX : SELECT ?x ?i ?j { { ?list list:index (?i "a") } UNION { ?list list:index (?j "b") } { ?x :p ?list } }