activefacts-examples 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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/OilSupply.rb ADDED
@@ -0,0 +1,112 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::OilSupply
4
+
5
+ class Cost < Money
6
+ value_type
7
+ end
8
+
9
+ class MonthNr < SignedInteger
10
+ value_type :length => 32
11
+ one_to_one :month, :restrict => 1..12 # See Month.month_nr
12
+ end
13
+
14
+ class ProductName < String
15
+ value_type
16
+ one_to_one :product # See Product.product_name
17
+ end
18
+
19
+ class Quantity < UnsignedInteger
20
+ value_type :length => 32
21
+ end
22
+
23
+ class RefineryName < String
24
+ value_type :length => 80
25
+ one_to_one :refinery # See Refinery.refinery_name
26
+ end
27
+
28
+ class RegionName < String
29
+ value_type
30
+ one_to_one :region # See Region.region_name
31
+ end
32
+
33
+ class Season < String
34
+ value_type :length => 6
35
+ restrict 'Autumn', 'Spring', 'Summer', 'Winter'
36
+ end
37
+
38
+ class TransportMethod < String
39
+ value_type
40
+ restrict 'Rail', 'Road', 'Sea'
41
+ end
42
+
43
+ class YearNr < SignedInteger
44
+ value_type :length => 32
45
+ one_to_one :year # See Year.year_nr
46
+ end
47
+
48
+ class Month
49
+ identified_by :month_nr
50
+ one_to_one :month_nr, :mandatory => true # See MonthNr.month
51
+ has_one :season, :mandatory => true # See Season.all_month
52
+ end
53
+
54
+ class Product
55
+ identified_by :product_name
56
+ one_to_one :product_name, :mandatory => true # See ProductName.product
57
+ end
58
+
59
+ class Refinery
60
+ identified_by :refinery_name
61
+ one_to_one :refinery_name, :mandatory => true # See RefineryName.refinery
62
+ end
63
+
64
+ class Region
65
+ identified_by :region_name
66
+ one_to_one :region_name, :mandatory => true # See RegionName.region
67
+ end
68
+
69
+ class TransportRoute
70
+ identified_by :transport_method, :refinery, :region
71
+ has_one :refinery, :mandatory => true # See Refinery.all_transport_route
72
+ has_one :region, :mandatory => true # See Region.all_transport_route
73
+ has_one :transport_method, :mandatory => true # See TransportMethod.all_transport_route
74
+ has_one :cost # See Cost.all_transport_route
75
+ end
76
+
77
+ class Year
78
+ identified_by :year_nr
79
+ one_to_one :year_nr, :mandatory => true # See YearNr.year
80
+ end
81
+
82
+ class AcceptableSubstitution
83
+ identified_by :product, :alternate_product, :season
84
+ has_one :alternate_product, :class => Product, :mandatory => true # See Product.all_acceptable_substitution_as_alternate_product
85
+ has_one :product, :mandatory => true # See Product.all_acceptable_substitution
86
+ has_one :season, :mandatory => true # See Season.all_acceptable_substitution
87
+ end
88
+
89
+ class SupplyPeriod
90
+ identified_by :year, :month
91
+ has_one :month, :mandatory => true # See Month.all_supply_period
92
+ has_one :year, :mandatory => true # See Year.all_supply_period
93
+ end
94
+
95
+ class ProductionForecast
96
+ identified_by :refinery, :supply_period, :product
97
+ has_one :product, :mandatory => true # See Product.all_production_forecast
98
+ has_one :quantity, :mandatory => true # See Quantity.all_production_forecast
99
+ has_one :refinery, :mandatory => true # See Refinery.all_production_forecast
100
+ has_one :supply_period, :mandatory => true # See SupplyPeriod.all_production_forecast
101
+ has_one :cost # See Cost.all_production_forecast
102
+ end
103
+
104
+ class RegionalDemand
105
+ identified_by :region, :supply_period, :product
106
+ has_one :product, :mandatory => true # See Product.all_regional_demand
107
+ has_one :quantity, :mandatory => true # See Quantity.all_regional_demand
108
+ has_one :region, :mandatory => true # See Region.all_regional_demand
109
+ has_one :supply_period, :mandatory => true # See SupplyPeriod.all_regional_demand
110
+ end
111
+
112
+ end
@@ -0,0 +1,66 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::OneRoleNesting
4
+
5
+ class AccuracyLevel < SignedInteger
6
+ value_type :length => 32
7
+ one_to_one :accuracy, :restrict => 1..5 # See Accuracy.accuracy_level
8
+ end
9
+
10
+ class PartyId < AutoCounter
11
+ value_type
12
+ one_to_one :party # See Party.party_id
13
+ end
14
+
15
+ class PartyName < String
16
+ value_type
17
+ end
18
+
19
+ class Ymd < Date
20
+ value_type
21
+ one_to_one :event_date # See EventDate.ymd
22
+ end
23
+
24
+ class Accuracy
25
+ identified_by :accuracy_level
26
+ one_to_one :accuracy_level, :mandatory => true # See AccuracyLevel.accuracy
27
+ end
28
+
29
+ class EventDate
30
+ identified_by :ymd
31
+ one_to_one :ymd, :mandatory => true # See ymd.event_date
32
+ end
33
+
34
+ class Party
35
+ identified_by :party_id
36
+ one_to_one :party_id, :mandatory => true # See PartyId.party
37
+ end
38
+
39
+ class PartyMoniker
40
+ identified_by :party
41
+ one_to_one :party, :mandatory => true # See Party.party_moniker
42
+ has_one :party_name, :mandatory => true # See PartyName.all_party_moniker
43
+ has_one :accuracy, :mandatory => true # See Accuracy.all_party_moniker
44
+ end
45
+
46
+ class Person < Party
47
+ maybe :died
48
+ end
49
+
50
+ class Birth
51
+ identified_by :person
52
+ has_one :event_date, :mandatory => true # See EventDate.all_birth
53
+ one_to_one :person, :mandatory => true # See Person.birth
54
+ has_one :attending_doctor, :class => "Doctor" # See Doctor.all_birth_as_attending_doctor
55
+ end
56
+
57
+ class Death
58
+ identified_by :person
59
+ one_to_one :person, :mandatory => true # See Person.death
60
+ has_one :death_event_date, :class => EventDate # See EventDate.all_death_as_death_event_date
61
+ end
62
+
63
+ class Doctor < Person
64
+ end
65
+
66
+ end
@@ -0,0 +1,216 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::Orienteering
4
+
5
+ class Accessibility < Char
6
+ value_type :length => 1
7
+ restrict 'A'..'D'
8
+ end
9
+
10
+ class ClubCode < String
11
+ value_type :length => 6
12
+ one_to_one :club # See Club.club_code
13
+ end
14
+
15
+ class ClubName < String
16
+ value_type :length => 32
17
+ one_to_one :club # See Club.club_name
18
+ end
19
+
20
+ class ControlNumber < UnsignedInteger
21
+ value_type :length => 32
22
+ restrict 1..1000
23
+ end
24
+
25
+ class Course < String
26
+ value_type :length => 16
27
+ restrict 'A'..'E', 'PW'
28
+ end
29
+
30
+ class EntryID < AutoCounter
31
+ value_type
32
+ one_to_one :entry # See Entry.entry_id
33
+ end
34
+
35
+ class EventID < AutoCounter
36
+ value_type
37
+ one_to_one :event # See Event.event_id
38
+ end
39
+
40
+ class EventName < String
41
+ value_type :length => 50
42
+ one_to_one :event # See Event.event_name
43
+ end
44
+
45
+ class FamilyName < String
46
+ value_type :length => 48
47
+ end
48
+
49
+ class Gender < Char
50
+ value_type :length => 1
51
+ restrict 'F', 'M'
52
+ end
53
+
54
+ class GivenName < String
55
+ value_type :length => 48
56
+ end
57
+
58
+ class Location < String
59
+ value_type :length => 200
60
+ end
61
+
62
+ class MapID < AutoCounter
63
+ value_type
64
+ one_to_one :map # See Map.map_id
65
+ end
66
+
67
+ class MapName < String
68
+ value_type :length => 80
69
+ one_to_one :map # See Map.map_name
70
+ end
71
+
72
+ class Number < UnsignedInteger
73
+ value_type :length => 32
74
+ restrict 1..100
75
+ end
76
+
77
+ class PersonID < AutoCounter
78
+ value_type
79
+ one_to_one :person # See Person.person_id
80
+ end
81
+
82
+ class Placing < UnsignedInteger
83
+ value_type :length => 32
84
+ end
85
+
86
+ class PointValue < UnsignedInteger
87
+ value_type :length => 32
88
+ end
89
+
90
+ class PostCode < UnsignedInteger
91
+ value_type :length => 32
92
+ end
93
+
94
+ class PunchID < AutoCounter
95
+ value_type
96
+ one_to_one :punch # See Punch.punch_id
97
+ end
98
+
99
+ class Score < SignedInteger
100
+ value_type :length => 32
101
+ end
102
+
103
+ class ScoringMethod < String
104
+ value_type :length => 32
105
+ restrict 'Scatter', 'Score', 'Special'
106
+ end
107
+
108
+ class SeriesID < AutoCounter
109
+ value_type
110
+ one_to_one :series # See Series.series_id
111
+ end
112
+
113
+ class SeriesName < String
114
+ value_type :length => 40
115
+ one_to_one :series, :counterpart => :name # See Series.name
116
+ end
117
+
118
+ class StartTime < DateTime
119
+ value_type
120
+ end
121
+
122
+ class Time < DateTime
123
+ value_type
124
+ end
125
+
126
+ class Year < UnsignedInteger
127
+ value_type :length => 32
128
+ restrict 1900..3000
129
+ end
130
+
131
+ class Club
132
+ identified_by :club_code
133
+ one_to_one :club_code, :mandatory => true # See ClubCode.club
134
+ one_to_one :club_name, :mandatory => true # See ClubName.club
135
+ end
136
+
137
+ class Event
138
+ identified_by :event_id
139
+ has_one :club, :mandatory => true # See Club.all_event
140
+ one_to_one :event_id, :class => EventID, :mandatory => true # See EventID.event
141
+ one_to_one :event_name # See EventName.event
142
+ has_one :map, :mandatory => true # See Map.all_event
143
+ has_one :number # See Number.all_event
144
+ has_one :series # See Series.all_event
145
+ has_one :start_location, :class => Location, :mandatory => true # See Location.all_event_as_start_location
146
+ has_one :start_time, :mandatory => true # See StartTime.all_event
147
+ end
148
+
149
+ class EventControl
150
+ identified_by :event, :control_number
151
+ has_one :control_number, :mandatory => true # See ControlNumber.all_event_control
152
+ has_one :event, :mandatory => true # See Event.all_event_control
153
+ has_one :point_value # See PointValue.all_event_control
154
+ end
155
+
156
+ class EventScoringMethod
157
+ identified_by :course, :event
158
+ has_one :course, :mandatory => true # See Course.all_event_scoring_method
159
+ has_one :event, :mandatory => true # See Event.all_event_scoring_method
160
+ has_one :scoring_method, :mandatory => true # See ScoringMethod.all_event_scoring_method
161
+ end
162
+
163
+ class Map
164
+ identified_by :map_id
165
+ has_one :accessibility # See Accessibility.all_map
166
+ one_to_one :map_id, :class => MapID, :mandatory => true # See MapID.map
167
+ one_to_one :map_name, :mandatory => true # See MapName.map
168
+ has_one :owner, :class => Club, :mandatory => true # See Club.all_map_as_owner
169
+ end
170
+
171
+ class Person
172
+ identified_by :person_id
173
+ has_one :birth_year, :class => Year # See Year.all_person_as_birth_year
174
+ has_one :club # See Club.all_person
175
+ has_one :family_name, :mandatory => true # See FamilyName.all_person
176
+ has_one :gender # See Gender.all_person
177
+ has_one :given_name, :mandatory => true # See GivenName.all_person
178
+ one_to_one :person_id, :class => PersonID, :mandatory => true # See PersonID.person
179
+ has_one :post_code # See PostCode.all_person
180
+ end
181
+
182
+ class Punch
183
+ identified_by :punch_id
184
+ one_to_one :punch_id, :class => PunchID, :mandatory => true # See PunchID.punch
185
+ end
186
+
187
+ class PunchPlacement
188
+ identified_by :punch, :event_control
189
+ has_one :event_control, :mandatory => true # See EventControl.all_punch_placement
190
+ has_one :punch, :mandatory => true # See Punch.all_punch_placement
191
+ end
192
+
193
+ class Series
194
+ identified_by :series_id
195
+ one_to_one :name, :class => SeriesName, :mandatory => true # See SeriesName.series_as_name
196
+ one_to_one :series_id, :class => SeriesID, :mandatory => true # See SeriesID.series
197
+ end
198
+
199
+ class Entry
200
+ identified_by :entry_id
201
+ has_one :course, :mandatory => true # See Course.all_entry
202
+ has_one :event, :mandatory => true # See Event.all_entry
203
+ has_one :person, :mandatory => true # See Person.all_entry
204
+ one_to_one :entry_id, :class => EntryID, :mandatory => true # See EntryID.entry
205
+ has_one :finish_placing, :class => Placing # See Placing.all_entry_as_finish_placing
206
+ has_one :score # See Score.all_entry
207
+ end
208
+
209
+ class Visit
210
+ identified_by :punch, :entry, :time
211
+ has_one :entry, :mandatory => true # See Entry.all_visit
212
+ has_one :punch, :mandatory => true # See Punch.all_visit
213
+ has_one :time, :mandatory => true # See Time.all_visit
214
+ end
215
+
216
+ end
@@ -0,0 +1,31 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::PersonPlaysGame
4
+
5
+ class GameCode < Char
6
+ value_type
7
+ one_to_one :game # See Game.game_code
8
+ end
9
+
10
+ class PersonName < String
11
+ value_type
12
+ one_to_one :person # See Person.person_name
13
+ end
14
+
15
+ class Game
16
+ identified_by :game_code
17
+ one_to_one :game_code, :mandatory => true # See GameCode.game
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 Playing
26
+ identified_by :person, :game
27
+ has_one :game, :mandatory => true # See Game.all_playing
28
+ has_one :person, :mandatory => true # See Person.all_playing
29
+ end
30
+
31
+ end
@@ -0,0 +1,53 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::RedundantDependency
4
+
5
+ class AddressId < AutoCounter
6
+ value_type
7
+ one_to_one :address # See Address.address_id
8
+ end
9
+
10
+ class DistrictNumber < SignedInteger
11
+ value_type :length => 32
12
+ end
13
+
14
+ class PoliticianId < AutoCounter
15
+ value_type
16
+ one_to_one :politician # See Politician.politician_id
17
+ end
18
+
19
+ class PostalCode < SignedInteger
20
+ value_type :length => 32
21
+ end
22
+
23
+ class StateOrProvinceId < AutoCounter
24
+ value_type
25
+ one_to_one :state_or_province # See StateOrProvince.state_or_province_id
26
+ end
27
+
28
+ class Address
29
+ identified_by :address_id
30
+ one_to_one :address_id, :mandatory => true # See AddressId.address
31
+ has_one :legislative_district # See LegislativeDistrict.all_address
32
+ has_one :postal_code # See PostalCode.all_address
33
+ has_one :state_or_province # See StateOrProvince.all_address
34
+ end
35
+
36
+ class Politician
37
+ identified_by :politician_id
38
+ one_to_one :politician_id, :mandatory => true # See PoliticianId.politician
39
+ end
40
+
41
+ class StateOrProvince
42
+ identified_by :state_or_province_id
43
+ one_to_one :state_or_province_id, :mandatory => true # See StateOrProvinceId.state_or_province
44
+ end
45
+
46
+ class LegislativeDistrict
47
+ identified_by :district_number, :state_or_province
48
+ has_one :district_number, :mandatory => true # See DistrictNumber.all_legislative_district
49
+ one_to_one :politician, :mandatory => true # See Politician.legislative_district
50
+ has_one :state_or_province, :mandatory => true # See StateOrProvince.all_legislative_district
51
+ end
52
+
53
+ end
@@ -0,0 +1,49 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::SchoolActivities
4
+
5
+ class ActivityName < String
6
+ value_type :length => 32
7
+ one_to_one :activity # See Activity.activity_name
8
+ end
9
+
10
+ class SchoolName < String
11
+ value_type
12
+ one_to_one :school # See School.school_name
13
+ end
14
+
15
+ class StudentName < String
16
+ value_type
17
+ one_to_one :student # See Student.student_name
18
+ end
19
+
20
+ class Activity
21
+ identified_by :activity_name
22
+ one_to_one :activity_name, :mandatory => true # See ActivityName.activity
23
+ end
24
+
25
+ class School
26
+ identified_by :school_name
27
+ one_to_one :school_name, :mandatory => true # See SchoolName.school
28
+ end
29
+
30
+ class SchoolActivity
31
+ identified_by :school, :activity
32
+ has_one :activity, :mandatory => true # See Activity.all_school_activity
33
+ has_one :school, :mandatory => true # See School.all_school_activity
34
+ end
35
+
36
+ class Student
37
+ identified_by :student_name
38
+ has_one :school, :mandatory => true # See School.all_student
39
+ one_to_one :student_name, :mandatory => true # See StudentName.student
40
+ end
41
+
42
+ class StudentParticipation
43
+ identified_by :student, :activity
44
+ has_one :activity, :mandatory => true # See Activity.all_student_participation
45
+ has_one :school, :mandatory => true # See School.all_student_participation
46
+ has_one :student, :mandatory => true # See Student.all_student_participation
47
+ end
48
+
49
+ end
@@ -0,0 +1,46 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::SeparateSubtype
4
+
5
+ class ClaimID < AutoCounter
6
+ value_type
7
+ one_to_one :claim # See Claim.claim_id
8
+ end
9
+
10
+ class DateTime < ::DateTime
11
+ value_type
12
+ end
13
+
14
+ class PersonName < String
15
+ value_type
16
+ one_to_one :person # See Person.person_name
17
+ end
18
+
19
+ class Claim
20
+ identified_by :claim_id
21
+ one_to_one :claim_id, :class => ClaimID, :mandatory => true # See ClaimID.claim
22
+ end
23
+
24
+ class Incident
25
+ identified_by :claim
26
+ one_to_one :claim, :mandatory => true # See Claim.incident
27
+ has_one :date_time # See DateTime.all_incident
28
+ has_one :witness # See Witness.all_incident
29
+ end
30
+
31
+ class Person
32
+ identified_by :person_name
33
+ one_to_one :person_name, :mandatory => true # See PersonName.person
34
+ end
35
+
36
+ class VehicleIncident < Incident
37
+ has_one :driver # See Driver.all_vehicle_incident
38
+ end
39
+
40
+ class Witness < Person
41
+ end
42
+
43
+ class Driver < Person
44
+ end
45
+
46
+ end
@@ -0,0 +1,10 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::SimplestUnary
4
+
5
+ class SomeString < String
6
+ value_type
7
+ maybe :is_long
8
+ end
9
+
10
+ end
@@ -0,0 +1,33 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::Supervision
4
+
5
+ class CompanyName < String
6
+ value_type
7
+ one_to_one :company # See Company.company_name
8
+ end
9
+
10
+ class EmployeeNr < SignedInteger
11
+ value_type :length => 32
12
+ end
13
+
14
+ class Company
15
+ identified_by :company_name
16
+ has_one :ceo, :class => "CEO", :mandatory => true # See CEO.all_company
17
+ one_to_one :company_name, :mandatory => true # See CompanyName.company
18
+ end
19
+
20
+ class Employee
21
+ identified_by :company, :employee_nr
22
+ has_one :company, :mandatory => true # See Company.all_employee
23
+ has_one :employee_nr, :mandatory => true # See EmployeeNr.all_employee
24
+ has_one :manager # See Manager.all_employee
25
+ end
26
+
27
+ class Manager < Employee
28
+ end
29
+
30
+ class CEO < Manager
31
+ end
32
+
33
+ end
data/ruby/TwoValues.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::E1
4
+
5
+ class Count < UnsignedInteger
6
+ value_type :length => 32
7
+ end
8
+
9
+ class Name < String
10
+ value_type
11
+ has_one :count
12
+ end
13
+
14
+ end
@@ -0,0 +1,64 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::VenueSeating
4
+
5
+ class EventId < AutoCounter
6
+ value_type
7
+ one_to_one :event # See Event.event_id
8
+ end
9
+
10
+ class Number < UnsignedInteger
11
+ value_type :length => 16
12
+ end
13
+
14
+ class ReserveName < String
15
+ value_type
16
+ one_to_one :reserve # See Reserve.reserve_name
17
+ end
18
+
19
+ class RowCode < Char
20
+ value_type
21
+ one_to_one :row # See Row.row_code
22
+ end
23
+
24
+ class VenueId < AutoCounter
25
+ value_type
26
+ one_to_one :venue # See Venue.venue_id
27
+ end
28
+
29
+ class Event
30
+ identified_by :event_id
31
+ one_to_one :event_id, :mandatory => true # See EventId.event
32
+ has_one :venue, :mandatory => true # See Venue.all_event
33
+ end
34
+
35
+ class Reserve
36
+ identified_by :reserve_name
37
+ one_to_one :reserve_name, :mandatory => true # See ReserveName.reserve
38
+ end
39
+
40
+ class Row
41
+ identified_by :row_code
42
+ one_to_one :row_code, :mandatory => true # See RowCode.row
43
+ end
44
+
45
+ class Venue
46
+ identified_by :venue_id
47
+ one_to_one :venue_id, :mandatory => true # See VenueId.venue
48
+ end
49
+
50
+ class Seat
51
+ identified_by :venue, :reserve, :row, :number
52
+ has_one :number, :mandatory => true # See Number.all_seat
53
+ has_one :reserve, :mandatory => true # See Reserve.all_seat
54
+ has_one :row, :mandatory => true # See Row.all_seat
55
+ has_one :venue, :mandatory => true # See Venue.all_seat
56
+ end
57
+
58
+ class Ticket
59
+ identified_by :event, :seat
60
+ has_one :event, :mandatory => true # See Event.all_ticket
61
+ has_one :seat, :mandatory => true # See Seat.all_ticket
62
+ end
63
+
64
+ end