Related or linked structures

Is it possible to connect data structures, similar to Primary-Key Foreign-Key connections in a relational database?

One way could be to have a type similar to enum that would limit a field to a given set of values. Using the type as a dimension label on multiple data structures (via via NamedArrays or AxisKeys) would implicitly “link” them together. Syntax like Einstein notation in TensorOperations, Tullio and Einsum could be used on the linked structure. Example

@PrimaryKey     Currency             AUD USD GBP EUR CAD
@PrimaryKey     Scenario_Number      1:100

values[ Currency,  Date ]   :=   Value.(  Deals,  Rates  )   |> sum

Where Deals and Rates are data structures using Currency and Scenario_Number as axis labels. The created data structure values also has them as element lables. Unlike Einstein notation, the indices only appear on the LHS of the equation since their use on the RHS is implicit.

The PrimaryKey type could also be used as a DataFrame row or column heading. Or as a structure field.