activefacts 0.7.3 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/LICENSE +19 -0
  2. data/Manifest.txt +24 -2
  3. data/Rakefile +25 -3
  4. data/bin/afgen +1 -1
  5. data/bin/cql +13 -2
  6. data/css/offline.css +3 -0
  7. data/css/orm2.css +24 -0
  8. data/css/print.css +8 -0
  9. data/css/style-print.css +357 -0
  10. data/css/style.css +387 -0
  11. data/download.html +85 -0
  12. data/examples/CQL/Address.cql +3 -3
  13. data/examples/CQL/Blog.cql +13 -14
  14. data/examples/CQL/CompanyDirectorEmployee.cql +4 -4
  15. data/examples/CQL/Death.cql +3 -2
  16. data/examples/CQL/Genealogy.cql +13 -11
  17. data/examples/CQL/Marriage.cql +2 -2
  18. data/examples/CQL/Metamodel.cql +136 -93
  19. data/examples/CQL/MultiInheritance.cql +2 -2
  20. data/examples/CQL/OilSupply.cql +14 -10
  21. data/examples/CQL/Orienteering.cql +22 -19
  22. data/examples/CQL/PersonPlaysGame.cql +3 -2
  23. data/examples/CQL/SchoolActivities.cql +4 -2
  24. data/examples/CQL/SimplestUnary.cql +1 -1
  25. data/examples/CQL/SubtypePI.cql +6 -7
  26. data/examples/CQL/Warehousing.cql +16 -19
  27. data/examples/CQL/unit.cql +584 -0
  28. data/examples/index.html +276 -0
  29. data/examples/intro.html +497 -0
  30. data/examples/local.css +20 -0
  31. data/index.html +96 -0
  32. data/lib/activefacts/api/concept.rb +48 -46
  33. data/lib/activefacts/api/constellation.rb +43 -23
  34. data/lib/activefacts/api/entity.rb +2 -2
  35. data/lib/activefacts/api/instance.rb +6 -2
  36. data/lib/activefacts/api/instance_index.rb +5 -0
  37. data/lib/activefacts/api/value.rb +8 -2
  38. data/lib/activefacts/api/vocabulary.rb +15 -10
  39. data/lib/activefacts/cql/CQLParser.treetop +109 -88
  40. data/lib/activefacts/cql/Concepts.treetop +32 -10
  41. data/lib/activefacts/cql/Context.treetop +34 -0
  42. data/lib/activefacts/cql/Expressions.treetop +9 -9
  43. data/lib/activefacts/cql/FactTypes.treetop +30 -31
  44. data/lib/activefacts/cql/Language/English.treetop +50 -0
  45. data/lib/activefacts/cql/LexicalRules.treetop +2 -1
  46. data/lib/activefacts/cql/Terms.treetop +117 -0
  47. data/lib/activefacts/cql/ValueTypes.treetop +152 -0
  48. data/lib/activefacts/cql/compiler.rb +1718 -0
  49. data/lib/activefacts/cql/parser.rb +124 -57
  50. data/lib/activefacts/generate/absorption.rb +1 -1
  51. data/lib/activefacts/generate/cql.rb +111 -100
  52. data/lib/activefacts/generate/cql/html.rb +5 -5
  53. data/lib/activefacts/generate/oo.rb +3 -3
  54. data/lib/activefacts/generate/ordered.rb +51 -19
  55. data/lib/activefacts/generate/ruby.rb +10 -8
  56. data/lib/activefacts/generate/sql/mysql.rb +14 -10
  57. data/lib/activefacts/generate/sql/server.rb +29 -24
  58. data/lib/activefacts/input/cql.rb +9 -1264
  59. data/lib/activefacts/input/orm.rb +213 -200
  60. data/lib/activefacts/persistence/columns.rb +11 -10
  61. data/lib/activefacts/persistence/index.rb +15 -18
  62. data/lib/activefacts/persistence/reference.rb +17 -17
  63. data/lib/activefacts/persistence/tables.rb +50 -51
  64. data/lib/activefacts/version.rb +1 -1
  65. data/lib/activefacts/vocabulary/extensions.rb +79 -8
  66. data/lib/activefacts/vocabulary/metamodel.rb +183 -114
  67. data/spec/absorption_ruby_spec.rb +99 -0
  68. data/spec/absorption_spec.rb +3 -4
  69. data/spec/api/constellation.rb +1 -1
  70. data/spec/api/entity_type.rb +3 -1
  71. data/spec/api/instance.rb +4 -2
  72. data/spec/api/roles.rb +8 -6
  73. data/spec/api_spec.rb +1 -2
  74. data/spec/cql/context_spec.rb +71 -0
  75. data/spec/cql/samples_spec.rb +154 -0
  76. data/spec/cql/unit_spec.rb +375 -0
  77. data/spec/cql_cql_spec.rb +31 -21
  78. data/spec/cql_mysql_spec.rb +70 -0
  79. data/spec/cql_parse_spec.rb +15 -9
  80. data/spec/cql_ruby_spec.rb +27 -13
  81. data/spec/cql_sql_spec.rb +42 -16
  82. data/spec/cql_symbol_tables_spec.rb +2 -3
  83. data/spec/cqldump_spec.rb +7 -7
  84. data/spec/helpers/file_matcher.rb +39 -0
  85. data/spec/norma_cql_spec.rb +20 -12
  86. data/spec/norma_ruby_spec.rb +6 -3
  87. data/spec/norma_sql_spec.rb +6 -3
  88. data/spec/norma_tables_spec.rb +6 -4
  89. data/spec/spec_helper.rb +27 -8
  90. data/status.html +69 -0
  91. data/why.html +60 -0
  92. metadata +34 -11
  93. data/lib/activefacts/cql/DataTypes.treetop +0 -81
  94. data/spec/cql_unit_spec.rb +0 -330
