Interface TypeSystemMgr

All Superinterfaces:
Iterable<Type>, TypeSystem
All Known Implementing Classes:
TypeSystemImpl

public interface TypeSystemMgr extends TypeSystem

Writable version of type system.

Public API for the UIMA Type System during pipe-line startup, while type system is being constructed from merge of type specifications of components.

For use by applications, not for use by annotator components (because they work with merged type system).

  • Method Details

    • addType

      Type addType(String typeName, Type mother) throws CASAdminException
      Add a new type to the type system.
      Parameters:
      typeName - The name of the new type.
      mother - The type node under which the new type should be attached. This must not be null.
      Returns:
      The new type, or null if typeName is already in use (so check for null return values).
      Throws:
      CASAdminException - If typeName is not a legal type name, type system is locked, or mother is inheritance final.
    • addStringSubtype

      Type addStringSubtype(String typeName, String[] stringList) throws CASAdminException
      Inherit from String. The only way you can inherit from String is by providing a restriction to a set of strings that are possible values for features of this type. This restriction will be checked when such feature values are set. Note that you can not introduce any features on such types, nor can you subtype them any further.
      Parameters:
      typeName - The name of the type to be created.
      stringList - The list of legal string values for this string type.
      Returns:
      The resulting type, or null if the type is already defined.
      Throws:
      CASAdminException - If the type system is locked.
    • addFeature

      Feature addFeature(String featureName, Type domainType, Type rangeType) throws CASAdminException
      Add an feature to the type system. Note: A subtype may define a feature that is also defined by a supertype. If the supertype definition is already present, then the subtype definition is "merged": using the merging criteria: ranges must match. Different isMultipleReferencesAllowed settings are OK; The supertype's setting takes precedence.
      Parameters:
      featureName - The name of the new feature.
      domainType - The type that defines the domain of the feature.
      rangeType - The type that defines the range of the feature.
      Returns:
      The new feature object, or null if featureName is already in use for domainType with the same range (if the range is different, an exception is thrown).
      Throws:
      CASAdminException - If featureName is not a legal feature name, the type system is locked or domainType is feature final. Also if featureName has already been defined on domainType (or a supertype) with a different range than rangeType.
    • addFeature

      Feature addFeature(String featureName, Type domainType, Type rangeType, boolean multipleReferencesAllowed) throws CASAdminException
      Add an feature to the type system.
      Parameters:
      featureName - The name of the new feature.
      domainType - The type that defines the domain of the feature.
      rangeType - The type that defines the range of the feature.
      multipleReferencesAllowed - If the rangeType is an array type, you can use this flag to enforce that the feature value is not referenced anywhere else. This is currently only used for XMI serialization. Defaults to true.
      Returns:
      The new feature object, or null if featureName is already in use for domainType with the same range (if the range is different, an exception is thrown).
      Throws:
      CASAdminException - If featureName is not a legal feature name, the type system is locked or domainType is feature final. Also if featureName has already been defined on domainType (or a supertype) with a different range than rangeType.
    • commit

      TypeSystem commit()
      Commit the type system, and load JCas Classes from the UIMA Framework's classloader. The type system will be locked and no longer writable. WARNING: Users should not call this, but instead call ((CASImpl) theAssociatedCAS).commitTypeSystem() in order to set up the parts of the CAS that should be set up when the type system is committed. WARNING: This API will use the UIMA Framework's class loader to find a load JCas classes. If you have JCas classes under some other class loader you wish to use (perhaps you are setting a ResourceManager's extension classpath, which creates a class loader), use the commit which takes a class loader as an argument, and pass in the class loader where the JCas classes are.
      Returns:
      the committed type system. Note that this may be the same object as "this" or a different (but equal) object. Type systems are cached and recreating the exact same type system repeatedly will return the original one.
    • commit

      TypeSystem commit(ClassLoader cl)
      Commit the type system, and load JCas classes from the passed in classloader. The type system will be locked and no longer writable. WARNING: Users should not call this, but instead call ((CASImpl) theAssociatedCAS).commitTypeSystem() in order to set up the parts of the CAS that should be set up when the type system is committed.
      Parameters:
      cl - the JCas class loader
      Returns:
      the committed type system. Note that this may be the same object as "this" or a different (but equal) object. Type systems are cached and recreating the exact same type system repeatedly will return the original one.
    • isCommitted

      boolean isCommitted()
      Check if this instance has been committed.
      Returns:
      true iff this instance has been committed.
    • setFeatureFinal

      void setFeatureFinal(Type type)
      Make type feature final in the sense that no new features can be added to this type. Note that making a type feature final automatically makes all ancestors of that type feature final as well.
      Parameters:
      type - The type to be made feature final.
    • setInheritanceFinal

      void setInheritanceFinal(Type type)
      Block any further inheritance from this type. Does not mean that the type can have no sub-types, just that no new ones can be introduced.
      Parameters:
      type - the type to block subtypes on