Skip to end of metadata
Go to start of metadata

As described on the Queries, Operators and Predicates page, predicates are used to make selections of a Building Block's instances. This page gives a comprehensive overview on the use of predicates and predicate-defining operators.

Working with Predicates

A single predicate may be used by simply placing it in the square brackets of the filter-operator's syntax.

Example

Consider the Building Block Information System having the Property costs and assume the following scenario:

Information System

costs

CRM

700

Callcenter

300

EAM

99

BI

2000

The predicate @costs < 500 may then be used via

 InformationSystem[ @costs < 500]; 

which then returns the result:

InformationSystems[ @costs < 500]

Callcenter

EAM

Negation of a Predicate

A predicate may be negated by placing a "!" in front of it. Taking the original predicate this will turn every "yes" into a "no" label and vice versa.

Example

Consider the basic example on this page.

The predicate @costs < 500 gives the labeling

Information System

CRM

Callcenter

EAM

BI

Predicate @costs < 500

no

yes

yes

no

It may be negated by putting a "!" in front of it

 ! @costs < 500 

This gives a new predicate:

Information System

CRM

Callcenter

EAM

BI

Predicate !@costs < 500

yes

no

no

yes

Therefore the query

 InformationSystem[ ! @costs < 500 ]; 

consequently returns:

InformationSystems[ ! @costs < 500]

CRM

BI

Combining several Predicates

Several predicates may be combined using "&" or "|" (meaning or).

"&"-combination

Two predicates may be combined via "&", meaning an instance of the Building Block must be labelled by both predicates with a "yes" to obtain a "yes" of the resulting predicate. Note that therefore the result of the use of "&" between two predicates provides itself a single predicate (that may be used further just as any other predicate). As well "&" is symmetric, meaning that the order of the two predicates to be combined does not matter.

Example

Consider the basic example on this page.

Combining the predicates _ @costs < 500 _ and _ @costs > 100 _ via "&" is achieved via

 @costs < 500  & @costs > 100

which gives the predicate labeling exactly those instances of the Building Block Information System with "yes" that have costs greater than 100 and less than 500.

The labeling of all occurring predicates is:

Information System

CRM

Callcenter

EAM

BI

@costs < 500

no

yes

yes

no

@costs > 100

yes

yes

no

yes

@costs < 500 & @costs > 100

no

yes

no

no

"|" (or)-combination

Two predicates may be combined via "|", meaning an instance of the Building Block must be labelled by at least one of the two predicates with a "yes" to obtain a "yes" of the resulting predicate.Just as seen for "&", the result of the use of "|" between two predicates provides itself a single predicate and "|" is symmetric meaning that the order of the two predicates to be combined does not matter.

Example

Consider the basic example on this page.

Combining the predicates _ @costs < 500 _ and _ @costs > 100 _ via "|" is achieved via

 @costs < 500  |  @costs > 100

which gives the predicate labeling exactly those instances of the Building Block Information System with "yes" that have costs greater than 100 or less than 500.

The labeling of all occurring predicates is:

Information System

CRM

Callcenter

EAM

BI

@costs < 500

no

yes

yes

no

@costs > 100

yes

yes

no

yes

@costs < 500 | @costs > 100

yes

yes

yes

yes

Combining more than two predicates

As seen above, the result of combining two predicates via "&" or "|" provides again a predicate that may be combined itself with another predicate. However, when using "&" and "|" combinations at the same time, it might be important to state the wanted order these combinations are intended to be made. This can be achieved using brackets "(...)". Any predicate may be placed into brackets without changing its meaning or validity. By placing a predicate resulting from a combination of two other predicates into brackets one forces iteraQL to first achieve the predicate inside the brackets and then execute any further operation with this result. Whenever "&" and "|" are used simultaneously, the use of brackets is highly recommended. If no brackets are used, iteraQL will execute the combinations in the order they are written in the query.

When negating combined predicates, the use of brackets is necessary, because iteraQl has no dedicated operator precedence and hence the ! (NOT) operator does not have a higher rank the the & (AND) and | (OR) operators.

Example

Consider the basic example on this page.

Compare the resulting predicates of

 ( @costs < 500 & @costs > 100 ) | @costs > 1000 

and

  @costs < 500 & ( @costs > 100  | @costs > 1000  )

In the former, the "&" combination is executed first, in the latter the "|" one.
Therefore the results differ as follows:

Information System

CRM

Callcenter

EAM

BI

( @costs < 500 & @costs > 100 ) | @costs > 1000

no

yes

no

yes

@costs < 500 & ( @costs > 100 | @costs > 1000 )

no

yes

no

no

Comparison Operators

This section resents the different comparison operators available for the iteraQl filter criteria for each supported data type. Comparisons may be made with numeric, string or date attributes. For obtaining a valid predicate, make sure both sides that are to be compared with each other are of the same nature.

