Interface SimplePrecondition

All Superinterfaces:
Cloneable, MetaDataObject, Precondition, 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 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.")
As with all MetaDataObjects, a SimplePrecondition may or may not be modifiable. An application can find out by calling the MetaDataObject.isModifiable() method.
  • Field Details

    • PRECONDITION_TYPE

      static final String PRECONDITION_TYPE
      The type identifier for this class of precondition. This is the return value of getPreconditionType().
      See Also:
    • EQUAL

      static final 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:
    • ELEMENT_OF

      static final 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:
    • LANGUAGE_SUBSUMED

      static final 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:
  • Method Details

    • getPreconditionType

      String getPreconditionType()
      Gets the type of this precondition. Each sub-interface of 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.
      Specified by:
      getPreconditionType in interface Precondition
      Returns:
      PRECONDITION_TYPE
    • getFsIndexName

      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(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 this MetaDataObject 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 this MetaDataObject is not modifiable.
    • getFeatureName

      String getFeatureName()
      Gets the name of the feature to be tested.
      Returns:
      the feature name, null if none
    • setFeatureName

      void setFeatureName(String aFeatureName)
      Sets the name of the feature to be tested.
      Parameters:
      aFeatureName - the feature name, null if none
      Throws:
      UIMA_UnsupportedOperationException - if this MetaDataObject is not modifiable.
    • getComparisonValue

      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(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 this MetaDataObject is not modifiable.
    • getPredicate

      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(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 this MetaDataObject 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 this MetaDataObject is not modifiable.