Interface SimplePrecondition
-
- All Superinterfaces:
java.lang.Cloneable
,MetaDataObject
,Precondition
,java.io.Serializable
,XMLizable
- All Known Subinterfaces:
LanguagePrecondition
,MimeTypePrecondition
- All Known Implementing Classes:
LanguagePrecondition_impl
,MimeTypePrecondition_impl
,SimplePrecondition_impl
public interface SimplePrecondition extends Precondition
SimplePrecondition
defines a few simple conditions that can be evaluated against aCAS
.A value in the CAS (see below) will be compared against the precondition's
comparisonValue
property using the specifiedpredicate
.The value in the CAS is specified by providing values for
indexName
,fsMatchConstraint
, andfeatureName
. If any FeatureStructure in the specified index matches the FS match constraint and has a feature value that satisfies this precondition's precicate, the precondition will be considered satisfied. If the index name is omitted, the default Annotation index (if present) will be used.The possible predicates are defined by constants on this interface. The currently avaialble predicates are:
EQUAL
- evaluates to true if and only if the values are equal (according to the equality rules of their data type).ELEMENT_OF
- the comparison value must be an array. Evaluates to true if and only if the test value is equal to one of the elements of the comparison array.LANGUAGE_SUBSUMED
- the comparison value must be an array of Strings, each of which is an ISO language identifier. Evaluates to true if and only if the test value is an ISO language identifier that is subsumed by one of the values of the comparison array. (For example, "en_US" is subsumed by "en.")
MetaDataObject
s, aSimplePrecondition
may or may not be modifiable. An application can find out by calling theMetaDataObject.isModifiable()
method.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ELEMENT_OF
Identifies the ELEMENT_OF predicate.static java.lang.String
EQUAL
Identifies the EQUAL predicate.static java.lang.String
LANGUAGE_SUBSUMED
Identifies the LANGUAGE_SUBSUMED predicate.static java.lang.String
PRECONDITION_TYPE
The type identifier for this class of precondition.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
getComparisonValue()
Retrieves the literal value to which features' values will be compared.boolean
getDefault()
Retrieves the default value for this precondition.java.lang.String
getFeatureName()
Gets the name of the feature to be tested.java.lang.String
getFsIndexName()
Retrieves the name of the FeatureStructure index containing FeatureStructures to be tested by this precondition.FSMatchConstraint
getFsMatchConstraint()
Retrieves the FSMatchConstraint that determines which CAS feature structures will be tested by this precondition.java.lang.String
getPreconditionType()
Gets the type of this precondition.java.lang.String
getPredicate()
Retrieves the predicate used to compare the test value to the comparison value.void
setComparisonValue(java.lang.Object aValue)
Sets the literal value to which features' values will be compared.void
setDefault(boolean aDefault)
Sets the default value for this precondition.void
setFeatureName(java.lang.String aFeatureName)
Sets the name of the feature to be tested.void
setFsIndexName(java.lang.String aIndexName)
Sets the name of the FeatureStructure index containing FeatureStructures to be tested by this precondition.void
setFsMatchConstraint(FSMatchConstraint aConstraint)
Sets the FSMatchConstraint that determines which CAS feature structures will be tested by this precondition.void
setPredicate(java.lang.String aPredicate)
Sets the predicate used to compare the test value to the comparison value.-
Methods inherited from interface org.apache.uima.resource.metadata.MetaDataObject
clone, equals, getAttributeValue, getSourceUrl, getSourceUrlString, isModifiable, listAttributes, setAttributeValue, setSourceUrl
-
Methods inherited from interface org.apache.uima.resource.metadata.Precondition
evaluate
-
Methods inherited from interface org.apache.uima.util.XMLizable
buildFromXMLElement, buildFromXMLElement, toXML, toXML, toXML, toXML
-
-
-
-
Field Detail
-
PRECONDITION_TYPE
static final java.lang.String PRECONDITION_TYPE
The type identifier for this class of precondition. This is the return value ofgetPreconditionType()
.- See Also:
- Constant Field Values
-
EQUAL
static final java.lang.String EQUAL
Identifies the EQUAL predicate. This predicate evaluates to true if and only if the test value and the comparison value are of the same data type and are equal, according to the equality rules of that data type.- See Also:
- Constant Field Values
-
ELEMENT_OF
static final java.lang.String ELEMENT_OF
Identifies the ELEMENT_OF predicate. For this predicate, the comparison value must be an array. ELEMENT_OF evaluates to true if and only if the test value is equal to one of the elements of the array. (If the comparison value is not an array, ELEMENT_OF always evaluates to false.)- See Also:
- Constant Field Values
-
LANGUAGE_SUBSUMED
static final java.lang.String LANGUAGE_SUBSUMED
Identifies the LANGUAGE_SUBSUMED predicate. For this predicate, the comparison value must be an array of ISO language identifiers. LANGUAGE_SUBSUMED evaluates to true if and only if the test value is an ISO language identifier that is subsumed by one of the values of the comparison array. (For example, "en_US" is subsumed by "en.")- See Also:
- Constant Field Values
-
-
Method Detail
-
getPreconditionType
java.lang.String getPreconditionType()
Gets the type of this precondition. Each sub-interface ofPrecondition
has its own standard type identifier String. These identifier Strings are used instead of Java class names in order to ease portability of metadata to other languages.- Specified by:
getPreconditionType
in interfacePrecondition
- Returns:
PRECONDITION_TYPE
-
getFsIndexName
java.lang.String getFsIndexName()
Retrieves the name of the FeatureStructure index containing FeatureStructures to be tested by this precondition.- Returns:
- the name of the FS index,
null
if the default annotation index should be used
-
setFsIndexName
void setFsIndexName(java.lang.String aIndexName)
Sets the name of the FeatureStructure index containing FeatureStructures to be tested by this precondition.- Parameters:
aIndexName
- the name of the FS index,null
if the default annotation index should be used- Throws:
UIMA_UnsupportedOperationException
- if thisMetaDataObject
is not modifiable.
-
getFsMatchConstraint
FSMatchConstraint getFsMatchConstraint()
Retrieves the FSMatchConstraint that determines which CAS feature structures will be tested by this precondition.- Returns:
- the FS match constraint,
null
if none
-
setFsMatchConstraint
void setFsMatchConstraint(FSMatchConstraint aConstraint)
Sets the FSMatchConstraint that determines which CAS feature structures will be tested by this precondition.- Parameters:
aConstraint
- the FS match constraint,null
if none- Throws:
UIMA_UnsupportedOperationException
- if thisMetaDataObject
is not modifiable.
-
getFeatureName
java.lang.String getFeatureName()
Gets the name of the feature to be tested.- Returns:
- the feature name,
null
if none
-
setFeatureName
void setFeatureName(java.lang.String aFeatureName)
Sets the name of the feature to be tested.- Parameters:
aFeatureName
- the feature name,null
if none- Throws:
UIMA_UnsupportedOperationException
- if thisMetaDataObject
is not modifiable.
-
getComparisonValue
java.lang.Object getComparisonValue()
Retrieves the literal value to which features' values will be compared.- Returns:
- the value, which must be a String, Integer, Float, Boolean or an array of one of those four types.
-
setComparisonValue
void setComparisonValue(java.lang.Object aValue)
Sets the literal value to which features' values will be compared.- Parameters:
aValue
- the comparison value, which must be a String, Integer, Float, Boolean, or an array of one of those four types.- Throws:
UIMA_UnsupportedOperationException
- if thisMetaDataObject
is not modifiable.
-
getPredicate
java.lang.String getPredicate()
Retrieves the predicate used to compare the test value to the comparison value.- Returns:
- a String that identifies the predicate used. This will always match one of the constants defined on this interface.
-
setPredicate
void setPredicate(java.lang.String aPredicate)
Sets the predicate used to compare the test value to the comparison value.- Parameters:
aPredicate
- a String that identifies the predicate used. This must match one of the constants defined on this interface.- Throws:
UIMA_UnsupportedOperationException
- if thisMetaDataObject
is not modifiable.UIMA_IllegalArgumentException
- if the given value is not appropriate for the given attribute.
-
getDefault
boolean getDefault()
Retrieves the default value for this precondition. This is the value returned if there is no applicable test value in the CAS.- Returns:
- the default value
-
setDefault
void setDefault(boolean aDefault)
Sets the default value for this precondition. This is the value returned if there is no applicable test value in the CAS.- Parameters:
aDefault
- the default value- Throws:
UIMA_UnsupportedOperationException
- if thisMetaDataObject
is not modifiable.
-
-