Facets

You can add a location or time facet to a concept to use this concept as a location or as a time in rules. For example, you can add a location facet to a concept, and use this concept in rules that apply to spatial reasoning.

In the rule, the concept takes the role of the type that is defined in the facet, and you can use the operators that are related to this type.

To define a facet, use the following syntax:

<a concept> has <an attribute> used as the default <facet>.

An event has a built-in facet of the type date and time. In a rule, you can use time operators by referring to the event directly. For example, 'the flight event' is at the same time as the departure time of 'the flight' is equivalent to the timestamp of 'the flight event' is at the same time as the departure time of 'the flight'

Example of a location facet

In the following example, a flight entity is a location-aware object because a facet of type point is defined on this entity.

a flight has a position used as the default point.

In a rule, you can then write the following statement. You can refer to the concept without specifying explicitly the position of the flight. Instead of writing the position of 'the flight', you just write 'the flight'.

if 
   the distance between 'the flight' and the location of the arrival airport of 'the flight' in kilometers equals 0
then 
   print "Airplane at arrival airport"

The flight entity is interpreted as a location, and you can use the operators that are specific to this location type in the rules.

Example of a date facet

In the following example, a flight has a planned duration with a facet of type duration.

a flight has a planned duration used as the default duration.

You can write the following rule where 'the flight' is treated as a duration.


when a flight delayed event occurs 
if 
   'the flight' is longer than the duration of the last period of 'the flight' 
then 
   print "Long flight expected" ;