Entities

Entities are objects that are comprised of properties. The entities of a project can be defined declaratively in Solution Designer. This means that you are not bound to fixed entities during project development, but you can define them freely depending on your individual requirements. The creation and editing of entities are done in the Solution Designer.

Entity usages

There are three types of entities available:

  • Entity: They are simple value entities without an ID, containing properties that can be connected to a root entity as a local entity. They can also be used as input/output for commands and services as well as payload to events. This type of entity will not be persisted.
  • Root entity: They are the only entry point to an encapsulated cluster of entities. A root entity has its own lifecycle (creation/life/deletion), contains a unique ID, properties and can persist in / delete from a database collection.
  • External entity: They are used to mapping and interacting with another entity from an external source which was integrated and modelled in an integration namespace. Since they represent a pointer to an entity that resides in another domain/system, they don't have to contain all definitions of the original external entity, just some identifier properties that help loading the external entity from wherever it resides through the external entity's load functionality. It can also contain its own properties.

See also introduction to Domain Driven Design for further details.

Warning:

Root entities and external entities are only available if Aggregate Persistence Support extension is enabled.

Create entities

You can access an overview page of the existing entities by visiting the entities tab on the domain namespace's Overview page. You can create a new entity by using the Create entity capability.

Entities

Entities are defined using the following master data:

  • Local Identifier: This is the local identifier (name) of the entity. It is unique within a namespace. Please note that only the characters A-z (without special characters), digits and the special character "_" are permitted for naming entities! Furthermore, local identifiers may not begin with a digit and the first character must be uppercase. The local identifier cannot be changed after creation (required)
  • Abstract: This is a checkbox field. When checked, it indicates that the entity will be abstract. If the field is checked, no instances of this entity can be created by the Solution Envoy environment. The default value is unchecked. This field is only available for entities and root entities
  • Label: This is used to name the entity (required)
  • Short Label: This is used to give an even shorter label (optional)
  • Notes: This is a long description of the entity and its lifecycle (optional)
  • Parents: This specifies one or more entities from which the new entity will inherit properties and commands. Entities can only add other entities as parents and root entities only other root entities. This field is only available for entities and root entities.

You can also use the Open after creation checkbox to open the entity for further editing after saving.

Generate entities from IBM Watson® Knowledge Catalog data assets

You can also import an entity by using the Import button on the entities tab at the Overview page of a domain namespace.

Note:

To be able to use this experimental feature make sure you have set up a connection to an IBM Cloud Pak for Data instance in the Admin Settings and added a valid API key at the User Settings.

1. Select service:

Select the instance of IBM Cloud Pak for Data from which you like to import entities. IBM Cloud Pak instances can be added and managed in the Admin Settings on the Cloud Pak Services tab (currently only IBM Cloud Pak for Data is supported).

2. Select catalog:

Select a catalog of the IBM Watson® Knowledge Catalog from which you like to import.

3. Select data asset:

Now select the Data Asset you like to use for generation of an entity. The table shows name, tags and rating of the assets which have been specified in the IBM Watson® Knowledge Catalog. It is only possible to select one data asset at a time.

4. Select properties:

After selecting a data asset and clicking on Next, the wizard shows all available properties of the selected data asset. There you can select one, many or all properties to be associated with the new entity. You can edit the name and choose the data type of each property and also set it as a required field or not.

But before, you have to decide what type of entity you want to create. It is also required to give the entity a name, a label and at least one associated property. After clicking on the Import button the new entity will be created.

Note:

Property names must be unique inside a namespace! In case of duplicates we recommend referencing to already existing properties by choosing them from the "Type" drop-down menu. Property names also have to start with a lowercase character and must not contain special characters nor spaces.

Warning:

If the data asset you selected has not been profiled in IBM Watson® Knowledge Catalog, there will be no properties shown in the table!

Field description:

  • Type: This is used to specify the type of the entity (required)
  • Local Identifier: This is the local identifier (name) of the entity. It is unique within a namespace. Please note that only the characters A-z (without special characters), digits and the special character "_" are permitted for naming entities! Furthermore, local identifiers may not begin with a digit and the first character must be uppercase. The local identifier cannot be changed after creation (required)
  • Label: This is used to name the entity (required)
  • Short Label: This is used to give an even shorter label (optional)
  • Available Properties: This is used to add properties to the entity. These properties have been specified in the IBM Watson® Knowledge Catalog and can now get adjusted in that table. Name, type, association, and origin type are shown in the table while name, type and association can also be edited in the table. Multiple properties can be selected for import but at least one has to be selected

