public interface SimplePrecondition extends Precondition
SimplePrecondition
defines a few simple conditions that can be evaluated against a
CAS
.
A value in the CAS (see below) will be compared against the precondition's
comparisonValue
property using the specified
predicate
.
The value in the CAS is specified by providing values for
indexName
,
fsMatchConstraint
, and
featureName
. 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, a SimplePrecondition
may or may not be
modifiable. An application can find out by calling the MetaDataObject.isModifiable()
method.Modifier and Type | Field and Description |
---|---|
static String |
ELEMENT_OF
Identifies the ELEMENT_OF predicate.
|
static String |
EQUAL
Identifies the EQUAL predicate.
|
static String |
LANGUAGE_SUBSUMED
Identifies the LANGUAGE_SUBSUMED predicate.
|
static String |
PRECONDITION_TYPE
The type identifier for this class of precondition.
|
Modifier and Type | Method and Description |
---|---|
Object |
getComparisonValue()
Retrieves the literal value to which features' values will be compared.
|
boolean |
getDefault()
Retrieves the default value for this precondition.
|
String |
getFeatureName()
Gets the name of the feature to be tested.
|
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.
|
String |
getPreconditionType()
Gets the type of this precondition.
|
String |
getPredicate()
Retrieves the predicate used to compare the test value to the comparison value.
|
void |
setComparisonValue(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(String aFeatureName)
Sets the name of the feature to be tested.
|
void |
setFsIndexName(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(String aPredicate)
Sets the predicate used to compare the test value to the comparison value.
|
evaluate
clone, equals, getAttributeValue, getSourceUrl, getSourceUrlString, isModifiable, listAttributes, setAttributeValue, setSourceUrl
buildFromXMLElement, buildFromXMLElement, toXML, toXML, toXML, toXML
static final String PRECONDITION_TYPE
getPreconditionType()
.static final String EQUAL
static final String ELEMENT_OF
static final String LANGUAGE_SUBSUMED
String getPreconditionType()
Precondition
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.getPreconditionType
in interface Precondition
PRECONDITION_TYPE
String getFsIndexName()
null
if the default annotation index should be
usedvoid setFsIndexName(String aIndexName)
aIndexName
- the name of the FS index, null
if the default annotation index should
be usedUIMA_UnsupportedOperationException
- if this MetaDataObject
is not modifiable.FSMatchConstraint getFsMatchConstraint()
null
if nonevoid setFsMatchConstraint(FSMatchConstraint aConstraint)
aConstraint
- the FS match constraint, null
if noneUIMA_UnsupportedOperationException
- if this MetaDataObject
is not modifiable.String getFeatureName()
null
if nonevoid setFeatureName(String aFeatureName)
aFeatureName
- the feature name, null
if noneUIMA_UnsupportedOperationException
- if this MetaDataObject
is not modifiable.Object getComparisonValue()
void setComparisonValue(Object aValue)
aValue
- the comparison value, which must be a String, Integer, Float, Boolean, or an array of
one of those four types.UIMA_UnsupportedOperationException
- if this MetaDataObject
is not modifiable.String getPredicate()
void setPredicate(String aPredicate)
aPredicate
- a String that identifies the predicate used. This must match one of the constants
defined on this interface.UIMA_UnsupportedOperationException
- if this MetaDataObject
is not modifiable.UIMA_IllegalArgumentException
- if the given value is not appropriate for the given attribute.boolean getDefault()
void setDefault(boolean aDefault)
aDefault
- the default valueUIMA_UnsupportedOperationException
- if this MetaDataObject
is not modifiable.Copyright © 2006–2017 The Apache Software Foundation. All rights reserved.