Class ClassDefinitionConverter

  • All Implemented Interfaces:
    IConverter

    public class ClassDefinitionConverter
    extends ObjectConverter
    A converter object specifically intended to convert ClassDefinition objects.

    We need a subclass for ClassDefinition objects because class definitions purposefully violate the unicity constraint of the SlotDefinition class. A slot definition is supposed to be a unique object (only one object with the same name can exist in the global context). But several classes can have an attribute with the same name, that should not imply that they share the same attribute! (In fact, one of the reasons for the concept of attributes is precisely so that classes can have “local slots” – slots whose definition has no impact outside of the declaring class. Therefore, within a LinkML schema, there may very well be several SlotDefinition objects with the same name: one global slot at most, plus an arbitrary number of class-specific attributes.

    In LinkML-Py, this violation of the unicity constraint is apparently managed by prepending the name of the declaring class to the name of the attribute, as in class__slotname, so that all slot definitions (including definitions of class-specific attributes) are globally unique.

    The approach adopted here is simply not to put the attribute definitions in the global context at all, so that they are really specific to the class in which they are defined. But this requires overriding the default behaviour of the ObjectConverter, which puts all unique objects (that is, all instances of classes that have an identifier slot) in the global context.

    Likewise for the SlotDefinition objects found in the slot_usage section: they are really local to the class and should not be treated as global objects.

    • Constructor Detail

      • ClassDefinitionConverter

        public ClassDefinitionConverter()