Query evaluation

Each condition in the query is evaluated in the specified sequence. Therefore, the query results are modified by each condition in turn.

By default, all buckets from the planning horizon are included in the initial query results. The Operation element indicates the process to apply filter condition, and how the filter results are combined with the existing query results.

For example:

  • ADD: Adds the results of the condition filter to the existing query results:
    • For bucket condition filter, the filter is applicable to all buckets in the planning horizon.
    • For a class condition filter, the filter is applicable to all resources for the Class.
  • LIMIT: Applies condition filter to the current query results:
    • For a bucket condition filter, the filter condition is applicable only to the buckets in the query results.
    • For a class condition filter, the filter condition is applicable only to the resources for the Class, in the query results.
  • RESET: Replaces the current query results with the results of the condition filter:
    • For a bucket condition filter, the filter condition is applicable to all the buckets in the planning horizon. The results of the filter replace the existing buckets in the query results.
    • For a class condition filter, the filter condition is applicable to all the resources for the Class. The results of the filter replace the existing query results for the filtered Class.

Filtering

Condition filters related to properties are evaluated only for property values in the buckets included in the query results. The data type for Comparison (string, date, number) is determined by the data type of the Condition filter field.

For example:

  • Field type Date:
    • Bucket fields, bucket.start, bucket.end;
    • Class system attributes effective from, effective to and effective at.
  • Field type Number
    • Class property, default property;
    • Class system attribute distribution.
  • Field type String
    • Bucket field bucket.name;
    • Class user attributes
    • Class system attributes such as name, description, units.

The value of condition filters is converted to the field data type for comparing against the field value. For example:

When evaluating the following condition filter, the ‘31-12-2018’ value is converted to a date for comparing against the bucket start date.

Field name Comparison Value
bucket.start > 31-12-2018

When evaluating the following condition filter, the value of ‘$min_shelf_life’ variable is converted to a number for comparing against default property shelf life (*) of class Products.

Field name Comparison Value
Products.shelf life (*) < $min_shelf_life

If the Value cannot be converted to the expected data type, an appropriate error is generated. For example:

  • APACS204=Invalid date "{0}"
  • APACS118=Invalid number "{0}"
Where {0} = The value that is considered invalid.