riddl icon indicating copy to clipboard operation
riddl copied to clipboard

Implement Entity Relationships

Open reid-spencer opened this issue 1 year ago • 0 comments

As in the old ERD days, entities can have relationships with other entities. The current type system supports this in a limited fashion with the cardinality rules. The state of an entity can indicate:

entity Node is {
  state Only of record OnlyStorage ...
  record OnlyStorage is {
    parent: entity Node /* 1:1 */
    children: entity Node* /* 1:N */
  }
}

But, how do we do N:N and N:1 relationships? Furthermore, how do we specify these four kinds of relationships without using the entity state? This issue aims to support these relationships more plainly and for more than just entities

The suggested syntax, for all Vital Definitions is:

"relates to" ~ relationship[VitalDef] ~ as relationshipKind

where relationshipKind is 1:1, 1:N, N:1, N:N

reid-spencer avatar Dec 19 '23 15:12 reid-spencer