Associations that you create are available as methods in the Application Builder query API. You can chain these methods to follow the
associations, and then search the data that is returned from the association method.
When you create an association, for example, one from the
book entity type to
the
person entity type called
authors, the query API provides a
method named the same as the association. So if you were on a
book detail page and
wanted to print something about the
authors, you could use the following request to
access the
authors entities:
subject.authors
Most associations are created by you, but some associations are created by
Application Builder, such as the following associations:
- Following
- A following relationship is created when you add an item to a workspace (the
workspace "follows" the item), or when a user clicks a Follow button (the
user "follows" the item). To find which items an entity is following, you can use the association
chain method followees or followees_by_type.
- Natural associations
- Application Builder uses the association
natural_associations to determine which entity types, although different, are
related. Natural associations are used for activity feeds and search contexts. For example, you
might have an entity type for credit cards and an entity type for transactions. They're logically
different entity types, but a transaction that occurs on a credit card is potentially an interesting
fact about that credit card. You might want to show an activity feed on a credit card page that
lists new transactions. To do so, you add an association between the entity types, and then include
that association in the natural_associations association chain. Then, events for
both entity types are listed in the activity feed for either entity type.