-
-
Notifications
You must be signed in to change notification settings - Fork 0
Choice Patterns
This document provides a full explanation of Choice semantics in uml2semantics, including exclusive and inclusive OR patterns, ISO 20022 lineage, OWL axioms, and Manchester syntax examples.
ChoiceOf and ChoiceSemantics allow UML-style “choice” constructs to be mapped deterministically
into OWL 2 logical structures.
Many domain models—especially ISO 20022, financial messaging, and metadata-driven schemas—use the concept of a Choice: a node that represents alternative structures, only one of which may apply at a time.
uml2semantics models these Choice constructs faithfully using:
- union classes
- disjointness axioms
- cardinality constraints
- controlled semantics (exclusive / inclusive)
This ensures the resulting ontology reflects the intended business rules.
Choice logic is sourced from Classes.tsv:
| Column | Meaning |
|---|---|
| ChoiceOf | Pipe-separated list of alternative classes |
| ChoiceSemantics |
exclusive, inclusive, or empty |
Example:
Curie Name ParentNames ChoiceOf ChoiceSemantics
iso:PartyIdChoice PartyIdChoice Identification LEIId|BICId|ProprietaryId exclusive
Exclusive OR means:
- Exactly one of the alternative structures is permitted at runtime.
- The choice class is equivalent to the union of the members.
- Each alternative is disjoint with the choice class.
- Alternatives may be disjoint with each other (depending on modelling needs).
uml2semantics enforces the safe minimal set: each member is disjoint with the choice container.
Mathematically:
Choice ⊑ (A ⊔ B ⊔ C)
Choice ⊓ A ⊑ ⊥
Choice ⊓ B ⊑ ⊥
Choice ⊓ C ⊑ ⊥
Class: PartyIdChoice
SubClassOf: LEIId or BICId or ProprietaryId
DisjointClasses: PartyIdChoice, LEIId
DisjointClasses: PartyIdChoice, BICId
DisjointClasses: PartyIdChoice, ProprietaryId
This ensures:
- A PartyIdChoice instance must be an instance of one of the alternatives.
- A PartyIdChoice instance cannot simultaneously be an instance of the choice itself and a concrete member, preventing recursive or self-referential classification.
When ChoiceSemantics is set to inclusive, the alternatives express:
“A Choice may be realised by one or more of the members.”
uml2semantics interprets this as:
- The choice class is equivalent to the union of alternatives.
- No disjointness statements are generated.
- The model permits overlapping membership.
Choice ⊑ (A ⊔ B ⊔ C)
No disjoint axioms.
Class: TransactionPartyChoice
SubClassOf: Originator or Intermediary or Beneficiary
No DisjointClasses block.
If ChoiceSemantics is empty:
- The choice is treated as inclusive OR.
- Only the union axiom is emitted.
- No validation warnings are generated (this is a deliberate opt‑in model).
This behaviour matches UML association classes: absence of “XOR” implies “multiple allowed.”
Exclusive OR is used in:
- financial message definitions (ISO 20022)
- complex type choices
- protocol-level structures where only one form is valid
- patterns where overlapping members are explicitly prohibited
The exclusive semantics enforce a strong design-time guarantee.
Inclusive choice is used when:
- multiple alternatives may co-exist
- the domain does not restrict overlapping structures
- the “choice” functions as a grouping abstraction rather than a constraint
This is common in metadata groups or logical OR constructs.
Attributes whose range is a Choice class inherit its semantics:
Class: Account
Facts:
partyIdChoice value <some PartyIdChoice member>
Instances cannot validly use two different choice members.
Multiple values are allowed, e.g. a metadata grouping field that may contain multiple forms of party description.
graph TD
CH[Choice Class] --> A[Alternative A]
CH --> B[Alternative B]
CH --> C[Alternative C]
A -. disjointWith .-> CH
B -. disjointWith .-> CH
C -. disjointWith .-> CH
This diagram applies when exclusive is selected.
For inclusive semantics:
graph TD
CH[Choice Class] --> A[Alternative A]
CH --> B[Alternative B]
CH --> C[Alternative C]
Given:
ChoiceOf = LEIId|BICId
ChoiceSemantics = exclusive
Generated OWL:
Class: PartyIdentifierChoice
SubClassOf:
LEIId or BICId
DisjointClasses:
PartyIdentifierChoice,
LEIId
DisjointClasses:
PartyIdentifierChoice,
BICId
Curie Name ParentNames Definition ChoiceOf ChoiceSemantics
iso:PtyIdChoice PartyIdentificationChoice Party Identification LEIId|BICId|OthrId exclusive
The generator will emit:
- union axioms
- disjointness axioms
- optional class annotations
- standard prefix‑based IRIs
- Always declare
exclusivewhen mutually-exclusive business rules apply. - Leave
ChoiceSemanticsblank when inclusivity is intended. - Ensure all ChoiceOf members appear in Classes.tsv.
- Avoid deep nested choice constructs unless necessary.
- Keep alternative class definitions disjoint when conceptually meaningful.
- Return to TSV-Specification
- Go to Datatypes-and-Facets
- Go to CLI-Usage
- Back to Home