Package org.apache.uima.cas
Class ConstraintFactory
java.lang.Object
org.apache.uima.cas.ConstraintFactory
- Direct Known Subclasses:
ConstraintFactoryImpl
Methods to create
FSMatchConstraints for filtered iterators or other
use. A constraint is an object which represents a test or a series of tests joined with "and" or
"or". Each test consists of a test predicate plus an optional "path" which specifies how to walk
through a chain of references, starting from a feature structure being tested, to reach the value
to be tested.
Tests include
- type subsumption --(satisfied if the CAS feature structure being tested is of a specified type (or is a subtype of that type).
- value equality
- for numeric values - range testing
FSIntConstraint, for
instance, the value would be an integer.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract FSMatchConstraintand(FSMatchConstraint c1, FSMatchConstraint c2) Conjoin two constraints.abstract FSBooleanConstraintCreate a new boolean constraint.abstract FSFloatConstraintCreate a new float constraint.abstract FSIntConstraintCreate a new int constraint.abstract FSStringConstraintCreate a new String constraint.abstract FSTypeConstraintCreate a new type constraint.abstract FSMatchConstraintembedConstraint(ArrayList<String> path, FSConstraint constraint) Embed a constraint under a path.abstract FSMatchConstraintembedConstraint(FeaturePath path, FSConstraint constraint) Combine a constraint test with a path from a feature structure instance to the value to be tested.static ConstraintFactoryinstance()Create a new constraint factory.abstract FSMatchConstraintor(FSMatchConstraint c1, FSMatchConstraint c2) Disjoin two constraints.
-
Constructor Details
-
ConstraintFactory
public ConstraintFactory()
-
-
Method Details
-
createTypeConstraint
Create a new type constraint. A type constraint contains one or more types to test against. A type constraint must be initialized by adding one or more types to it. The match is true if any of the types are the same or a super type of the feature structure being tested by the constraint.- Returns:
- A new type constraint with the type set to the top type.
-
createIntConstraint
Create a new int constraint. An int constraint must be initialized after it's created by adding one or more tests to it.- Returns:
- A new int constraint, completely unconstrained.
-
createFloatConstraint
Create a new float constraint. A float constraint must be initialized after it's created by adding one or more tests to it.- Returns:
- A new float constraint, completely unconstrained.
-
createStringConstraint
Create a new String constraint. A String constraint must be initialized after it's created by adding one or more tests to it.- Returns:
- A new String constraint, completely unconstrained.
-
createBooleanConstraint
Create a new boolean constraint. A boolean constraint must be initialized after it's created by adding one or more tests to it.- Returns:
- A new boolean constraint, completely unconstrained.
-
embedConstraint
Combine a constraint test with a path from a feature structure instance to the value to be tested. This is called "embedding" a constraint under a path. For example, create an int constraint, and then embed it under some int valued feature, such as the start feature of an annotation.- Parameters:
path- The path to embed the constraint under. Create a new path withCAS.createFeaturePath().constraint- The constraint to be embedded.- Returns:
- A new FSMatchConstraint.
-
embedConstraint
Embed a constraint under a path. For example, create an int constraint, and then embed it under some int valued feature, such as the start feature of an annotation.- Parameters:
path- The path to embed the constraint under. This is a list ofFeaturenames.constraint- The constraint to be embedded.- Returns:
- A new FSMatchConstraint.
-
and
Conjoin two constraints.- Parameters:
c1- The first conjunct.c2- The second conjunct.- Returns:
- A new FSMatchConstraint, representing the conjunction of
c1andc2.
-
or
Disjoin two constraints.- Parameters:
c1- The first disjunct.c2- The second disjunct.- Returns:
- A new FSMatchConstraint, representing the disjunction of
c1andc2.
-
instance
Create a new constraint factory.- Returns:
- A new ConstraintFactory instance.
-