Describes a value drawn from one of several alternatives.
The alternatives a union admits.
Driving CRUD from union shapes, matched as sh:xone on write and sh:or on read
Resolves the branches a shape admits values from.
Picks the single branch a data value belongs to.
Picks the single branch a relational bound filters against.
Picks the single branch a set-matching option is tested against.
Picks every branch a retrieval placeholder fits.
Creates a union shape.
Union shape types and operations.
Defines the shape describing a value drawn from one of several alternatives and its branch types, and provides the union factory stating them and the accessors reading the branches, so that a member whose vocabulary ranges over unrelated types is described by a single shape. Alternatives are stated positionally, and a value is stored as it stands under the one branch it belongs to.
Defining polymorphic members
State the alternatives positionally; cardinality belongs to the enclosing member rather than to a branch:
Either alternative is accepted at the same position, stored as it stands with no wrapping:
Reading the alternatives off a shape
The accessors list the alternatives a shape admits values from, treating a shape that is not a union as a single branch, so a caller handles polymorphic and plain shapes alike. They also pick the branches an input is matched against: the one branch a stored value, a relational bound or a set-matching option singles out, and every branch a retrieval placeholder may draw from.
See