Associations
Overview
Associations define ontological relationships between defs. An association
is a tag used on defs to cross-reference related defs via symbols. We use the term association to denote def-to-def relationships versus instance data relationships, which utilize ref tags.
Associations are def tags where the value is a list of symbols. Most foundational def relationships are associations including:
is
: defines supertypes used to build taxonomy treetagOn
: annotates a tag to be used with a given type
In the following example both is
and tagOn
are associations which create a relationship between defs:
def: ^yearBuilt is: ^number tagOn: ^site
As a convenience, association tags can use as a simple symbol value. But, they are always normalized to a list. Association tags are never used on instance data; they are strictly used only on defs.
Reciprocal Of
The reciprocalOf
tag is applied to an association to define its inverse term. For example:
tags
is reciprocalOf oftagOn
(and vice versa)quantities
is reciprocalOf ofquantityOf
(and vice versa)
Reciprocals are used to coin terms that are intuitive for bi-directional relationship queries. However, to promote consistency, it is desirable to only declare associations in one direction. Typically, "child-to-parent" is the preferred direction for declaring associations. For example, it is more convenient to declare tagOn
for value tags than to enumerate all the tags
for a given entity type. This design also provides more flexibility for late binding of associations in separate libs. We use the computed
tag to capture this concept. For example, tags
is annotated with the computed
marker. This means its tags
must be not used directly as a def tag (it exists only to provide an inverse term for tagOn
).