Package org.apache.uima.cas.admin
Interface TypeSystemMgr
- All Superinterfaces:
Iterable<Type>
,TypeSystem
- All Known Implementing Classes:
TypeSystemImpl
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).
-
Field Summary
Fields inherited from interface org.apache.uima.cas.TypeSystem
FEATURE_SEPARATOR, NAMESPACE_SEPARATOR, PARAM_EXCLUDE_PREBUILT_TYPES
-
Method Summary
Modifier and TypeMethodDescriptionaddFeature
(String featureName, Type domainType, Type rangeType) Add an feature to the type system.addFeature
(String featureName, Type domainType, Type rangeType, boolean multipleReferencesAllowed) Add an feature to the type system.addStringSubtype
(String typeName, String[] stringList) Inherit from String.Add a new type to the type system.commit()
Commit the type system, and load JCas Classes from the UIMA Framework's classloader.commit
(ClassLoader cl) Commit the type system, and load JCas classes from the passed in classloader.boolean
Check if this instance has been committed.void
setFeatureFinal
(Type type) Make type feature final in the sense that no new features can be added to this type.void
setInheritanceFinal
(Type type) Block any further inheritance from this type.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface org.apache.uima.cas.TypeSystem
getArrayType, getDirectlySubsumedTypes, getDirectSubtypes, getFeatureByFullName, getFeatures, getLowLevelTypeSystem, getParent, getProperlySubsumedTypes, getTopType, getType, getTypeIterator, getTypeNameSpace, subsumes
-
Method Details
-
addType
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
iftypeName
is already in use (so check for null return values). - Throws:
CASAdminException
- IftypeName
is not a legal type name, type system is locked, ormother
is inheritance final.
-
addStringSubtype
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
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
iffeatureName
is already in use fordomainType
with the same range (if the range is different, an exception is thrown). - Throws:
CASAdminException
- IffeatureName
is not a legal feature name, the type system is locked ordomainType
is feature final. Also iffeatureName
has already been defined ondomainType
(or a supertype) with a different range thanrangeType
.
-
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 therangeType
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 totrue
.- Returns:
- The new feature object, or
null
iffeatureName
is already in use fordomainType
with the same range (if the range is different, an exception is thrown). - Throws:
CASAdminException
- IffeatureName
is not a legal feature name, the type system is locked ordomainType
is feature final. Also iffeatureName
has already been defined ondomainType
(or a supertype) with a different range thanrangeType
.
-
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
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
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
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
-