@@ -4,11 +4,11 @@ vocabulary Address;
4
4
  * Value Types
5
5
  */
6
6
  City is written as VariableLengthText(64);
7
- CompanyName is written as VariableLengthText();
7
+ CompanyName is written as VariableLengthText;
8
8
  FamilyName is written as VariableLengthText(20);
9
9
  GivenNames is written as VariableLengthText(20);
10
10
  Number is written as VariableLengthText(12);
11
- Postcode is written as VariableLengthText();
11
+ Postcode is written as VariableLengthText;
12
12
  StreetLine is written as VariableLengthText(64);
13
13
 
14
14
  /*
@@ -32,7 +32,7 @@ Address is identified by street-Number and Street and City and Postcode where
32
32
  Address is at at most one street-Number,
33
33
  Address is at one Street,
34
34
  Address is in one City,
35
- Address is in at most one Postcode,
35
+ Address is in at most one Postcode restricted to {1000..9999},
36
36
  Postcode is of Address;
37
37
  Company has head office at at most one Address;
38
38
  Person lives at at most one Address;
@@ -3,14 +3,14 @@ vocabulary Blog;
3
3
  /*
4
4
  * Value Types
5
5
  */
6
- AuthorId is written as AutoCounter();
7
- CommentId is written as AutoCounter();
6
+ AuthorId is written as AutoCounter;
7
+ CommentId is written as AutoCounter;
8
8
  Name is written as VariableLengthText(64);
9
9
  Ordinal is written as UnsignedInteger(32);
10
- PostId is written as AutoCounter();
10
+ PostId is written as AutoCounter;
11
11
  Style is written as VariableLengthText(20);
12
- Text is written as LargeLengthText();
13
- TopicId is written as AutoCounter();
12
+ Text is written as LargeLengthText;
13
+ TopicId is written as AutoCounter;
14
14
 
15
15
  /*
16
16
  * Entity Types
@@ -32,12 +32,6 @@ Content provides text of Comment,
32
32
 
33
33
  Post is identified by its Id;
34
34
  Post was written by one Author;
35
- Paragraph is where
36
- Post includes Ordinal paragraph;
37
- Content is of Paragraph,
38
- Paragraph contains one Content;
39
- Paragraph has Comment,
40
- Comment is on one Paragraph;
41
35
 
42
36
  Topic is identified by its Id;
43
37
  Post belongs to one Topic,
@@ -46,9 +40,14 @@ Topic belongs to at most one parent-Topic [acyclic];
46
40
  Topic is called one topic-Name,
47
41
  Name is of at most one Topic;
48
42
 
43
+ Paragraph is where
44
+ Post includes Ordinal paragraph;
45
+ Content is of Paragraph,
46
+ Paragraph contains one Content;
47
+ Paragraph has Comment,
48
+ Comment is on one Paragraph;
49
+
49
50
  /*
50
51
  * Constraints:
51
52
  */
