activefacts-examples 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (262) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +10 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +22 -0
  8. data/Rakefile +6 -0
  9. data/activefacts-examples.gemspec +26 -0
  10. data/cql/Address.cql +44 -0
  11. data/cql/Astronomy.cql +35 -0
  12. data/cql/Blog.cql +54 -0
  13. data/cql/CinemaBookings.cql +64 -0
  14. data/cql/CinemaTickets.cql +127 -0
  15. data/cql/CompanyDirectorEmployee.cql +56 -0
  16. data/cql/Death.cql +17 -0
  17. data/cql/Diplomacy.cql +48 -0
  18. data/cql/Genealogy.cql +98 -0
  19. data/cql/Health.cql +78 -0
  20. data/cql/Insurance.cql +320 -0
  21. data/cql/Marriage.cql +18 -0
  22. data/cql/Metamodel.cql +567 -0
  23. data/cql/Monogamy.cql +24 -0
  24. data/cql/MultiInheritance.cql +22 -0
  25. data/cql/MultipleSubtyping.cql +30 -0
  26. data/cql/NonRoleId.cql +14 -0
  27. data/cql/OddIdentifier.cql +18 -0
  28. data/cql/OilSupply.cql +53 -0
  29. data/cql/OneRoleNesting.cql +38 -0
  30. data/cql/OneToOnes.cql +17 -0
  31. data/cql/Orienteering.cql +111 -0
  32. data/cql/PartyModel.cql +38 -0
  33. data/cql/PersonPlaysGame.cql +18 -0
  34. data/cql/RedundantDependency.cql +34 -0
  35. data/cql/SchoolActivities.cql +33 -0
  36. data/cql/SeparateSubtype.cql +30 -0
  37. data/cql/ServiceDirector.cql +276 -0
  38. data/cql/SimplestUnary.cql +12 -0
  39. data/cql/Supervision.cql +34 -0
  40. data/cql/VenueSeating.cql +45 -0
  41. data/cql/WaiterTips.cql +33 -0
  42. data/cql/Warehousing.cql +101 -0
  43. data/cql/WindowInRoomInBldg.cql +28 -0
  44. data/cql/unit.cql +474 -0
  45. data/diagrams/json/Address.json +41 -0
  46. data/diagrams/json/Astronomy.json +31 -0
  47. data/diagrams/json/Blog.json +46 -0
  48. data/diagrams/json/CinemaBookings.json +53 -0
  49. data/diagrams/json/CinemaTickets.json +101 -0
  50. data/diagrams/json/CompanyDirectorEmployee.json +44 -0
  51. data/diagrams/json/Death.json +20 -0
  52. data/diagrams/json/Diplomacy.json +34 -0
  53. data/diagrams/json/Genealogy.json +78 -0
  54. data/diagrams/json/Insurance.json +259 -0
  55. data/diagrams/json/Marriage.json +21 -0
  56. data/diagrams/json/Metamodel.json +318 -0
  57. data/diagrams/json/Monogamy.json +22 -0
  58. data/diagrams/json/MultiInheritance.json +25 -0
  59. data/diagrams/json/MultipleSubtyping.json +22 -0
  60. data/diagrams/json/OilSupply.json +49 -0
  61. data/diagrams/json/OneRoleNesting.json +37 -0
  62. data/diagrams/json/Orienteering.json +94 -0
  63. data/diagrams/json/PersonPlaysGame.json +22 -0
  64. data/diagrams/json/RedundantDependency.json +33 -0
  65. data/diagrams/json/SchoolActivities.json +28 -0
  66. data/diagrams/json/SeparateSubtype.json +29 -0
  67. data/diagrams/json/SimplestUnary.json +15 -0
  68. data/diagrams/json/Supervision.json +27 -0
  69. data/diagrams/json/VenueSeating.json +40 -0
  70. data/diagrams/json/WaiterTips.json +29 -0
  71. data/diagrams/json/Warehousing.json +86 -0
  72. data/diagrams/json/WindowInRoomInBldg.json +31 -0
  73. data/images/Address.SQL.png +0 -0
  74. data/images/Address.png +0 -0
  75. data/images/Blog.png +0 -0
  76. data/images/CinemaBookings.png +0 -0
  77. data/images/CinemaTickets.png +0 -0
  78. data/images/CompanyDirectorEmployee.png +0 -0
  79. data/images/Death.png +0 -0
  80. data/images/Diplomacy.png +0 -0
  81. data/images/DumpMetamodel.bat +2 -0
  82. data/images/Genealogy.png +0 -0
  83. data/images/Insurance/Claim.png +0 -0
  84. data/images/Insurance/Insurance.png +0 -0
  85. data/images/Insurance/Person.png +0 -0
  86. data/images/Insurance/Policy.png +0 -0
  87. data/images/Insurance/Related.png +0 -0
  88. data/images/Insurance/VehicleIncident.png +0 -0
  89. data/images/Marriage.png +0 -0
  90. data/images/Metamodel/Concepts.png +0 -0
  91. data/images/Metamodel/Constraints.png +0 -0
  92. data/images/Metamodel/ContextNote.png +0 -0
  93. data/images/Metamodel/Diagrams.png +0 -0
  94. data/images/Metamodel/Language.png +0 -0
  95. data/images/Metamodel/Legacy.png +0 -0
  96. data/images/Metamodel/Objects.png +0 -0
  97. data/images/Metamodel/Populations.png +0 -0
  98. data/images/Metamodel/Query.png +0 -0
  99. data/images/Metamodel/Units.png +0 -0
  100. data/images/Metamodel/ValueConstraints.png +0 -0
  101. data/images/Metamodel/ValueTypes.png +0 -0
  102. data/images/MetamodelER.bcp +1 -0
  103. data/images/MetamodelER.pdf +0 -0
  104. data/images/MultiInheritance.png +0 -0
  105. data/images/NorthwindER.png +0 -0
  106. data/images/OilSupply.png +0 -0
  107. data/images/Orienteering/Administration.png +0 -0
  108. data/images/Orienteering/Registration.png +0 -0
  109. data/images/Orienteering/Scoring.png +0 -0
  110. data/images/PersonPlaysGame.png +0 -0
  111. data/images/RedundantDependency.png +0 -0
  112. data/images/SchoolActivities.png +0 -0
  113. data/images/SeparateSubtype.png +0 -0
  114. data/images/SimplestUnary.png +0 -0
  115. data/images/Supervision.png +0 -0
  116. data/images/VenueSeating.png +0 -0
  117. data/images/WaiterTips.png +0 -0
  118. data/images/Warehousing.png +0 -0
  119. data/images/WindowInRoomInBldg.png +0 -0
  120. data/metadata/json/Astronomy.json +175 -0
  121. data/metadata/json/CinemaBookings.json +354 -0
  122. data/metadata/json/CinemaTickets.json +768 -0
  123. data/metadata/json/CompanyDirectorEmployee.json +270 -0
  124. data/metadata/json/Diplomacy.json +186 -0
  125. data/metadata/json/Metamodel.json +3214 -0
  126. data/metadata/json/OilSupply.json +411 -0
  127. data/metadata/json/SeparateSubtype.json +157 -0
  128. data/metadata/json/Supervision.json +128 -0
  129. data/metadata/json/VenueSeating.json +209 -0
  130. data/orm/.gitignore +11 -0
  131. data/orm/Address.orm +1268 -0
  132. data/orm/Astronomy.orm +925 -0
  133. data/orm/Blog.orm +1711 -0
  134. data/orm/CinemaBookings.orm +1998 -0
  135. data/orm/CinemaTickets.orm +5060 -0
  136. data/orm/CompanyDirectorEmployee.orm +2094 -0
  137. data/orm/Death.orm +386 -0
  138. data/orm/Diplomacy.orm +1478 -0
  139. data/orm/ExampleModels2010.csproj +764 -0
  140. data/orm/ExampleModels2010.sln +16 -0
  141. data/orm/Genealogy.orm +3209 -0
  142. data/orm/Health.orm +2407 -0
  143. data/orm/Insurance.orm +12727 -0
  144. data/orm/Marriage.orm +493 -0
  145. data/orm/Metamodel.orm +20998 -0
  146. data/orm/Monogamy.orm +328 -0
  147. data/orm/MultiInheritance.orm +537 -0
  148. data/orm/MultipleSubtyping.orm +347 -0
  149. data/orm/OilSupply.orm +2533 -0
  150. data/orm/OneRoleNesting.orm +1237 -0
  151. data/orm/Orienteering.orm +3976 -0
  152. data/orm/PersonPlaysGame.orm +426 -0
  153. data/orm/RedundantDependency.orm +844 -0
  154. data/orm/SchoolActivities.orm +961 -0
  155. data/orm/SeparateSubtype.orm +821 -0
  156. data/orm/SimplestUnary.orm +172 -0
  157. data/orm/Supervision.orm +734 -0
  158. data/orm/VenueSeating.orm +1289 -0
  159. data/orm/WaiterTips.orm +789 -0
  160. data/orm/Warehousing.orm +3792 -0
  161. data/orm/WindowInRoomInBldg.orm +772 -0
  162. data/rails/models/Astronomy.models +17 -0
  163. data/rails/models/CinemaBookings.models +123 -0
  164. data/rails/models/CinemaTickets.models +192 -0
  165. data/rails/models/Diplomacy.models +126 -0
  166. data/rails/models/Metamodel.models +894 -0
  167. data/rails/models/OneRoleNesting.models +18 -0
  168. data/rails/models/SeparateSubtype.models +49 -0
  169. data/rails/models/VenueSeating.models +70 -0
  170. data/rails/schema/Astronomy.schema.rb +25 -0
  171. data/rails/schema/CinemaBookings.schema.rb +78 -0
  172. data/rails/schema/CinemaTickets.schema.rb +132 -0
  173. data/rails/schema/Diplomacy.schema.rb +74 -0
  174. data/rails/schema/Metamodel.schema.rb +538 -0
  175. data/rails/schema/OneRoleNesting.rb +20 -0
  176. data/rails/schema/SeparateSubtype.schema.rb +35 -0
  177. data/rails/schema/VenueSeating.schema.rb +46 -0
  178. data/rails/schema/Warehousing.schema.rb +145 -0
  179. data/ruby/Address.rb +68 -0
  180. data/ruby/Astronomy.rb +55 -0
  181. data/ruby/Blog.rb +84 -0
  182. data/ruby/CinemaBookings.rb +109 -0
  183. data/ruby/CinemaTickets.rb +218 -0
  184. data/ruby/CompanyDirectorEmployee.rb +73 -0
  185. data/ruby/Death.rb +26 -0
  186. data/ruby/Diplomacy.rb +59 -0
  187. data/ruby/Genealogy.rb +173 -0
  188. data/ruby/Insurance.rb +562 -0
  189. data/ruby/Marriage.rb +21 -0
  190. data/ruby/Metamodel.rb +621 -0
  191. data/ruby/Monogamy.rb +27 -0
  192. data/ruby/MultiInheritance.rb +38 -0
  193. data/ruby/OilSupply.rb +112 -0
  194. data/ruby/OneRoleNesting.rb +66 -0
  195. data/ruby/Orienteering.rb +216 -0
  196. data/ruby/PersonPlaysGame.rb +31 -0
  197. data/ruby/RedundantDependency.rb +53 -0
  198. data/ruby/SchoolActivities.rb +49 -0
  199. data/ruby/SeparateSubtype.rb +46 -0
  200. data/ruby/SimplestUnary.rb +10 -0
  201. data/ruby/Supervision.rb +33 -0
  202. data/ruby/TwoValues.rb +14 -0
  203. data/ruby/VenueSeating.rb +64 -0
  204. data/ruby/WaiterTips.rb +49 -0
  205. data/ruby/Warehousing.rb +167 -0
  206. data/ruby/WindowInRoomInBldg.rb +45 -0
  207. data/sql/server/Address.sql +40 -0
  208. data/sql/server/Astronomy.sql +36 -0
  209. data/sql/server/Blog.sql +78 -0
  210. data/sql/server/CinemaBookings.sql +95 -0
  211. data/sql/server/CinemaTickets.sql +191 -0
  212. data/sql/server/CompanyDirectorEmployee.sql +104 -0
  213. data/sql/server/Death.sql +11 -0
  214. data/sql/server/Diplomacy.sql +66 -0
  215. data/sql/server/Genealogy.sql +138 -0
  216. data/sql/server/Health.sql +169 -0
  217. data/sql/server/Insurance.sql +484 -0
  218. data/sql/server/Marriage.sql +30 -0
  219. data/sql/server/Metamodel.sql +1000 -0
  220. data/sql/server/Monogamy.sql +20 -0
  221. data/sql/server/MultiInheritance.sql +27 -0
  222. data/sql/server/OilSupply.sql +105 -0
  223. data/sql/server/OneRoleNesting.sql +29 -0
  224. data/sql/server/Orienteering.sql +186 -0
  225. data/sql/server/PersonPlaysGame.sql +9 -0
  226. data/sql/server/RedundantDependency.sql +54 -0
  227. data/sql/server/SchoolActivities.sql +30 -0
  228. data/sql/server/SeparateSubtype.sql +33 -0
  229. data/sql/server/SimplestUnary.sql +9 -0
  230. data/sql/server/Supervision.sql +30 -0
  231. data/sql/server/VenueSeating.sql +54 -0
  232. data/sql/server/WaiterTips.sql +31 -0
  233. data/sql/server/Warehousing.sql +203 -0
  234. data/sql/server/WindowInRoomInBldg.sql +13 -0
  235. data/transform/surrogate/Address.absorption +2 -0
  236. data/transform/surrogate/Blog.absorption +5 -0
  237. data/transform/surrogate/CinemaBookings.absorption +7 -0
  238. data/transform/surrogate/CompanyDirectorEmployee.absorption +7 -0
  239. data/transform/surrogate/Death.absorption +1 -0
  240. data/transform/surrogate/Diplomacy-revised.absorption +6 -0
  241. data/transform/surrogate/Diplomacy.absorption +6 -0
  242. data/transform/surrogate/Genealogy.absorption +8 -0
  243. data/transform/surrogate/Insurance.absorption +18 -0
  244. data/transform/surrogate/Marriage.absorption +2 -0
  245. data/transform/surrogate/Metamodel.absorption +25 -0
  246. data/transform/surrogate/Monogamy.absorption +1 -0
  247. data/transform/surrogate/MultiInheritance.absorption +1 -0
  248. data/transform/surrogate/MultipleSubtyping.absorption +1 -0
  249. data/transform/surrogate/OilSupply.absorption +8 -0
  250. data/transform/surrogate/OneRoleNesting.absorption +1 -0
  251. data/transform/surrogate/Orienteering.absorption +11 -0
  252. data/transform/surrogate/PersonPlaysGame.absorption +1 -0
  253. data/transform/surrogate/RedundantDependency.absorption +3 -0
  254. data/transform/surrogate/SchoolActivities.absorption +3 -0
  255. data/transform/surrogate/SeparateSubtype.absorption +3 -0
  256. data/transform/surrogate/SimplestUnary.absorption +1 -0
  257. data/transform/surrogate/Supervision.absorption +2 -0
  258. data/transform/surrogate/WaiterTips.absorption +3 -0
  259. data/transform/surrogate/Warehousing.absorption +12 -0
  260. data/transform/surrogate/WindowInRoomInBldg.absorption +1 -0
  261. data/transform/surrogate/unit.absorption +0 -0
  262. metadata +374 -0
