Skip to content

Relationships & crow's foot notation โ€‹

Every Ref: declaration in your schema becomes a curved line in the diagram, connecting the source field to the target field. The shape of the line tells you which two fields are related; the symbols at each end tell you the cardinality and optionality of that relationship.

๐Ÿ“ธ Screenshot placeholder

[Screenshot needed] Filename suggestion: relationships-overview.png Caption: A diagram with three relationships visible, demonstrating different cardinalities. Should show: a small schema (e.g. blog or e-commerce) with three or four relationship lines visible, showing a mix of crow's foot variants at the endpoints (one-to-many, many-to-many, and one-or-zero). Cardinality text labels visible next to each endpoint.

Crow's foot symbols โ€‹

Crow's foot notation has been the standard for ER diagrams since the 1980s. The vocabulary is small. Each endpoint of a relationship line carries one of four symbols, built from three primitives:

Exactly onemin=1, max=1 (mandatory, single)Zero or onemin=0, max=1 (optional, exclusive)One or manymin=1, max=* (mandatory, multiple)Zero or manymin=0, max=* (optional, multiple)

The three primitives compose into the four standard cases:

  • A bar (โ•‘) caps the line for "exactly one" cardinality.
  • A ring (โ—‹) marks "zero is allowed" (optional participation).
  • A crow's foot (โ‰บ) marks "many" cardinality, with the V opening toward the related entity.

Combining them gives:

  • Bar alone: exactly one. Mandatory, single.
  • Ring + bar: zero or one. Optional, exclusive.
  • Crow's foot alone: one or many. Mandatory, multiple.
  • Ring + crow's foot: zero or many. Optional, multiple.

The ring always sits closer to the line, the bar or crow's foot at the line's end. The relationship is read by looking at each endpoint independently: "at this end, how many of this entity participate?"

Where the cardinality comes from โ€‹

xDBML has two ways to express cardinality, and the diagram uses whichever is present:

Explicit settings override everything else:

xdbml
Ref: orders.customer_id > customers.id [source: '0..*', target: '1..1']

The strings are UML-style min..max. 0 means optional, 1 means mandatory minimum, * means unbounded maximum. The diagram parses these and picks the matching glyph at each end.

Operator shorthand is the default when no explicit cardinality is given:

xdbml
Ref: orders.customer_id > customers.id

The four operators map to defaults:

OperatorMeaningSource glyphTarget glyph
>many-to-onecrow's footbar
<one-to-manybarcrow's foot
-one-to-onebarbar
<>many-to-manycrow's footcrow's foot

The operators can't express optionality (the min is always 1 by default), so all four operator-only cases produce mandatory participation. If you need an optional side, use explicit [source: '0..*'].

Non-standard cardinalities โ€‹

xDBML accepts non-standard cardinalities like [source: '2..5'] (between 2 and 5 instances). The crow's foot symbol can only approximate this; for the example above, the diagram draws a "one or many" glyph (1..*), since "between 2 and 5" is closer to that than to "exactly one" or "zero or one."

The exact text is shown alongside the glyph as a small label, so the precise value isn't lost. For non-standard cardinalities, the text is the source of truth and the glyph is a visual hint.

The line itself โ€‹

Relationship lines are drawn as smooth cubic Bezier curves between endpoints. The exact path is chosen to:

  • Start and end on the left or right edge of each entity card, whichever side is closer to the other endpoint
  • Anchor at the vertical midpoint of the source or target field's row
  • Curve out horizontally before bending toward the other endpoint, which keeps line crossings legible

The curve is purely visual. The semantic content is in the two endpoints' field paths and the symbols at each end.

Selection โ€‹

Clicking on a relationship line selects it. The line and both endpoint glyphs turn blue and the stroke thickens. The inspector pane opens showing the operator, source path, target path, optional name, and any settings.

The hit area for clicking is wider than the visible line, since the visible 1.5-pixel line would be hard to target precisely. You can click within a few pixels of the line and it counts as a click on the line.

What if I want a different notation? โ€‹

The playground uses crow's foot notation only. Other ERD notations (Chen, Bachman, UML's filled-and-open-arrows) are not currently supported. If you'd find them useful, open an issue and we'll track interest.

What's next โ€‹

Spec under Apache License 2.0 ยท Examples under CC0 1.0