Package org.apache.uima.util
Class TypeSystemUtil
java.lang.Object
org.apache.uima.util.TypeSystemUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FeatureDescriptionfeature2FeatureDescription(Feature aFeature) Convert aFeatureto an equivalentFeatureDescription.static String[]getAllowedValuesForType(Type aType, TypeSystem aTypeSystem) Gets the allowed values for a string subtype.static booleanisFeatureName(String name) static booleanisTypeName(String name) Check ifnameis a possible type name.static List<FsIndexCollection>loadFsIndexCollectionsFromClasspath(Class<?> aContext, String... aLocations) Loads FS index collections and resolves their imports.static List<TypePriorities>loadTypePrioritiesFromClasspath(Class<?> aContext, String... aLocations) Loads type priorities and resolves their imports.static List<TypeSystemDescription>loadTypeSystemDescriptionsFromClasspath(Class<?> aContext, String... aLocations) Loads type system descriptions and resolves their imports.static TypeDescriptiontype2TypeDescription(Type aType, TypeSystem aTypeSystem) Convert aTypeto an equivalentTypeDescription.static TypeSystemDescriptiontypeSystem2TypeSystemDescription(TypeSystem aTypeSystem) Convert aTypeSystemto an equivalentTypeSystemDescription.
-
Constructor Details
-
TypeSystemUtil
public TypeSystemUtil()
-
-
Method Details
-
loadTypeSystemDescriptionsFromClasspath
public static List<TypeSystemDescription> loadTypeSystemDescriptionsFromClasspath(Class<?> aContext, String... aLocations) Loads type system descriptions and resolves their imports. For example when you place aTypeSystemDescriptionProviderimplementation and place the type system descriptions it should provide in the same package, you can use this method to conveniently load them simply by name in the provider implementation.public class MyTypeSystemDescriptionProvider implements TypeSystemDescriptionProvider {@Overridepublic List<TypeSystemDescription> listTypeSystemDescriptions(){ return TypeSystemUtil.loadTypeSystemDescriptionsFromClasspath(getClass(), "TypeSystem1.xml", "TypeSystem2.xml"); } }- Parameters:
aContext- a context class. If the locations are not absolute, then they are looked up relative to this context class as perClass.getResource(String).aLocations- type system description locations to load.- Returns:
- list of the loaded and resolved descriptions.
-
loadTypePrioritiesFromClasspath
public static List<TypePriorities> loadTypePrioritiesFromClasspath(Class<?> aContext, String... aLocations) Loads type priorities and resolves their imports. For example when you place aTypePrioritiesProviderimplementation and place the type priorities it should provide in the same package, you can use this method to conveniently load them simply by name in the provider implementation.public class MyTypePrioritiesProvider implements TypePrioritiesProvider {@Overridepublic List<TypePriorities> listTypePriorities(){ return TypeSystemUtil.loadTypePrioritiesFromClasspath(getClass(), "TypePriorities1.xml", "TypePriorities2.xml"); } }- Parameters:
aContext- a context class. If the locations are not absolute, then they are looked up relative to this context class as perClass.getResource(String).aLocations- type priorities locations to load.- Returns:
- list of the loaded and resolved descriptions.
-
loadFsIndexCollectionsFromClasspath
public static List<FsIndexCollection> loadFsIndexCollectionsFromClasspath(Class<?> aContext, String... aLocations) Loads FS index collections and resolves their imports. For example when you place aFsIndexCollectionProviderimplementation and place the FS index collections it should provide in the same package, you can use this method to conveniently load them simply by name in the provider implementation.public class MyFsIndexCollectionProvider implements FsIndexCollectionProvider {@Overridepublic List<FsIndexCollection> listFsIndexCollections(){ return TypeSystemUtil.loadFsIndexCollectionsFromClasspath(getClass(), "FsIndexCollection1.xml", "FsIndexCollection2.xml"); } }- Parameters:
aContext- a context class. If the locations are not absolute, then they are looked up relative to this context class as perClass.getResource(String).aLocations- FS index collections locations to load.- Returns:
- list of the loaded and resolved descriptions.
-
typeSystem2TypeSystemDescription
Convert aTypeSystemto an equivalentTypeSystemDescription.- Parameters:
aTypeSystem- type system object to convert- Returns:
- a TypeSystemDescription that is equivalent to
aTypeSystem
-
type2TypeDescription
Convert aTypeto an equivalentTypeDescription.- Parameters:
aType- type object to convertaTypeSystem- the TypeSystem that containsaType- Returns:
- a TypeDescription that is equivalent to
aType
-
feature2FeatureDescription
Convert aFeatureto an equivalentFeatureDescription.- Parameters:
aFeature- feature object to convert- Returns:
- a FeatureDescription that is equivalent to
aFeature
-
getAllowedValuesForType
Gets the allowed values for a string subtype.- Parameters:
aType- the type, which must be a subtype of uima.cas.StringaTypeSystem- the type system to use- Returns:
- array of allowed values for
aTypeTODO - this should be a method on Type.
-
isFeatureName
- Parameters:
name- The name to check.- Returns:
- if the given
nameis a valid feature name. Does not check if the feature actually exists!
-
isTypeName
Check ifnameis a possible type name. Does not check if this type actually exists!- Parameters:
name- The name to check.- Returns:
trueiffnameis a possible type name.
-