Relatude Help

9 Relations — the graph edges

A relation is an indexed edge between two nodes, readable from both ends: relating A to B also relates B to A. Relations can be traversed, filtered and counted without loading the nodes.

Relations are not foreign keys: you never store a VenueId on an event. You declare a relation class with a nested class for each end, and use the nested classes as property types.

  • The five shapes — There is no zero-or-one and no separate many-to-one: use OneToMany from the other end. When the edge itself carries data, such as a ticket price or a role, make the edge a node type with a relation to each side.
  • Using them on node types — Each nested class is a property type. Name the property whatever reads best:
  • The "one" side API — A One, OneFrom or OneTo end is a OneProperty<T>:
  • The "many" side API — A Many, ManyFrom or ManyTo end is a ManyProperty<T>:
  • 9.1 Relation lists are ordered — A many end is a list, not a set: its order is stored, and you can change it. Use it for hand-curated sequences, such as a running order, a menu or a gallery, instead of a SortIndex property. AddRelation appends at the…
  • Relation options — [Relation] also takes SourceTypes and TargetTypes, but the generic parameters already say that. [RelationProperty] on an end can put the related nodes into this node's text index, so a venue is found by the names of its…