activefacts 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +83 -0
  3. data/README.rdoc +81 -0
  4. data/Rakefile +41 -0
  5. data/bin/afgen +46 -0
  6. data/bin/cql +52 -0
  7. data/examples/CQL/Address.cql +46 -0
  8. data/examples/CQL/Blog.cql +54 -0
  9. data/examples/CQL/CompanyDirectorEmployee.cql +51 -0
  10. data/examples/CQL/Death.cql +16 -0
  11. data/examples/CQL/Genealogy.cql +95 -0
  12. data/examples/CQL/Marriage.cql +18 -0
  13. data/examples/CQL/Metamodel.cql +238 -0
  14. data/examples/CQL/MultiInheritance.cql +19 -0
  15. data/examples/CQL/OilSupply.cql +47 -0
  16. data/examples/CQL/Orienteering.cql +108 -0
  17. data/examples/CQL/PersonPlaysGame.cql +17 -0
  18. data/examples/CQL/SchoolActivities.cql +31 -0
  19. data/examples/CQL/SimplestUnary.cql +12 -0
  20. data/examples/CQL/SubtypePI.cql +32 -0
  21. data/examples/CQL/Warehousing.cql +99 -0
  22. data/examples/CQL/WindowInRoomInBldg.cql +22 -0
  23. data/lib/activefacts.rb +10 -0
  24. data/lib/activefacts/api.rb +25 -0
  25. data/lib/activefacts/api/concept.rb +384 -0
  26. data/lib/activefacts/api/constellation.rb +106 -0
  27. data/lib/activefacts/api/entity.rb +239 -0
  28. data/lib/activefacts/api/instance.rb +54 -0
  29. data/lib/activefacts/api/numeric.rb +158 -0
  30. data/lib/activefacts/api/role.rb +94 -0
  31. data/lib/activefacts/api/standard_types.rb +67 -0
  32. data/lib/activefacts/api/support.rb +59 -0
  33. data/lib/activefacts/api/value.rb +122 -0
  34. data/lib/activefacts/api/vocabulary.rb +120 -0
  35. data/lib/activefacts/cql.rb +31 -0
  36. data/lib/activefacts/cql/CQLParser.treetop +104 -0
  37. data/lib/activefacts/cql/Concepts.treetop +112 -0
  38. data/lib/activefacts/cql/DataTypes.treetop +66 -0
  39. data/lib/activefacts/cql/Expressions.treetop +113 -0
  40. data/lib/activefacts/cql/FactTypes.treetop +185 -0
  41. data/lib/activefacts/cql/Language/English.treetop +92 -0
  42. data/lib/activefacts/cql/LexicalRules.treetop +169 -0
  43. data/lib/activefacts/cql/Rakefile +6 -0
  44. data/lib/activefacts/cql/parser.rb +88 -0
  45. data/lib/activefacts/generate/absorption.rb +87 -0
  46. data/lib/activefacts/generate/cql.rb +441 -0
  47. data/lib/activefacts/generate/cql/html.rb +397 -0
  48. data/lib/activefacts/generate/null.rb +19 -0
  49. data/lib/activefacts/generate/ordered.rb +557 -0
  50. data/lib/activefacts/generate/ruby.rb +326 -0
  51. data/lib/activefacts/generate/sql/server.rb +164 -0
  52. data/lib/activefacts/generate/text.rb +21 -0
  53. data/lib/activefacts/input/cql.rb +1268 -0
  54. data/lib/activefacts/input/orm.rb +926 -0
  55. data/lib/activefacts/persistence.rb +1 -0
  56. data/lib/activefacts/persistence/composition.rb +653 -0
  57. data/lib/activefacts/support.rb +51 -0
  58. data/lib/activefacts/version.rb +3 -0
  59. data/lib/activefacts/vocabulary.rb +6 -0
  60. data/lib/activefacts/vocabulary/extensions.rb +343 -0
  61. data/lib/activefacts/vocabulary/metamodel.rb +303 -0
  62. data/script/txt2html +71 -0
  63. data/spec/absorption_spec.rb +95 -0
  64. data/spec/api/autocounter.rb +82 -0
  65. data/spec/api/constellation.rb +130 -0
  66. data/spec/api/entity_type.rb +101 -0
  67. data/spec/api/instance.rb +428 -0
  68. data/spec/api/roles.rb +122 -0
  69. data/spec/api/value_type.rb +112 -0
  70. data/spec/api_spec.rb +14 -0
  71. data/spec/cql_cql_spec.rb +58 -0
  72. data/spec/cql_parse_spec.rb +31 -0
  73. data/spec/cql_ruby_spec.rb +60 -0
  74. data/spec/cql_sql_spec.rb +54 -0
  75. data/spec/cql_symbol_tables_spec.rb +259 -0
  76. data/spec/cql_unit_spec.rb +336 -0
  77. data/spec/cqldump_spec.rb +169 -0
  78. data/spec/norma_cql_spec.rb +48 -0
  79. data/spec/norma_ruby_spec.rb +50 -0
  80. data/spec/norma_sql_spec.rb +45 -0
  81. data/spec/norma_tables_spec.rb +94 -0
  82. data/spec/spec.opts +1 -0
  83. data/spec/spec_helper.rb +10 -0
  84. metadata +173 -0
