prefix owl: prefix : select ?X ?Y ?A ?B from where {{?X :rel ?Y} UNION {?A owl:sameAs ?B}}