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,28 @@
1
+ vocabulary SeparateSubtype;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Claim ID is written as Auto Counter;
7
+ Date Time is written as Date Time;
8
+ Driver Name is written as String;
9
+
10
+ /*
11
+ * Entity Types
12
+ */
13
+ Claim is identified by its ID;
14
+
15
+ Driver is identified by its Name;
16
+
17
+ Incident is identified by Claim where
18
+ Claim concerns at most one Incident;
19
+ Incident occurred on at most one Date Time;
20
+
21
+ Vehicle Incident is a kind of Incident [separate];
22
+ Vehicle Incident occured while at most one Driver was in charge;
23
+
24
+ /*
25
+ * Constraints:
26
+ */
27
+ each Incident occurs one time in
28
+ Claim concerns Incident;
@@ -0,0 +1,283 @@
1
+ vocabulary ServiceDirector;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Company Code is written as Char(5);
7
+ Credential Nr is written as Signed Integer(32);
8
+ DDMMYYYY is written as Date;
9
+ Data Store Name is written as String(15);
10
+ Email Address is written as String(50);
11
+ HHMMSS is written as Time;
12
+ Host System Name is written as String(15);
13
+ IP is written as String(16);
14
+ MDYHMS is written as Auto Time Stamp;
15
+ Message Data is written as Blob(8000);
16
+ Message Header is written as String(30);
17
+ Monitor Id is written as Auto Counter;
18
+ Monitoring Application Name is written as String(10);
19
+ Name is written as String(15);
20
+ Netmask is written as String(16);
21
+ Network Nr is written as Signed Integer(32);
22
+ Notification Level Nr is written as Signed Integer(32);
23
+ Notification Type Name is written as String(20);
24
+ Password is written as String;
25
+ Path is written as String(20);
26
+ Port is written as Signed Integer(32);
27
+ Provider Type Id is written as Signed Integer(20);
28
+ Recurring Schedule Id is written as Auto Counter;
29
+ Satellite Message Id is written as Unsigned Integer(32);
30
+ Seconds is written as Unsigned Integer(32);
31
+ Serial Number is written as String(20);
32
+ Service Type is written as String(15) [independent];
33
+ Subscription Nr is written as Signed Integer(32);
34
+ Switch Id is written as Auto Counter;
35
+ Transaction Nr is written as Unsigned Integer(32);
36
+ Truck PCID is written as Unsigned Integer(32);
37
+ User Name is written as String(20);
38
+ Version is written as Char(5);
39
+
40
+ /*
41
+ * Entity Types
42
+ */
43
+ Company is identified by its Code;
44
+ Company has one Operating-Name;
45
+ Company is client;
46
+ Company is vendor;
47
+
48
+ Credential is identified by its Nr;
49
+ Credential has one Password;
50
+ Credential has one User Name;
51
+
52
+ Data Store is identified by its Name;
53
+ Data Store requires at least one Credential;
54
+ Data Store has one Friendly-Name;
55
+ Data Store has at most one Heart- Beat Truck PCID;
56
+ Data Store has one Internal-Credential;
57
+ Data Store is one Major-Version;
58
+ Data Store is one Minor-Version;
59
+ Data Store is one Revision-Version;
60
+
61
+ Date is identified by DDMMYYYY where
62
+ Date has one DDMMYYYY,
63
+ DDMMYYYY is of at most one Date;
64
+ Credential has at most one Expiration-Date;
65
+
66
+ Date Time is identified by MDYHMS where
67
+ Date Time has one MDYHMS,
68
+ MDYHMS is of at most one Date Time;
69
+
70
+ Duration is identified by Seconds where
71
+ Duration has one Seconds,
72
+ Seconds is of at most one Duration;
73
+
74
+ Geocode File is identified by Path where
75
+ Geocode File has one Path,
76
+ Path is of at most one Geocode File;
77
+ Data Store uses at most one Geocode File;
78
+
79
+ Host System is identified by its Name;
80
+ Data Store is on one Primary-Host System;
81
+ Data Store is on one Secondary-Host System;
82
+
83
+ Monitor is identified by its Id;
84
+ Monitor monitors one Data Store;
85
+ Monitor is disabled;
86
+
87
+ Monitoring Application is identified by its Name [independent];
88
+ Monitor is owned by one Monitoring Application;
89
+
90
+ Network is identified by its Nr;
91
+ Company has at least one Origin-Network;
92
+ Data Store has Tcp- Proxy Network,
93
+ Tcp- Proxy Network is in at most one Data Store;
94
+ Host System uses at least one Network,
95
+ Network is used by at most one Host System;
96
+ Network uses at most one Domain-Name;
97
+ Network has at most one Ending-IP;
98
+ Network has one Initial-IP;
99
+ Network uses at most one Netmask;
100
+ Network is ip_range;
101
+ Network is ip_single;
102
+ Network is ip_subnet;
103
+
104
+ Notification Level is identified by its Nr;
105
+ Notification Level has one Initial- Delay Duration;
106
+ Notification Level has one Repeat-Duration;
107
+
108
+ Notification Type is identified by its Name [independent];
109
+
110
+ Provider Type is identified by its Id;
111
+
112
+ Recurring Schedule is identified by its Id;
113
+ Monitor has All- Exclusion Recurring Schedule,
114
+ All- Exclusion Recurring Schedule applies to at most one Monitor;
115
+ Monitor (as IntegratingMonitor) has Integration- Exclusion Recurring Schedule,
116
+ Integration- Exclusion Recurring Schedule applies to at most one IntegratingMonitor;
117
+ Recurring Schedule has one Duration;
118
+ Recurring Schedule friday;
119
+ Recurring Schedule monday;
120
+ Recurring Schedule saturday;
121
+ Recurring Schedule sunday;
122
+ Recurring Schedule thursday;
123
+ Recurring Schedule tuesday;
124
+ Recurring Schedule wednesday;
125
+
126
+ Satellite Message is identified by its Id;
127
+ Satellite Message is designated for one Data Store;
128
+ Satellite Message one Insertion-Date Time;
129
+ Satellite Message has at most one Message Data;
130
+ Satellite Message has at most one Message Header;
131
+ Satellite Message is of at most one Provider Type;
132
+ Satellite Message has one Serial Number;
133
+
134
+ Subscription is identified by its Nr;
135
+ Company has one Driver- Tech Subscription;
136
+ Subscription has one Beginning-Date;
137
+ Subscription has at most one Ending-Date;
138
+ Subscription is enabled;
139
+
140
+ Switch is identified by its Id;
141
+ Data Store has at most one Legacy-Switch;
142
+ Switch is one Major-Version;
143
+ Switch is one Minor-Version;
144
+ Switch has one Operating-Port;
145
+ Switch is one Revision-Version;
146
+ Switch has one monitoring-Port;
147
+ Switch (as Private Interface Switch) is on private-Network,
148
+ private-Network connects to at most one Private Interface Switch;
149
+ Switch (as Public Interface Switch) is on at least one public-Network,
150
+ Network connects to at most one Public Interface Switch;
151
+ Switch is backup messages;
152
+ Switch is backup updates;
153
+ Switch is send disabled;
154
+ Switch is test vectors enabled;
155
+
156
+ Time is identified by HHMMSS where
157
+ Time has one HHMMSS,
158
+ HHMMSS is of at most one Time;
159
+ Recurring Schedule has one Start-Time;
160
+
161
+ Transaction is identified by its Nr;
162
+ Satellite Message has at most one Group-Transaction;
163
+
164
+ User is identified by its Name;
165
+ User has one Primary-Email Address;
166
+ User has at most one Secondary-Email Address;
167
+ User is monitor notification disabled;
168
+
169
+ Vendor is a kind of Company [separate];
170
+ Vendor requires at least one Credential;
171
+
172
+ Client is a kind of Company [separate];
173
+ Client has at most one default-Data Store;
174
+ Data Store belongs to one Client,
175
+ Client uses Data Store;
176
+
177
+ File Host System is a kind of Host System;
178
+ File Host System has one Port;
179
+
180
+ Host System Runs Switch is where
181
+ Host System runs Switch;
182
+
183
+ Monitor Notification Type is where
184
+ Monitor has at least one Notification Type;
185
+ Monitor Notification Type is excluded;
186
+
187
+ Monitor Notification User is where
188
+ Monitor Notification Type has notification-User;
189
+ Monitor Notification User has one Notification Level;
190
+
191
+ Service is identified by Vendor and Service Type where
192
+ Vendor provides Service,
193
+ Service is of one Service Type;
194
+
195
+ Data Store File Host System is where
196
+ Data Store has at most one File Host System;
197
+ Data Store File Host System has one Internal-Credential;
198
+
199
+ Data Store Service is where
200
+ Service is from at least one Data Store,
201
+ Data Store has Service;
202
+ Data Store Service belongs to one Client;
203
+ Data Store Service requires at least one Credential;
204
+ Data Store Service has one Subscription;
205
+
206
+ /*
207
+ * Constraints:
208
+ */
209
+ either Company is client or Company is vendor but not both;
210
+ for each Credential exactly one of these holds:
211
+ Data Store(1) requires Credential,
212
+ Data Store Service requires Credential,
213
+ Vendor requires Credential,
214
+ Data Store File Host System has Internal-Credential,
215
+ Data Store(2) has Internal-Credential;
216
+ for each Network exactly one of these holds:
217
+ Network is used by Host System,
218
+ Company has Origin-Network,
219
+ Tcp- Proxy Network is in Data Store;
220
+ for each Network exactly one of these holds:
221
+ Network is ip_single,
222
+ Network is ip_subnet,
223
+ Network is ip_range;
224
+ either Host System runs Switch or Data Store has Legacy-Switch but not both;
225
+ for each Network at most one of these holds:
226
+ Network is ip_single,
227
+ Network has Ending-IP;
228
+ Network has Ending IP
229
+ if and only if
230
+ Network is ip_range;
231
+ Network is ip_subnet
232
+ if and only if
233
+ Network uses Netmask;
234
+ Switch is on private Network
235
+ if and only if
236
+ Data Store has Legacy Switch;
237
+ Client has default Data Store
238
+ only if Data Store belongs to Client;
239
+ Data Store has Tcp Proxy Network
240
+ only if Network is ip_single;
241
+ Network uses Domain Name
242
+ only if Network is ip_single;
243
+ each Credential occurs at most one time in
244
+ Data Store File Host System has Internal Credential;
245
+ each Credential occurs at most one time in
246
+ Data Store Service requires Credential;
247
+ each Credential occurs at most one time in
248
+ Data Store has Internal Credential;
249
+ each Credential occurs at most one time in
250
+ Data Store requires Credential;
251
+ each Credential occurs at most one time in
252
+ Vendor requires Credential;
253
+ each IP occurs at most one time in
254
+ Network has Ending IP;
255
+ each IP occurs at most one time in
256
+ Network has Initial IP;
257
+ each Name occurs at most one time in
258
+ Data Store has Friendly Name;
259
+ each Network occurs at most one time in
260
+ Company has Origin Network;
261
+ each Port occurs at most one time in
262
+ Switch has monitoring Port;
263
+ each Recurring Schedule occurs at least one time in
264
+ Recurring Schedule monday,
265
+ Recurring Schedule tuesday,
266
+ Recurring Schedule wednesday,
267
+ Recurring Schedule thursday,
268
+ Recurring Schedule friday,
269
+ Recurring Schedule saturday,
270
+ Recurring Schedule sunday;
271
+ each Service occurs one time in
272
+ Vendor provides Service;
273
+ each Subscription occurs at most one time in
274
+ Company has Driver Tech Subscription;
275
+ each Subscription occurs at most one time in
276
+ Data Store Service has Subscription;
277
+ each Switch occurs at most one time in
278
+ Data Store has Legacy Switch;
279
+ each combination User Name, Vendor, Data Store Service, Data Store occurs at most one time in
280
+ Credential has User Name,
281
+ Vendor requires Credential,
282
+ Data Store Service requires Credential,
283
+ Data Store requires Credential;
@@ -3,10 +3,10 @@ vocabulary SimplestUnary;
3
3
  /*
4
4
  * Value Types
5
5
  */
