Package com.iphrase.runtime.query.constraint

Constraint and related collection classes for creating and building boolean combinations of query constraints.

See:
          Description

Interface Summary
Constraint.Flags Define Constraint feature flag values.
 

Class Summary
Bool Represent a constraint for a boolean feature type.
Conjunction Represent a collection of constraint Disjunction instances ANDed together by this conjunction.
Constraint Abstract base class for all atomic constraints.
DateTime Represent constraints for datetime feature types.
DateTime.Eq Constrain a feature to be equal to a particular date.
DateTime.Gt Constrain a feature to be greater than a particular date.
DateTime.Gte Constrain a feature to be greater than or equal to a particular date.
DateTime.Lt Constrain a feature to be less than a particular date.
DateTime.Lte Constrain a feature to be less than or equal to a particular date.
DateTime.Neq Constrain a feature to be not equal to a particular date.
DateTime.Range Represent a range-comparison DateTime constraint.
Disjunction Represent a collection of Constraint instances ORed together by this disjunction.
Enumerated Represent constraints for enumerated feature types.
Enumerated.Equals Constrain a feature to be equal to a particular enumerated value.
Enumerated.InList Constrain a feature to be within a list of enumerated values.
Enumerated.NotEquals Constrain a feature to be not equal to a particular enumerated value.
Enumerated.NotInList Constrain a feature to be not within a list of enumerated values.
Example Represent a "query by example" constraint.
Mentions Represent a concept constraint against indexed text feature types.
Null Constrain any feature type to be either null or non-null.
Numeric Represent constraints for numeric feature types.
Numeric.Eq Constrain a feature to be equal to a particular numeric value.
Numeric.Gt Constrain a feature to be greater than a particular numeric value.
Numeric.Gte Constrain a feature to be greater than or equal to a particular numeric value.
Numeric.Lt Constrain a feature to be less than a particular numeric value.
Numeric.Lte Constrain a feature to be less than or equal to a particular numeric value.
Numeric.Neq Constrain a feature to be not equal to a particular numeric value.
Numeric.Range Represent range-comparison Numeric constraints.
Taxonomy Represent constraints for taxonomy feature types.
Taxonomy.Contains Constrain a feature to contain a particular taxonomy value.
Taxonomy.NotContains Constrain a feature to not contain a particular taxonomy value.
Taxonomy.NotStartsWith Constrain a feature to not start with a particular taxonomy value.
Taxonomy.StartsWith Constrain a feature to start with a particular taxonomy value.
Text Represent constraints for text feature types.
Text.Contains Constrain a feature to contain a particular text value.
Text.EndsWith Constrain a feature to end with a particular text value.
Text.Equals Constrain a feature to equal a particular text value.
Text.StartsWith Constrain a feature to start with a particular text value.
Within Use this constraint to require that matched items fall within a bounded range of the min or max of the current result set.
 

Package com.iphrase.runtime.query.constraint Description

Constraint and related collection classes for creating and building boolean combinations of query constraints.

There are a number of different kinds of query constraints, all subclasses of the Constraint base class. Some of these classes contain inner classes that further specialize the type of constraint.

The OneStep server handles constraints as an ANDed set of ORed constraints. Only these two levels are supported. For example, here is one of many possible boolean combinations of a set of five constraints a, b, c, d, and e:

(a OR b) AND (c OR d) AND (e)

The API represents ORed constraints with the collection class Disjunction and ANDed disjunctions with the collection class Conjunction. The root conjunction is obtained from a query via Query.getConstraints() and can be set on the query via Query.setConstraints(com.iphrase.runtime.query.constraint.Conjunction).

As an example, here is how we might code the example above:

Constraint a = new Text.Contains("sitemap name", "laptop");
Constraint b = new Text.Contains("sitemap name", "monitor")
Constraint c = new Enumerated.Equals("vendor name", "Acer");
Constraint d = new Taxonomy.StartsWith("category", ":Computers");
Constraint e = new Text.Equals("developer", "Brian Morgan");

Conjunction ands = query.getConstraints(); // keep any existing constraints

Disjunction ors = new Disjunction();
ors.add(a);
ors.add(b);
ands.merge(ors);

ors = new Disjunction();
ors.add(c);
ors.add(d);
ands.merge(ors);

ands.merge(new Disjunction(e)); // can construct a Disjunction from a constraint

query.setConstraints(ands);

For advanced usage, the Constraint base class defines two methods that can be used to recreate a constraint from (drill-down) navigation data or a serialization string, respectively: Constraint.newInstance(String type, String op, String feature, Object value) and Constraint.newInstance(String state).

Related Documentation

See the Configuring the Look and Feel chapter in the OneStep User's Guide.


© Copyright 2005, 2006. IBM Corporation. All rights reserved.