activefacts 0.8.6 → 0.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/Manifest.txt +33 -2
  2. data/README.rdoc +30 -36
  3. data/Rakefile +16 -20
  4. data/bin/afgen +17 -11
  5. data/bin/cql +313 -36
  6. data/download.html +43 -19
  7. data/examples/CQL/Address.cql +15 -15
  8. data/examples/CQL/Blog.cql +8 -8
  9. data/examples/CQL/CompanyDirectorEmployee.cql +6 -5
  10. data/examples/CQL/Death.cql +3 -3
  11. data/examples/CQL/Diplomacy.cql +48 -0
  12. data/examples/CQL/Genealogy.cql +41 -41
  13. data/examples/CQL/Insurance.cql +311 -0
  14. data/examples/CQL/JoinEquality.cql +35 -0
  15. data/examples/CQL/Marriage.cql +1 -1
  16. data/examples/CQL/Metamodel.cql +290 -185
  17. data/examples/CQL/MetamodelNext.cql +420 -0
  18. data/examples/CQL/Monogamy.cql +24 -0
  19. data/examples/CQL/MonthInSeason.cql +27 -0
  20. data/examples/CQL/Moon.cql +23 -0
  21. data/examples/CQL/MultiInheritance.cql +4 -4
  22. data/examples/CQL/NonRoleId.cql +14 -0
  23. data/examples/CQL/OddIdentifier.cql +18 -0
  24. data/examples/CQL/OilSupply.cql +24 -24
  25. data/examples/CQL/OneToOnes.cql +17 -0
  26. data/examples/CQL/Orienteering.cql +55 -55
  27. data/examples/CQL/OrienteeringER.cql +58 -0
  28. data/examples/CQL/PersonPlaysGame.cql +2 -2
  29. data/examples/CQL/RedundantDependency.cql +34 -0
  30. data/examples/CQL/SchoolActivities.cql +5 -5
  31. data/examples/CQL/SeparateSubtype.cql +28 -0
  32. data/examples/CQL/ServiceDirector.cql +283 -0
  33. data/examples/CQL/SimplestUnary.cql +2 -2
  34. data/examples/CQL/SubtypePI.cql +11 -11
  35. data/examples/CQL/Supervision.cql +38 -0
  36. data/examples/CQL/Tests.Test5.Load.cql +38 -0
  37. data/examples/CQL/WaiterTips.cql +33 -0
  38. data/examples/CQL/Warehousing.cql +55 -53
  39. data/examples/CQL/WindowInRoomInBldg.cql +9 -9
  40. data/examples/CQL/unit.cql +433 -544
  41. data/examples/index.html +314 -170
  42. data/examples/intro.html +6 -176
  43. data/examples/local.css +8 -4
  44. data/index.html +40 -25
  45. data/lib/activefacts/api/concept.rb +2 -2
  46. data/lib/activefacts/api/constellation.rb +4 -4
  47. data/lib/activefacts/api/instance.rb +2 -2
  48. data/lib/activefacts/api/instance_index.rb +4 -0
  49. data/lib/activefacts/api/numeric.rb +3 -1
  50. data/lib/activefacts/api/role.rb +1 -1
  51. data/lib/activefacts/api/standard_types.rb +23 -16
  52. data/lib/activefacts/api/support.rb +3 -1
  53. data/lib/activefacts/api/vocabulary.rb +4 -0
  54. data/lib/activefacts/cql/CQLParser.treetop +87 -39
  55. data/lib/activefacts/cql/Concepts.treetop +95 -69
  56. data/lib/activefacts/cql/Context.treetop +11 -2
  57. data/lib/activefacts/cql/Expressions.treetop +23 -59
  58. data/lib/activefacts/cql/FactTypes.treetop +141 -95
  59. data/lib/activefacts/cql/Language/English.treetop +33 -21
  60. data/lib/activefacts/cql/LexicalRules.treetop +6 -1
  61. data/lib/activefacts/cql/Terms.treetop +75 -26
  62. data/lib/activefacts/cql/ValueTypes.treetop +52 -54
  63. data/lib/activefacts/cql/compiler.rb +46 -1691
  64. data/lib/activefacts/cql/compiler/constraint.rb +602 -0
  65. data/lib/activefacts/cql/compiler/entity_type.rb +425 -0
  66. data/lib/activefacts/cql/compiler/fact.rb +300 -0
  67. data/lib/activefacts/cql/compiler/fact_type.rb +230 -0
  68. data/lib/activefacts/cql/compiler/reading.rb +832 -0
  69. data/lib/activefacts/cql/compiler/shared.rb +109 -0
  70. data/lib/activefacts/cql/compiler/value_type.rb +104 -0
  71. data/lib/activefacts/cql/parser.rb +132 -81
  72. data/lib/activefacts/generate/cql.rb +397 -274
  73. data/lib/activefacts/generate/oo.rb +13 -12
  74. data/lib/activefacts/generate/ordered.rb +107 -117
  75. data/lib/activefacts/generate/ruby.rb +34 -38
  76. data/lib/activefacts/generate/sql/mysql.rb +62 -45
  77. data/lib/activefacts/generate/sql/server.rb +59 -42
  78. data/lib/activefacts/input/cql.rb +6 -3
  79. data/lib/activefacts/input/orm.rb +991 -557
  80. data/lib/activefacts/persistence/columns.rb +16 -12
  81. data/lib/activefacts/persistence/foreignkey.rb +7 -4
  82. data/lib/activefacts/persistence/index.rb +3 -4
  83. data/lib/activefacts/persistence/reference.rb +5 -2
  84. data/lib/activefacts/support.rb +20 -14
  85. data/lib/activefacts/version.rb +1 -1
  86. data/lib/activefacts/vocabulary.rb +1 -0
  87. data/lib/activefacts/vocabulary/extensions.rb +328 -44
  88. data/lib/activefacts/vocabulary/metamodel.rb +145 -20
  89. data/lib/activefacts/vocabulary/verbaliser.rb +621 -0
  90. data/spec/absorption_spec.rb +4 -4
  91. data/spec/api/value_type.rb +1 -1
  92. data/spec/cql/context_spec.rb +45 -22
  93. data/spec/cql/deontic_spec.rb +88 -0
  94. data/spec/cql/matching_spec.rb +517 -0
  95. data/spec/cql/samples_spec.rb +88 -31
  96. data/spec/cql/unit_spec.rb +58 -37
  97. data/spec/cql_cql_spec.rb +12 -7
  98. data/spec/cql_mysql_spec.rb +3 -7
  99. data/spec/cql_parse_spec.rb +0 -4
  100. data/spec/cql_ruby_spec.rb +1 -4
  101. data/spec/cql_sql_spec.rb +5 -18
  102. data/spec/cql_symbol_tables_spec.rb +3 -0
  103. data/spec/cqldump_spec.rb +0 -2
  104. data/spec/helpers/array_matcher.rb +35 -0
  105. data/spec/helpers/ctrl_c_support.rb +52 -0
  106. data/spec/helpers/diff_matcher.rb +38 -0
  107. data/spec/helpers/file_matcher.rb +5 -3
  108. data/spec/helpers/string_matcher.rb +39 -0
  109. data/spec/helpers/test_parser.rb +13 -0
  110. data/spec/norma_cql_spec.rb +13 -5
  111. data/spec/norma_ruby_spec.rb +11 -3
  112. data/spec/{absorption_ruby_spec.rb → norma_ruby_sql_spec.rb} +37 -32
  113. data/spec/norma_sql_spec.rb +11 -5
  114. data/spec/norma_tables_spec.rb +33 -29
  115. data/spec/spec_helper.rb +4 -1
  116. data/status.html +92 -23
  117. metadata +102 -36
  118. data/lib/activefacts/generate/cql/html.rb +0 -403