Numeric Comparison

Syntax

Meaning

arg1 = arg2

Numeric equality between two arguments.

arg1 != arg2

Numeric inequality between two arguments.

arg1 < arg2

First argument is lass than second argument.

arg1 <= arg2

First argument is lass than or equal to second argument.

arg1 > arg2

First argument is greater than second argument.

arg1 >= arg2

First argument is greater than or equal to second argument.

String Comparison

Note: All string comparison operators are case-insensitive.

Syntax

Meaning

arg1 = arg2

String equality between the arguments.

arg1 != arg2

String inequality between the arguments.

arg1.contains(arg2)

The value of the property represented by arg1 contains the string or value of property represented by arg2.

arg1.beginsWith(arg2)

The value of the property represented by arg1 begins with the string or value of property represented by arg2.

arg1.endsWith(arg2)

The value of the property represented by arg1 ends with the string or value of property represented by arg2.

Date Comparison

Note: Date values should be given in quotes, to ensure correct recognition, e.g. "09/01/12" instead of just 09/01/12.

Syntax

Meaning

arg1 = arg2

The two arguments represent the same date with day accuracy.

arg1 != arg2

The two arguments represents different dates with day accuracy.

arg1 < arg2

The date represented by arg1 is before the date represented by arg2.

arg1 <= arg2

The date represented by arg1 is before, or the same as, the date represented by arg2.

arg1 > arg2

The date represented by arg1 is after the date represented by arg2.

arg1 >= arg2

The date represented by arg1 is after, or the same as, the date represented by arg2.

Date Ranges

The complete string with date range values should be written in quotes, to ensure correct recognition, e.g. "09-01-12;10-01-12" instead of just 09-01-12;10-01-12.

Syntax

Meaning

fromDate;toDate

The start and end date for a range specification.

Examples

Using English locale:

InformationSystem[@Productive period.contains("2016-01-01;2016-01-01")];

Using German locale:

InformationSystem[@Productive period.contains("01.05.2011;01.06.2011")]; 


Comparison Operators on Multi-Valued Properties

It may happen that one of the two sides happens to be a multi-valued Property. In this case, the statement remains valid if the single values of both sides are still of the same kind, meaning both numeric, a string or a date.

There are two cases:

Multi-valued Left-Side

If the left side in the use of a comparison operator is a multi-valued Property, the predicate returns a "yes" label if at least one value in the list of the left side obtains a "yes" from the comparison.

Multi-valued Right-Side

If the right side in the use of a comparison operator is a multi-valued Property, the predicate returns a "yes" label only if all values in the list of the right side obtain a "yes" from the comparison.

Other predicate-defining Operators

There are further predicate-defining operators as well. Those will be presented as the operators on the operators' reference page .

Contains

Summary

Effect:

States whether a text contains a given text-string.

Input:

Text Property

Output:

Predicate

Syntax
  %P%.contains( "%TEXTSTRING%" ) 
Explanation

The contains operator returns a predicate that selects instances of the affected Building Block by checking whether or not the given Property does contain the text-string of interest.

Example
Example

Assume there are the Information Systems "CRM #1", "cc CRM #2", "t CRM" and "BI #1".

Then _@name.contains("CRM") gives the predicate

Information System

"CRM #1"

"cc CRM #2"

"t CRM"

"BI #1"

@name.contains("CRM")

yes

yes

yes

no

and the query

 InformationSystem[ @name.contains("CRM") ]; 

would then return the Information Systems "CRM #1", "cc CRM #2" and "t CRM" .

Begins With

Summary

Effect:

States whether a text begins with a given text-string.

Input:

Text Property

Output:

Predicate

Syntax
  %P%.beginsWith( "%TEXTSTRING%" ) 
Explanation

The contains operator returns a predicate that selects instances of the affected Building Block by checking whether or not the given Property begins with the text-string of interest.

Example
Example

Assume there are the Information Systems "CRM #1", "cc CRM #2", "t CRM" and "BI #1".

Then _@name.beginsWith("CRM") gives the predicate

Information System

"CRM #1"

"cc CRM #2"

"t CRM"

"BI #1"

@name.beginsWith("CRM")

yes

no

no

no

Ends With

Summary

Effect:

States whether a text begins with a given text-string.

Input:

Text Property

Output:

Predicate

Syntax
  %P%.endsWith( "%TEXTSTRING%" ) 
Explanation

The contains operator returns a predicate that selects instances of the affected Building Block by checking whether or not the given Property begins with the text-string of interest.

Example
Example

Assume there are the Information Systems "CRM #1", "cc CRM #2", "t CRM" and "BI #1".

Then _@name.endsWith("1") gives the predicate

Information System

"CRM #1"

"cc CRM #2"

"t CRM"

"BI #1"

@name.endsWith("1")

yes

no

no

yes

  • No labels