Business model statements syntax

You use the business statements to add behavior to your business model entity and event types.

You define the behavior of your entity and event types by building statements in the Statements editor of the business model file.

Table 1. Constructs
Construct Description Example

<an entity> is initialized from <an event>, where <source> comes from <target>[: - <action>].

Defines the initialization of an entity from an event.

The source is the identifier of the bound entity and the target is the identifier of the event. The action part of the rule defines attributes for the entity.

an account is initialized from an open account event, where this account comes from the account of this open account event:
   - set the credit limit of this account to the limit of this open account event
   - set the customer of this account to the cutomer of this open account event.

<an entity> is enriched by <the data provider>, given <the attribute> from <the attribute of the bound entity>, setting <the attribute> to <the attribute> of <the data provider>.

Defines the enrichment of an attribute from external data. The attribute that is set to the attribute of the data provider is enriched.

an airport is enriched by the weather provider,
   given the latitude from the latitude of this airport
   and the longitude from the longitude of this airport,
   setting the temperature to the temperature of this weather provider,
      the wind speed to the wind speed of this weather provider
      and the precipitation level to the precipitation of this weather provider.

<the attribute> of <an entity type> is <another attribute> of <an entity> <arithmetic operation>.

Defines the derivation of the value of an attribute. This value is calculated from the value of another attribute.

the yearly income of an employee is the income of this employee * 12.

<attribute> of <entity type> is aggregated from <event type> where <source> comes from <target> as <aggregate expression> [ defaulting to <number|null> [ if there are less than <number> events ]] available for <time duration> [ with a resolution of <time duration> ].

Computes the value of an attribute from the aggregation of values from a collection of events that is related to an entity.

The following diagram shows the structure of the aggregate expression construct:Structure of an aggregate expression.

the bill of a shopping cart is aggregated from purchase events where this shopping cart comes from the cart of this purchase event
   as the total price of all purchase events
   during the current month,
   where the amount of each purchase is more than 500
   defaulting to 0 if there are less than 3 events 
   available for 6 months with a resolution of 12 hours.