-
Notifications
You must be signed in to change notification settings - Fork 0
Relationship Grammar
The relationships section follows the class section. Here each relationship is defined. Here are a couple of examples so we can look at the basic structure.
relationships
R1
has service features define by, 1 Bank
defines service features of, M Shaft
Shaft.Bank -> Bank.Name
--
R2
travels through, 1 Shaft
is conduit for, 1 Cabin
Cabin.Shaft -> Shaft.ID
--
We start off with the unindented relationships keyword to mark the beginning of the section.
Then we have any number of relationship descriptions.
The relevant grammar is:
// Relationships
// ---
rel_section = relationship_header rel* // All relationships in the subsystem
relationship_header = "relationships" EOL*
rel = rname (ordinal_rel / binary_rel / gen_rel) block_end // A rel is an ordinal, association or a generalization
rname = INDENT rnum EOL* // Name of a rel is its rnum
...
rnum = r'O?R[1-9][0-9]*' // Relationship number
Here we see the rel token represents a relationship description.
The indented rname token defines a relationship's name as a short string consisting of an optional O character
(if this is an ordinal relationship) followed by an R followed by a number.
We also see that there are three possible types. Each is indented to line up with the relationship name.
And each is terminated by an unindented -- separator.
See the sidebar for a breakdown of each of these relationship types.
Copyright 2023-2026 © Leon Starr under MIT Open Source License