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: internal, 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).

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.  geoJSON structures are also good candidates for definitions.

A reference can later be replaced by its attributes to branch away from the definition. 

Internal definitions are provided mostly for JSON Schema compatibility.  But model and external definitions are the most useful, with external definitions being used when needed across multiple models.

 

Have more questions? Submit a request

6 Comments

  • 1
    Avatar
    Miguel Ballesteros

    This is a handy feature at design time. However, when forward-engineering schema files, model references are kept as references, and those cannot be found anywhere in any of the generated schema files.

            "description": {
                    "$ref": "#model/definitions/localizableString"
             },

    If I try to find the re-usable object definition "localizableString", it is not present on any of the generated schema files. Also, there's no option to export "Rendered" re-usabe objects, hoping with a feature like this that those references are replaced by the actual object structure and therefore used right away in any other JSON-validator library/application.

    Any options I'm missing in the app?

  • 1
    Avatar
    Pascal

    Hello Miguel,

     

    Thank you for your comment.  Indeed, the feature is there specifically to help data modelers.  If you do Tools >  Forward-Engineering > JSON Schema, the references are displayed as is.  We could provide an option to render the definition instead of displaying the reference.  I'll add this to the backlog.

     

     

  • 0
    Avatar
    Tiffany Schack

    I agree with Miguel, displaying the definitions instead of the localized string reference would be helpful (which that capability is now there). If there was a way to display all of the references in one place, including their specific properties such as sample, would be a great enhancement.

    Edited by Tiffany Schack
  • 0
    Avatar
    Pascal

    Hello Tiffany,

    Thank you for your comment.  This is now at the top of our backlog, and I expect that it will be released towards the end of this month, or early next month at the latest.  Stay tuned.

  • 0
    Avatar
    Sandy Davis

    According to this https://json-schema.org/understanding-json-schema/structuring.html?highlight=ref, the reference source could be internal to the same schema document or external.  Similar to include/import in XML Schema.  Maybe a switch that would control how references are rendered.

    Edited by Sandy Davis
  • 0
    Avatar
    Pascal

    The feature requested by Miguel and Tiffany was released earlier.  When displaying our exporting a JSON Schema, the user has the choice of 'Referenced definitions' (with $ref to internal or external sources), or 'Resolved definitions'.  More details in this page: https://hackolade.com/help/Reusableobjectsdefinitions.html

Please sign in to leave a comment.