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

What is it for?

AQ_Instance_Create is used to create a new instance and directly set its attributes and relations. By default the instance is activated directly upon creation (before attributes and relations can be set).

Parameters

NameDescriptionTypeRequired
EntityThe type of the instance that should be createdModule Element - EntityTrue
Instance ActivationSelect whether the created instance is activated before or after setting the attributes and relations. The instance will remain activated after the service call, regardless of which value is chosen.

Enumeration

  • Before (default)
  • After
True
Attributes and RelationsAdd one line for each attribute or relation that you want to setLineFalse

Attribute/RelationSelect an attribute or relation of the entity selected aboveModule element - Attribute/RelationFalse

Value

Write an expression that results in a value for the selected attribute or relation

ExpressionFalse

This service executes all lines from top to bottom, so when setting InstanceActivationType to "Before" you could use the new value of an attribute or relation that you set in a previous line by using this attribute or relation in the expression of a subsequent line. Attributes and relation will be set in the order that you specify.

Examples

Create Job

Imagine a situation in which you want to create a new job instance, and place it in the Person.hasJobs relation. In this fictitious example we are only registering business engineers, and the job title should get this value. The service shown below will do all this within one service.

  • A new Job instance is created
  • The instance is activated before the attributes and relations are set
  • The attribute Job.Name gets the value "Business Engineer"
  • The backwards relation is set with the active Person.

If a person can have multiple jobs, then the above service will work. By adding setting the Job.BelongsToPerson relation, the Person.HasJobs relation will be updated by adding the instance to the existing job instances.

Copy Job

Imagine a situation in which you want to create a new job instance and use current active job instance to retrieve values from. In this fictitious example we are using the active job instance to retrieve values from and set them on the newly created job instance. The service shown below will do all this within one service.

  • A new Job instance is created
  • The instance is activated after the attributes and relations are set, therefore we can retrieve values from the current active job instance.
  • The attribute Job.Name gets the value from the active job instance.
  • The backwards relation is set with the person from the active job instance.

If the instance activation parameter is set to before. The newly created instance would be been activated before setting the attributes and relations. This would mean that the Name attribute and ofPerson relation would have been set to UNKNOWN, because the values would have been retrieved from the newly created job instance. Instead of the old active job instance.