@prefix list: <http://www.w3.org/2000/10/swap/list#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.

{?C owl:hasKey ?L. ?X a ?C. ?Y a ?C. ?X log:notEqualTo ?Y. (?P {?P list:in ?L. ?X ?P ?Z. ?Y ?P ?Z} ?L2) log:collectAllIn ?S. ?L2 list:setEqualTo ?L} => {?X owl:sameAs ?Y}.