Edit entities

You can edit the master data of all entity types by clicking the Edit entity details button in the Entity Details section on the entity's instance page. Alternatively, you can use the Edit capability of each table row on the Entities tab of a domain namespace's Overview page. The fields that can be edited are Type, Label, Short Label, Notes and Abstract.

Note:

It is not possible to change the Local Identifier for an entity.

Delete entities

You can delete a entity by clicking the Delete entity button in the upper right corner of the entity instance page. Alternatively, you can use the Delete capability of each table row on the Entities tab of a domain namespace's Overview page.

Warning:

You can only delete an entity if it is not in use.You can check the usages of an entity by using the Information capability and navigating to the Usages section. You will need to confirm the action before the selected entity is permanently deleted.

Entity inheritance

You can assign any number of parent entities while creating entities. It is also possible to add parents after creation in the Parents section of the Details view. Each entity for which a parent was assigned is called a child of the parent entity. All children inherit Properties and Commands from their parents. You can use the Remove capability to remove the assignment of a parent to an entity within the Details view as well.

Inheritance rules

Entities can only add other entities as parents (no root entities or external entities).

Associate properties to entities

You can associate new or existing properties to the entity by navigating to the entity's instance page and using the Add button within the Associated Properties at this Level section.

There are two options when adding the properties:

  • create a new property definition and associate it to the entity by selecting Create new property
  • choose one or many existing properties and associate them to the entity by selecting Associate existing property

Regarding already existing properties, a list of all (or all unused) properties that have been created in all Domain Namespaces or Integration Namespaces of the project are shown. It is also possible to search for a specific property using the Search capability. One or more property definitions can be selected in order to be added to the entity.

While associating a property you can overwrite or adjust the pre-filled name of the association.

Edit property associations

Once you associated a property definition to an entity you can edit the information of the association within the context of an entity by using the header or inline Edit capability.

Define association-specific behaviour

After associating a property you can define a specific behaviour within the context of an entity.

Text, Text/Mail, Text/URL

NameStringName of the property association
AssociationSelectionMarks the property as mandatory (1) or optional (0..1)
Min. lengthIntegerDefines the minimum number of characters of a text
Max. lengthIntegerDefines the maximum number of characters of a text
Default ValueStringThe user can specify the default value of the property
Validation Regular ExpressionStringTo restrict a text, Email and URL content, you can set a regular expression validation pattern. This pattern is used for validation within any modifying action

Boolean, Timestamp, Date, Selection Element, GeoPoint, Time

NameStringName of the property association
AssociationSelectionMarks the property as mandatory (1) or optional (0..1)

Currency, Integer, Long

NameStringName of the property association
AssociationSelectionMarks the property as mandatory (1) or optional (0..1)
Min. valueDecimalDefines the smallest valid value (minimum value) for a numeric property
Max. valueDecimalDefines the largest valid value (maximum value) for a numeric property. If filled, it must be bigger or equal than the Min. value

Decimal

NameStringName of the property association
AssociationSelectionMarks the property as mandatory (1) or optional (0..1)
Min. valueDecimalDefines the smallest valid value (minimum value) for a numeric property
Max. valueDecimalDefines the largest valid value (maximum value) for a numeric property. If filled, it must be bigger or equal than the Min. value
Decimal PlacesSelection ListDecimal places can be defined from 0 to 6. The information is mandatory

References (to already existing entities)

NameStringName of the property association
AssociationSelectionMarks the property as mandatory (1) or optional (0..1) or as array
Range RestrictionSelection ListFor a range property, it is possible to specify the range. The restriction is only possible towards a hierarchical child element of the original value. Range restriction is available for references to entities or root entities, not for external entities.
Note:

The range restriction cannot be set initially while adding a property. You can change all above described property specific information but NOT the master data of a property definition. In that case you would need to use the displayed capability Edit Property.

Sort associated properties

You can use the plus capability of the table to add a new or associate an existing property at a specific location. Alternatively, the options "Move to top", "Move up", "Move down" and "Move to bottom" are available in the inline capability of the row.

Remove property associations

You can remove the property association by using the inline or header Remove capability.

Note:

You can only remove property associations that are not inherited. To remove inherited properties, you must go to the parent entity and remove it from there. You will need to confirm the action before multiple selected properties are removed.