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/ruby/Metamodel.rb ADDED
@@ -0,0 +1,621 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::Metamodel
4
+
5
+ class Adjective < String
6
+ value_type :length => 64
7
+ end
8
+
9
+ class AgentName < String
10
+ value_type
11
+ one_to_one :agent # See Agent.agent_name
12
+ end
13
+
14
+ class AggregateCode < String
15
+ value_type :length => 32
16
+ one_to_one :aggregate # See Aggregate.aggregate_code
17
+ end
18
+
19
+ class Annotation < String
20
+ value_type
21
+ end
22
+
23
+ class Assimilation < String
24
+ value_type
25
+ restrict 'absorbed', 'partitioned', 'separate'
26
+ end
27
+
28
+ class ContextNoteKind < String
29
+ value_type
30
+ restrict 'as_opposed_to', 'because', 'so_that', 'to_avoid'
31
+ end
32
+
33
+ class Date < ::Date
34
+ value_type
35
+ end
36
+
37
+ class Denominator < UnsignedInteger
38
+ value_type :length => 32
39
+ end
40
+
41
+ class Discussion < String
42
+ value_type
43
+ end
44
+
45
+ class DisplayRoleNamesSetting < String
46
+ value_type
47
+ restrict 'false', 'true'
48
+ end
49
+
50
+ class EnforcementCode < String
51
+ value_type :length => 16
52
+ end
53
+
54
+ class EphemeraURL < String
55
+ value_type
56
+ end
57
+
58
+ class Exponent < SignedInteger
59
+ value_type :length => 16
60
+ end
61
+
62
+ class Frequency < UnsignedInteger
63
+ value_type :length => 32
64
+ end
65
+
66
+ class Guid < ::Guid
67
+ value_type
68
+ one_to_one :alternative_set # See AlternativeSet.guid
69
+ one_to_one :component # See Component.guid
70
+ one_to_one :composition # See Composition.guid
71
+ one_to_one :concept # See Concept.guid
72
+ one_to_one :role_sequence # See RoleSequence.guid
73
+ one_to_one :shape # See Shape.guid
74
+ one_to_one :step # See Step.guid
75
+ end
76
+
77
+ class ImplicationRuleName < String
78
+ value_type
79
+ one_to_one :implication_rule # See ImplicationRule.implication_rule_name
80
+ end
81
+
82
+ class Length < UnsignedInteger
83
+ value_type :length => 32
84
+ end
85
+
86
+ class Literal < String
87
+ value_type
88
+ end
89
+
90
+ class Name < String
91
+ value_type :length => 64
92
+ one_to_one :composition # See Composition.name
93
+ one_to_one :plural_named_unit, :class => "Unit", :counterpart => :plural_name # See Unit.plural_name
94
+ one_to_one :topic, :counterpart => :topic_name # See Topic.topic_name
95
+ one_to_one :unit # See Unit.name
96
+ one_to_one :vocabulary # See Vocabulary.name
97
+ end
98
+
99
+ class Numerator < Decimal
100
+ value_type
101
+ end
102
+
103
+ class Offset < Decimal
104
+ value_type
105
+ end
106
+
107
+ class Ordinal < UnsignedInteger
108
+ value_type :length => 16
109
+ end
110
+
111
+ class Pronoun < String
112
+ value_type :length => 20
113
+ restrict 'feminine', 'masculine', 'neuter', 'personal'
114
+ end
115
+
116
+ class RegularExpression < String
117
+ value_type
118
+ end
119
+
120
+ class RingType < String
121
+ value_type
122
+ end
123
+
124
+ class RotationSetting < String
125
+ value_type
126
+ restrict 'left', 'right'
127
+ end
128
+
129
+ class Scale < UnsignedInteger
130
+ value_type :length => 32
131
+ end
132
+
133
+ class Subscript < UnsignedInteger
134
+ value_type :length => 16
135
+ end
136
+
137
+ class Text < String
138
+ value_type :length => 256
139
+ end
140
+
141
+ class TransactionPhase < String
142
+ value_type
143
+ restrict 'assert', 'commit'
144
+ end
145
+
146
+ class X < SignedInteger
147
+ value_type :length => 32
148
+ end
149
+
150
+ class Y < SignedInteger
151
+ value_type :length => 32
152
+ end
153
+
154
+ class Agent
155
+ identified_by :agent_name
156
+ one_to_one :agent_name, :mandatory => true # See AgentName.agent
157
+ end
158
+
159
+ class Aggregate
160
+ identified_by :aggregate_code
161
+ one_to_one :aggregate_code, :mandatory => true # See AggregateCode.aggregate
162
+ end
163
+
164
+ class AlternativeSet
165
+ identified_by :guid
166
+ one_to_one :guid, :mandatory => true # See Guid.alternative_set
167
+ maybe :members_are_exclusive
168
+ end
169
+
170
+ class Coefficient
171
+ identified_by :numerator, :denominator, :is_precise
172
+ has_one :denominator, :mandatory => true # See Denominator.all_coefficient
173
+ maybe :is_precise
174
+ has_one :numerator, :mandatory => true # See Numerator.all_coefficient
175
+ end
176
+
177
+ class Component
178
+ identified_by :guid
179
+ one_to_one :guid, :mandatory => true # See Guid.component
180
+ has_one :mapping, :counterpart => :member # See Mapping.all_member
181
+ has_one :name # See Name.all_component
182
+ end
183
+
184
+ class Composition
185
+ identified_by :guid
186
+ one_to_one :guid, :mandatory => true # See Guid.composition
187
+ one_to_one :name, :mandatory => true # See Name.composition
188
+ end
189
+
190
+ class Concept
191
+ identified_by :guid
192
+ one_to_one :guid, :mandatory => true # See Guid.concept
193
+ has_one :implication_rule # See ImplicationRule.all_concept
194
+ has_one :topic # See Topic.all_concept
195
+ end
196
+
197
+ class ConceptAnnotation
198
+ identified_by :concept, :mapping_annotation
199
+ has_one :concept, :mandatory => true # See Concept.all_concept_annotation
200
+ has_one :mapping_annotation, :class => Annotation, :mandatory => true # See Annotation.all_concept_annotation_as_mapping_annotation
201
+ end
202
+
203
+ class Constraint
204
+ identified_by :concept
205
+ one_to_one :concept, :mandatory => true # See Concept.constraint
206
+ has_one :name # See Name.all_constraint
207
+ has_one :vocabulary # See Vocabulary.all_constraint
208
+ end
209
+
210
+ class ContextNote
211
+ identified_by :concept
212
+ one_to_one :concept, :mandatory => true # See Concept.context_note
213
+ has_one :context_note_kind, :mandatory => true # See ContextNoteKind.all_context_note
214
+ has_one :discussion, :mandatory => true # See Discussion.all_context_note
215
+ has_one :relevant_concept, :class => Concept # See Concept.all_context_note_as_relevant_concept
216
+ end
217
+
218
+ class Discriminator < Component
219
+ end
220
+
221
+ class Enforcement
222
+ identified_by :constraint
223
+ has_one :agent # See Agent.all_enforcement
224
+ one_to_one :constraint, :mandatory => true # See Constraint.enforcement
225
+ has_one :enforcement_code, :mandatory => true # See EnforcementCode.all_enforcement
226
+ end
227
+
228
+ class Fact
229
+ identified_by :concept
230
+ one_to_one :concept, :mandatory => true # See Concept.fact
231
+ has_one :fact_type, :mandatory => true # See FactType.all_fact
232
+ has_one :population, :mandatory => true # See Population.all_fact
233
+ end
234
+
235
+ class FactType
236
+ identified_by :concept
237
+ one_to_one :concept, :mandatory => true # See Concept.fact_type
238
+ end
239
+
240
+ class ImplicationRule
241
+ identified_by :implication_rule_name
242
+ one_to_one :implication_rule_name, :mandatory => true # See ImplicationRuleName.implication_rule
243
+ end
244
+
245
+ class Indicator < Component
246
+ has_one :role, :mandatory => true # See Role.all_indicator
247
+ end
248
+
249
+ class Instance
250
+ identified_by :concept
251
+ one_to_one :concept, :mandatory => true # See Concept.instance
252
+ one_to_one :fact # See Fact.instance
253
+ has_one :object_type, :mandatory => true # See ObjectType.all_instance
254
+ has_one :population, :mandatory => true # See Population.all_instance
255
+ has_one :value # See Value.all_instance
256
+ end
257
+
258
+ class LinkFactType < FactType
259
+ end
260
+
261
+ class Location
262
+ identified_by :x, :y
263
+ has_one :x, :mandatory => true # See X.all_location
264
+ has_one :y, :mandatory => true # See Y.all_location
265
+ end
266
+
267
+ class Mapping < Component
268
+ has_one :object_type, :mandatory => true # See ObjectType.all_mapping
269
+ end
270
+
271
+ class Nesting < Mapping
272
+ end
273
+
274
+ class PresenceConstraint < Constraint
275
+ maybe :is_mandatory
276
+ maybe :is_preferred_identifier
277
+ has_one :max_frequency, :class => Frequency # See Frequency.all_presence_constraint_as_max_frequency
278
+ has_one :min_frequency, :class => Frequency # See Frequency.all_presence_constraint_as_min_frequency
279
+ has_one :role_sequence, :mandatory => true # See RoleSequence.all_presence_constraint
280
+ end
281
+
282
+ class Query
283
+ identified_by :concept
284
+ one_to_one :concept, :mandatory => true # See Concept.query
285
+ end
286
+
287
+ class Reading
288
+ identified_by :fact_type, :ordinal
289
+ has_one :fact_type, :mandatory => true # See FactType.all_reading
290
+ maybe :is_negative
291
+ has_one :ordinal, :mandatory => true # See Ordinal.all_reading
292
+ has_one :role_sequence, :mandatory => true # See RoleSequence.all_reading
293
+ has_one :text, :mandatory => true # See Text.all_reading
294
+ end
295
+
296
+ class RingConstraint < Constraint
297
+ has_one :other_role, :class => "Role" # See Role.all_ring_constraint_as_other_role
298
+ has_one :ring_type, :mandatory => true # See RingType.all_ring_constraint
299
+ has_one :role # See Role.all_ring_constraint
300
+ end
301
+
302
+ class Role
303
+ identified_by :fact_type, :ordinal
304
+ one_to_one :concept, :mandatory => true # See Concept.role
305
+ has_one :fact_type, :mandatory => true # See FactType.all_role
306
+ one_to_one :link_fact_type, :counterpart => :implying_role # See LinkFactType.implying_role
307
+ has_one :object_type, :mandatory => true # See ObjectType.all_role
308
+ has_one :ordinal, :mandatory => true # See Ordinal.all_role
309
+ has_one :role_name, :class => Name # See Name.all_role_as_role_name
310
+ end
311
+
312
+ class RoleSequence
313
+ identified_by :guid
314
+ one_to_one :guid, :mandatory => true # See Guid.role_sequence
315
+ maybe :has_unused_dependency_to_force_table_in_norma
316
+ end
317
+
318
+ class RoleValue
319
+ identified_by :fact, :role
320
+ has_one :fact, :mandatory => true # See Fact.all_role_value
321
+ has_one :instance, :mandatory => true # See Instance.all_role_value
322
+ has_one :population, :mandatory => true # See Population.all_role_value
323
+ has_one :role, :mandatory => true # See Role.all_role_value
324
+ end
325
+
326
+ class SetConstraint < Constraint
327
+ end
328
+
329
+ class Shape
330
+ identified_by :guid
331
+ one_to_one :guid, :mandatory => true # See Guid.shape
332
+ maybe :is_expanded
333
+ has_one :location # See Location.all_shape
334
+ has_one :orm_diagram, :class => "ORMDiagram", :mandatory => true # See ORMDiagram.all_shape
335
+ end
336
+
337
+ class Step
338
+ identified_by :guid
339
+ has_one :alternative_set # See AlternativeSet.all_step
340
+ has_one :fact_type, :mandatory => true # See FactType.all_step
341
+ one_to_one :guid, :mandatory => true # See Guid.step
342
+ maybe :is_disallowed
343
+ maybe :is_optional
344
+ end
345
+
346
+ class SubsetConstraint < SetConstraint
347
+ has_one :subset_role_sequence, :class => RoleSequence, :mandatory => true # See RoleSequence.all_subset_constraint_as_subset_role_sequence
348
+ has_one :superset_role_sequence, :class => RoleSequence, :mandatory => true # See RoleSequence.all_subset_constraint_as_superset_role_sequence
349
+ end
350
+
351
+ class Topic
352
+ identified_by :topic_name
353
+ one_to_one :topic_name, :class => Name, :mandatory => true # See Name.topic_as_topic_name
354
+ end
355
+
356
+ class Unit
357
+ identified_by :concept
358
+ has_one :coefficient # See Coefficient.all_unit
359
+ one_to_one :concept, :mandatory => true # See Concept.unit
360
+ has_one :ephemera_url, :class => EphemeraURL # See EphemeraURL.all_unit
361
+ maybe :is_fundamental
362
+ one_to_one :name, :mandatory => true # See Name.unit
363
+ has_one :offset # See Offset.all_unit
364
+ one_to_one :plural_name, :class => Name, :counterpart => :plural_named_unit # See Name.plural_named_unit
365
+ has_one :vocabulary, :mandatory => true # See Vocabulary.all_unit
366
+ end
367
+
368
+ class Value
369
+ identified_by :literal, :is_literal_string, :unit
370
+ maybe :is_literal_string
371
+ has_one :literal, :mandatory => true # See Literal.all_value
372
+ has_one :unit # See Unit.all_value
373
+ has_one :value_type, :mandatory => true # See ValueType.all_value
374
+ end
375
+
376
+ class ValueConstraint < Constraint
377
+ has_one :regular_expression # See RegularExpression.all_value_constraint
378
+ one_to_one :role, :counterpart => :role_value_constraint # See Role.role_value_constraint
379
+ end
380
+
381
+ class Variable
382
+ identified_by :query, :ordinal
383
+ has_one :object_type, :mandatory => true # See ObjectType.all_variable
384
+ has_one :ordinal, :mandatory => true # See Ordinal.all_variable
385
+ one_to_one :projection, :class => Role # See Role.variable_as_projection
386
+ has_one :query, :mandatory => true # See Query.all_variable
387
+ has_one :role_name, :class => Name # See Name.all_variable_as_role_name
388
+ one_to_one :step, :counterpart => :objectification_variable # See Step.objectification_variable
389
+ has_one :subscript # See Subscript.all_variable
390
+ has_one :value # See Value.all_variable
391
+ end
392
+
393
+ class Vocabulary
394
+ identified_by :name
395
+ one_to_one :name, :mandatory => true # See Name.vocabulary
396
+ end
397
+
398
+ class Absorption < Mapping
399
+ has_one :child_role, :class => Role, :mandatory => true # See Role.all_absorption_as_child_role
400
+ maybe :flattens
401
+ has_one :index_role, :class => Role # See Role.all_absorption_as_index_role
402
+ has_one :parent_role, :class => Role, :mandatory => true # See Role.all_absorption_as_parent_role
403
+ end
404
+
405
+ class Aggregation
406
+ identified_by :aggregate, :aggregated_variable
407
+ has_one :aggregate, :mandatory => true # See Aggregate.all_aggregation
408
+ has_one :aggregated_variable, :class => Variable, :mandatory => true # See Variable.all_aggregation_as_aggregated_variable
409
+ has_one :variable, :mandatory => true # See Variable.all_aggregation
410
+ end
411
+
412
+ class Agreement
413
+ identified_by :context_note
414
+ one_to_one :context_note, :mandatory => true # See ContextNote.agreement
415
+ has_one :date # See Date.all_agreement
416
+ end
417
+
418
+ class Bound
419
+ identified_by :value, :is_inclusive
420
+ maybe :is_inclusive
421
+ has_one :value, :mandatory => true # See Value.all_bound
422
+ end
423
+
424
+ class Composite
425
+ identified_by :mapping
426
+ has_one :composition, :mandatory => true # See Composition.all_composite
427
+ one_to_one :mapping, :mandatory => true # See Mapping.composite
428
+ end
429
+
430
+ class ConstraintShape < Shape
431
+ has_one :constraint, :mandatory => true # See Constraint.all_constraint_shape
432
+ end
433
+
434
+ class ContextAccordingTo
435
+ identified_by :context_note, :agent
436
+ has_one :agent, :mandatory => true # See Agent.all_context_according_to
437
+ has_one :context_note, :mandatory => true # See ContextNote.all_context_according_to
438
+ has_one :date # See Date.all_context_according_to
439
+ end
440
+
441
+ class ContextAgreedBy
442
+ identified_by :agreement, :agent
443
+ has_one :agent, :mandatory => true # See Agent.all_context_agreed_by
444
+ has_one :agreement, :mandatory => true # See Agreement.all_context_agreed_by
445
+ end
446
+
447
+ class Derivation
448
+ identified_by :derived_unit, :base_unit
449
+ has_one :base_unit, :class => Unit, :mandatory => true # See Unit.all_derivation_as_base_unit
450
+ has_one :derived_unit, :class => Unit, :mandatory => true # See Unit.all_derivation_as_derived_unit
451
+ has_one :exponent # See Exponent.all_derivation
452
+ end
453
+
454
+ class Diagram
455
+ identified_by :vocabulary, :name
456
+ has_one :name, :mandatory => true # See Name.all_diagram
457
+ has_one :vocabulary, :mandatory => true # See Vocabulary.all_diagram
458
+ end
459
+
460
+ class DiscriminatedRole
461
+ identified_by :discriminator, :role
462
+ has_one :discriminator, :mandatory => true # See Discriminator.all_discriminated_role
463
+ has_one :role, :mandatory => true # See Role.all_discriminated_role
464
+ has_one :value, :mandatory => true # See Value.all_discriminated_role
465
+ end
466
+
467
+ class FactTypeShape < Shape
468
+ has_one :display_role_names_setting # See DisplayRoleNamesSetting.all_fact_type_shape
469
+ has_one :fact_type, :mandatory => true # See FactType.all_fact_type_shape
470
+ has_one :rotation_setting # See RotationSetting.all_fact_type_shape
471
+ end
472
+
473
+ class Injection < Mapping
474
+ end
475
+
476
+ class ModelNoteShape < Shape
477
+ has_one :context_note, :mandatory => true # See ContextNote.all_model_note_shape
478
+ end
479
+
480
+ class ORMDiagram < Diagram
481
+ end
482
+
483
+ class ObjectType
484
+ identified_by :vocabulary, :name
485
+ one_to_one :concept, :mandatory => true # See Concept.object_type
486
+ maybe :is_independent
487
+ has_one :name, :mandatory => true # See Name.all_object_type
488
+ has_one :pronoun # See Pronoun.all_object_type
489
+ has_one :vocabulary, :mandatory => true # See Vocabulary.all_object_type
490
+ end
491
+
492
+ class ObjectTypeShape < Shape
493
+ maybe :has_expanded_reference_mode
494
+ has_one :object_type, :mandatory => true # See ObjectType.all_object_type_shape
495
+ end
496
+
497
+ class ObjectifiedFactTypeNameShape < Shape
498
+ one_to_one :fact_type_shape, :mandatory => true # See FactTypeShape.objectified_fact_type_name_shape
499
+ end
500
+
501
+ class Play
502
+ identified_by :step, :role
503
+ has_one :role, :mandatory => true # See Role.all_play
504
+ has_one :step, :mandatory => true # See Step.all_play
505
+ has_one :variable, :mandatory => true # See Variable.all_play
506
+ maybe :is_input
507
+ end
508
+
509
+ class Population
510
+ identified_by :vocabulary, :name
511
+ one_to_one :concept, :mandatory => true # See Concept.population
512
+ has_one :name, :mandatory => true # See Name.all_population
513
+ has_one :vocabulary # See Vocabulary.all_population
514
+ end
515
+
516
+ class ReadingShape < Shape
517
+ one_to_one :fact_type_shape, :mandatory => true # See FactTypeShape.reading_shape
518
+ has_one :reading, :mandatory => true # See Reading.all_reading_shape
519
+ end
520
+
521
+ class RingConstraintShape < ConstraintShape
522
+ has_one :fact_type_shape, :mandatory => true # See FactTypeShape.all_ring_constraint_shape
523
+ end
524
+
525
+ class RoleDisplay
526
+ identified_by :fact_type_shape, :ordinal
527
+ has_one :fact_type_shape, :mandatory => true # See FactTypeShape.all_role_display
528
+ has_one :ordinal, :mandatory => true # See Ordinal.all_role_display
529
+ has_one :role, :mandatory => true # See Role.all_role_display
530
+ end
531
+
532
+ class RoleNameShape < Shape
533
+ one_to_one :role_display, :mandatory => true # See RoleDisplay.role_name_shape
534
+ end
535
+
536
+ class RoleRef
537
+ identified_by :role_sequence, :ordinal
538
+ has_one :ordinal, :mandatory => true # See Ordinal.all_role_ref
539
+ has_one :role, :mandatory => true # See Role.all_role_ref
540
+ has_one :role_sequence, :mandatory => true # See RoleSequence.all_role_ref
541
+ has_one :leading_adjective, :class => Adjective # See Adjective.all_role_ref_as_leading_adjective
542
+ one_to_one :play # See Play.role_ref
543
+ has_one :trailing_adjective, :class => Adjective # See Adjective.all_role_ref_as_trailing_adjective
544
+ end
545
+
546
+ class SetComparisonConstraint < SetConstraint
547
+ end
548
+
549
+ class SetComparisonRoles
550
+ identified_by :set_comparison_constraint, :ordinal
551
+ has_one :ordinal, :mandatory => true # See Ordinal.all_set_comparison_roles
552
+ has_one :role_sequence, :mandatory => true # See RoleSequence.all_set_comparison_roles
553
+ has_one :set_comparison_constraint, :mandatory => true # See SetComparisonConstraint.all_set_comparison_roles
554
+ end
555
+
556
+ class SetEqualityConstraint < SetComparisonConstraint
557
+ end
558
+
559
+ class SetExclusionConstraint < SetComparisonConstraint
560
+ maybe :is_mandatory
561
+ end
562
+
563
+ class ValueConstraintShape < ConstraintShape
564
+ has_one :object_type_shape # See ObjectTypeShape.all_value_constraint_shape
565
+ one_to_one :role_display # See RoleDisplay.value_constraint_shape
566
+ end
567
+
568
+ class ValueRange
569
+ identified_by :minimum_bound, :maximum_bound
570
+ has_one :maximum_bound, :class => Bound # See Bound.all_value_range_as_maximum_bound
571
+ has_one :minimum_bound, :class => Bound # See Bound.all_value_range_as_minimum_bound
572
+ end
573
+
574
+ class AllowedRange
575
+ identified_by :value_constraint, :value_range
576
+ has_one :value_constraint, :mandatory => true # See ValueConstraint.all_allowed_range
577
+ has_one :value_range, :mandatory => true # See ValueRange.all_allowed_range
578
+ end
579
+
580
+ class DomainObjectType < ObjectType
581
+ end
582
+
583
+ class EntityType < DomainObjectType
584
+ one_to_one :fact_type # See FactType.entity_type
585
+ end
586
+
587
+ class TypeInheritance < FactType
588
+ identified_by :subtype, :supertype
589
+ has_one :subtype, :class => EntityType, :mandatory => true # See EntityType.all_type_inheritance_as_subtype
590
+ has_one :supertype, :class => EntityType, :mandatory => true # See EntityType.all_type_inheritance_as_supertype
591
+ has_one :assimilation # See Assimilation.all_type_inheritance
592
+ maybe :provides_identification
593
+ end
594
+
595
+ class ValueType < DomainObjectType
596
+ has_one :length # See Length.all_value_type
597
+ has_one :scale # See Scale.all_value_type
598
+ has_one :supertype, :class => ValueType # See ValueType.all_value_type_as_supertype
599
+ has_one :transaction_phase # See TransactionPhase.all_value_type
600
+ has_one :unit # See Unit.all_value_type
601
+ one_to_one :value_constraint # See ValueConstraint.value_type
602
+ end
603
+
604
+ class ValueTypeParameter
605
+ identified_by :value_type, :name
606
+ has_one :name, :mandatory => true # See Name.all_value_type_parameter
607
+ has_one :value_type, :mandatory => true # See ValueType.all_value_type_parameter
608
+ has_one :facet_value_type, :class => ValueType, :mandatory => true # See ValueType.all_value_type_parameter_as_facet_value_type
609
+ end
610
+
611
+ class ValueTypeParameterRestriction
612
+ identified_by :value_type, :value_type_parameter
613
+ has_one :value_type, :mandatory => true # See ValueType.all_value_type_parameter_restriction
614
+ has_one :value_type_parameter, :mandatory => true # See ValueTypeParameter.all_value_type_parameter_restriction
615
+ has_one :value, :mandatory => true # See Value.all_value_type_parameter_restriction
616
+ end
617
+
618
+ class ImplicitBooleanValueType < ValueType
619
+ end
620
+
621
+ end
data/ruby/Monogamy.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::Monogamy
4
+
5
+ class Name < String
6
+ value_type
7
+ end
8
+
9
+ class PersonID < AutoCounter
10
+ value_type
11
+ one_to_one :person # See Person.person_id
12
+ end
13
+
14
+ class Person
15
+ identified_by :person_id
16
+ has_one :name, :mandatory => true # See Name.all_person
17
+ one_to_one :person_id, :class => PersonID, :mandatory => true # See PersonID.person
18
+ end
19
+
20
+ class Boy < Person
21
+ end
22
+
23
+ class Girl < Person
24
+ one_to_one :boyfriend, :class => Boy, :counterpart => :girlfriend # See Boy.girlfriend
25
+ end
26
+
27
+ end
@@ -0,0 +1,38 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::MultiInheritance
4
+
5
+ class EmployeeID < AutoCounter
6
+ value_type
7
+ one_to_one :employee # See Employee.employee_id
8
+ end
9
+
10
+ class PersonName < String
11
+ value_type
12
+ one_to_one :person # See Person.person_name
13
+ end
14
+
15
+ class TFN < Char
16
+ value_type :length => 9
17
+ one_to_one :australian, :mandatory => true # See Australian.tfn
18
+ end
19
+
20
+ class Person
21
+ identified_by :person_name
22
+ one_to_one :person_name, :mandatory => true # See PersonName.person
23
+ end
24
+
25
+ class Australian < Person
26
+ one_to_one :tfn, :class => TFN # See TFN.australian
27
+ end
28
+
29
+ class Employee < Person
30
+ identified_by :employee_id
31
+ one_to_one :employee_id, :class => EmployeeID, :mandatory => true # See EmployeeID.employee
32
+ end
33
+
34
+ class AustralianEmployee < Employee
35
+ supertypes Australian
36
+ end
37
+
38
+ end