@@ -0,0 +1,420 @@
1
+ vocabulary Metamodel;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Adjective is written as String(64);
7
+ Agent Name is written as String;
8
+ Assimilation is written as String restricted to {'partitioned', 'separate'};
9
+ Context Note Id is written as Auto Counter;
10
+ Context Note Kind is written as String restricted to {'as_opposed_to', 'because', 'so_that', 'to_avoid'};
11
+ Date is written as Date;
12
+ Denominator is written as Unsigned Integer(32);
13
+ Discussion is written as String;
14
+ Display Role Names Setting is written as String restricted to {'false', 'true'};
15
+ Enforcement Code is written as String(16);
16
+ Ephemera URL is written as String;
17
+ Exponent is written as Signed Integer(16);
18
+ Fact Id is written as Auto Counter;
19
+ Frequency is written as Unsigned Integer(32);
20
+ GUID is written as String;
21
+ Instance Id is written as Auto Counter;
22
+ Join Id is written as Auto Counter;
23
+ Length is written as Unsigned Integer(32);
24
+ Literal is written as String;
25
+ Name is written as String(64);
26
+ Numerator is written as Decimal;
27
+ Offset is written as Decimal;
28
+ Ordinal is written as Unsigned Integer(16);
29
+ Pronoun is written as String(20) restricted to {'feminine', 'masculine', 'neuter', 'personal'};
30
+ Ring Type is written as String;
31
+ Role Sequence Id is written as Auto Counter;
32
+ Rotation Setting is written as String restricted to {'left', 'right'};
33
+ Scale is written as Unsigned Integer(32);
34
+ Shape Id is written as Auto Counter;
35
+ Text is written as String(256);
36
+ Unit Id is written as Auto Counter;
37
+ X is written as Signed Integer(32);
38
+ Y is written as Signed Integer(32);
39
+
40
+ /*
41
+ * Entity Types
42
+ */
43
+ Agent is identified by its Name;
44
+
45
+ Coefficient is identified by Numerator and Denominator and Coefficient is precise where
46
+ Coefficient has one Numerator,
47
+ Coefficient has one Denominator,
48
+ Coefficient is precise;
49
+
50
+ Concept is identified by GUID where
51
+ Concept has one GUID,
52
+ GUID is of at most one Concept;
53
+
54
+ Constraint is a kind of Concept [partitioned];
55
+ Name is of Constraint,
56
+ Constraint is called at most one Name;
57
+
58
+ Context Note is identified by its Id;
59
+ Concept has Context Note,
60
+ Context Note applies to at most one Concept;
61
+ Context Note has one Context Note Kind,
62
+ Context Note Kind is of Context Note;
63
+ Context Note has one Discussion,
64
+ Discussion is for Context Note;
65
+
66
+ Enforcement is identified by Constraint where
67
+ Constraint requires at most one Enforcement,
68
+ Enforcement applies to one Constraint;
69
+ Enforcement notifies at most one Agent;
70
+ Enforcement has one Enforcement Code,
71
+ Enforcement Code is of Enforcement;
72
+
73
+ Fact is identified by its Id;
74
+
75
+ Fact Type is a kind of Concept [partitioned];
76
+ Fact is of one Fact Type;
77
+
78
+ Implicit Fact Type is a kind of Fact Type;
79
+
80
+ Instance is identified by its Id;
81
+ Instance objectifies at most one Fact,
82
+ Fact is objectified as at most one Instance;
83
+
84
+ Join is identified by its Id;
85
+
86
+ Join Node is identified by Join and Ordinal where
87
+ Join includes Join Node,
88
+ Join Node is in one Join,
89
+ Join Node has one Ordinal position;
90
+
91
+ Join Step is identified by input-Join Node and output-Join Node where
92
+ Join Step has one input-Join Node,
93
+ Join Step has one output-Join Node;
94
+ Join Step traverses one Fact Type;
95
+ is anti Join Step;
96
+ Join Step is outer;
97
+
98
+ Object Type is a kind of Concept [partitioned];
99
+ Instance is of one Object Type;
100
+ Join Node is for one Object Type,
101
+ Object Type is referenced in Join Node;
102
+ Object Type uses at most one Pronoun;
103
+ Object Type is independent;
104
+
105
+ Position is identified by X and Y where
106
+ Position is at one X,
107
+ Position is at one Y;
108
+
109
+ Presence Constraint is a kind of Constraint;
110
+ Presence Constraint has at most one max-Frequency restricted to {1..};
111
+ Presence Constraint has at most one min-Frequency restricted to {2..};
112
+ Presence Constraint is mandatory;
113
+ Presence Constraint is preferred identifier;
114
+
115
+ Reading is identified by Fact Type and Ordinal where
116
+ Fact Type has Reading,
117
+ Reading is for one Fact Type,
118
+ Reading is in one Ordinal position,
119
+ Ordinal reading for fact type is Reading;
120
+ Reading has one Text;
121
+
122
+ Ring Constraint is a kind of Constraint;
123
+ Ring Constraint is of one Ring Type;
124
+
125
+ Role is a kind of Concept [partitioned] where
126
+ Fact Type has at least one Ordinal role;
127
+ Implicit Fact Type is implied by one Role,
128
+ Role implies at most one Implicit Fact Type;
129
+ Object Type plays Role,
130
+ Role is played by one Object Type;
131
+ Ring Constraint has at most one other-Role;
132
+ Ring Constraint has other-Role,
133
+ other-Role is of Ring Constraint;
134
+ Role is of Ring Constraint,
135
+ Ring Constraint has at most one Role;
136
+
137
+ Role Sequence is identified by its Id;
138
+ Join projects one Role Sequence;
139
+ Presence Constraint covers one Role Sequence;
140
+ Reading is in one Role Sequence,
141
+ Role Sequence is for Reading;
142
+ Role Sequence has unused dependency to force table in norma;
143
+
144
+ Role Value is identified by Instance and Fact where
145
+ Instance plays Role Value,
146
+ Role Value is of one Instance,
147
+ Role Value fulfils one Fact,
148
+ Fact includes at least one Role Value;
149
+ Role Value is of one Role;
150
+
151
+ Set Constraint is a kind of Constraint;
152
+
153
+ Shape is identified by its Id;
154
+ Shape is at at most one Position;
155
+ Shape is expanded;
156
+
157
+ Subset Constraint is a kind of Set Constraint;
158
+ Subset Constraint covers one subset-Role Sequence;
159
+ Subset Constraint covers one superset-Role Sequence;
160
+
161
+ Unit is identified by its Id;
162
+ Ephemera URL provides Unit coefficient,
163
+ Unit uses coefficient from at most one Ephemera URL;
164
+ Name is of Unit,
165
+ Unit is called one Name;
166
+ Unit has at most one Coefficient;
167
+ Unit has at most one Offset;
168
+ Unit has at most one plural-Name;
169
+ Unit is fundamental;
170
+
171
+ Value is identified by Literal and Value is a string and Unit where
172
+ Value is represented by one Literal,
173
+ Literal represents Value,
174
+ Value is a string,
175
+ Value is in at most one Unit,
176
+ Unit is of Value;
177
+ Instance has at most one Value;
178
+
179
+ Value Constraint is a kind of Constraint;
180
+ Role has at most one role-Value Constraint,
181
+ Value Constraint applies to at most one Role;
182
+
183
+ Value Type is a kind of Object Type;
184
+ Value Type has at most one Length,
185
+ Length is of Value Type;
186
+ Value Type has at most one Scale,
187
+ Scale is of Value Type;
188
+ Value Type is of at most one Unit;
189
+ Value Type has at most one Value Constraint,
190
+ Value Constraint constrains at most one Value Type;
191
+ Value Type is subtype of at most one super-Value Type (as Supertype) [acyclic],
192
+ Supertype is supertype of Value Type;
193
+
194
+ Vocabulary is identified by Name where
195
+ Vocabulary is called one Name;
196
+ Vocabulary contains Constraint,
197
+ Constraint belongs to at most one Vocabulary;
198
+ Vocabulary includes Unit,
199
+ Unit is in one Vocabulary;
200
+
201
+ Agreement is identified by Context Note where
202
+ Context Note was added by at most one Agreement,
203
+ Agreement covers one Context Note;
204
+ Agreement was on at most one Date,
205
+ Date is of Agreement;
206
+
207
+ Bound is identified by Value and Bound is inclusive where
208
+ Bound has one Value,
209
+ Value is of at least one Bound,
210
+ Bound is inclusive;
211
+
212
+ Constraint Shape is a kind of Shape;
213
+ Constraint Shape is for one Constraint;
214
+
215
+ Context According To is where
216
+ Context Note is according to Agent,
217
+ Agent claims Context Note;
218
+ Context According To was lodged on at most one Date;
219
+
220
+ Context Agreed By is where
221
+ Agreement was reached by Agent,
222
+ Agent agreed on Agreement;
223
+
224
+ Derivation is where
225
+ Unit (as Derived Unit) is derived from base-Unit (as Base Unit) [acyclic, intransitive];
226
+ Derivation has at most one Exponent;
227
+
228
+ Diagram is identified by Vocabulary and Name where
229
+ Diagram is for one Vocabulary,
230
+ Vocabulary contains Diagram,
231
+ Diagram is called one Name,
232
+ Name is of Diagram;
233
+ Shape is in one Diagram,
234
+ Diagram includes Shape;
235
+
236
+ Entity Type is a kind of Object Type;
237
+ Entity Type nests at most one Fact Type,
238
+ Fact Type is nested as at most one Entity Type;
239
+
240
+ Fact Type Shape is a kind of Shape;
241
+ Fact Type Shape has at most one Display Role Names Setting;
242
+ Fact Type Shape is for one Fact Type,
243
+ Fact Type has Fact Type Shape;
244
+ Fact Type Shape has at most one Rotation Setting;
245
+
246
+ ImplicitBooleanValueType is a kind of Value Type;
247
+
248
+ Model Note Shape is a kind of Shape;
249
+ Model Note Shape is for one Context Note;
250
+
251
+ Object Type Shape is a kind of Shape;
252
+ Object Type Shape is for one Object Type,
253
+ Object Type has Object Type Shape;
254
+ Object Type Shape has expanded reference mode;
255
+
256
+ Objectified Fact Type Name Shape is a kind of Shape identified by Fact Type Shape where
257
+ Objectified Fact Type Name Shape is for one Fact Type Shape,
258
+ Fact Type Shape has at most one Objectified Fact Type Name Shape;
259
+
260
+ Parameter is where
261
+ Name is a parameter of Value Type,
262
+ Value Type has parameter called Name;
263
+
264
+ Population is identified by Vocabulary and Name where
265
+ Vocabulary includes Population,
266
+ Population belongs to at most one Vocabulary,
267
+ Population has one Name,
268
+ Name is of Population;
269
+ Population includes Fact,
270
+ Fact belongs to one Population;
271
+ Population includes Instance,
272
+ Instance belongs to one Population;
273
+ Population includes Role Value,
274
+ Role Value belongs to one Population;
275
+
276
+ Reading Shape is a kind of Shape identified by Fact Type Shape where
277
+ Fact Type Shape has at most one Reading Shape,
278
+ Reading Shape is for one Fact Type Shape;
279
+ Reading Shape is for one Reading,
280
+ Reading has Reading Shape;
281
+
282
+ Ring Constraint Shape is a kind of Constraint Shape;
283
+ Ring Constraint Shape is attached to one Fact Type;
284
+
285
+ Role Display is where
286
+ Fact Type Shape displays Role in Ordinal position,
287
+ Fact Type Shape displays in Ordinal position at most one Role;
288
+
289
+ Role Name Shape is a kind of Shape;
290
+ Role Name Shape is for one Role Display,
291
+ Role Display has at most one Role Name Shape;
292
+
293
+ Role Ref is where
294
+ Role Sequence in Ordinal position includes at most one Role,
295
+ Role is in Role Sequence in at most one Ordinal place,
296
+ Role Sequence includes Role in Ordinal place,
297
+ Role has Ordinal place in Role Sequence;
298
+ Join Node includes Role Ref,
299
+ Role Ref connects to at most one Join Node;
300
+ Role Ref has at most one leading-Adjective;
301
+ Role Ref has at most one trailing-Adjective;
302
+
303
+ Set Comparison Constraint is a kind of Set Constraint;
304
+
305
+ Set Comparison Roles is where
306
+ Set Comparison Constraint has in Ordinal position at most one Role Sequence,
307
+ Role Sequence is Ordinal in Set Comparison Constraint,
308
+ in Ordinal position Set Comparison Constraint has Role Sequence,
309
+ Set Comparison Constraint has Role Sequence in at most one Ordinal position;
310
+
311
+ Set Equality Constraint is a kind of Set Comparison Constraint;
312
+
313
+ Set Exclusion Constraint is a kind of Set Comparison Constraint;
314
+ Set Exclusion Constraint is mandatory;
315
+
316
+ Term is where
317
+ Vocabulary contains Name;
318
+ Term designates at most one Object Type,
319
+ Object Type uses one Term;
320
+ Term is secondary for at most one Object Type (as Secondary),
321
+ Secondary has secondary-Term;
322
+ Term (as Role Name) is name of Role Ref,
323
+ Role Ref has at most one Role Name;
324
+
325
+ Type Inheritance is a kind of Fact Type identified by Subtype and Supertype where
326
+ Entity Type (as Subtype) is subtype of super-Entity Type (as Supertype) [acyclic, intransitive],
327
+ Supertype is supertype of Subtype;
328
+ Assimilation applies to Type Inheritance,
329
+ Type Inheritance uses at most one Assimilation;
330
+ Type Inheritance provides identification;
331
+
332
+ Value Constraint Shape is a kind of Constraint Shape;
333
+ Role Display has at most one Value Constraint Shape,
334
+ Value Constraint Shape is for at most one Role Display;
335
+ Value Constraint Shape is for at most one Object Type Shape,
336
+ Object Type Shape has Value Constraint Shape;
337
+
338
+ Value Range is identified by minimum-Bound and maximum-Bound where
339
+ Value Range has at most one minimum-Bound,
340
+ Value Range has at most one maximum-Bound;
341
+
342
+ Allowed Range is where
343
+ Value Constraint allows at least one Value Range;
344
+
345
+ Param Value is where
346
+ Value for Parameter applies to at most one Value Type;
347
+
348
+ /*
349
+ * Constraints:
350
+ */
351
+ for each Concept exactly one of these holds:
352
+ Concept is a Object Type,
353
+ Concept is a Fact Type,
354
+ Concept is a Constraint,
355
+ Concept is a Role;
356
+ for each Constraint exactly one of these holds:
357
+ Constraint is a Presence Constraint,
358
+ Constraint is a Set Constraint,
359
+ Constraint is a Ring Constraint;
360
+ either Object Type is an Entity Type or Object Type is a Value Type but not both;
361
+ for each Role Sequence exactly one of these holds:
362
+ Role Sequence is for Reading,
363
+ Presence Constraint covers Role Sequence,
364
+ Subset Constraint(1) covers subset-Role Sequence,
365
+ Subset Constraint(2) covers superset-Role Sequence,
366
+ Role Sequence is Ordinal in Set Comparison Constraint;
367
+ either Set Comparison Constraint is a Set Exclusion Constraint or Set Comparison Constraint is a Set Equality Constraint but not both;
368
+ either Set Constraint is a Set Comparison Constraint or Set Constraint is a Subset Constraint but not both;
369
+ either Unit uses coefficient from Ephemera URL or Unit has Coefficient but not both;
370
+ either Unit is fundamental or Unit is derived from base-Unit but not both;
371
+ either Value Constraint Shape is for Object Type Shape or Value Constraint Shape is for Role Display but not both;
372
+ either Value Constraint constrains Value Type or Value Constraint applies to Role but not both;
373
+ for each Instance at most one of these holds:
374
+ Instance has Value,
375
+ Instance objectifies Fact;
376
+ for each Term at most one of these holds:
377
+ Term designates Object Type,
378
+ Term is name of Role Ref;
379
+ for each Term at most one of these holds:
380
+ Term designates Object Type(1),
381
+ Term is secondary for Object Type(2);
382
+ for each Term at most one of these holds:
383
+ Term is secondary for Object Type,
384
+ Term is name of Role Ref;
385
+ Role Value is of Instance that is of Object Type
386
+ if and only if
387
+ Role Value is of Role that is played by Object Type;
388
+ Role Value fulfils Fact that is of Fact Type
389
+ if and only if
390
+ Role Value is of Role (where Fact Type has Ordinal role);
391
+ Presence Constraint is preferred identifier
392
+ only if Presence Constraint has max Frequency;
393
+ Value Type has Scale
394
+ only if Value Type has Length;
395
+ either Agreement was reached by Agent or Agreement was on Date;
396
+ each combination Diagram, Position occurs at most one time in
397
+ Shape is in Diagram,
398
+ Shape is at Position;
399
+ each combination Entity Type, Type Inheritance occurs at most one time in
400
+ Entity Type is subtype of super Entity Type,
401
+ Type Inheritance provides identification;
402
+ each Presence Constraint occurs at least one time in
403
+ Presence Constraint has min Frequency,
404
+ Presence Constraint has max Frequency,
405
+ Presence Constraint is mandatory;
406
+ each Role Sequence occurs at least one time in
407
+ Role Sequence in Ordinal position includes Role;
408
+ each Set Comparison Constraint occurs at least 2 times in
409
+ Set Comparison Constraint has in Ordinal position Role Sequence;
410
+ each Term occurs at least one time in
411
+ Term designates Object Type,
412
+ Term is secondary for Object Type,
413
+ Term is name of Role Ref;
414
+ either Value Range has minimum Bound or Value Range has maximum Bound;
415
+ each combination Vocabulary, Name occurs at most one time in
416
+ Constraint belongs to Vocabulary,
417
+ Constraint is called Name;
418
+ each combination Vocabulary, Name occurs at most one time in
419
+ Unit is in Vocabulary,
420
+ Unit is called Name;
@@ -0,0 +1,24 @@
1
+ vocabulary Monogamy;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Name is written as String;
7
+ Person ID is written as Auto Counter;
8
+
9
+ /*
10
+ * Entity Types
11
+ */
12
+ Person is identified by its ID;
13
+ Person is called one Name;
14
+
15
+ Boy is a kind of Person;
16
+
17
+ Girl is a kind of Person;
18
+ Girl (as Girlfriend) is going out with at most one Boy (as Boyfriend) [symmetric],
19
+ Boyfriend is going out with at most one Girlfriend;
20
+
21
+ /*
22
+ * Constraints:
23
+ */
24
+ either Person is a Girl or Person is a Boy but not both;
@@ -0,0 +1,27 @@
1
+ vocabulary MonthInSeason;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Event Id is written as Auto Counter;
7
+ Month is written as String;
8
+ Season is written as String;
9
+
10
+ /*
11
+ * Entity Types
12
+ */
13
+ Event is identified by its Id;
14
+
15
+ Occurrence is where
16
+ Event occurred in Month;
17
+
18
+ /*
19
+ * Fact Types
20
+ */
21
+ Month is in at most one Season;
22
+
23
+ /*
24
+ * Constraints:
25
+ */
26
+ each Season occurs at least one time in
27
+ Month is in Season;