52
- for each Content exactly one of these holds:
53
- Content provides text of Comment,
54
- Content is of Paragraph;
53
+ either Content provides text of Comment or Content is of Paragraph but not both;
@@ -25,10 +25,12 @@ Person is identified by given-Name and family-Name where
25
25
  given-Name is of Person,
26
26
  family-Name is of Person,
27
27
  Person is called at most one family-Name;
28
- Person was born on at most one birth-Date;
28
+ Person was born on at most one birth-Date restricted to {'1900/01/01'..};
29
+
29
30
  Attendance is where
30
31
  Person (as Attendee) attended Meeting,
31
32
  Meeting was attended by Attendee;
33
+
32
34
  Directorship is where
33
35
  Person (as Director) directs Company,
34
36
  Company is directed by at least one Director;
@@ -46,6 +48,4 @@ Manager is ceo;
46
48
  /*
47
49
  * Constraints:
48
50
  */
49
- for each Employee exactly one of these holds:
50
- that Employee is ceo,
51
- that Employee is supervised by some Manager;
51
+ either that Employee is ceo or that Employee is supervised by some Manager but not both;
@@ -3,13 +3,14 @@ vocabulary Death;
3
3
  /*
4
4
  * Value Types
5
5
  */
6
- CauseOfDeath is written as VariableLengthText();
6
+ CauseOfDeath is written as VariableLengthText;
7
7
  PersonName is written as VariableLengthText(40);
8
8
 
9
9
  /*
10
10
  * Entity Types
11
11
  */
12
- Person is identified by its Name;
12
+ Person is identified by its Name [independent];
13
+
13
14
  Death is where
14
15
  Person is dead;
15
16
  Death was due to at most one CauseOfDeath;
@@ -7,22 +7,22 @@ Address is written as VariableLengthText(128);
7
7
  Certificate is written as VariableLengthText(64);
8
8
  Day is written as UnsignedInteger(32) restricted to {1..31};
9
9
  Email is written as VariableLengthText(64);
10
- EventID is written as AutoCounter();
10
+ EventID is written as AutoCounter;
11
11
  EventLocation is written as VariableLengthText(128);
12
- EventRoleName is written as VariableLengthText() restricted to {'Celebrant', 'Father', 'Husband', 'Mother', 'Subject', 'Wife'};
13
- EventTypeID is written as AutoCounter();
12
+ EventRoleName is written as VariableLengthText restricted to {'Celebrant', 'Father', 'Husband', 'Mother', 'Subject', 'Wife'};
13
+ EventTypeID is written as AutoCounter;
14
14
  EventTypeName is written as VariableLengthText(16) restricted to {'Birth', 'Burial', 'Christening', 'Death', 'Divorce', 'Marriage'};
15
15
  Gender is written as FixedLengthText(1) restricted to {'F', 'M'};
16
16
  Month is written as UnsignedInteger(32) restricted to {1..12};
17
17
  Name is written as VariableLengthText(128);
18
18
  Occupation is written as VariableLengthText(128);
19
19
  Official is written as VariableLengthText(64);
20
- PersonID is written as AutoCounter();
20
+ PersonID is written as AutoCounter;
21
21
  Picture is written as PictureRawData(20);
22
- RoleID is written as AutoCounter();
23
- SourceID is written as AutoCounter();
22
+ RoleID is written as AutoCounter;
23
+ SourceID is written as AutoCounter;
24
24
  SourceName is written as VariableLengthText(128);
25
- UserID is written as AutoCounter();
25
+ UserID is written as AutoCounter;
26
26
  Year is written as UnsignedInteger(32);
27
27
 
28
28
  /*
@@ -67,20 +67,22 @@ Role is called one EventRoleName,
67
67
  Source is identified by its ID;
68
68
  Source has one SourceName,
69
69
  SourceName is of at most one Source;
70
- Participation is where
71
- Person played Role in Event according to Source,
72
- Person was involved in Event according to Source in Role,
73
- Source claims Person played Role in Event;
74
70
 
75
71
  User is identified by its ID;
76
72
  Email is of User,
77
73
  User has at most one Email;
78
74
  User provided Source,
79
75
  Source was provided by one User;
76
+
80
77
  Friend is where
81
78
  User is friend of other-User [symmetric];
82
79
  Friend is confirmed;
83
80
 
81
+ Participation is where
82
+ Person played Role in Event according to Source,
83
+ Person was involved in Event according to Source in Role,
84
+ Source claims Person played Role in Event;
85
+
84
86
  /*
85
87
  * Constraints:
86
88
  */
