Predicate

<< Click to Display Table of Contents >>

Navigation:  Technical Guide >

Predicate

 

Predicates are data structures that allow complex queries to be passed through DTS towards various Connectors in order to extract records or create streams. All record requests through DTS will internally resolve to Predicates, though the direct interface may sometimes wrap the request in simpler parameters for ease of use.

Predicates are also used by DTS to define fundamental Collection Filters and to design relationships within Aggregates.h

 

Structure

 

DTS Predicates can be found in various endpoints either as Java Objects or JSON or XML data structures. We will explore their structure in JSON format for simplicity:

{

 "operatorName": "",

 "attributeName": "",

 "attributeValue": "",

 "negated": false,

 "leftPredicate": {

         // another predicate

 },

 "rightPredicate": {

         // another predicate

 }

}

 

 

Information-icon_16px The types of all of the Predicate's fields is String, with the exception of "negated", which is a boolean

To pass a number-type attributeValue, into the predicate, simply use the standard String representation (e.g.: 34 -> "34", 100.29 -> "100.29", etc.)

 

Information-icon_16px Certain expressions can also be passed through the attributeName and attributeValue fields, in order to provide another layer of query customization

The exact limits of this feature depend on the targeted system. You can find a general description of it below and individual implementation limits in the "Limitations" section of each Connector category.

 

 

Operators

 

The operators, specified using the operatorName field of the Predicate, control the actual function of the Predicate. The following operators are known to DTS:

operatorName

Function

Details

eq

Equals

Creates a clause which checks if attributeName equals attributeValue

like

Matches

Creates a clause which checks if attributeName matches attributeValue (may be a regex or some other kind of matching pattern, depending on the targeted system)

gt

Greater Than

Creates a clause which checks if attributeName is greater than attributeValue

gteq

Greater Or Equal Than

Creates a clause which checks if attributeName is greater than or equals attributeValue

lt

Lesser Than

Creates a clause which checks if attributeName is lesser than attributeValue

lteq

Lesser or Equal Than

Creates a clause which checks if attributeName is lesser than or equals attributeValue

and

And

Combines leftPredicate and rightPredicate using an AND operator

or

Or

Combines leftPredicate and rightPredicate using an OR operator

Information-icon_16px The negated field value determines whether the entire result of the Predicate should be negated, thus making the creation of complementary operators possible:

eq + negated = not-Equals

like + negated = not-Matches

and + negated = NAND

or + negated = NOR

 

 

Passing Expressions

 

 

 

Examples