activefacts 0.8.9 → 0.8.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/.gemtest +0 -0
  2. data/Manifest.txt +28 -33
  3. data/Rakefile +11 -12
  4. data/bin/cql +90 -46
  5. data/examples/CQL/Blog.cql +2 -1
  6. data/examples/CQL/CompanyDirectorEmployee.cql +2 -2
  7. data/examples/CQL/Death.cql +1 -1
  8. data/examples/CQL/Diplomacy.cql +9 -9
  9. data/examples/CQL/Genealogy.cql +3 -2
  10. data/examples/CQL/Insurance.cql +10 -7
  11. data/examples/CQL/JoinEquality.cql +2 -2
  12. data/examples/CQL/Marriage.cql +1 -1
  13. data/examples/CQL/Metamodel.cql +73 -53
  14. data/examples/CQL/MetamodelNext.cql +89 -67
  15. data/examples/CQL/OneToOnes.cql +2 -2
  16. data/examples/CQL/ServiceDirector.cql +10 -5
  17. data/examples/CQL/Supervision.cql +3 -3
  18. data/examples/CQL/Tests.Test5.Load.cql +1 -1
  19. data/examples/CQL/Warehousing.cql +4 -2
  20. data/lib/activefacts/cql/CQLParser.treetop +26 -60
  21. data/lib/activefacts/cql/Context.treetop +12 -2
  22. data/lib/activefacts/cql/Expressions.treetop +14 -30
  23. data/lib/activefacts/cql/FactTypes.treetop +165 -110
  24. data/lib/activefacts/cql/Language/English.treetop +167 -54
  25. data/lib/activefacts/cql/LexicalRules.treetop +16 -2
  26. data/lib/activefacts/cql/{Concepts.treetop → ObjectTypes.treetop} +36 -37
  27. data/lib/activefacts/cql/Terms.treetop +57 -27
  28. data/lib/activefacts/cql/ValueTypes.treetop +39 -13
  29. data/lib/activefacts/cql/compiler.rb +5 -3
  30. data/lib/activefacts/cql/compiler/{reading.rb → clause.rb} +407 -285
  31. data/lib/activefacts/cql/compiler/constraint.rb +178 -275
  32. data/lib/activefacts/cql/compiler/entity_type.rb +73 -64
  33. data/lib/activefacts/cql/compiler/expression.rb +418 -0
  34. data/lib/activefacts/cql/compiler/fact.rb +146 -145
  35. data/lib/activefacts/cql/compiler/fact_type.rb +197 -80
  36. data/lib/activefacts/cql/compiler/join.rb +159 -0
  37. data/lib/activefacts/cql/compiler/shared.rb +51 -23
  38. data/lib/activefacts/cql/compiler/value_type.rb +56 -2
  39. data/lib/activefacts/cql/parser.rb +15 -4
  40. data/lib/activefacts/generate/absorption.rb +7 -7
  41. data/lib/activefacts/generate/cql.rb +100 -37
  42. data/lib/activefacts/generate/oo.rb +28 -51
  43. data/lib/activefacts/generate/ordered.rb +60 -36
  44. data/lib/activefacts/generate/ruby.rb +6 -6
  45. data/lib/activefacts/generate/sql/server.rb +4 -4
  46. data/lib/activefacts/input/orm.rb +71 -53
  47. data/lib/activefacts/persistence.rb +1 -1
  48. data/lib/activefacts/persistence/columns.rb +27 -23
  49. data/lib/activefacts/persistence/foreignkey.rb +6 -6
  50. data/lib/activefacts/persistence/index.rb +17 -17
  51. data/lib/activefacts/persistence/{concept.rb → object_type.rb} +9 -9
  52. data/lib/activefacts/persistence/reference.rb +61 -36
  53. data/lib/activefacts/persistence/tables.rb +61 -59
  54. data/lib/activefacts/support.rb +54 -29
  55. data/lib/activefacts/version.rb +1 -1
  56. data/lib/activefacts/vocabulary/extensions.rb +99 -54
  57. data/lib/activefacts/vocabulary/metamodel.rb +43 -37
  58. data/lib/activefacts/vocabulary/verbaliser.rb +134 -109
  59. data/spec/absorption_spec.rb +8 -8
  60. data/spec/cql/comparison_spec.rb +91 -0
  61. data/spec/cql/contractions_spec.rb +251 -0
  62. data/spec/cql/entity_type_spec.rb +319 -0
  63. data/spec/cql/expressions_spec.rb +63 -0
  64. data/spec/cql/fact_type_matching_spec.rb +283 -0
  65. data/spec/cql/french_spec.rb +21 -0
  66. data/spec/cql/parser/bad_literals_spec.rb +86 -0
  67. data/spec/cql/parser/constraints_spec.rb +19 -0
  68. data/spec/cql/parser/entity_types_spec.rb +106 -0
  69. data/spec/cql/parser/expressions_spec.rb +179 -0
  70. data/spec/cql/parser/fact_types_spec.rb +41 -0
  71. data/spec/cql/parser/literals_spec.rb +312 -0
  72. data/spec/cql/parser/pragmas_spec.rb +89 -0
  73. data/spec/cql/parser/value_types_spec.rb +42 -0
  74. data/spec/cql/role_matching_spec.rb +147 -0
  75. data/spec/cql/samples_spec.rb +9 -9
  76. data/spec/cql_cql_spec.rb +1 -1
  77. data/spec/cql_dm_spec.rb +116 -0
  78. data/spec/cql_mysql_spec.rb +1 -1
  79. data/spec/cql_ruby_spec.rb +1 -1
  80. data/spec/cql_sql_spec.rb +3 -3
  81. data/spec/cql_symbol_tables_spec.rb +30 -30
  82. data/spec/cqldump_spec.rb +4 -4
  83. data/spec/helpers/array_matcher.rb +32 -27
  84. data/spec/helpers/diff_matcher.rb +6 -26
  85. data/spec/helpers/file_matcher.rb +41 -32
  86. data/spec/helpers/parse_to_ast_matcher.rb +76 -0
  87. data/spec/helpers/string_matcher.rb +32 -31
  88. data/spec/norma_cql_spec.rb +1 -1
  89. data/spec/norma_ruby_spec.rb +1 -1
  90. data/spec/norma_ruby_sql_spec.rb +1 -1
  91. data/spec/norma_sql_spec.rb +3 -1
  92. data/spec/norma_tables_spec.rb +1 -1
  93. data/spec/ruby_api_spec.rb +23 -0
  94. data/spec/spec_helper.rb +5 -4
  95. metadata +66 -66
  96. data/examples/CQL/OrienteeringER.cql +0 -58
  97. data/lib/activefacts/api.rb +0 -44
  98. data/lib/activefacts/api/concept.rb +0 -410
  99. data/lib/activefacts/api/constellation.rb +0 -128
  100. data/lib/activefacts/api/entity.rb +0 -256
  101. data/lib/activefacts/api/instance.rb +0 -60
  102. data/lib/activefacts/api/instance_index.rb +0 -80
  103. data/lib/activefacts/api/numeric.rb +0 -167
  104. data/lib/activefacts/api/role.rb +0 -80
  105. data/lib/activefacts/api/role_proxy.rb +0 -70
  106. data/lib/activefacts/api/role_values.rb +0 -117
  107. data/lib/activefacts/api/standard_types.rb +0 -87
  108. data/lib/activefacts/api/support.rb +0 -65
  109. data/lib/activefacts/api/value.rb +0 -135
  110. data/lib/activefacts/api/vocabulary.rb +0 -82
  111. data/spec/api/autocounter.rb +0 -82
  112. data/spec/api/constellation.rb +0 -130
  113. data/spec/api/entity_type.rb +0 -103
  114. data/spec/api/instance.rb +0 -461
  115. data/spec/api/roles.rb +0 -124
  116. data/spec/api/value_type.rb +0 -112
  117. data/spec/api_spec.rb +0 -13
  118. data/spec/cql/matching_spec.rb +0 -517
  119. data/spec/cql/unit_spec.rb +0 -394
  120. data/spec/spec.opts +0 -1