@@ -3,12 +3,12 @@ vocabulary Marriage;
3
3
  /*
4
4
  * Value Types
5
5
  */
6
- Name is written as VariableLengthText();
6
+ Name is written as VariableLengthText;
7
7
 
8
8
  /*
9
9
  * Entity Types
10
10
  */
11
- Person is identified by given-Name and family-Name where
11
+ Person is identified by given-Name and family-Name [independent] where
12
12
  Person has one given-Name,
13
13
  Person has one family-Name;
14
14
 
@@ -4,36 +4,36 @@ vocabulary Metamodel;
4
4
  * Value Types
5
5
  */
6
6
  Adjective is written as VariableLengthText(64);
7
- ConstraintId is written as AutoCounter();
7
+ Assimilation is written as VariableLengthText restricted to {'partitioned', 'separate'};
8
+ ConstraintId is written as AutoCounter;
9
+ ContextNoteId is written as AutoCounter;
10
+ ContextNoteKind is written as VariableLengthText restricted to {'as_opposed_to', 'because', 'so_that', 'to_avoid'};
8
11
  Denominator is written as UnsignedInteger(32);
12
+ Discussion is written as VariableLengthText;
9
13
  Enforcement is written as VariableLengthText(16);
10
14
  Exponent is written as SignedSmallInteger(32);
11
- FactId is written as AutoCounter();
12
- FactTypeId is written as AutoCounter();
15
+ FactId is written as AutoCounter;
16
+ FactTypeId is written as AutoCounter;
13
17
  Frequency is written as UnsignedInteger(32);
14
- InstanceId is written as AutoCounter();
18
+ InstanceId is written as AutoCounter;
15
19
  Length is written as UnsignedInteger(32);
20
+ Literal is written as VariableLengthText;
16
21
  Name is written as VariableLengthText(64);
17
- Numerator is written as Decimal();
18
- Offset is written as Decimal();
22
+ Numerator is written as Decimal;
23
+ Offset is written as Decimal;
19
24
  Ordinal is written as UnsignedSmallInteger(32);
20
- Pronoun is written as VariableLengthText(20) restricted to {'feminine', 'masculine', 'personal'};
21
- RingType is written as VariableLengthText();
22
- RoleSequenceId is written as AutoCounter();
25
+ PersonName is written as VariableLengthText;
26
+ Pronoun is written as VariableLengthText(20) restricted to {'feminine', 'masculine', 'neuter', 'personal'};
27
+ RingType is written as VariableLengthText;
28
+ RoleSequenceId is written as AutoCounter;
23
29
  Scale is written as UnsignedInteger(32);
24
30
  Text is written as VariableLengthText(256);
25
- UnitId is written as AutoCounter();
26
- Value is written as VariableLengthText(256);
27
- ValueRestrictionId is written as AutoCounter();
31
+ UnitId is written as AutoCounter;
32
+ ValueRestrictionId is written as AutoCounter;
28
33
 
29
34
  /*
30
35
  * Entity Types
31
36
  */
32
- Bound is identified by Value and Bound is inclusive where
33
- Bound has one Value,
34
- Value is of at least one Bound,
35
- Bound is inclusive;
36
-
37
37
  Coefficient is identified by Numerator and Denominator and Coefficient is precise where
38
38
  Coefficient has one Numerator,
39
39
  Coefficient has one Denominator,
@@ -45,17 +45,29 @@ Constraint requires at most one Enforcement,
45
45
  Name is of Constraint,
46
46
  Constraint is called at most one Name;
47
47
 
48
+ ContextNote is identified by its Id;
49
+ Constraint has ContextNote,
50
+ ContextNote applies to at most one Constraint;
51
+ ContextNote has one ContextNoteKind,
52
+ ContextNoteKind is of ContextNote;
53
+ ContextNote has one Discussion,
54
+ Discussion is for ContextNote;
55
+
48
56
  Fact is identified by its Id;
49
57
 
50
58
  FactType is identified by its Id;