6
- SomeString is written as VariableLengthText;
6
+ Some String is written as String;
7
7
 
8
8
  /*
9
9
  * Fact Types
10
10
  */
11
- SomeString is long;
11
+ Some String is long;
12
12
 
@@ -3,29 +3,29 @@ vocabulary SubtypePI;
3
3
  /*
4
4
  * Value Types
5
5
  */
6
- EntrantID is written as AutoCounter;
7
- FamilyName is written as VariableLengthText;
8
- GivenName is written as VariableLengthText;
9
- TeamID is written as AutoCounter;
6
+ Entrant ID is written as Auto Counter;
7
+ Family Name is written as String;
8
+ Given Name is written as String;
9
+ Team ID is written as Auto Counter;
10
10
 
11
11
  /*
12
12
  * Entity Types
13
13
  */
14
14
  Entrant is identified by its ID;
15
15
 
16
- EntrantHasGivenName is where
17
- Entrant has at least one GivenName,
18
- GivenName is of Entrant;
16
+ Entrant Given Name is where
17
+ Entrant has at least one Given Name,
18
+ Given Name is of Entrant;
19
19
 
20
20
  Team is a kind of Entrant identified by its ID;
21
21
 
22
22
  Competitor is a kind of Entrant;
23
- Competitor has one FamilyName;
23
+ Competitor has one Family Name;
24
24
 
