def neighborhood(self, elements: List[ELEMENT_NAME])-> References:
touches = References()<EOL>for element in elements:<EOL><INDENT>if element in self.schema.classes:<EOL><INDENT>touches.classrefs.add(element)<EOL>if None in touches.classrefs:<EOL><INDENT>raise ValueError("<STR_LIT:1>")<EOL><DEDENT>cls = self.schema.classes[element]<EOL>if cls.is_a:<EOL><INDENT>touches.classrefs.add(cls.is_a)<EOL><DEDENT>if None in touches.classrefs:<EOL><INDENT>raise ValueError("<STR_LIT:1>")<EOL><DEDENT>touches.classrefs.update(set(cls.mixins))<EOL>for slotname in cls.slots:<EOL><INDENT>slot = self.schema.slots[slotname]<EOL>if slot.range in self.schema.classes:<EOL><INDENT>touches.classrefs.add(slot.range)<EOL><DEDENT>elif slot.range in self.schema.types:<EOL><INDENT>touches.typerefs.add(slot.range)<EOL><DEDENT>if None in touches.classrefs:<EOL><INDENT>raise ValueError("<STR_LIT:1>")<EOL><DEDENT><DEDENT>if element in self.synopsis.rangerefs:<EOL><INDENT>for slotname in self.synopsis.rangerefs[element]:<EOL><INDENT>touches.slotrefs.add(slotname)<EOL>if self.schema.slots[slotname].domain:<EOL><INDENT>touches.classrefs.add(self.schema.slots[slotname].domain)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>elif element in self.schema.slots:<EOL><INDENT>touches.slotrefs.add(element)<EOL>slot = self.schema.slots[element]<EOL>touches.slotrefs.update(set(slot.mixins))<EOL>if slot.is_a:<EOL><INDENT>touches.slotrefs.add(slot.is_a)<EOL><DEDENT>if element in self.synopsis.inverses:<EOL><INDENT>touches.slotrefs.update(self.synopsis.inverses[element])<EOL><DEDENT>if slot.domain:<EOL><INDENT>touches.classrefs.add(slot.domain)<EOL><DEDENT>if slot.range in self.schema.classes:<EOL><INDENT>touches.classrefs.add(slot.range)<EOL><DEDENT>elif slot.range in self.schema.types:<EOL><INDENT>touches.typerefs.add(slot.range)<EOL><DEDENT><DEDENT>elif element in self.schema.types:<EOL><INDENT>if element in self.synopsis.rangerefs:<EOL><INDENT>touches.slotrefs.update(self.synopsis.rangerefs[element])<EOL><DEDENT><DEDENT><DEDENT>return touches<EOL>
Return a list of all slots, classes and types that touch any element in elements, including the element
        itself

        @param elements: Elements to do proximity with
        @return: All slots and classes that touch element