51
59
  Fact is of one FactType;
60
+ FactType has ContextNote,
61
+ ContextNote applies to at most one FactType;
52
62
 
53
63
  Instance is identified by its Id;
54
- Instance has at most one Value;
64
+ Instance objectifies at most one Fact;
65
+
66
+ Person is identified by its Name;
55
67
 
56
68
  PresenceConstraint is a kind of Constraint;
57
- PresenceConstraint has at most one max-Frequency;
58
- PresenceConstraint has at most one min-Frequency;
69
+ PresenceConstraint has at most one max-Frequency restricted to {1..};
70
+ PresenceConstraint has at most one min-Frequency restricted to {2..};
59
71
  PresenceConstraint is mandatory;
60
72
  PresenceConstraint is preferred identifier;
61
73
 
@@ -69,6 +81,15 @@ Reading has one Text;
69
81
  RingConstraint is a kind of Constraint;
70
82
  RingConstraint is of one RingType;
71
83
 
84
+ Role is where
85
+ FactType has at least one Ordinal role;
86
+ Role is of RingConstraint,
87
+ RingConstraint has at most one Role;
88
+ Role has at most one role-Name,
89
+ role-Name is name of at least one Role;
90
+ other-Role is of RingConstraint,
91
+ RingConstraint has at most one other-Role;
92
+
72
93
  RoleSequence is identified by its Id;
73
94
  PresenceConstraint covers one RoleSequence;
74
95
  Reading is in one RoleSequence,
@@ -79,6 +100,7 @@ RoleValue is identified by Instance and Fact where
79
100
  RoleValue is of one Instance,
80
101
  RoleValue fulfils one Fact,
81
102
  Fact includes at least one RoleValue;
103
+ RoleValue is of one Role;
82
104
 
83
105
  SetConstraint is a kind of Constraint;
84
106
 
@@ -91,18 +113,20 @@ Name is of Unit,
91
113
  Unit is called one Name;
92
114
  Unit has at most one Coefficient;
93
115
  Unit has at most one Offset;
116
+ Unit is ephemeral;
94
117
  Unit is fundamental;
95
- Derivation is where
96
- Unit (as DerivedUnit) is derived from base-Unit (as BaseUnit) [acyclic, intransitive];
97
- Derivation has at most one Exponent;
98
118
 
99
- ValueRange is identified by minimum-Bound and maximum-Bound where
100
- ValueRange has at most one minimum-Bound,
101
- ValueRange has at most one maximum-Bound;
119
+ Value is identified by Literal and Value is a string and Unit where
120
+ Value is represented by one Literal,
121
+ Literal represents Value,
122
+ Value is a string,
123
+ Value is in at most one Unit,
124
+ Unit is of Value;
125
+ Instance has at most one Value;
102
126
 
103
127
  ValueRestriction is identified by its Id;
104
- AllowedRange is where
105
- ValueRestriction allows at least one ValueRange;
128
+ Role has at most one role-ValueRestriction,
129
+ ValueRestriction applies to Role;
106
130
 
107
131
  Vocabulary is identified by Name where
108
132
  Vocabulary is called one Name;
@@ -111,10 +135,43 @@ Vocabulary contains Constraint,
111
135
  Vocabulary includes Unit,
112
136
  Unit is in one Vocabulary;
113
137
 
114
- Feature is identified by Vocabulary and Name where
115
- Feature belongs to at most one Vocabulary,
116
- Vocabulary contains Feature,
117
- Feature is called one Name;
138
+ Agreement is identified by ContextNote where
139
+ ContextNote was added by at most one Agreement,
140
+ Agreement covers one ContextNote;
141
+ Agreement was on at most one Date;
142
+
143
+ Bound is identified by Value and Bound is inclusive where
144
+ Bound has one Value,
145
+ Value is of at least one Bound,
146
+ Bound is inclusive;
147
+
148
+ Concept is identified by Vocabulary and Name where
149
+ Concept belongs to one Vocabulary,
150
+ Vocabulary contains Concept,
151
+ Concept is called one Name;
152
+ Concept has ContextNote,
153
+ ContextNote applies to at most one Concept;
154
+ Concept uses at most one Pronoun;
155
+ Concept plays Role,
156
+ Role is played by one Concept;
157
+ Concept is independent;
158
+ Instance is of one Concept;
159
+
160
+ ContextAccordingTo is where
161
+ ContextNote is according to Person,
162
+ Person claims ContextNote;
163
+
164
+ ContextAgreedBy is where
165
+ Agreement was reached by Person,
166
+ Person agreed on Agreement;
167
+
168
+ Derivation is where
169
+ Unit (as DerivedUnit) is derived from base-Unit (as BaseUnit) [acyclic, intransitive];
170
+ Derivation has at most one Exponent;
171
+
172
+ EntityType is a kind of Concept;
173
+ EntityType nests at most one FactType,
174
+ FactType is nested as at most one EntityType;
118
175
 
