Relations

Relations are where the magic of graph networks shine. The more models you have that reference other models, the more flexibility you have in representing a complete picture of your data.

Relations

Each model can be connected to any other model through one of three relation types:

  • Many to One
    Example: Product to Producer. A producer can have many products, but a product has one producer.
  • One to Many
    Example: Producer to Product. A producer can have many products, but a product has one producer.
  • Many to Many
    Example: Consumer to Product. A consumer can consume many products, and a product can be consumed by many consumers.

Union Types (Polymorphism)

Additionally, a relation can be of one or more types. This is known as a polymorphic relation in database modeling and as "Union Types" in GraphQL.

Example: A hardware store's products could all share the property "Name" but additional support the core product properties of a hand tool, power tool or even raw material.

Sorting

Relations can also benefit from editorial sorting, independent from a derived property.

Sorting alphabetically, by date or other data values is a derived sort order. Sometimes you simply want to manually tell a relationship which order to represent the values.


Working with Relations

Connecting a Relation

  1. Open a content entry you'd like to connect a relation to.
  2. Locate the relation field.
  3. Choose between "add an existing..." or "create and add a new..." of whatever model you are wanting to connect.
  4. When pressing on:
    • "Add an existing"
      • A popup listing all the possible entries of that model will appear.
      • Press the link icon at the far left of the content entry.
    • "Create and add new"
      • An in-line content editor window for the selected type will appear.
      • Fill out for the form's fields.
      • Choose to "save" or "save and publish" to create a DRAFT or DRAFT and PUBLISHED entry in the related model. Connecting will happen automatically.

Connecting Multiple Types to a Relation

Follow the steps from "Connecting a Relation", when you press on either of the buttons, an intermediate select box will have you first decide with model you want to choose from or create a new entry in.

Disconnecting a Relation

  1. Open a content entry you'd like to disconnect a relation to.
  2. Find the relation field you'd like to remove a conenction from.
  3. Click on the broken link icon at the far right of the content entry.

Sorting a Relation

  1. Open a content entry you'd like to sort relations on.
  2. Find the relation field you'd like to sort.
  3. Grab the four dot handle at the left edge of the content entry and drag up and down in the list.

This site uses cookies to provide you with a better user experience. For more information, refer to our Privacy Policy