Skip to main content

Data models

Data models are a way to represent business objects and their relations into an application.

A Data Model is composed of Business Models. Properties can be added to these models and they can be connected together in order to create relations. Business objects are not necessarily stored in the Olympe database.

Models are created in the project sub-editor and they belong to a Data Model. Any model (from the Marketplace) can be added as property or as relation. Each property and relation of a model is displayed inside its box. The models which are defined in other Data Models are available in the Marketplace (if imported/visible). The user can delete the model by clicking on the Delete button.

data_model

When creating a Data Model, it is recommended to also create a set of helper logic bricks to make it easier to manipulate that data. The standard terminology is:

  • Constructors are used to construct objects from a model and the relevant parameters should be set. We may typically have multiple constructors to accommodate different criteria. Constructors are logic bricks that typically contain a Create Local Object brick, as well as a few Set Object Property and Persist bricks.

  • Getters are used to retrieve information from an object. Many functions need to retrieve more than one property of an object, therefore it is often more convenient to define a single function that provides all attributes. It is important to note that there is no harm in leaving outputs unconnected within a function.

  • Setters are used to modify information within an object.

From the Business Model Editor’s contextual menu, Generate Constructor/Generate Getter/Generate Setter opens a wizard to select from the list of available Folder(s) (a new Folder can also be created) where the constructor/getter/setter are generated and saved as pre-defined Actions and Functions.

Properties and relations#

Properties represent the attributes that have the same lifecycle as the object (e.g: could be text, number, date, color, etc): when the object is deleted, the property is deleted too.

Any existing model listed in the Marketplace can be drag-and-dropped on the property zone of a Model. This creates a new property. User can then change the name of the property or delete it.

Relations represent the attributes that have a different lifecycle as the object: when the object is deleted, the related object is not deleted. The relation is between two business models. Moreover, it is possible to link more than one object within a single relation.

Any existing model listed in the Marketplace can be drag-and-dropped on the relation zone of a Model. This creates a new property. User can then change the name of the relation or delete it. If the target model belongs to the Data Model, a line is drawn between them.

relation