Variants are mutually exclusive alternatives (sh:xone): the union is not validated for exclusivity ex-ante, but a
state value singles out exactly one variant (sh:xone) at write time while a model placeholder matches at least
one by kind (sh:or) at read time. Variant order is preserved
deterministically: it drives indexed model keys ({"0": ..., "1": ...}), positional trace-error reporting, and the
order of the merged result when an extending shape narrows the union (see UnionShape for the full inheritance
contract).
At extends-time each child variant must narrow exactly one parent variant, so a parent declaring
union(reference(Person), reference(Organization)) can be narrowed on either alternative independently. Because
matching is by narrowing rather than a precomputed key, parent variants that no child variant can single out (for
example two reference variants with the same target shape) cannot be narrowed individually — a child narrowing
such a variant is rejected as ambiguous.
Creates a union of value shapes.
Variants are mutually exclusive alternatives (
sh:xone): the union is not validated for exclusivity ex-ante, but astatevalue singles out exactly one variant (sh:xone) at write time while amodelplaceholder matches at least one by kind (sh:or) at read time. Variant order is preserved deterministically: it drives indexedmodelkeys ({"0": ..., "1": ...}), positional trace-error reporting, and the order of the merged result when an extending shape narrows the union (see UnionShape for the full inheritance contract).At extends-time each child variant must narrow exactly one parent variant, so a parent declaring
union(reference(Person), reference(Organization))can be narrowed on either alternative independently. Because matching is by narrowing rather than a precomputed key, parent variants that no child variant can single out (for example tworeferencevariants with the same target shape) cannot be narrowed individually — a child narrowing such a variant is rejected as ambiguous.