25
25
  /*
26
26
  * Constraints:
27
27
  */
28
28
  either Entrant is a Competitor or Entrant is a Team but not both;
29
- each combination FamilyName, GivenName occurs at most one time in
30
- Competitor has FamilyName,
31
- Entrant has GivenName;
29
+ each combination Family Name, Given Name occurs at most one time in
30
+ Competitor has Family Name,
31
+ Entrant has Given Name;
@@ -0,0 +1,38 @@
1
+ vocabulary Supervision;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ CompanyName is written as String;
7
+ EmployeeNr is written as Signed Integer(32);
8
+
9
+ /*
10
+ * Entity Types
11
+ */
12
+ Company is identified by its Name;
13
+
14
+ Employee is identified by Company and EmployeeNr where
15
+ Employee works for one Company,
16
+ Company employs Employee,
17
+ Employee has one EmployeeNr,
18
+ EmployeeNr is of Employee;
19
+
20
+ Manager is a kind of Employee;
21
+ Manager supervises Employee,
22
+ Employee reports to at most one Manager;
23
+
24
+ CEO is a kind of Manager;
25
+ CEO runs Company,
26
+ Company is run by one CEO;
27
+
28
+ /*
29
+ * Constraints:
30
+ */
31
+ either Employee reports to Manager(1) or Employee is a Manager(2) that is a CEO that runs Company but not both;
32
+ CEO runs Company
33
+ if and only if
34
+ CEO is a kind of Manager that works for Company;
35
+ // This constraint cannot be expressed in NORMA until it adds explicit join paths:
36
+ Employee(1) reports to Manager that is a kind of Employee(2) that works for Company
37
+ if and only if
38
+ Employee(1) works for Company;
@@ -0,0 +1,38 @@
1
+ vocabulary ORMModel1;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Accuracy Level is written as Signed Integer(32);
7
+ Party Id is written as Auto Counter;
8
+ Party Name is written as String;
9
+ ymd is written as Date;
10
+
11
+ /*
12
+ * Entity Types
13
+ */
14
+ Accuracy is identified by its Level restricted to {1..5};
15
+
16
+ Event Date is identified by ymd where
17
+ Event Date has one ymd,
18
+ ymd is of at most one Event Date;
19
+
20
+ Party is identified by its Id [independent];
21
+
22
+ Party Moniker is where
23
+ Party is called at most one Party Name;
24
+ Party Moniker has one Accuracy;
25
+
26
+ Person is a kind of Party;
27
+
28
+ Birth is where
29
+ Person was born on one Event Date;
30
+
31
+ Death is where
32
+ Person died;
33
+ Death occurred on at most one death-Event Date;
34
+
35
+ Doctor is a kind of Person;
36
+ Birth was assisted by at most one attending-Doctor,
37
+ Doctor attended Birth;
38
+
@@ -0,0 +1,33 @@
1
+ vocabulary WaiterTips;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ AUDValue is written as Money;
7
+ MealId is written as Auto Counter;
8
+ WaiterNr is written as Signed Integer(32);
9
+
10
+ /*
11
+ * Entity Types
12
+ */
13
+ Amount is identified by AUDValue where
14
+ Amount has one AUDValue,
15
+ AUDValue is of at most one Amount;
16
+
17
+ Meal is identified by its Id;
18
+
19
+ Waiter is identified by its Nr;
20
+
21
+ WaiterTip is where
22
+ Waiter for serving Meal reported a tip of at most one Amount;
23
+
24
+ Service is where
25
+ Waiter served Meal;
26
+ Service earned a tip of at most one Amount;
27
+
28
+ /*
29
+ * Constraints:
30
+ */
31
+ Service (where Waiter served Meal) earned a tip of Amount
32
+ if and only if
33
+ Waiter for serving Meal reported a tip of Amount;