@@ -55,6 +55,7 @@ Occupation is of Person,
55
55
  Person is of at most one Gender;
56
56
  Person is called at most one family-Name,
57
57
  family-Name is of Person;
58
+ given-Name is name of Person; // Avoid ambiguity; this is a new fact type
58
59
  given-Name is name of Person,
59
60
  Person is called at most one given-Name;
60
61
  preferred-Picture is of Person,
@@ -87,8 +88,8 @@ Participation is where
87
88
  * Constraints:
88
89
  */
89
90
  each Event Date occurs at least one time in
90
- Event Date wasnt before min Year,
91
- Event Date wasnt after max Year,
91
+ Event Date wasnt before min Year(2),
92
+ Event Date wasnt after max Year(1),
92
93
  Event Date occurred in Month,
93
94
  Event Date occurred on Day;
94
95
  each Event occurs at least one time in
@@ -70,7 +70,7 @@ Cover Type is identified by its Code;
70
70
  Cover Type has one Cover Type Name,
71
71
  Cover Type Name is of at most one Cover Type;
72
72
 
73
- Demerit Kind is identified by its Name [independent];
73
+ Demerit Kind is independent identified by its Name;
74
74
 
75
75
  Incident is identified by Claim where
76
76
  Claim concerns at most one Incident,
@@ -101,8 +101,11 @@ Person is a kind of Party;
101
101
  Person has at most one Occupation;
102
102
  Person has one Title;
103
103
  Person has at most one birth-Date;
104
- Person has one family-Name;
105
- Person has one given-Name;
104
+ Person has one family-Name,
105
+ family-Name is of Person;
106
+ Person has given-Name; // Avoid ambiguity; this is a new fact type
107
+ Person has one given-Name,
108
+ given-Name is of Person;
106
109
 
107
110
  Phone is identified by its Nr;
108
111
 
@@ -125,7 +128,7 @@ Prod Description is of at most one Product,
125
128
 
126
129
  Registration is identified by its Nr;
127
130
 