@@ -0,0 +1,16 @@
1
+ vocabulary DeathAsUnary;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ CauseOfDeath is defined as VariableLengthText();
7
+ PersonName is defined as VariableLengthText(40);
8
+
9
+ /*
10
+ * Entity Types
11
+ */
12
+ Person is identified by its Name;
13
+ Death is where
14
+ Person is dead;
15
+ Death was due to at most one CauseOfDeath;
16
+
@@ -0,0 +1,95 @@
1
+ vocabulary Genealogy;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Address is defined as VariableLengthText(128);
7
+ Certificate is defined as VariableLengthText(64);
8
+ Day is defined as UnsignedInteger(32) restricted to {1..31};
9
+ Email is defined as VariableLengthText(64);
10
+ EventID is defined as AutoCounter();
11
+ EventLocation is defined as VariableLengthText(128);
12
+ EventRoleName is defined as VariableLengthText() restricted to {'Subject', 'Father', 'Mother', 'Husband', 'Wife', 'Celebrant'};
13
+ EventTypeID is defined as AutoCounter();
14
+ EventTypeName is defined as VariableLengthText(16) restricted to {'Birth', 'Christening', 'Marriage', 'Divorce', 'Death', 'Burial'};
15
+ Gender is defined as FixedLengthText(1) restricted to {'M', 'F'};
16
+ Month is defined as UnsignedInteger(32) restricted to {1..12};
17
+ Name is defined as VariableLengthText(128);
18
+ Occupation is defined as VariableLengthText(128);
19
+ Official is defined as VariableLengthText(64);
20
+ PersonID is defined as AutoCounter();
21
+ Picture is defined as PictureRawData(20);
22
+ RoleID is defined as AutoCounter();
23
+ SourceID is defined as AutoCounter();
24
+ SourceName is defined as VariableLengthText(128);
25
+ UserID is defined as AutoCounter();
26
+ Year is defined as UnsignedInteger(32);
27
+
28
+ /*
29
+ * Entity Types
30
+ */
31
+ Event is identified by its ID;
32
+ Event is certified by at most one Certificate;
33
+ Event occurred at at most one EventLocation;
34
+ Event was confirmed by at most one Official;
35
+
36
+ EventDate is identified by min-Year and max-Year and Month and Day where
37
+ EventDate wasnt before at most one min-Year,
38
+ EventDate wasnt after at most one max-Year,
39
+ EventDate occurred in at most one Month,
40
+ EventDate occurred on at most one Day;
41
+ Event occurred on at most one EventDate;
42
+
43
+ EventType is identified by its ID;
44
+ Event is of at most one EventType;
45
+ EventType is called one EventTypeName,
46
+ EventTypeName is name of at most one EventType;
47
+
48
+ Person is identified by its ID;
49
+ Address is of Person,
50
+ Person lives at at most one Address;
51
+ Email is of Person,
52
+ Person has at most one Email;
53
+ Occupation is of Person,
54
+ Person is employed in at most one Occupation;
55
+ Person is of at most one Gender;
56
+ Person is called at most one family-Name,
57
+ family-Name is of Person;
58
+ given-Name is name of Person,
59
+ Person is called at most one given-Name;
60
+ preferred-Picture is of Person,
61
+ Person has at most one preferred-Picture;
62
+
63
+ Role is identified by its ID;
64
+ Role is called one EventRoleName,
65
+ EventRoleName is name of one Role;
66
+
67
+ Source is identified by its ID;
68
+ Source has one SourceName,
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
+
75
+ User is identified by its ID;
76
+ Email is of User,
77
+ User has at most one Email;
78
+ User provided Source,
79
+ Source was provided by one User;
80
+ Friend is where
81
+ User is friend of other-User [symmetric];
82
+ Friend is confirmed;
83
+
84
+ /*
85
+ * Constraints:
86
+ */
87
+ each Event occurs at least one time in
88
+ Person played Role in Event according to Source;
89
+ each EventDate occurs at least one time in
90
+ EventDate wasnt before min-Year,
91
+ EventDate wasnt after max-Year,
92
+ EventDate occurred in Month,
93
+ EventDate occurred on Day;
94
+ each Person occurs at least one time in
95
+ Person played Role in Event according to Source;
@@ -0,0 +1,18 @@
1
+ vocabulary Marriage;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Name is defined as VariableLengthText();
7
+
8
+ /*
9
+ * Entity Types
10
+ */
11
+ Person is identified by given-Name and family-Name where
12
+ Person has one given-Name,
13
+ Person has one family-Name;
14
+
15
+ Marriage is identified by Husband and Wife where
16
+ Marriage is by one husband-Person (as Husband),
17
+ Marriage is of one wife-Person (as Wife);
18
+
@@ -0,0 +1,238 @@
1
+ vocabulary Metamodel;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Adjective is defined as VariableLengthText(64);
7
+ ConstraintId is defined as AutoCounter();
8
+ Denominator is defined as UnsignedInteger(32);
9
+ Enforcement is defined as VariableLengthText(16);
10
+ Exponent is defined as SignedSmallInteger(32);
11
+ FactId is defined as AutoCounter();
12
+ FactTypeId is defined as AutoCounter();
13
+ Frequency is defined as UnsignedInteger(32);
14
+ InstanceId is defined as AutoCounter();
15
+ Length is defined as UnsignedInteger(32);
16
+ Name is defined as VariableLengthText(64);
17
+ Numerator is defined as Decimal();
18
+ Ordinal is defined as UnsignedSmallInteger(32);
19
+ ReadingText is defined as VariableLengthText(256);
20
+ RingType is defined as VariableLengthText();
21
+ RoleSequenceId is defined as AutoCounter();
22
+ Scale is defined as UnsignedInteger(32);
23
+ UnitId is defined as AutoCounter();
24
+ Value is defined as VariableLengthText(256);
25
+ ValueRestrictionId is defined as AutoCounter();
26
+
27
+ /*
28
+ * Entity Types
29
+ */
30
+ Bound is identified by Value and Bound is inclusive where
31
+ Bound has one Value,
32
+ Value is of at least one Bound,
33
+ Bound is inclusive;
34
+
35
+ Coefficient is identified by Numerator and Denominator and Coefficient is precise where
36
+ Coefficient has one Numerator,
37
+ Coefficient has one Denominator,
38
+ Coefficient is precise;
39
+
40
+ Constraint is identified by its Id;
41
+ Constraint requires at most one Enforcement,
42
+ Enforcement applies to Constraint;
43
+ Name is of Constraint,
44
+ Constraint is called at most one Name;
45
+
46
+ Fact is identified by its Id;
47
+
48
+ FactType is identified by its Id;
49
+ Fact is of one FactType;
50
+
51
+ Instance is identified by its Id;
52
+ Instance has at most one Value;
53
+
54
+ PresenceConstraint is a kind of Constraint;
55
+ PresenceConstraint has at most one max-Frequency;
56
+ PresenceConstraint has at most one min-Frequency;
57
+ PresenceConstraint is mandatory;
58
+ PresenceConstraint is preferred identifier;
59
+
60
+ Reading is identified by FactType and Ordinal where
61
+ FactType has at least one Reading,
62
+ Reading is for one FactType,
63
+ Reading is in at most one Ordinal position,
64
+ Ordinal reading for fact type is Reading;
65
+ Reading has one ReadingText;
66
+
67
+ RingConstraint is a kind of Constraint;
68
+ RingConstraint is of one RingType;
69
+
70
+ RoleSequence is identified by its Id;
71
+ PresenceConstraint covers one RoleSequence;
72
+ Reading is in one RoleSequence,
73
+ RoleSequence is for Reading;
74
+
75
+ RoleValue is identified by Instance and Fact where
76
+ Instance plays RoleValue,
77
+ RoleValue is of one Instance,
78
+ RoleValue fulfils one Fact,
79
+ Fact includes at least one RoleValue;
80
+
81
+ SetConstraint is a kind of Constraint;
82
+
83
+ SubsetConstraint is a kind of SetConstraint;
84
+ SubsetConstraint covers one subset-RoleSequence;
85
+ SubsetConstraint covers one superset-RoleSequence;
86
+
87
+ Unit is identified by its Id;
88
+ Name is of Unit,
89
+ Unit is called one Name;
90
+ Unit has at most one Coefficient;
91
+ Unit is fundamental;
92
+ UnitBasis is where
93
+ Unit (as DerivedUnit) is derived from base-Unit (as BaseUnit) [acyclic, intransitive];
94
+ UnitBasis has at most one Exponent;
95
+
96
+ ValueRange is identified by minimum-Bound and maximum-Bound where
97
+ ValueRange has at most one minimum-Bound,
98
+ ValueRange has at most one maximum-Bound;
99
+
100
+ ValueRestriction is identified by its Id;
101
+ AllowedRange is where
102
+ ValueRestriction allows at least one ValueRange;
103
+
104
+ Vocabulary is identified by Name where
105
+ Vocabulary is called one Name;
106
+ Vocabulary contains Constraint,
107
+ Constraint belongs to at most one Vocabulary;
108
+ Import is where
109
+ Vocabulary imports imported-Vocabulary [acyclic];
110
+
111
+ Feature is identified by Name and Vocabulary where
112
+ Feature is called one Name,
113
+ Feature belongs to at most one Vocabulary,
114
+ Vocabulary contains Feature;
115
+ Correspondence is where
116
+ in Import imported-Feature corresponds to at most one local-Feature;
117
+
118
+ Population is identified by Vocabulary and Name where
119
+ Vocabulary includes Population,
120
+ Population belongs to at most one Vocabulary,
121
+ Population has one Name,
122
+ Name is of Population;
123
+ Population includes Fact,
124
+ Fact belongs to one Population;
125
+ Population includes Instance,
126
+ Instance belongs to one Population;
127
+ Population includes RoleValue,
128
+ RoleValue belongs to one Population;
129
+
130
+ SetComparisonConstraint is a kind of SetConstraint;
131
+ SetComparisonRoles is where
132
+ SetComparisonConstraint covers at least one RoleSequence;
133
+
134
+ SetEqualityConstraint is a kind of SetComparisonConstraint;
135
+
136
+ SetExclusionConstraint is a kind of SetComparisonConstraint;
137
+ SetExclusionConstraint is mandatory;
138
+
139
+ Alias is a kind of Feature;
140
+
141
+ Concept is a kind of Feature;
142
+ Concept is independent;
143
+ Concept is personal;
144
+ Instance is of one Concept;
145
+ Role is where
146
+ FactType has Ordinal role played by Concept,
147
+ Concept plays role in FactType in Ordinal place,
148
+ Concept plays Ordinal role in FactType;
149
+ Role is of RingConstraint,
150
+ RingConstraint has at most one Role;
151
+ Role has at most one role-Name,
152
+ role-Name is name of at least one Role;
153
+ Role has at most one role-ValueRestriction,
154
+ ValueRestriction applies to Role;
155
+ RoleValue is of one Role;
156
+ other-Role is of RingConstraint,
157
+ RingConstraint has at most one other-Role;
158
+ RoleRef is where
159
+ RoleSequence in Ordinal position includes at most one Role,
160
+ Role is in RoleSequence in at most one Ordinal place,
161
+ RoleSequence includes Role in Ordinal place,
162
+ Role has Ordinal place in RoleSequence;
163
+ RoleRef has at most one leading-Adjective;
164
+ RoleRef has at most one trailing-Adjective;
165
+ JoinPath is where
166
+ RoleRef has Ordinal (as JoinStep) path;
167
+ JoinPath traverses at most one Concept,
168
+ Concept is traversed by JoinPath;
169
+ JoinPath has one input-Role;
170
+ JoinPath has one output-Role;
171
+
172
+ EntityType is a kind of Concept;
173
+ EntityType nests at most one FactType,
174
+ FactType is nested as at most one EntityType;
175
+ TypeInheritance is a kind of FactType identified by Subtype and Supertype where
176
+ EntityType (as Subtype) is subtype of super-EntityType (as Supertype) [acyclic],
177
+ Supertype is supertype of Subtype;
178
+ TypeInheritance provides identification;
179
+
180
+ ValueType is a kind of Concept;
181
+ ValueType has at most one Length,
182
+ Length is of ValueType;
183
+ ValueType has at most one Scale,
184
+ Scale is of ValueType;
185
+ ValueType is of at most one Unit;
186
+ ValueType has at most one ValueRestriction;
187
+ ValueType is subtype of at most one super-ValueType (as Supertype) [acyclic],
188
+ Supertype is supertype of ValueType;
189
+
190
+ /*
191
+ * Constraints:
192
+ */
193
+ for each Concept exactly one of these holds:
194
+ EntityType is a subtype of Concept,
195
+ ValueType is a subtype of Concept;
196
+ for each Constraint exactly one of these holds:
197
+ PresenceConstraint is a subtype of Constraint,
198
+ SetConstraint is a subtype of Constraint,
199
+ RingConstraint is a subtype of Constraint;
200
+ for each Feature exactly one of these holds:
201
+ Concept is a subtype of Feature,
202
+ Alias is a subtype of Feature;
203
+ Instance plays RoleValue and Instance is of Concept
204
+ if and only if
205
+ RoleValue is of Role and FactType has Ordinal role played by Concept;
206
+ RoleValue fulfils Fact and Fact is of FactType
207
+ if and only if
208
+ RoleValue is of Role and FactType has Ordinal role played by Concept;
209
+ for each SetComparisonConstraint exactly one of these holds:
210
+ SetExclusionConstraint is a subtype of SetComparisonConstraint,
211
+ SetEqualityConstraint is a subtype of SetComparisonConstraint;
212
+ for each SetConstraint exactly one of these holds:
213
+ SetComparisonConstraint is a subtype of SetConstraint,
214
+ SubsetConstraint is a subtype of SetConstraint;
215
+ for each Unit exactly one of these holds:
216
+ Unit is fundamental,
217
+ that Unit is derived from some base-Unit;
218
+ PresenceConstraint is preferred identifier
219
+ only if PresenceConstraint has max-Frequency;
220
+ ValueType has Scale
221
+ only if ValueType has Length;
222
+ each combination EntityType, TypeInheritance occurs at most one time in
223
+ EntityType is subtype of super-EntityType,
224
+ TypeInheritance provides identification;
225
+ each FactType occurs at least one time in
226
+ FactType has Ordinal role played by Concept;
227
+ each combination Name, Vocabulary occurs at most one time in
228
+ Name is of Constraint,
229
+ Vocabulary contains Constraint;
230
+ each PresenceConstraint occurs at least one time in
231
+ PresenceConstraint has min-Frequency,
232
+ PresenceConstraint has max-Frequency,
233
+ PresenceConstraint is mandatory;
234
+ each RoleSequence occurs at least one time in
235
+ RoleSequence in Ordinal position includes Role;
236
+ each ValueRange occurs at least one time in
237
+ ValueRange has minimum-Bound,
238
+ ValueRange has maximum-Bound;
@@ -0,0 +1,19 @@
1
+ vocabulary MultiInheritance;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ EmployeeID is defined as AutoCounter();
7
+ PersonName is defined as VariableLengthText();
8
+
9
+ /*
10
+ * Entity Types
11
+ */
12
+ Person is identified by its Name;
13
+
14
+ Australian is a kind of Person;
15
+
16
+ Employee is a kind of Person identified by its ID;
17
+
18
+ AustralianEmployee is a kind of Employee, Australian;
19
+
@@ -0,0 +1,47 @@
1
+ vocabulary OilSupply;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Cost is defined as Money();
7
+ MonthCode is defined as FixedLengthText();
8
+ ProductName is defined as VariableLengthText();
9
+ Quantity is defined as UnsignedInteger(32);
10
+ RefineryName is defined as VariableLengthText(80);
11
+ RegionName is defined as VariableLengthText();
12
+ Season is defined as VariableLengthText(6) restricted to {'Spring', 'Summer', 'Autumn', 'Winter'};
13
+ TransportMethod is defined as VariableLengthText() restricted to {'Rail', 'Road', 'Sea'};
14
+ YearNr is defined as SignedInteger(32);
15
+
16
+ /*
17
+ * Entity Types
18
+ */
19
+ Month is identified by its Code;
20
+ Month is in one Season;
21
+
22
+ Product is identified by its Name;
23
+ AcceptableSubstitutes is where
24
+ Product may be substituted by alternate-Product in Season [acyclic, intransitive],
25
+ alternate-Product is an acceptable substitute for Product in Season;
26
+
27
+ Refinery is identified by its Name;
28
+
29
+ Region is identified by its Name;
30
+ TransportRoute is where
31
+ TransportMethod transportation is available from Refinery to Region,
32
+ TransportMethod transportation is available to Region from Refinery;
33
+ TransportRoute incurs at most one Cost per kl;
34
+
35
+ Year is identified by its Nr;
36
+
37
+ SupplyPeriod is identified by Month and Year where
38
+ SupplyPeriod is in one Month,
39
+ SupplyPeriod is in one Year;
40
+ ProductionForecast is where
41
+ Refinery forecasts production of Product in SupplyPeriod;
42
+ RegionalDemand is where
43
+ Region will need Product in SupplyPeriod;
44
+ ProductionForecast predicts at most one Cost;
45
+ ProductionForecast is for one Quantity;
46
+ RegionalDemand is for at most one Quantity;
47
+
@@ -0,0 +1,108 @@
1
+ vocabulary Orienteering;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Accessibility is defined as FixedLengthText(1) restricted to {'A'..'D'};
7
+ ClubCode is defined as VariableLengthText(6);
8
+ ClubName is defined as VariableLengthText(32);
9
+ ControlNumber is defined as UnsignedInteger(32) restricted to {1..1000};
10
+ Course is defined as VariableLengthText(16) restricted to {'A'..'E', 'PW'};
11
+ EntryID is defined as AutoCounter();
12
+ EventID is defined as AutoCounter();
13
+ EventName is defined as VariableLengthText(50);
14
+ FamilyName is defined as VariableLengthText(48);
15
+ Gender is defined as FixedLengthText(1) restricted to {'M', 'F'};
16
+ GivenName is defined as VariableLengthText(48);
17
+ Location is defined as VariableLengthText(200);
18
+ MapID is defined as AutoCounter();
19
+ MapName is defined as VariableLengthText(80);
20
+ Number is defined as UnsignedInteger(32) restricted to {1..100};
21
+ PersonID is defined as AutoCounter();
22
+ Placing is defined as UnsignedInteger(32);
23
+ PointValue is defined as UnsignedInteger(32);
24
+ PostCode is defined as UnsignedInteger(32);
25
+ PunchID is defined as AutoCounter();
26
+ Score is defined as SignedInteger(32);
27
+ ScoringMethod is defined as VariableLengthText(32) restricted to {'Score', 'Scatter', 'Special'};
28
+ SeriesID is defined as AutoCounter();
29
+ SeriesName is defined as VariableLengthText(40);
30
+ StartTime is defined as DateAndTime();
31
+ Time is defined as DateAndTime();
32
+ Year is defined as UnsignedInteger(32) restricted to {1900..3000};
33
+
34
+ /*
35
+ * Entity Types
36
+ */
37
+ Club is identified by its Code;
38
+ ClubName is name of at most one Club,
39
+ Club is called one ClubName;
40
+
41
+ Event is identified by its ID;
42
+ Club runs Event,
43
+ Event is run by one Club;
44
+ Event is called at most one EventName,
45
+ EventName is name of at most one Event;
46
+ Event has at most one Number;
47
+ Event is held on one StartTime;
48
+ Event starts at one start-Location,
49
+ Location is where Event starts;
50
+ EventControl is where
51
+ Event includes at least one ControlNumber;
52
+ EventScoringMethod is where
53
+ ScoringMethod is used for Course of Event,
54
+ Course of Event uses at most one ScoringMethod;
55
+ EventControl has at most one PointValue;
56
+
57
+ Map is identified by its ID;
58
+ Club (as Owner) owns Map,
59
+ Map is owned by one Owner;
60
+ Map has at most one Accessibility;
61
+ Map is map for Event,
62
+ Event uses one Map;
63
+ Map has one MapName,
64
+ MapName is of at most one Map;
65
+
66
+ Person is identified by its ID;
67
+ Person is member of at most one Club;
68
+ Person has one FamilyName,
69
+ FamilyName is of Person;
70
+ Person is of at most one Gender;
71
+ Person has one GivenName,
72
+ GivenName is name of Person;
73
+ Person has at most one PostCode;
74
+ Person was born in at most one birth-Year;
75
+ Entry is identified by its ID where
76
+ Person entered Course of Event,
77
+ Person entered Event in at most one Course;
78
+ Entry received at most one Score;
79
+ Entry finished in at most one finish-Placing;
80
+
81
+ Punch is identified by its ID;
82
+ PunchPlacement is where
83
+ Punch is placed at EventControl;
84
+ Visit is where
85
+ Punch was visited by Entry at Time;
86
+
87
+ Series is identified by its ID;
88
+ Event is in at most one Series;
89
+ Series has one SeriesName (as Name),
90
+ Name is of at most one Series;
91
+
92
+ /*
93
+ * Constraints:
94
+ */
95
+ Event is in Series
96
+ if and only if
97
+ Event has Number;
98
+ each Event occurs at least one time in
99
+ Event is called EventName,
100
+ Event is in Series;
101
+ each EventControl occurs at least one time in
102
+ Punch is placed at EventControl;
103
+ each combination GivenName, FamilyName occurs at most one time in
104
+ Person has GivenName,
105
+ Person has FamilyName;
106
+ each combination Series, Number occurs at most one time in
107
+ Event is in Series,
108
+ Event has Number;