data/cql/Health.cql ADDED
@@ -0,0 +1,78 @@
1
+ vocabulary Health;
2
+
3
+ vocabulary BasicTypes;
4
+
5
+ each Integer is written as an Int;
6
+ each Code is written as a String(16);
7
+ each ID is written as an Auto Counter;
8
+ each Date is written as a Date;
9
+ each Text is written as a String;
10
+ each Name is written as a String;
11
+ each Number is written as an Integer;
12
+
13
+ vocabulary PartyRoles;
14
+ each Party is identified by its ID;
15
+ each Stakeholder is a kind of Party;
16
+ each Policy Holder is a kind of Stakeholder;
17
+ each Claimant is a kind of Stakeholder;
18
+
19
+ vocabulary InsurerProducts;
20
+ // Insurer, Product, Available Coverage
21
+ each Insurer [static, separate] is identified by its Name;
22
+ each Product Offering [static, separate] is identified by its Name;
23
+ Product Offering is offered by one Insurer;
24
+ each Coverage Type [separate] is identified by its Name;
25
+ Coverage Type has at most one descriptive- Text;
26
+ each Available Coverage [static] is where
27
+ Coverage Type is available in Product Offering,
28
+ Product Offering offers Coverage Type;
29
+
30
+ vocabulary Policies;
31
+ // Policy, Policy Coverage
32
+ each Policy Number is written as an Integer;
33
+ each Policy is identified by Insurer and Policy Number where
34
+ that Policy is from one Insurer, that Insurer issued that Policy,
35
+ that Policy has one Policy Number;
36
+ Policy is held by one Policy Holder;
37
+ Policy was purchased from one Product Offering;
38
+ Policy was purchased on one Date;
39
+
40
+ each Policy Coverage is where
41
+ Policy includes Coverage Type;
42
+ each Coverage Level is written as an Integer;
43
+ Policy Coverage is at at most one Coverage Level;
44
+
45
+ some Policy includes some Coverage Type
46
+ only if that Policy was purchased from some Product Offering that offers that Coverage Type;
47
+
48
+ vocabulary Incidents;
49
+ // Incident
50
+ each Incident Type [static, separate] is identified by its Name;
51
+ each Incident [separate] is identified by its ID;
52
+ each Incident is of one Incident Type;
53
+ each Incident occurred on one Date;
54
+ Incident has at most one descriptive- Text;
55
+
56
+ Incident affected one
57
+ (according to Praneet, because we don't want to handle class actions yet, as agreed on 25 September by Clifford)
58
+ Claimant;
59
+
60
+ vocabulary Claims;
61
+ // Claim and Details
62
+ each Claim [separate] is identified by its Number;
63
+ Claim concerns one Incident,
64
+ Incident resulted in at most one Claim;
65
+
66
+ each Claim Details is where
67
+ some Claim claims against some Policy Coverage on some Date,
68
+ that Policy Coverage is claimed under that Claim for that Date;
69
+
70
+ vocabulary ClaimPayments;
71
+ // Claim Payment
72
+ Claim Payment [separate] is identified by Claim Details where
73
+ Claim Payment is for one Claim Details,
74
+ Claim Details is paid by at most one Claim Payment;
75
+
76
+ Claim Payment Type [independent, static] is identified by its Code;
77
+ Claim Payment Type has at most one descriptive-Text;
78
+ Claim Payment is of one Claim Payment Type;
data/cql/Insurance.cql ADDED
@@ -0,0 +1,320 @@
1
+ vocabulary Insurance;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Alias is written as Char(3);
7
+ Application Nr is written as Signed Integer(32);
8
+ Asset ID is written as Auto Counter;
9
+ Badge is written as String;
10
+ Charge is written as String;
11
+ City is written as String;
12
+ Claim ID is written as Auto Counter;
13
+ Claim Sequence is written as Unsigned Integer(32) restricted to {1..999};
14
+ Colour is written as String;
15
+ Contact Method is written as Char(1) restricted to {'B', 'H', 'M'};
16
+ Count is written as Unsigned Integer(32);
17
+ Cover Type Code is written as Char;
18
+ Cover Type Name is written as String;
19
+ Date is written as Date;
20
+ Date Time is written as Date Time;
21
+ Description is written as String(1024);
22
+ Email is written as String;
23
+ Engine Number is written as String;
24
+ Hospital Name is written as String;
25
+ ITC Claimed is written as Decimal(18,2) restricted to {0.0..100.0};
26
+ Intoxication is written as String;
27
+ Liability Code is written as Char(1) restricted to {'D', 'L', 'R', 'U'};
28
+ License Number is written as String;
29
+ License Type is written as String;
30
+ Location is written as String;
31
+ Loss Type Code is written as Char;
32
+ Lost Item Nr is written as Signed Integer(32);
33
+ Make is written as String;
34
+ Model is written as String;
35
+ Name is written as String(256);
36
+ Occupation is written as String;
37
+ Party ID is written as Auto Counter;
38
+ Phone Nr is written as String;
39
+ Place is written as String;
40
+ Policy Serial is written as Unsigned Integer(32) restricted to {1..99999};
41
+ Policy Wording Text is written as String;
42
+ Postcode is written as String;
43
+ Price is written as Decimal(18,2);
44
+ Product Code is written as Unsigned Integer(8) restricted to {1..99};
45
+ Reason is written as String;
46
+ Registration Nr is written as Char(8);
47
+ Report Nr is written as Signed Integer(32);
48
+ State Code is written as Unsigned Integer(8) restricted to {0..9};
49
+ State Name is written as String(256);
50
+ Street is written as String(256);
51
+ Test Result is written as String;
52
+ Text is written as String;
53
+ Time is written as Time;
54
+ Title is written as String;
55
+ Underwriting Question ID is written as Auto Counter;
56
+ VIN is written as Unsigned Integer(32);
57
+ Year Nr is written as Signed Integer(32);
58
+
59
+ /*
60
+ * Entity Types
61
+ */
62
+ Application is identified by its Nr;
63
+
64
+ Asset is identified by its ID;
65
+
66
+ Claim is identified by its ID;
67
+ Claim has one Claim Sequence (as p_sequence),
68
+ p_sequence is of Claim;
69
+
70
+ Cover Type is identified by its Code;
71
+ Cover Type has one Cover Type Name,
72
+ Cover Type Name is of at most one Cover Type;
73
+
74
+ Hospital is identified by its Name;
75
+
76
+ Incident is identified by Claim where
77
+ Claim concerns at most one Incident,
78
+ Incident is of one Claim;
79
+ Incident relates to loss on one Date Time;
80
+
81
+ Liability is identified by its Code restricted to {'D', 'L', 'R', 'U'};
82
+
83
+ Loss Type is identified by its Code;
84
+ Loss Type implies at most one Liability;
85
+ Loss Type involves driving;
86
+ Loss Type is single vehicle incident;
87
+
88
+ Lost Item is identified by Incident and Lost Item Nr where
89
+ Lost Item was lost in one Incident,
90
+ Lost Item has one Lost Item Nr,
91
+ Lost Item Nr is of Lost Item;
92
+ Description is of Lost Item,
93
+ Lost Item has one Description;
94
+ Lost Item was purchased on at most one purchase-Date;
95
+ Lost Item was purchased at at most one purchase-Place;
96
+ Lost Item was purchased for at most one purchase-Price;
97
+
98
+ Party is identified by its ID;
99
+ Party is a company;
100
+
101
+ Person is a kind of Party;
102
+ Person has at most one Occupation;
103
+ Person has one Title;
104
+ Person has at most one birth-Date;
105
+ Person has one family-Name,
106
+ family-Name is of Person;
107
+ Person has given-Name; // Avoid ambiguity; this is a new fact type
108
+ Person has one given-Name,
109
+ given-Name is of Person;
110
+
111
+ Phone is identified by its Nr;
112
+
113
+ Police Report is identified by Incident where
114
+ Incident is covered by at most one Police Report,
115
+ Police Report covers one Incident;
116
+ Police Report was to at most one officer-Name;
117
+ Police Report has at most one police-Report Nr;
118
+ Police Report was on at most one report-Date Time;
119
+ Police Report was by at most one reporter-Name;
120
+ Police Report was at at most one station-Name;
121
+
122
+ Policy Wording is identified by its Text;
123
+
124
+ Product is identified by its Code;
125
+ Alias is of at most one Product,
126
+ Product has at most one Alias;
127
+ Description is of at most one Product,
128
+ Product has at most one Description;
129
+
130
+ Registration is identified by its Nr;
131
+
132
+ State is independent identified by its Code;
133
+ State Name is of at most one State,
134
+ State has at most one State Name;
135
+
136
+ Underwriting Question is identified by its ID;
137
+ Text is of at most one Underwriting Question,
138
+ Underwriting Question has one Text;
139
+
140
+ Vehicle is a kind of Asset identified by VIN where
141
+ Vehicle has one VIN,
142
+ VIN is of at most one Vehicle;
143
+ Registration is of Vehicle,
144
+ Vehicle has one Registration;
145
+ Vehicle is of at most one Colour;
146
+ Vehicle has at most one Engine Number;
147
+ Vehicle has commercial registration;
148
+
149
+ Vehicle Incident is a kind of Incident [separate];
150
+ Vehicle Incident has at most one Description;
151
+ Vehicle Incident resulted from at most one Loss Type;
152
+ Vehicle Incident was caused by at most one Reason;
153
+ Vehicle Incident involved at most one previous_damage-Description;
154
+ Vehicle Incident resulted in vehicle being towed to at most one towed-Location;
155
+ Vehicle Incident occurred during at most one weather-Description;
156
+
157
+ Vehicle Type is identified by Make and Model and Badge where
158
+ Vehicle Type is of one Make,
159
+ Vehicle Type is of one Model,
160
+ Badge is of Vehicle Type,
161
+ Vehicle Type has at most one Badge;
162
+ Vehicle is of one Vehicle Type;
163
+
164
+ Witness is identified by Incident and Name where
165
+ Incident was independently witnessed by Witness,
166
+ Witness saw one Incident,
167
+ Witness is called one Name;
168
+ Witness has at most one contact-Phone;
169
+
170
+ Year is identified by its Nr;
171
+ Vehicle is of one model-Year restricted to {1900..2100};
172
+
173
+ Address is identified by Street and City and Postcode and State where
174
+ Address is at one Street,
175
+ Address is in one City,
176
+ Address is in at most one Postcode,
177
+ Address is in at most one State;
178
+ Incident relates to loss at one Address;
179
+ Party has at most one postal-Address;
180
+ Person lives at at most one Address;
181
+ Witness lives at at most one Address;
182
+
183
+ Authorised Rep is a kind of Party;
184
+
185
+ Company is a kind of Party;
186
+ Company has one contact-Person,
187
+ Person is contact for Company;
188
+
189
+ Contact Methods is identified by Person where
190
+ Person has one Contact Methods,
191
+ Contact Methods are for one Person;
192
+ Contact Methods includes at most one Email;
193
+ Contact Methods includes at most one business-Phone;
194
+ Contact Methods prefers at most one contact-Time;
195
+ Contact Methods includes at most one home-Phone;
196
+ Contact Methods includes at most one mobile-Phone;
197
+ Contact Methods has at most one preferred-Contact Method;
198
+
199
+ Contractor is a kind of Company;
200
+
201
+ Contractor Appointment is where
202
+ Claim involves Contractor,
203
+ Contractor is appointed to handle Claim;
204
+
205
+ Cover Wording is where
206
+ Cover Type used Policy Wording from start-Date;
207
+
208
+ Dealer is a kind of Party;
209
+ Vehicle was sold by at most one Dealer;
210
+
211
+ Driving is where
212
+ Vehicle Incident occurred while being driven;
213
+ Driving followed at most one Intoxication;
214
+ Driving resulted in at most one breath-Test Result;
215
+ Driving was without owners consent for at most one nonconsent-Reason;
216
+ Driving was unlicenced for at most one unlicensed-Reason;
217
+ Person was Driving,
218
+ Driving was by one Person;
219
+
220
+ Driving Charge is where
221
+ Driving resulted in at most one Charge;
222
+ Driving Charge is a warning;
223
+
224
+ Finance Institution is a kind of Company;
225
+ Vehicle is subject to finance with at most one Finance Institution;
226
+
227
+ Hospitalization is where
228
+ Driving resulted in driver taken to at most one Hospital;
229
+ Hospitalization resulted in at most one blood-Test Result;
230
+
231
+ Insured is a kind of Party;
232
+
233
+ Insurer is a kind of Company;
234
+
235
+ Investigator is a kind of Contractor;
236
+
237
+ License is identified by Person where
238
+ Person holds at most one License,
239
+ License is held by one Person;
240
+ License has one License Number,
241
+ License Number is of at most one License;
242
+ License is of one License Type,
243
+ License Type has License instance;
244
+ License was granted in at most one Year restricted to {1990..2100};
245
+ License is international;
246
+
247
+ Lodgement is where
248
+ Claim was lodged by one Person;
249
+ Lodgement was made at at most one Date Time;
250
+
251
+ Policy is identified by p_year and p_product and p_state and p_serial where
252
+ Policy was issued in one Year (as p_year) restricted to {0..99},
253
+ Policy is for product having one Product (as p_product),
254
+ Policy issued in state having one State (as p_state),
255
+ Policy has one Policy Serial (as p_serial);
256
+ Application is for Policy,
257
+ Policy has one Application;
258
+ Claim is on one Policy,
259
+ Policy has Claim;
260
+ ITC Claimed is for Policy,
261
+ Policy has at most one ITC Claimed;
262
+ Policy was sold by at most one Authorised Rep,
263
+ Authorised Rep sold Policy;
264
+ Policy belongs to one Insured,
265
+ Insured has Policy;
266
+
267
+ Property Damage is identified by Incident and Address where
268
+ Incident caused Property Damage,
269
+ Property Damage was damaged in at most one Incident,
270
+ Property Damage is at one Address,
271
+ Address is of Property Damage;
272
+ Property Damage owner has contact at most one Phone;
273
+ Property Damage belongs to at most one owner-Name;
274
+
275
+ Repairer is a kind of Contractor;
276
+
277
+ Solicitor is a kind of Contractor;
278
+
279
+ Third Party is where
280
+ Person was third party in Vehicle Incident;
281
+ Third Party is insured by at most one Insurer;
282
+ Third Party vehicle is of at most one Vehicle Type;
283
+ Third Party vehicle is of at most one model-Year;
284
+ Third Party drove at most one vehicle-Registration;
285
+
286
+ Underwriting Demerit is identified by Vehicle Incident and Underwriting Question where
287
+ Vehicle Incident occurred despite Underwriting Demerit,
288
+ Underwriting Demerit preceded one Vehicle Incident,
289
+ Underwriting Demerit has one Underwriting Question,
290
+ Underwriting Question is of Underwriting Demerit;
291
+ Underwriting Demerit occurred at most one occurrence-Count times;
292
+
293
+ Assessor is a kind of Contractor;
294
+
295
+ Cover is where
296
+ Policy provides Cover Type over Asset,
297
+ Cover Type over Asset is provided by Policy;
298
+
299
+ Motor Policy is a kind of Policy;
300
+
301
+ Single Motor Policy is a kind of Motor Policy;
302
+
303
+ Motor Fleet Policy is a kind of Motor Policy;
304
+
305
+ /*
306
+ * Constraints:
307
+ */
308
+ either Motor Policy is a Single Motor Policy or Motor Policy is a Motor Fleet Policy but not both;
309
+ Party is a Company that has contact Person
310
+ if and only if
311
+ Party is a company;
312
+ each Contact Methods occurs at least one time in
313
+ Contact Methods includes mobile Phone(3),
314
+ Contact Methods includes home Phone(2),
315
+ Contact Methods includes business Phone(1),
316
+ Contact Methods includes Email;
317
+ each combination Policy, Claim Sequence occurs at most one time in
318
+ Claim is on Policy,
319
+ Claim has Claim Sequence;
320
+ either Witness lives at Address or Witness has contact Phone;
data/cql/Marriage.cql ADDED
@@ -0,0 +1,18 @@
1
+ vocabulary Marriage;
2
+
3
+ /*
4
+ * Value Types
5
+ */
6
+ Name is written as String;
7
+
8
+ /*
9
+ * Entity Types
10
+ */
11
+ Person is independent 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
+