128
- State is identified by its Code [independent];
131
+ State is independent identified by its Code;
129
132
  State Name is of at most one State,
130
133
  State has at most one State Name;
131
134
 
@@ -301,9 +304,9 @@ Party is a Company that has contact Person
301
304
  if and only if
302
305
  Party is a company;
303
306
  each Contact Methods occurs at least one time in
304
- Contact Methods includes mobile Phone,
305
- Contact Methods includes home Phone,
306
- Contact Methods includes business Phone,
307
+ Contact Methods includes mobile Phone(3),
308
+ Contact Methods includes home Phone(2),
309
+ Contact Methods includes business Phone(1),
307
310
  Contact Methods includes Email;
308
311
  each combination Policy, Claim Sequence occurs at most one time in
309
312
  Claim is on Policy,
@@ -14,10 +14,10 @@ Venue Id is written as Auto Counter;
14
14
  */
15
15
  Event is identified by its Id;
16
16
 
17
- Venue is identified by its Id [independent];
17
+ Venue is independent identified by its Id;
18
18
  Event is held at one Venue;
19
19
 
20
- Seat is identified by Venue and Reserve and Row and Number [independent] where
20
+ Seat is independent identified by Venue and Reserve and Row and Number where
21
21
  Seat is at one Venue,
22
22
  Seat is in one Reserve,
23
23
  Seat is in one Row,
@@ -8,7 +8,7 @@ Name is written as String;
8
8
  /*
9
9
  * Entity Types
10
10
  */
11
- Person is identified by given-Name and family-Name [independent] where
11
+ Person is independent identified by given-Name and family-Name where
12
12
  Person has one given-Name,
13
13
  Person has one family-Name;
14
14
 
