Skip to content

A logical data model built from scratch

What this example shows

How a hand-built logical data model looks in CrossModel once it is finished: entities with typed attributes, identifiers, and the relationships that tie them together.

It is the end state of Datamodeling Fundamentals. Clone it if you want to see where that tutorial lands before - or instead of - doing it.

Branch: examplesdata-modelingfundamentals

What's in the workspace

On top of the BrightGreen base, this example adds a MyFirstModel data model:

Object What it demonstrates
Customer A straightforward entity with an identifier and descriptive attributes
Product A second independent entity
SalesOrder An entity that references a customer
SalesOrderLine A line-item entity referencing both an order and a product
Customer_to_SalesOrder A one-to-many relationship
SalesOrder_to_SalesOrderLine A parent-to-line relationship
Product_to_SalesOrderLine A lookup relationship from the product side

This is the classic order-header / order-line shape, which is why it works well as a first model: it is small enough to hold in your head, but it exercises identifiers, cardinality and more than one relationship per entity.

What to look at

  • Open an entity in all three perspectives. Use the tabs at the bottom of the editor to switch between the form, the code (.cm YAML) and the diagram. They are three views of one file - a change in any of them shows up in the others immediately.
  • Follow a relationship. Open SalesOrder_to_SalesOrderLine and look at how the parent and child ends are declared, then see the same relationship drawn on the diagram.
  • Compare with the source systems. MyFirstModel is deliberately separate from JuiceERP and PreciseFinance in the BrightGreen base. Modelling the same concepts twice, in a source system and in your own model, is exactly the situation that mappings exist to bridge.

Where to go next