Associations
A non-owning link between instances
An Association connects concrete Block instances to one another without any lifecycle ownership — a non-owning model link, distinct from the ownership an Aggregation carries.
Association type must be InstanceReference
An Association's type must be InstanceReference(T) or InstanceReference(T)[] with T extending core:Block — a bare Block FQN such as core:Block is invalid there, unlike on an Aggregation.
Associations versus documentation references
Associations form the instance graph between concrete Block instances; documentation References connect types to types or types to instances for narrative purposes only and never form that instance graph themselves.
Linking one instance to another
An Association declaration wraps its target Block in InstanceReference, and an instance sets it to the id of an existing composition child.
<!-- Definition: "primaryItem" is an Association typed InstanceReference(acme:Widget) -->
<acme:Basket xmlns="http://blockml.org/bml"
xmlns:acme="com.acme.example"
xmlns:core="org.blockml.bml.core"
xmlns:type="org.blockml.bml.type">
<baseType>
core:Block
</baseType>
<associations>
<primaryItem type="type:InstanceReference(acme:Widget)" />
</associations>
</acme:Basket>
<!-- Instance: primaryItem points at the bml:id of an existing composition child -->
<acme:Basket bml:id="myBasket" primaryItem="firstWidget">
<items>
<acme:Widget bml:id="firstWidget" />
</items>
</acme:Basket>
myBasket's primaryItem does not create firstWidget — it merely points at the id of the Widget already owned by items. firstWidget continues to exist independently of primaryItem, unlike the ownership items itself carries; if items were ever emptied, primaryItem would simply be left pointing at nothing.
What to carry into the next pages
After this page, readers should be able to add a non-owning link without confusing it with aggregation ownership, before Capabilities introduce behaviour as the fourth member kind.