119
176
  Population is identified by Vocabulary and Name where
120
177
  Vocabulary includes Population,
@@ -128,7 +185,16 @@ Population includes Instance,
128
185
  Population includes RoleValue,
129
186
  RoleValue belongs to one Population;
130
187
 
188
+ RoleRef is where
189
+ RoleSequence in Ordinal position includes at most one Role,
190
+ Role is in RoleSequence in at most one Ordinal place,
191
+ RoleSequence includes Role in Ordinal place,
192
+ Role has Ordinal place in RoleSequence;
193
+ RoleRef has at most one leading-Adjective;
194
+ RoleRef has at most one trailing-Adjective;
195
+
131
196
  SetComparisonConstraint is a kind of SetConstraint;
197
+
132
198
  SetComparisonRoles is where
133
199
  SetComparisonConstraint has in Ordinal position at most one RoleSequence,
134
200
  RoleSequence is Ordinal in SetComparisonConstraint,
@@ -140,45 +206,17 @@ SetEqualityConstraint is a kind of SetComparisonConstraint;
140
206
  SetExclusionConstraint is a kind of SetComparisonConstraint;
141
207
  SetExclusionConstraint is mandatory;
142
208
 
143
- Concept is a kind of Feature;
144
- Concept uses at most one Pronoun;
145
- Concept is independent;
146
- Instance is of one Concept;
147
- Role is where
148
- FactType has Ordinal role played by Concept,
149
- Concept plays role in FactType in Ordinal place,
150
- Concept plays Ordinal role in FactType;
151
- Role is of RingConstraint,
152
- RingConstraint has at most one Role;
153
- Role has at most one role-Name,
154
- role-Name is name of at least one Role;
155
- Role has at most one role-ValueRestriction,
156
- ValueRestriction applies to Role;
157
- RoleValue is of one Role;
158
- other-Role is of RingConstraint,
159
- RingConstraint has at most one other-Role;
160
- RoleRef is where
161
- RoleSequence in Ordinal position includes at most one Role,
162
- Role is in RoleSequence in at most one Ordinal place,
163
- RoleSequence includes Role in Ordinal place,
164
- Role has Ordinal place in RoleSequence;
165
- RoleRef has at most one leading-Adjective;
166
- RoleRef has at most one trailing-Adjective;
167
- Join is where
168
- RoleRef has Ordinal (as JoinStep) join;
169
- Join traverses at most one Concept,
170
- Concept is traversed by Join;
171
- Join has at most one input-Role;
172
- Join has at most one output-Role;
173
-
174
- EntityType is a kind of Concept;
175
- EntityType nests at most one FactType,
176
- FactType is nested as at most one EntityType;
177
209
  TypeInheritance is a kind of FactType identified by Subtype and Supertype where
178
210
  EntityType (as Subtype) is subtype of super-EntityType (as Supertype) [acyclic],
179
211
  Supertype is supertype of Subtype;
212
+ Assimilation applies to TypeInheritance,
213
+ TypeInheritance uses at most one Assimilation;
180
214
  TypeInheritance provides identification;
181
215
 
216
+ ValueRange is identified by minimum-Bound and maximum-Bound where
217
+ ValueRange has at most one minimum-Bound,
218
+ ValueRange has at most one maximum-Bound;
219
+
182
220
  ValueType is a kind of Concept;
183
221
  ValueType has at most one Length,
184
222
  Length is of ValueType;
@@ -188,39 +226,48 @@ ValueType is of at most one Unit;
188
226
  ValueType has at most one ValueRestriction;
189
227
  ValueType is subtype of at most one super-ValueType (as Supertype) [acyclic],
190
228
  Supertype is supertype of ValueType;
