Association

An Object

Associations are a special kind of node which is responsible for defining a relationship between two other non-association nodes. By all accounts, Associations are proper nodes. You can create custom Types for associations, define new attributes and override behaviors. Associations are indexed and full-text searchable.

Associations, on the other hand, do not bear permissions. They are considered structural elements that provide several meanings for the content in a branch:

  • The "linked" relationships between nodes. These relationships can be broken by either party without validating the integrity of either object. An example is a "related items" relationship in a web site. Suppose Product A points to Product B via a linked relationship. If Product B is deleted, the association is also deleted and no harm is done.
  • The "owned" relationships between nodes. These relationships imply that one or both ends of the association require the other end to exist and be valid in order for the entire structure to be valid. An example is a Book with multiple Chapters, where each Chapter has multiple Pages. One way to model this is to think of a Book as owning its Chapters. And each Chapter owns its Pages. If you were to delete a Page, you would invalidate the Chapter (since its now missing pages). And invalidating a Chapter would in turn invalidate the entire Book.
  • Any other kind of relationship that you wish to model. Since associations are nodes, you're free to define custom metadata and custom server-side behaviors for your objects. You might, for example, need to make remote calls to a third-party service to determine the validity of the object model.

Directionality

Each Association defines a source and a target node which are related together via the association. Associations also have a directionality field which defines the direction of the association. This field can have one of two values:

  • directed - the association points from source to target
  • undirected - the association points both from source to target and target to source

An undirected association gives equal merit to the idea that the association points from source to target as from target to source. This allows for a mutual relationship.

An example of a mutual (or undirected) relationship is a married couple. A wife is married to her husband and the husband is also married to his wife. Both are convinced they're in a mutual relationship. Except, of course, when he obsesses over football and forgets to the dishes. Well...

Note

Drop in one of our language drivers to accelerate your development.
Here are links to some of our popular Cookbooks to help you get started!

Parent

This Association is contained within a Repository.

Properties

The following properties are available:

Property Type Default Read-Only Description
_doc string No The primary ID
_system object No Metadata maintained by the system

Schema


{
  "type": "object",
  "extends": "document",
  "description": "Association",
  "container": "repository",
  "properties": {
    "_doc": null,
    "_system": null
  },
  "id": "association"
}