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
@@ -0,0 +1,46 @@
1
+ #
2
+ # schema.rb auto-generated using ActiveFacts for VenueSeating on 2015-07-08
3
+ #
4
+
5
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
6
+ ActiveRecord::Schema.define(:version => 20150708011603) do
7
+ enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')
8
+ create_table "events", :id => false, :force => true do |t|
9
+ t.column "event_id", :primary_key, :null => false
10
+ t.column "venue_id", :integer, :null => false
11
+ end
12
+
13
+
14
+ create_table "seats", :id => false, :force => true do |t|
15
+ t.column "seat_id", :primary_key, :null => false
16
+ t.column "venue_id", :integer, :null => false
17
+ t.column "number", :integer, :limit => 16, :null => false
18
+ t.column "reserve_name", :string, :null => false
19
+ t.column "row_code", :string, :null => false
20
+ end
21
+
22
+ add_index "seats", ["venue_id", "reserve_name", "row_code", "number"], :name => :index_seats_on_venue_id_reserve_name_row_code_number, :unique => true
23
+
24
+ create_table "tickets", :id => false, :force => true do |t|
25
+ t.column "event_id", :integer, :null => false
26
+ t.column "seat_id", :integer, :null => false
27
+ end
28
+
29
+ add_index "tickets", ["event_id", "seat_id"], :name => :index_tickets_on_event_id_seat_id, :unique => true
30
+
31
+ create_table "venues", :id => false, :force => true do |t|
32
+ t.column "venue_id", :primary_key, :null => false
33
+ end
34
+
35
+
36
+ unless ENV["EXCLUDE_FKS"]
37
+ add_foreign_key :events, :venues, :column => :venue_id, :primary_key => :venue_id, :on_delete => :cascade
38
+ add_index :events, [:venue_id], :unique => false, :name => :index_events_on_venue_id
39
+ add_foreign_key :seats, :venues, :column => :venue_id, :primary_key => :venue_id, :on_delete => :cascade
40
+ add_index :seats, [:venue_id], :unique => false, :name => :index_seats_on_venue_id
41
+ add_foreign_key :tickets, :events, :column => :event_id, :primary_key => :event_id, :on_delete => :cascade
42
+ add_index :tickets, [:event_id], :unique => false, :name => :index_tickets_on_event_id
43
+ add_foreign_key :tickets, :seats, :column => :seat_id, :primary_key => :seat_id, :on_delete => :cascade
44
+ add_index :tickets, [:seat_id], :unique => false, :name => :index_tickets_on_seat_id
45
+ end
46
+ end
@@ -0,0 +1,145 @@
1
+ #
2
+ # schema.rb auto-generated using ActiveFacts for Warehousing on 2015-07-08
3
+ #
4
+
5
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
6
+ ActiveRecord::Schema.define(:version => 20150708011604) do
7
+ enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')
8
+ create_table "back_order_allocations", :id => false, :force => true do |t|
9
+ t.column "back_order_allocation_id", :primary_key, :null => false
10
+ t.column "purchase_order_item_id", :integer, :null => false
11
+ t.column "sales_order_item_id", :integer, :null => false
12
+ t.column "quantity", :integer, :limit => 32, :null => false
13
+ end
14
+
15
+ add_index "back_order_allocations", ["purchase_order_item_id", "sales_order_item_id"], :name => :index_back_order_allocations_on_purchase_order_item_i__1a63f970, :unique => true
16
+
17
+ create_table "bins", :id => false, :force => true do |t|
18
+ t.column "bin_id", :primary_key, :null => false
19
+ t.column "product_id", :integer, :null => true
20
+ t.column "warehouse_id", :integer, :null => true
21
+ t.column "quantity", :integer, :limit => 32, :null => false
22
+ end
23
+
24
+
25
+ create_table "dispatch_items", :id => false, :force => true do |t|
26
+ t.column "dispatch_item_id", :primary_key, :null => false
27
+ t.column "product_id", :integer, :null => false
28
+ t.column "sales_order_item_id", :integer, :null => true
29
+ t.column "transfer_request_id", :integer, :null => true
30
+ t.column "dispatch_id", :integer, :null => true
31
+ t.column "quantity", :integer, :limit => 32, :null => false
32
+ end
33
+
34
+
35
+ create_table "parties", :id => false, :force => true do |t|
36
+ t.column "party_id", :primary_key, :null => false
37
+ end
38
+
39
+
40
+ create_table "products", :id => false, :force => true do |t|
41
+ t.column "product_id", :primary_key, :null => false
42
+ end
43
+
44
+
45
+ create_table "purchase_orders", :id => false, :force => true do |t|
46
+ t.column "purchase_order_id", :primary_key, :null => false
47
+ t.column "supplier_id", :integer, :null => false
48
+ t.column "warehouse_id", :integer, :null => false
49
+ end
50
+
51
+
52
+ create_table "purchase_order_items", :id => false, :force => true do |t|
53
+ t.column "purchase_order_item_id", :primary_key, :null => false
54
+ t.column "product_id", :integer, :null => false
55
+ t.column "purchase_order_id", :integer, :null => false
56
+ t.column "quantity", :integer, :limit => 32, :null => false
57
+ end
58
+
59
+ add_index "purchase_order_items", ["purchase_order_id", "product_id"], :name => :index_purchase_order_items_on_purchase_order_id_product_id, :unique => true
60
+
61
+ create_table "received_items", :id => false, :force => true do |t|
62
+ t.column "received_item_id", :primary_key, :null => false
63
+ t.column "product_id", :integer, :null => false
64
+ t.column "purchase_order_item_id", :integer, :null => true
65
+ t.column "transfer_request_id", :integer, :null => true
66
+ t.column "quantity", :integer, :limit => 32, :null => false
67
+ t.column "receipt_id", :integer, :null => true
68
+ end
69
+
70
+
71
+ create_table "sales_orders", :id => false, :force => true do |t|
72
+ t.column "sales_order_id", :primary_key, :null => false
73
+ t.column "customer_id", :integer, :null => false
74
+ t.column "warehouse_id", :integer, :null => false
75
+ end
76
+
77
+
78
+ create_table "sales_order_items", :id => false, :force => true do |t|
79
+ t.column "sales_order_item_id", :primary_key, :null => false
80
+ t.column "product_id", :integer, :null => false
81
+ t.column "sales_order_id", :integer, :null => false
82
+ t.column "quantity", :integer, :limit => 32, :null => false
83
+ end
84
+
85
+ add_index "sales_order_items", ["sales_order_id", "product_id"], :name => :index_sales_order_items_on_sales_order_id_product_id, :unique => true
86
+
87
+ create_table "transfer_requests", :id => false, :force => true do |t|
88
+ t.column "transfer_request_id", :primary_key, :null => false
89
+ t.column "from_warehouse_id", :integer, :null => false
90
+ t.column "product_id", :integer, :null => false
91
+ t.column "to_warehouse_id", :integer, :null => false
92
+ t.column "quantity", :integer, :limit => 32, :null => false
93
+ end
94
+
95
+
96
+ create_table "warehouses", :id => false, :force => true do |t|
97
+ t.column "warehouse_id", :primary_key, :null => false
98
+ end
99
+
100
+
101
+ unless ENV["EXCLUDE_FKS"]
102
+ add_foreign_key :back_order_allocations, :purchase_order_items, :column => :purchase_order_item_id, :primary_key => :purchase_order_item_id, :on_delete => :cascade
103
+ add_index :back_order_allocations, [:purchase_order_item_id], :unique => false, :name => :index_back_order_allocations_on_purchase_order_item_id
104
+ add_foreign_key :back_order_allocations, :sales_order_items, :column => :sales_order_item_id, :primary_key => :sales_order_item_id, :on_delete => :cascade
105
+ add_index :back_order_allocations, [:sales_order_item_id], :unique => false, :name => :index_back_order_allocations_on_sales_order_item_id
106
+ add_foreign_key :bins, :products, :column => :product_id, :primary_key => :product_id, :on_delete => :cascade
107
+ add_index :bins, [:product_id], :unique => false, :name => :index_bins_on_product_id
108
+ add_foreign_key :bins, :warehouses, :column => :warehouse_id, :primary_key => :warehouse_id, :on_delete => :cascade
109
+ add_index :bins, [:warehouse_id], :unique => false, :name => :index_bins_on_warehouse_id
110
+ add_foreign_key :dispatch_items, :products, :column => :product_id, :primary_key => :product_id, :on_delete => :cascade
111
+ add_index :dispatch_items, [:product_id], :unique => false, :name => :index_dispatch_items_on_product_id
112
+ add_foreign_key :dispatch_items, :sales_order_items, :column => :sales_order_item_id, :primary_key => :sales_order_item_id, :on_delete => :cascade
113
+ add_index :dispatch_items, [:sales_order_item_id], :unique => false, :name => :index_dispatch_items_on_sales_order_item_id
114
+ add_foreign_key :dispatch_items, :transfer_requests, :column => :transfer_request_id, :primary_key => :transfer_request_id, :on_delete => :cascade
115
+ add_index :dispatch_items, [:transfer_request_id], :unique => false, :name => :index_dispatch_items_on_transfer_request_id
116
+ add_foreign_key :purchase_orders, :parties, :column => :supplier_id, :primary_key => :party_id, :on_delete => :cascade
117
+ add_index :purchase_orders, [:supplier_id], :unique => false, :name => :index_purchase_orders_on_supplier_id
118
+ add_foreign_key :purchase_orders, :warehouses, :column => :warehouse_id, :primary_key => :warehouse_id, :on_delete => :cascade
119
+ add_index :purchase_orders, [:warehouse_id], :unique => false, :name => :index_purchase_orders_on_warehouse_id
120
+ add_foreign_key :purchase_order_items, :products, :column => :product_id, :primary_key => :product_id, :on_delete => :cascade
121
+ add_index :purchase_order_items, [:product_id], :unique => false, :name => :index_purchase_order_items_on_product_id
122
+ add_foreign_key :purchase_order_items, :purchase_orders, :column => :purchase_order_id, :primary_key => :purchase_order_id, :on_delete => :cascade
123
+ add_index :purchase_order_items, [:purchase_order_id], :unique => false, :name => :index_purchase_order_items_on_purchase_order_id
124
+ add_foreign_key :received_items, :products, :column => :product_id, :primary_key => :product_id, :on_delete => :cascade
125
+ add_index :received_items, [:product_id], :unique => false, :name => :index_received_items_on_product_id
126
+ add_foreign_key :received_items, :purchase_order_items, :column => :purchase_order_item_id, :primary_key => :purchase_order_item_id, :on_delete => :cascade
127
+ add_index :received_items, [:purchase_order_item_id], :unique => false, :name => :index_received_items_on_purchase_order_item_id
128
+ add_foreign_key :received_items, :transfer_requests, :column => :transfer_request_id, :primary_key => :transfer_request_id, :on_delete => :cascade
129
+ add_index :received_items, [:transfer_request_id], :unique => false, :name => :index_received_items_on_transfer_request_id
130
+ add_foreign_key :sales_orders, :parties, :column => :customer_id, :primary_key => :party_id, :on_delete => :cascade
131
+ add_index :sales_orders, [:customer_id], :unique => false, :name => :index_sales_orders_on_customer_id
132
+ add_foreign_key :sales_orders, :warehouses, :column => :warehouse_id, :primary_key => :warehouse_id, :on_delete => :cascade
133
+ add_index :sales_orders, [:warehouse_id], :unique => false, :name => :index_sales_orders_on_warehouse_id
134
+ add_foreign_key :sales_order_items, :products, :column => :product_id, :primary_key => :product_id, :on_delete => :cascade
135
+ add_index :sales_order_items, [:product_id], :unique => false, :name => :index_sales_order_items_on_product_id
136
+ add_foreign_key :sales_order_items, :sales_orders, :column => :sales_order_id, :primary_key => :sales_order_id, :on_delete => :cascade
137
+ add_index :sales_order_items, [:sales_order_id], :unique => false, :name => :index_sales_order_items_on_sales_order_id
138
+ add_foreign_key :transfer_requests, :products, :column => :product_id, :primary_key => :product_id, :on_delete => :cascade
139
+ add_index :transfer_requests, [:product_id], :unique => false, :name => :index_transfer_requests_on_product_id
140
+ add_foreign_key :transfer_requests, :warehouses, :column => :from_warehouse_id, :primary_key => :warehouse_id, :on_delete => :cascade
141
+ add_index :transfer_requests, [:from_warehouse_id], :unique => false, :name => :index_transfer_requests_on_from_warehouse_id
142
+ add_foreign_key :transfer_requests, :warehouses, :column => :to_warehouse_id, :primary_key => :warehouse_id, :on_delete => :cascade
143
+ add_index :transfer_requests, [:to_warehouse_id], :unique => false, :name => :index_transfer_requests_on_to_warehouse_id
144
+ end
145
+ end
data/ruby/Address.rb ADDED
@@ -0,0 +1,68 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::Address
4
+
5
+ class City < String
6
+ value_type :length => 64
7
+ end
8
+
9
+ class CompanyName < String
10
+ value_type
11
+ one_to_one :company # See Company.company_name
12
+ end
13
+
14
+ class FamilyName < String
15
+ value_type :length => 20
16
+ one_to_one :family # See Family.family_name
17
+ end
18
+
19
+ class GivenNames < String
20
+ value_type :length => 20
21
+ end
22
+
23
+ class Number < String
24
+ value_type :length => 12
25
+ end
26
+
27
+ class Postcode < String
28
+ value_type
29
+ end
30
+
31
+ class StreetLine < String
32
+ value_type :length => 64
33
+ end
34
+
35
+ class Company
36
+ identified_by :company_name
37
+ has_one :address # See Address.all_company
38
+ one_to_one :company_name, :mandatory => true # See CompanyName.company
39
+ end
40
+
41
+ class Family
42
+ identified_by :family_name
43
+ one_to_one :family_name, :mandatory => true # See FamilyName.family
44
+ end
45
+
46
+ class Person
47
+ identified_by :family, :given_names
48
+ has_one :address # See Address.all_person
49
+ has_one :family, :mandatory => true # See Family.all_person
50
+ has_one :given_names, :mandatory => true # See GivenNames.all_person
51
+ end
52
+
53
+ class Street
54
+ identified_by :first_street_line, :second_street_line, :third_street_line
55
+ has_one :first_street_line, :class => StreetLine, :mandatory => true # See StreetLine.all_street_as_first_street_line
56
+ has_one :second_street_line, :class => StreetLine # See StreetLine.all_street_as_second_street_line
57
+ has_one :third_street_line, :class => StreetLine # See StreetLine.all_street_as_third_street_line
58
+ end
59
+
60
+ class Address
61
+ identified_by :street_number, :street, :city, :postcode
62
+ has_one :city, :mandatory => true # See City.all_address
63
+ has_one :postcode # See Postcode.all_address
64
+ has_one :street, :mandatory => true # See Street.all_address
65
+ has_one :street_number, :class => Number # See Number.all_address_as_street_number
66
+ end
67
+
68
+ end
data/ruby/Astronomy.rb ADDED
@@ -0,0 +1,55 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::Astronomy
4
+
5
+ class AstronomicalObjectCode < String
6
+ value_type :length => 12
7
+ one_to_one :astronomical_object # See AstronomicalObject.astronomical_object_code
8
+ end
9
+
10
+ class Mass < Real
11
+ value_type :length => 32
12
+ end
13
+
14
+ class MoonName < String
15
+ value_type :length => 256
16
+ one_to_one :moon # See Moon.moon_name
17
+ end
18
+
19
+ class NrDays < Real
20
+ value_type :length => 32
21
+ end
22
+
23
+ class PlanetName < String
24
+ value_type :length => 256
25
+ one_to_one :planet # See Planet.planet_name
26
+ end
27
+
28
+ class AstronomicalObject
29
+ identified_by :astronomical_object_code
30
+ one_to_one :astronomical_object_code, :mandatory => true # See AstronomicalObjectCode.astronomical_object
31
+ maybe :is_in_orbit
32
+ has_one :mass # See Mass.all_astronomical_object
33
+ end
34
+
35
+ class Moon < AstronomicalObject
36
+ identified_by :moon_name
37
+ one_to_one :moon_name, :mandatory => true # See MoonName.moon
38
+ end
39
+
40
+ class Orbit
41
+ identified_by :astronomical_object
42
+ one_to_one :astronomical_object, :mandatory => true # See AstronomicalObject.orbit
43
+ has_one :center, :class => AstronomicalObject, :mandatory => true # See AstronomicalObject.all_orbit_as_center
44
+ has_one :nr_days # See NrDays.all_orbit
45
+ end
46
+
47
+ class Planet < AstronomicalObject
48
+ identified_by :planet_name
49
+ one_to_one :planet_name, :mandatory => true # See PlanetName.planet
50
+ end
51
+
52
+ class Star < AstronomicalObject
53
+ end
54
+
55
+ end
data/ruby/Blog.rb ADDED
@@ -0,0 +1,84 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::Blog
4
+
5
+ class AuthorId < AutoCounter
6
+ value_type
7
+ one_to_one :author # See Author.author_id
8
+ end
9
+
10
+ class CommentId < AutoCounter
11
+ value_type
12
+ one_to_one :comment # See Comment.comment_id
13
+ end
14
+
15
+ class Name < String
16
+ value_type :length => 64
17
+ one_to_one :author, :counterpart => :author_name # See Author.author_name
18
+ one_to_one :topic, :counterpart => :topic_name # See Topic.topic_name
19
+ end
20
+
21
+ class Ordinal < UnsignedInteger
22
+ value_type :length => 32
23
+ end
24
+
25
+ class PostId < AutoCounter
26
+ value_type
27
+ one_to_one :post # See Post.post_id
28
+ end
29
+
30
+ class Style < String
31
+ value_type :length => 20
32
+ end
33
+
34
+ class Text < ::Text
35
+ value_type
36
+ end
37
+
38
+ class TopicId < AutoCounter
39
+ value_type
40
+ one_to_one :topic # See Topic.topic_id
41
+ end
42
+
43
+ class Author
44
+ identified_by :author_id
45
+ one_to_one :author_id, :mandatory => true # See AuthorId.author
46
+ one_to_one :author_name, :class => Name, :mandatory => true # See Name.author_as_author_name
47
+ end
48
+
49
+ class Comment
50
+ identified_by :comment_id
51
+ has_one :author, :mandatory => true # See Author.all_comment
52
+ one_to_one :comment_id, :mandatory => true # See CommentId.comment
53
+ has_one :content, :mandatory => true # See Content.all_comment
54
+ has_one :paragraph, :mandatory => true # See Paragraph.all_comment
55
+ end
56
+
57
+ class Content
58
+ identified_by :style, :text
59
+ has_one :style # See Style.all_content
60
+ has_one :text, :mandatory => true # See Text.all_content
61
+ end
62
+
63
+ class Post
64
+ identified_by :post_id
65
+ has_one :author, :mandatory => true # See Author.all_post
66
+ one_to_one :post_id, :mandatory => true # See PostId.post
67
+ has_one :topic, :mandatory => true # See Topic.all_post
68
+ end
69
+
70
+ class Topic
71
+ identified_by :topic_id
72
+ has_one :parent_topic, :class => Topic # See Topic.all_topic_as_parent_topic
73
+ one_to_one :topic_id, :mandatory => true # See TopicId.topic
74
+ one_to_one :topic_name, :class => Name, :mandatory => true # See Name.topic_as_topic_name
75
+ end
76
+
77
+ class Paragraph
78
+ identified_by :post, :ordinal
79
+ has_one :ordinal, :mandatory => true # See Ordinal.all_paragraph
80
+ has_one :post, :mandatory => true # See Post.all_paragraph
81
+ has_one :content, :mandatory => true # See Content.all_paragraph
82
+ end
83
+
84
+ end
@@ -0,0 +1,109 @@
1
+ require 'activefacts/api'
2
+
3
+ module ::CinemaBookings
4
+
5
+ class CinemaID < AutoCounter
6
+ value_type
7
+ one_to_one :cinema # See Cinema.cinema_id
8
+ end
9
+
10
+ class DateTimeValue < DateTime
11
+ value_type
12
+ one_to_one :date_time # See DateTime.date_time_value
13
+ end
14
+
15
+ class FilmID < AutoCounter
16
+ value_type
17
+ one_to_one :film # See Film.film_id
18
+ end
19
+
20
+ class Name < String
21
+ value_type
22
+ one_to_one :person, :counterpart => :login_name # See Person.login_name
23
+ end
24
+
25
+ class Number < UnsignedInteger
26
+ value_type :length => 16
27
+ restrict 1..Infinity
28
+ end
29
+
30
+ class PersonID < AutoCounter
31
+ value_type
32
+ one_to_one :person # See Person.person_id
33
+ end
34
+
35
+ class RowNr < Char
36
+ value_type :length => 2
37
+ end
38
+
39
+ class SeatNumber < UnsignedInteger
40
+ value_type :length => 16
41
+ end
42
+
43
+ class SectionName < String
44
+ value_type
45
+ one_to_one :section # See Section.section_name
46
+ end
47
+
48
+ class Cinema
49
+ identified_by :cinema_id
50
+ one_to_one :cinema_id, :class => CinemaID, :mandatory => true # See CinemaID.cinema
51
+ end
52
+
53
+ class DateTime
54
+ identified_by :date_time_value
55
+ one_to_one :date_time_value, :mandatory => true # See DateTimeValue.date_time
56
+ end
57
+
58
+ class Film
59
+ identified_by :film_id
60
+ one_to_one :film_id, :class => FilmID, :mandatory => true # See FilmID.film
61
+ has_one :name # See Name.all_film
62
+ end
63
+
64
+ class Person
65
+ identified_by :person_id
66
+ one_to_one :login_name, :class => Name, :mandatory => true # See Name.person_as_login_name
67
+ one_to_one :person_id, :class => PersonID, :mandatory => true # See PersonID.person
68
+ end
69
+
70
+ class Row
71
+ identified_by :cinema, :row_nr
72
+ has_one :cinema, :mandatory => true # See Cinema.all_row
73
+ has_one :row_nr, :mandatory => true # See RowNr.all_row
74
+ end
75
+
76
+ class Seat
77
+ identified_by :row, :seat_number
78
+ has_one :row, :mandatory => true # See Row.all_seat
79
+ has_one :seat_number, :mandatory => true # See SeatNumber.all_seat
80
+ has_one :section # See Section.all_seat
81
+ end
82
+
83
+ class Section
84
+ identified_by :section_name
85
+ one_to_one :section_name, :mandatory => true # See SectionName.section
86
+ end
87
+
88
+ class Session
89
+ identified_by :cinema, :date_time
90
+ has_one :cinema, :mandatory => true # See Cinema.all_session
91
+ has_one :date_time, :mandatory => true # See DateTime.all_session
92
+ has_one :film, :mandatory => true # See Film.all_session
93
+ end
94
+
95
+ class Booking
96
+ identified_by :person, :session
97
+ has_one :number, :mandatory => true # See Number.all_booking
98
+ has_one :person, :mandatory => true # See Person.all_booking
99
+ has_one :session, :mandatory => true # See Session.all_booking
100
+ maybe :is_confirmed
101
+ end
102
+
103
+ class SeatAllocation
104
+ identified_by :booking, :allocated_seat
105
+ has_one :allocated_seat, :class => Seat, :mandatory => true # See Seat.all_seat_allocation_as_allocated_seat
106
+ has_one :booking, :mandatory => true # See Booking.all_seat_allocation
107
+ end
108
+
109
+ end