Skip to content
v2.7 (latest)

Entities ​

This section provides step-by-step instructions for creating and configuring entities in Rulecube.

Entities are containers into which (input) data and rules acting on that data can be integrated, as in a JavaScript class. Using entities is the most natural/logical way to implement a business rule in a ruleset, and therefore, they improve the manageability of your rulesets.

Within an entity, data become regular properties and rules calculated properties of the entity, like in this Person entity:

  • Name (regular property)
  • Address (regular property)
  • DateOfBirth (regular property)
  • Age (calculated property – rule)

Elementary and compound entities ​

The Person entity is self-contained and therefore a so-called elementary entity. Elementary entities cover many real-world business rule scenarios, but Rulecube goes even further with compound entities that are composed of two or more connected entities to cover all possible business scenarios.

For example, a compound Invoice entity consists of its own properties and properties based on the InvoiceItem entity, where one invoice can have one or more items. Furthermore, the InvoiceItem entity is connected to the ProductItem entity that holds product details:

  • Invoice (entity):
    • InvoiceDate
    • TotalAmount
    • InvoiceItems → InvoiceItem (entity):
      • Count
      • Amount
      • Product → ProductItem (entity):
        • ProductID
        • Description
        • Price

This way, you can cover each data structure you need in your rulesets.

For more information about Entity instantiation, see Entity instantiation.