@@ -12,6 +12,7 @@ Context Note Kind is written as String restricted to {'as_opposed_to', 'because'
12
12
  Date is written as Date;
13
13
  Denominator is written as Unsigned Integer(32);
14
14
  Discussion is written as String;
15
+ Disjunction Id is written as Auto Counter;
15
16
  Display Role Names Setting is written as String restricted to {'false', 'true'};
16
17
  Enforcement Code is written as String(16);
17
18
  Ephemera URL is written as String;
@@ -35,6 +36,7 @@ Scale is written as Unsigned Integer(32);
35
36
  Shape Id is written as Auto Counter;
36
37
  Subscript is written as Unsigned Integer(16);
37
38
  Text is written as String(256);
39
+ Transaction Timing is written as String restricted to {'assert', 'commit'};
38
40
  Unit Id is written as Auto Counter;
39
41
  X is written as Signed Integer(32);
40
42
  Y is written as Signed Integer(32);
@@ -61,6 +63,8 @@ Context Note has one Context Note Kind,
61
63
  Context Note has one Discussion,
62
64
  Discussion is for Context Note;
63
65
 
66
+ Disjunction is identified by its Id;
67
+
64
68
  Enforcement is identified by Constraint where
65
69
  Constraint requires at most one Enforcement,
66
70
  Enforcement applies to one Constraint;
@@ -89,6 +93,8 @@ Join Node is identified by Join and Ordinal where
89
93
  Join Node has one Ordinal position;
90
94
  Join Node has at most one Subscript,
91
95
  Subscript is of Join Node;
96
+ Join Node has at most one role-Name,
97
+ Name is of Join Node;
92
98
 
93
99
  Position is identified by X and Y where
94
100
  Position is at one X,
@@ -112,11 +118,11 @@ Ring Constraint is of one Ring Type;
112
118
 
113
119
  Role is where
114
120
  Fact Type has at least one Ordinal role;
115
- Implicit Fact Type is implied by one Role,
116
- Role implies at most one Implicit Fact Type;
117
- Ring Constraint has at most one other-Role;
118
- Ring Constraint has other-Role,
121
+ Implicit Fact Type is implied by one Role (as Implying Role),
122
+ Implying Role implies at most one Implicit Fact Type;
123
+ Ring Constraint has at most one other-Role,
119
124
  other-Role is of Ring Constraint;
125
+ Role is of Ring Constraint; // Avoid ambiguity; this is a new fact type
120
126
  Role is of Ring Constraint,
121
127
  Ring Constraint has at most one Role;
122
128
  Role has at most one role-Name,
@@ -186,20 +192,6 @@ Bound is identified by Value and Bound is inclusive where
186
192
  Value is of at least one Bound,
187
193
  Bound is inclusive;
188
194
 
189
- Concept is identified by Vocabulary and Name where
190
- Concept belongs to one Vocabulary,
191
- Vocabulary contains Concept,
192
- Concept is called one Name;
193
- Concept has Context Note,
194
- Context Note applies to at most one Concept;
195
- Concept uses at most one Pronoun;
196
- Concept plays Role,
197
- Role is played by one Concept;
198
- Concept is independent;
199
- Instance is of one Concept;
200
- Join Node is for one Concept,
201
- Concept is referenced in Join Node;
202
-
203
195
  Constraint Shape is a kind of Shape;
204
196
  Constraint Shape is for one Constraint;
205
197
 
@@ -224,35 +216,48 @@ Diagram is identified by Vocabulary and Name where
224
216
  Shape is in one Diagram,
225
217
  Diagram includes Shape;
226
218
 
227
- Entity Type is a kind of Concept;
228
- Entity Type nests at most one Fact Type,
229
- Fact Type is nested as at most one Entity Type;
230
-
231
219
  Fact Type Shape is a kind of Shape;
232
220
  Fact Type Shape has at most one Display Role Names Setting;
233
221
  Fact Type Shape is for one Fact Type,
234
222
  Fact Type has Fact Type Shape;
235
223
  Fact Type Shape has at most one Rotation Setting;
236
224
 
237
- Join Role is where
225
+ Join Role is independent where
238
226
  Join Node includes at least one Role,
239
227
  Role connects to Join Node;
240
228
 
241
229
  Join Step is identified by input-Join Role and output-Join Role where
242
230
  Join Step has one input-Join Role,
243
231
  Join Step has one output-Join Role;
232
+ Join Step falls under at most one Disjunction,
233
+ Disjunction covers at least one Join Step;
244
234
  Join Step traverses one Fact Type,
245
235
  Fact Type directs Join Step;
246
- Join Step involves incidental-Join Role;
236
+ Join Step involves incidental-Join Role,
237
+ Join Role is incidentally involved in at most one Join Step;
247
238
  is anti Join Step;
248
239
  Join Step is outer;
249
240
 
250
241
  Model Note Shape is a kind of Shape;
251
242
  Model Note Shape is for one Context Note;
252
243
 
244
+ Object Type is identified by Vocabulary and Name where
245
+ Object Type belongs to one Vocabulary,
246
+ Vocabulary contains Object Type,
247
+ Object Type is called one Name;
248
+ Instance is of one Object Type;
249
+ Join Node is for one Object Type,
250
+ Object Type is referenced in Join Node;
251
+ Object Type has Context Note,
252
+ Context Note applies to at most one Object Type;
253
+ Object Type uses at most one Pronoun;
254
+ Object Type plays Role,
255
+ Role is played by one Object Type;
256
+ Object Type is independent;
257
+
253
258
  Object Type Shape is a kind of Shape;
254
- Object Type Shape is for one Concept,
255
- Concept has Object Type Shape;
259
+ Object Type Shape is for one Object Type,
260
+ Object Type has Object Type Shape;
256
261
  Object Type Shape has expanded reference mode;
257
262
 
258
263
  Objectified Fact Type Name Shape is a kind of Shape identified by Fact Type Shape where
@@ -310,13 +315,6 @@ Set Equality Constraint is a kind of Set Comparison Constraint;
310
315
  Set Exclusion Constraint is a kind of Set Comparison Constraint;
311
316
  Set Exclusion Constraint is mandatory;
312
317
 
313
- Type Inheritance is a kind of Fact Type identified by Subtype and Supertype where
314
- Entity Type (as Subtype) is subtype of super-Entity Type (as Supertype) [acyclic],
315
- Supertype is supertype of Subtype;
316
- Assimilation applies to Type Inheritance,
317
- Type Inheritance uses at most one Assimilation;
318
- Type Inheritance provides identification;
319
-
320
318
  Value Constraint Shape is a kind of Constraint Shape;
321
319
  Role Display has at most one Value Constraint Shape,
322
320
  Value Constraint Shape is for at most one Role Display;
@@ -327,7 +325,7 @@ Value Range is identified by minimum-Bound and maximum-Bound where
327
325
  Value Range has at most one minimum-Bound,
328
326
  Value Range has at most one maximum-Bound;
329
327
 
330
- Value Type is a kind of Concept;
328
+ Value Type is a kind of Object Type;
331
329
  Value Type has at most one Length,
332
330
  Length is of Value Type;
333
331
  Value Type has at most one Scale,
@@ -335,34 +333,52 @@ Value Type has at most one Scale,
335
333
  Value Type is of at most one Unit;
336
334
  Value Type has at most one Value Constraint,
337
335
  Value Constraint constrains at most one Value Type;
336
+ Value Type has at most one auto- assigned Transaction Timing;
338
337
  Value Type is subtype of at most one super-Value Type (as Supertype) [acyclic],
339
338
  Supertype is supertype of Value Type;
340
- Value Type is auto-assigned;
341
339
 
342
340
  Allowed Range is where
343
341
  Value Constraint allows at least one Value Range;
344
342
 
345
- ImplicitBooleanValueType is a kind of Value Type;
343
+ Entity Type is a kind of Object Type;
344
+ Entity Type nests at most one Fact Type,
345
+ Fact Type is nested as at most one Entity Type;
346
+
347
+ Facet is where
348
+ Value Type has facet called Name,
349
+ Name is a facet of Value Type;
350
+
351
+ Facet Value is where
352
+ Value Type defines Facet as having one Value,
353
+ Value for Facet applies to Value Type;
346
354
 
347
- Parameter is where
348
- Name is a parameter of Value Type,
349
- Value Type has parameter called Name;
355
+ Implicit Boolean Value Type is a kind of Value Type;
350
356
 
351
- Param Value is where
352
- Value for Parameter applies to one Value Type;
357
+ Type Inheritance is a kind of Fact Type identified by Subtype and Supertype where
358
+ Entity Type (as Subtype) is subtype of super-Entity Type (as Supertype) [acyclic, intransitive],
359
+ Supertype is supertype of Subtype;
360
+ Assimilation applies to Type Inheritance,
361
+ Type Inheritance uses at most one Assimilation;
362
+ Type Inheritance provides identification;
353
363
 
354
364
  /*
355
365
  * Constraints:
356
366
  */
357
- either Concept is an Entity Type or Concept is a Value Type but not both;
358
367
  for each Constraint exactly one of these holds:
359
368
  Constraint is a Presence Constraint,
360
369
  Constraint is a Set Constraint,
361
370
  Constraint is a Ring Constraint;
362
371
  for each Context Note exactly one of these holds:
363
- Context Note applies to Concept,
372
+ Context Note applies to Object Type,
364
373
  Context Note applies to Fact Type,
365
374
  Context Note applies to Constraint;
375
+ either Object Type is an Entity Type or Object Type is a Value Type but not both;
376
+ for each Role Sequence exactly one of these holds:
377
+ Role Sequence is for Reading,
378
+ Presence Constraint covers Role Sequence,
379
+ Subset Constraint(1) covers subset-Role Sequence,
380
+ Subset Constraint(2) covers superset-Role Sequence,
381
+ Role Sequence is Ordinal in Set Comparison Constraint;
366
382
  either Set Comparison Constraint is a Set Exclusion Constraint or Set Comparison Constraint is a Set Equality Constraint but not both;
367
383
  either Set Constraint is a Set Comparison Constraint or Set Constraint is a Subset Constraint but not both;
368
384
  either Unit uses coefficient from Ephemera URL or Unit has Coefficient but not both;
@@ -372,12 +388,18 @@ either Value Constraint constrains Value Type or Value Constraint applies to Rol
372
388
  for each Instance at most one of these holds:
373
389
  Instance has Value,
374
390
  Instance objectifies Fact;
375
- Join Node is for Concept that plays Role
391
+ for each Join Role at most one of these holds:
392
+ Join Step(1) has input-Join Role,
393
+ Join Role is incidentally involved in Join Step;
394
+ for each Join Role at most one of these holds:
395
+ Join Step(1) has output-Join Role,
396
+ Join Role is incidentally involved in Join Step;
397
+ Join Node is for Object Type that plays Role
376
398
  if and only if
377
399
  Join Node includes Role;
378
- Role Value is of Instance that is of Concept
400
+ Role Value is of Instance that is of Object Type
379
401
  if and only if
380
- Role Value is of Role that is played by Concept;
402
+ Role Value is of Role that is played by Object Type;
381
403
  Role Value fulfils Fact that is of Fact Type
382
404
  if and only if
383
405
  Role Value is of Role (where Fact Type has Ordinal role);
@@ -389,14 +411,12 @@ either Agreement was reached by Agent or Agreement was on Date;
389
411
  each combination Diagram, Position occurs at most one time in
390
412
  Shape is in Diagram,
391
413
  Shape is at Position;
392
- each combination Entity Type, Type Inheritance occurs at most one time in
393
- Entity Type is subtype of super Entity Type,
414
+ each combination Entity Type(1), Type Inheritance occurs at most one time in
415
+ Entity Type(1) is subtype of super Entity Type(2),
394
416
  Type Inheritance provides identification;
395
- each Join Role occurs at most one time in
396
- Join Step involves incidental Join Role;
397
417
  each Presence Constraint occurs at least one time in
398
- Presence Constraint has min Frequency,
399
- Presence Constraint has max Frequency,
418
+ Presence Constraint has min Frequency(2),
419
+ Presence Constraint has max Frequency(1),
400
420
  Presence Constraint is mandatory;
401
421
  each Role Ref occurs at most one time in
402
422
  Join Role projects Role Ref;
@@ -404,7 +424,7 @@ each Role Sequence occurs at least one time in
404
424
  Role Sequence in Ordinal position includes Role;
405
425
  each Set Comparison Constraint occurs at least 2 times in
406
426
  Set Comparison Constraint has in Ordinal position Role Sequence;
407
- either Value Range has minimum Bound or Value Range has maximum Bound;
427
+ either Value Range has minimum Bound(2) or Value Range has maximum Bound(1);
408
428
  each combination Vocabulary, Name occurs at most one time in
409
429
  Constraint belongs to Vocabulary,
410
430
  Constraint is called Name;
@@ -6,7 +6,6 @@ vocabulary Metamodel;
6
6
  Adjective is written as String(64);
7
7
  Agent Name is written as String;
8
8
  Assimilation is written as String restricted to {'partitioned', 'separate'};
9
- Context Note Id is written as Auto Counter;
10
9
  Context Note Kind is written as String restricted to {'as_opposed_to', 'because', 'so_that', 'to_avoid'};
11
10
  Date is written as Date;
12
11
  Denominator is written as Unsigned Integer(32);
@@ -15,11 +14,9 @@ Display Role Names Setting is written as String restricted to {'false', 'true'};
15
14
  Enforcement Code is written as String(16);
16
15
  Ephemera URL is written as String;
17
16
  Exponent is written as Signed Integer(16);
18
- Fact Id is written as Auto Counter;
19
17
  Frequency is written as Unsigned Integer(32);
20
18
  GUID is written as String;
21
- Instance Id is written as Auto Counter;
22
- Join Id is written as Auto Counter;
19
+ Language Code is written as Char(3);
23
20
  Length is written as Unsigned Integer(32);
24
21
  Literal is written as String;
25
22
  Name is written as String(64);
@@ -28,13 +25,12 @@ Offset is written as Decimal;
28
25
  Ordinal is written as Unsigned Integer(16);
29
26
  Pronoun is written as String(20) restricted to {'feminine', 'masculine', 'neuter', 'personal'};
30
27
  Ring Type is written as String;
31
- Role Sequence Id is written as Auto Counter;
32
28
  Rotation Setting is written as String restricted to {'left', 'right'};
33
29
  Scale is written as Unsigned Integer(32);
34
- Shape Id is written as Auto Counter;
35
- Subscript is written as String;
30
+ Subscript is written as Unsigned Integer(16);
36
31
  Text is written as String(256);
37
- Unit Id is written as Auto Counter;
32
+ Transaction Timing is written as String restricted to {'assert', 'commit'};
33
+ Unit Code is written as Char;
38
34
  X is written as Signed Integer(32);
39
35
  Y is written as Signed Integer(32);
40
36
 
@@ -52,11 +48,13 @@ Concept is identified by GUID where
52
48
  Concept has one GUID,
53
49
  GUID is of at most one Concept;
54
50
 
55
- Constraint is a kind of Concept [partitioned];
51
+ Constraint is a kind of Concept;
56
52
  Name is of Constraint,
57
53
  Constraint is called at most one Name;
58
54
 
59
- Context Note is identified by its Id;
55
+ Context Note is identified by GUID where
56
+ Context Note has one GUID,
57
+ GUID is of at most one Context Note;
60
58
  Concept has Context Note,
61
59
  Context Note applies to at most one Concept;
62
60
  Context Note has one Context Note Kind,
@@ -71,18 +69,24 @@ Enforcement notifies at most one Agent;
71
69
  Enforcement has one Enforcement Code,
72
70
  Enforcement Code is of Enforcement;
73
71
 
74
- Fact is identified by its Id;
72
+ Fact is identified by GUID where
73
+ Fact has one GUID,
74
+ GUID is of at most one Fact;
75
75
 
76
- Fact Type is a kind of Concept [partitioned];
76
+ Fact Type is a kind of Concept;
77
77
  Fact is of one Fact Type;
78
78
 
79
79
  Implicit Fact Type is a kind of Fact Type;
80
80
 
81
- Instance is identified by its Id;
81
+ Instance is identified by GUID where
82
+ Instance has one GUID,
83
+ GUID is of at most one Instance;
82
84
  Instance objectifies at most one Fact,
83
85
  Fact is objectified as at most one Instance;
84
86
 
85
- Join is identified by its Id;
87
+ Join is identified by GUID where
88
+ Join has one GUID,
89
+ GUID is of at most one Join;
86
90
 
87
91
  Join Node is identified by Join and Ordinal where
88
92
  Join includes Join Node,
@@ -90,8 +94,12 @@ Join Node is identified by Join and Ordinal where
90
94
  Join Node has one Ordinal position;
91
95
  Join Node has at most one Subscript,
92
96
  Subscript is of Join Node;
97
+ Join Node has at most one role-Name,
98
+ Name is of Join Node;
93
99
 
94
- Object Type is a kind of Concept [partitioned];
100
+ Language is identified by its Code;
101
+
102
+ Object Type is a kind of Concept;
95
103
  Instance is of one Object Type;
96
104
  Join Node is for one Object Type,
97
105
  Object Type is referenced in Join Node;
@@ -118,19 +126,21 @@ Reading has one Text;
118
126
  Ring Constraint is a kind of Constraint;
119
127
  Ring Constraint is of one Ring Type;
120
128
 
121
- Role is a kind of Concept [partitioned] where
129
+ Role is a kind of Concept where
122
130
  Fact Type has at least one Ordinal role;
123
- Implicit Fact Type is implied by one Role,
124
- Role implies at most one Implicit Fact Type;
131
+ Implicit Fact Type is implied by one Role (as Implying Role),
132
+ Implying Role implies at most one Implicit Fact Type;
125
133
  Object Type plays Role,
126
134
  Role is played by one Object Type;
127
- Ring Constraint has at most one other-Role;
128
135
  Ring Constraint has at most one other-Role,
129
136
  other-Role is of Ring Constraint;
137
+ Role is of Ring Constraint; // Avoid ambiguity; this is a new fact type
130
138
  Role is of Ring Constraint,
131
139
  Ring Constraint has at most one Role;
132
140
 
133
- Role Sequence is identified by its Id;
141
+ Role Sequence is identified by GUID where
142
+ Role Sequence has one GUID,
143
+ GUID is of at most one Role Sequence;
134
144
  Presence Constraint covers one Role Sequence;
135
145
  Reading is in one Role Sequence,
136
146
  Role Sequence is for Reading;
@@ -145,7 +155,9 @@ Role Value is of one Role;
145
155
 
146
156
  Set Constraint is a kind of Constraint;
147
157
 
148
- Shape is identified by its Id;
158
+ Shape is identified by GUID where
159
+ Shape has one GUID,
160
+ GUID is of at most one Shape;
149
161
  Shape is at at most one Position;
150
162
  Shape is expanded;
151
163
 
@@ -153,7 +165,11 @@ Subset Constraint is a kind of Set Constraint;
153
165
  Subset Constraint covers one subset-Role Sequence;
154
166
  Subset Constraint covers one superset-Role Sequence;
155
167
 
156
- Unit is identified by its Id;
168
+ Topic is identified by Name where
169
+ Topic has one Name,
170
+ Name is of at most one Topic;
171
+
172
+ Unit is identified by its Code;
157
173
  Ephemera URL provides Unit coefficient,
158
174
  Unit uses coefficient from at most one Ephemera URL;
159
175
  Name is of Unit,
@@ -169,7 +185,8 @@ Value is identified by Literal and Value is a string and Unit where
169
185
  Value is a string,
170
186
  Value is in at most one Unit,
171
187
  Unit is of Value;
172
- Instance has at most one Value;
188
+ Instance has at most one Value,
189
+ Value is of Instance;
173
190
  Join Node has at most one Value;
174
191
 
175
192
  Value Constraint is a kind of Constraint;
@@ -184,11 +201,15 @@ Value Type has at most one Scale,
184
201
  Value Type is of at most one Unit;
185
202
  Value Type has at most one Value Constraint,
186
203
  Value Constraint constrains at most one Value Type;
204
+ Value Type has at most one auto- assigned Transaction Timing;
187
205
  Value Type is subtype of at most one super-Value Type (as Supertype) [acyclic],
188
206
  Supertype is supertype of Value Type;
189
207
 
190
- Vocabulary is identified by Name where
191
- Vocabulary is called one Name;
208
+ Vocabulary is where
209
+ Topic is described in Language,
210
+ Language describes Topic;
211
+ Reading is for at most one Vocabulary,
212
+ Vocabulary contains Reading;
192
213
  Vocabulary contains Constraint,
193
214
  Constraint belongs to at most one Vocabulary;
194
215
  Vocabulary includes Unit,
@@ -230,8 +251,17 @@ Shape is in one Diagram,
230
251
  Diagram includes Shape;
231
252
 
232
253
  Entity Type is a kind of Object Type;
233
- Entity Type nests at most one Fact Type,
234
- Fact Type is nested as at most one Entity Type;
254
+ Entity Type objectifies at most one Fact Type,
255
+ Fact Type is objectified as at most one Entity Type;
256
+
257
+ Facet is where
258
+ Value Type has facet called Name,
259
+ Name is a facet of Value Type;
260
+ Facet has values of at most one Value Type;
261
+
262
+ Facet Value is where
263
+ Value Type defines Facet as having one Value,
264
+ Value for Facet applies to Value Type;
235
265
 
236
266
  Fact Type Shape is a kind of Shape;
237
267
  Fact Type Shape has at most one Display Role Names Setting;
@@ -239,10 +269,10 @@ Fact Type Shape is for one Fact Type,
239
269
  Fact Type has Fact Type Shape;
240
270
  Fact Type Shape has at most one Rotation Setting;
241
271
 
242
- ImplicitBooleanValueType is a kind of Value Type;
272
+ Implicit Boolean Value Type is a kind of Value Type;
243
273
 
244
- Join Role is where
245
- Join Node includes Role,
274
+ Join Role is independent where
275
+ Join Node includes at least one Role,
246
276
  Role connects to Join Node;
247
277
 
248
278
  Join Step is identified by input-Join Role and output-Join Role where
@@ -250,6 +280,8 @@ Join Step is identified by input-Join Role and output-Join Role where
250
280
  Join Step has one output-Join Role;
251
281
  Join Step traverses one Fact Type,
252
282
  Fact Type directs Join Step;
283
+ Join Step involves incidental-Join Role,
284
+ Join Role is incidentally involved in at most one Join Step;
253
285
  is anti Join Step;
254
286
  Join Step is outer;
255
287
 
@@ -265,13 +297,9 @@ Objectified Fact Type Name Shape is a kind of Shape identified by Fact Type Shap
265
297
  Objectified Fact Type Name Shape is for one Fact Type Shape,
266
298
  Fact Type Shape has at most one Objectified Fact Type Name Shape;
267
299
 
268
- Parameter is where
269
- Name is a parameter of Value Type,
270
- Value Type has parameter called Name;
271
-
272
- Population is identified by Vocabulary and Name where
273
- Vocabulary includes Population,
274
- Population belongs to at most one Vocabulary,
300
+ Population is identified by Topic and Name where
301
+ Topic includes Population,
302
+ Population belongs to at most one Topic,
275
303
  Population has one Name,
276
304
  Name is of Population;
277
305
  Population includes Fact,
@@ -321,19 +349,20 @@ Set Exclusion Constraint is a kind of Set Comparison Constraint;
321
349
  Set Exclusion Constraint is mandatory;
322
350
 
323
351
  Term is where
324
- Vocabulary contains Name;
325
- Term designates at most one Object Type,
326
- Object Type uses one Term;
327
- Term is secondary for at most one Object Type (as Secondary),
328
- Secondary has secondary-Term;
329
- Term (as Role Name) is name of Role Ref,
330
- Role Ref has at most one Role Name;
331
-
332
- Type Inheritance is a kind of Fact Type identified by Subtype and Supertype where
352
+ Vocabulary uses Name for one Object Type,
353
+ Vocabulary refers to Object Type as Name,
354
+ Name applies to Object Type in Vocabulary;
355
+ Term (as Role Name) is name of Role,
356
+ Role has at most one Role Name;
357
+ Term is preferred;
358
+
359
+ Type Inheritance is where
333
360
  Entity Type (as Subtype) is subtype of super-Entity Type (as Supertype) [acyclic, intransitive],
334
361
  Supertype is supertype of Subtype;
335
362
  Assimilation applies to Type Inheritance,
336
363
  Type Inheritance uses at most one Assimilation;
364
+ Type Inheritance implies one Fact Type,
365
+ Fact Type is implied by at most one Type Inheritance;
337
366
  Type Inheritance provides identification;
338
367
 
339
368
  Value Constraint Shape is a kind of Constraint Shape;
@@ -349,9 +378,6 @@ Value Range is identified by minimum-Bound and maximum-Bound where
349
378
  Allowed Range is where
350
379
  Value Constraint allows at least one Value Range;
351
380
 
352
- Param Value is where
353
- Value for Parameter applies to one Value Type;
354
-
355
381
  /*
356
382
  * Constraints:
357
383
  */
@@ -380,15 +406,12 @@ either Value Constraint constrains Value Type or Value Constraint applies to Rol
380
406
  for each Instance at most one of these holds:
381
407
  Instance has Value,
382
408
  Instance objectifies Fact;
383
- for each Term at most one of these holds:
384
- Term designates Object Type,
385
- Term is name of Role Ref;
386
- for each Term at most one of these holds:
387
- Term designates Object Type(1),
388
- Term is secondary for Object Type(2);
389
- for each Term at most one of these holds:
390
- Term is secondary for Object Type,
391
- Term is name of Role Ref;
409
+ for each Join Role at most one of these holds:
410
+ Join Step(1) has input-Join Role,
411
+ Join Role is incidentally involved in Join Step;
412
+ for each Join Role at most one of these holds:
413
+ Join Step(1) has output-Join Role,
414
+ Join Role is incidentally involved in Join Step;
392
415
  Join Node is for Object Type that plays Role
393
416
  if and only if
394
417
  Join Node includes Role;
@@ -406,12 +429,12 @@ either Agreement was reached by Agent or Agreement was on Date;
406
429
  each combination Diagram, Position occurs at most one time in
407
430
  Shape is in Diagram,
408
431
  Shape is at Position;
409
- each combination Entity Type, Type Inheritance occurs at most one time in
410
- Entity Type is subtype of super Entity Type,
432
+ each combination Entity Type(1), Type Inheritance occurs at most one time in
433
+ Entity Type(1) is subtype of super Entity Type(2),
411
434
  Type Inheritance provides identification;
412
435
  each Presence Constraint occurs at least one time in
413
- Presence Constraint has min Frequency,
414
- Presence Constraint has max Frequency,
436
+ Presence Constraint has min Frequency(2),
437
+ Presence Constraint has max Frequency(1),
415
438
  Presence Constraint is mandatory;
416
439
  each Role Ref occurs at most one time in
417
440
  Join Role projects Role Ref;
@@ -419,14 +442,13 @@ each Role Sequence occurs at least one time in
419
442
  Role Sequence in Ordinal position includes Role;
420
443
  each Set Comparison Constraint occurs at least 2 times in
421
444
  Set Comparison Constraint has in Ordinal position Role Sequence;
422
- each Term occurs at least one time in
423
- Term designates Object Type,
424
- Term is secondary for Object Type,
425
- Term is name of Role Ref;
426
- either Value Range has minimum Bound or Value Range has maximum Bound;
445
+ either Value Range has minimum Bound(2) or Value Range has maximum Bound(1);
427
446
  each combination Vocabulary, Name occurs at most one time in
428
447
  Constraint belongs to Vocabulary,
429
448
  Constraint is called Name;
430
449
  each combination Vocabulary, Name occurs at most one time in
431
450
  Unit is in Vocabulary,
432
451
  Unit is called Name;
452
+ each combination Vocabulary, Object Type, Term occurs at most one time in
453
+ Vocabulary uses Name for Object Type,
454
+ Term is preferred;