You are viewing the documentation for Blueriq 15. Documentation for other versions is available in our documentation directory.

What is it for?

Relations define possible associations between instances of entities

What is it?

A relation describes the association between two entities. The relation is reversible; from entity1 towards entity2 and from entity2 towards entity1. This reverse relation is required.

For instance, if ‘Person’ and ‘Job’ are both entities, a relation ‘HasJobs’ can be created from ‘Person’ to ‘Job’. The reverse relation ‘IsOfPerson’ can be created from ‘Job’ to ‘Person’.

How to – define a relation

When creating a relation you need at least one or more entities.

  1. Select the Home tab
  2. From the Domain group select the Relation icon
  3. Fill in the required fields and tick the necessary boxes
  4. Add a validation if desired
  5. Click Save or Save & close




Properties

PropertyDescription
Functional nameOptional, can be used in Documentation
From entity

Choose the entity from which the relation originates.

Icon

When this entity is not yet created it is possible to create it whilst creating an entity by clicking on the icon create new entity.

RelationName the relation
Multi-valuedTick this box if the relation can be multi-valued
To entity

Choose the entity the relation points to.

Icon

When this entity is not yet created it is possible to create it whilst creating an entity by clicking on the icon create new entity.

Reverse relationName the reverse relation
Multi-valuedTick this box if the reverse relation can be multi-valued
Default valueUsing the default value to set a relation will cause the inference engine to automatically determine the instances linked in the relation. You are able to create an expression here to select these instances.
DescriptionIs optional, but recommended.
Question textFill when the relation should be visible to the user
Explain textProvides additional explanatory text.
Validation ruleChoose one or more validation rules. Validations check the correctness of the input for that relation at run-time. First you have to create a validation rule in order to be able to choose it here. Validation rules can also be added to a relation by dragging and dropping.
Validation type

The following validation types are available:

  • Bankaccount (string): use to check whether a bank account number is valid
  • Date (date): use to construct validations for specific date formats
  • IBAN (string): International Bank Account Number
  • Number (number, integer, percentage, currency)
  • Regexp (string): use for regular expressions |
  • SofiNumberValidator (string): use to check whether a social security number is valid
  • StringLength (string)

Creating and maintaining relations

Relations between instances can be created and maintained in several ways.

Service calls

Relations can be managed using the following service calls:

Adding a relation to a containment

By adding a relation to a Page or Container, a 1:1 relation can be created and/or read out between active instances or between an active instance and a newly created instance.

Default value

Using the default value to set a relation will cause the inference engine to automatically determine the instances linked in the relation. Take note when using the relation its default expression is evaluated to determine all instances that will be present in the relation. The truth maintenance system ensures that any change in the profile that affects the outcome of the expression will cause the relation to be re-evaluated.

Manually setting the relation will take precedence over the inferred instances (inferred value is system set, using services to set the relation makes it user set).

Reverse relation

We strongly discourage using the reverse relation of relations with a default value in any way, as this can cause performance issues.

1 Comment

  1. I'm trying to understand when using the reverse relation of relations with a default causes performance issues. Is this caused by the fact that in order to determine the value of the reverse relation the expression has to be evaluated for each instance of the entity the reverse relations points to? 

    Furthermore I'm wondering if the values of the derived relations are cached? And thus only re-evaluated if an attribute used in the expression changes value.