229
+
230
+ AllowedRange is where
231
+ ValueRestriction allows at least one ValueRange;
232
+
233
+ Join is where
234
+ RoleRef has Ordinal (as JoinStep) join;
235
+ Join traverses at most one Concept,
236
+ Concept is traversed by Join;
237
+ Join has at most one input-Role;
238
+ Join has at most one output-Role;
239
+
191
240
  Parameter is where
192
241
  Name is a parameter of ValueType,
193
242
  ValueType has parameter called Name;
243
+
194
244
  ParamValue is where
195
245
  Value for Parameter applies to at most one ValueType;
196
246
 
197
247
  /*
198
248
  * Constraints:
199
249
  */
200
- for each Concept exactly one of these holds:
201
- EntityType is a subtype of Concept,
202
- ValueType is a subtype of Concept;
250
+ either Concept is an EntityType or Concept is a ValueType but not both;
203
251
  for each Constraint exactly one of these holds:
204
- PresenceConstraint is a subtype of Constraint,
205
- SetConstraint is a subtype of Constraint,
206
- RingConstraint is a subtype of Constraint;
207
- for each Feature exactly one of these holds:
208
- Concept is a subtype of Feature;
252
+ PresenceConstraint is a kind of Constraint,
253
+ SetConstraint is a kind of Constraint,
254
+ RingConstraint is a kind of Constraint;
255
+ for each ContextNote exactly one of these holds:
256
+ Concept has ContextNote,
257
+ FactType has ContextNote,
258
+ Constraint has ContextNote;
259
+ for each Instance at most one of these holds:
260
+ Instance has Value,
261
+ Instance objectifies Fact;
209
262
  Instance plays RoleValue and Instance is of Concept
210
263
  if and only if
211
- RoleValue is of Role and FactType has Ordinal role played by Concept;
264
+ RoleValue is of Role and Concept plays Role;
212
265
  RoleValue fulfils Fact and Fact is of FactType
213
266
  if and only if
214
- RoleValue is of Role and FactType has Ordinal role played by Concept;
215
- for each SetComparisonConstraint exactly one of these holds:
216
- SetExclusionConstraint is a subtype of SetComparisonConstraint,
217
- SetEqualityConstraint is a subtype of SetComparisonConstraint;
218
- for each SetConstraint exactly one of these holds:
219
- SetComparisonConstraint is a subtype of SetConstraint,
220
- SubsetConstraint is a subtype of SetConstraint;
221
- for each Unit exactly one of these holds:
222
- Unit is fundamental,
223
- that Unit is derived from some base-Unit;
267
+ RoleValue is of Role and FactType has Ordinal role;
268
+ either SetComparisonConstraint is a SetExclusionConstraint or SetComparisonConstraint is a SetEqualityConstraint but not both;
269
+ either SetConstraint is a SetComparisonConstraint or SetConstraint is a SubsetConstraint but not both;
270
+ either Unit is fundamental or that Unit is derived from some base-Unit but not both;
224
271
  PresenceConstraint is preferred identifier
225
272
  only if PresenceConstraint has max-Frequency;
226
273
  ValueType has Scale
@@ -228,20 +275,16 @@ ValueType has Scale
228
275
  each combination EntityType, TypeInheritance occurs at most one time in
229
276
  EntityType is subtype of super-EntityType,
230
277
  TypeInheritance provides identification;
231
- each FactType occurs at least one time in
232
- FactType has Ordinal role played by Concept;
233
- each Join occurs at least one time in
234
- Join has input-Role,
235
- Join has output-Role;
278
+ each Fact occurs at most one time in
279
+ Instance objectifies Fact;
280
+ either Join has input-Role or Join has output-Role;
236
281
  each PresenceConstraint occurs at least one time in
237
282
  PresenceConstraint has min-Frequency,
238
283
  PresenceConstraint has max-Frequency,
239
284
  PresenceConstraint is mandatory;
240
285
  each RoleSequence occurs at least one time in
241
286
  RoleSequence in Ordinal position includes Role;
242
- each ValueRange occurs at least one time in
243
- ValueRange has minimum-Bound,
244
- ValueRange has maximum-Bound;
287
+ either ValueRange has minimum-Bound or ValueRange has maximum-Bound;
245
288
  each combination Vocabulary, Name occurs at most one time in
246
289
  Vocabulary contains Constraint,
247
290
  Name is of Constraint;