Class SchemaDocument


  • public class SchemaDocument
    extends Object
    Represents an entire LinkML schema.
    • Constructor Summary

      Constructors 
      Constructor Description
      SchemaDocument​(File source)
      Creates a new instance from the specified file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Collection<org.incenp.linkml.schema.model.ClassDefinition> getAllClasses()
      Gets all classes defined across the top-level schema and all imported schemas.
      Collection<org.incenp.linkml.schema.model.EnumDefinition> getAllEnums()
      Gets all enums defined across the top-level schema and all imported schemas.
      Collection<org.incenp.linkml.schema.model.SlotDefinition> getAllSlots()
      Gets all slots defined across the top-level schema and all imported schemas.
      Collection<org.incenp.linkml.schema.model.TypeDefinition> getAllTypes()
      Gets all types defined across the top-level schema and all imported schemas.
      org.incenp.linkml.schema.model.SlotDefinition getAttribute​(String className, String attrName)
      Gets the definition of the specified attribute within a class.
      org.incenp.linkml.schema.model.ClassDefinition getClassDefinition​(String name)
      Gets the definition of the specified class.
      org.incenp.linkml.schema.model.EnumDefinition getEnum​(String name)
      Gets the definition of the specified enum.
      Collection<org.incenp.linkml.schema.model.SchemaDefinition> getImports()
      Gets the schemas that are (directly or not) imported by the top-level schema.
      org.incenp.linkml.schema.model.SchemaDefinition getRootSchema()
      Gets the top-level schema.
      org.incenp.linkml.schema.model.SlotDefinition getSlot​(String name)
      Gets the definition of the specified slot.
      org.incenp.linkml.schema.model.SlotDefinition getSlotUsage​(String className, String slotName)
      Gets the definition of the specified slot usage within a class.
      org.incenp.linkml.schema.model.TypeDefinition getType​(String name)
      Gets the definition of the specified type.
    • Method Detail

      • getRootSchema

        public org.incenp.linkml.schema.model.SchemaDefinition getRootSchema()
        Gets the top-level schema.

        This is the schema contained directly in the file given to the constructor.

      • getImports

        public Collection<org.incenp.linkml.schema.model.SchemaDefinition> getImports()
        Gets the schemas that are (directly or not) imported by the top-level schema.
      • getAllClasses

        public Collection<org.incenp.linkml.schema.model.ClassDefinition> getAllClasses()
        Gets all classes defined across the top-level schema and all imported schemas.
      • getAllSlots

        public Collection<org.incenp.linkml.schema.model.SlotDefinition> getAllSlots()
        Gets all slots defined across the top-level schema and all imported schemas.
      • getAllEnums

        public Collection<org.incenp.linkml.schema.model.EnumDefinition> getAllEnums()
        Gets all enums defined across the top-level schema and all imported schemas.
      • getAllTypes

        public Collection<org.incenp.linkml.schema.model.TypeDefinition> getAllTypes()
        Gets all types defined across the top-level schema and all imported schemas.
      • getClassDefinition

        public org.incenp.linkml.schema.model.ClassDefinition getClassDefinition​(String name)
        Gets the definition of the specified class.

        This looks up the class across the entire imports closure.

        Parameters:
        name - The name of the class.
        Returns:
        The corresponding class definition, or null if there is no class with that name.
      • getSlot

        public org.incenp.linkml.schema.model.SlotDefinition getSlot​(String name)
        Gets the definition of the specified slot.

        This looks up the slot across the entire imports closure.

        Parameters:
        name - The name of the slot.
        Returns:
        The corresponding slot definition, or null if there is no slot with that name.
      • getEnum

        public org.incenp.linkml.schema.model.EnumDefinition getEnum​(String name)
        Gets the definition of the specified enum.

        This looks up the enum across the entire imports closure.

        Parameters:
        name - The name of the enum.
        Returns:
        The corresponding enum definition, or null if there is no enum with that name.
      • getType

        public org.incenp.linkml.schema.model.TypeDefinition getType​(String name)
        Gets the definition of the specified type.

        This looks up the type across the entire imports closure.

        Parameters:
        name - The name of the type.
        Returns:
        The corresponding type definition, or null if there is no type with that name.
      • getAttribute

        public org.incenp.linkml.schema.model.SlotDefinition getAttribute​(String className,
                                                                          String attrName)
        Gets the definition of the specified attribute within a class.

        This looks up the the class entire the entire import closure.

        Parameters:
        className - The name of the class.
        attrName - The name of the attribute.
        Returns:
        The corresponding attribute definition, or null if there is no class with the indicated name or the class has no such attribute.
      • getSlotUsage

        public org.incenp.linkml.schema.model.SlotDefinition getSlotUsage​(String className,
                                                                          String slotName)
        Gets the definition of the specified slot usage within a class.

        This looks up the class entire the entire import closure.

        Parameters:
        className - The name of the class.
        slotName - The name of the slot.
        Returns:
        The corresponding slot usage definition, or null if there is no class with the indicated name or the class has no slot usage definition with such a name.