Re-usable objects definitions
To facilitate the work of data modelers, Hackolade has introduced a handy feature: the ability to create once object definitions that can be re-used in multiple places. A library of definitions standardizes content and insures consistency. This dictionary also simplifies the work of data modelers so maintenance can be performed in one place and be automatically propagated to all places where the definition is referenced.
Definitions can be maintained at 3 distinct levels: collection, model, and external.
External definitions let you reference another Hackolade model or part of another model. In order for changes to a referenced model to be activated in a referencing model, the latter needs to be opened in the application.
If a definition is created at the model level, it can be referenced in any collection of the same model, whereas it will be limited to its own collection if it is created locally (internally). It is easy to create a re-usable definition from scratch, then reference it in a collection. Or by selecting an attribute in an existing collection, and converting it to a re-usable definition, so it can be referenced elsewhere.
Definitions are not carried over to the NoSQL database. They are only used in physical modeling in Hackolade. To make things easy for the data modeler, Object Browser, ERD, collection tree views, and documentation all show the referenced attributes as if they had been defined directly in the collection(s).
When displaying the JSON Schema preview or forward-engineering JSON Schema, the user may choose between the standard 'Referenced definitions'
or 'Resolved definitions'
A good example of a useful re-usable object is an address. You may want to have a 'billing address' and a 'shipping address', both of which use the same structure.
1) Reference to another Hackolade model
If you have defined a separate model with the structure of an address, you may reference it in any other Hackolade model:
next, you're prompted to choose the reference model, either from your file system or a URL:
You then can choose an individual attribute, or an entire structure:
Note: it is not intended to combine definition levels. In other words, if you have a Hackolade model with attribute structures intended to be re-used in other models, you should define these as simple attributes, not as internal or model definitions.
2) Initially create a definition
A definition can be created from scratch, just like any collection, either by selecting the Model Definitions lower tab at the model ERD level:
or by selecting the Internal Definitions lower tab at the collection level:
In our address example, the definition may look like this:
Once the definition is created, it can be referenced in a collection, via the contextual menu:
As a result, a reference is created in the collection. The application displays all the elements of the definition, as if they were in the collection, but only a reference to the definition is actually stored in the collection:
The reference is marked with the middle line in the tree box, showing the name of the referenced definition, followed by either (m) for model definitions, or (i) for internal definitions.
At any point, it is possible, if desired, to replace a reference by the object definition structure:
3) Convert an existing attribute into a definition
If you want to make an attribute available for use elsewhere in the same collection, or in another collection, you can convert it with just a few clicks:
This will create the internal or model definition, and replace the attribute (and its children if any) by a reference to the definition.