activefacts-examples 1.7.2 → 1.8.0
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.
- checksums.yaml +4 -4
- data/Gemfile +5 -1
- data/activefacts-examples.gemspec +5 -7
- data/cql/Metamodel.cql +79 -69
- data/cql/SeparateSubtype.cql +1 -1
- data/diagrams/json/Metamodel.json +9 -7
- data/metadata/json/Metamodel.json +515 -504
- data/metadata/json/OilSupply.json +54 -54
- data/orm/Health.orm +257 -0
- data/orm/Metamodel.orm +3471 -3154
- data/rails/models/Metamodel.models +42 -11
- data/rails/schema/Metamodel.schema.rb +24 -12
- data/ruby/Metamodel.rb +17 -8
- data/sql/server/CinemaBookings.sql +1 -1
- data/sql/server/CinemaTickets.sql +3 -3
- data/sql/server/CompanyDirectorEmployee.sql +2 -2
- data/sql/server/Genealogy.sql +1 -1
- data/sql/server/Insurance.sql +6 -6
- data/sql/server/Metamodel.sql +64 -29
- data/sql/server/OilSupply.sql +20 -4
- data/sql/server/SimplestUnary.sql +1 -1
- metadata +22 -38
@@ -56,8 +56,11 @@ module Concernz
|
|
56
56
|
included do
|
57
57
|
self.primary_key = 'guid'
|
58
58
|
|
59
|
-
# maybe Component
|
60
|
-
belongs_to :
|
59
|
+
# maybe Component is a Mapping and maybe Mapping is an Absorption and maybe Absorption is matched by reverse-Absorption and Absorption is a kind of Mapping and Mapping is a kind of Component
|
60
|
+
belongs_to :component_via_mapping_absorption_absorption_mapping, :class_name => 'Component', :foreign_key => :absorption_reverse_absorption_guid
|
61
|
+
|
62
|
+
# maybe Component belongs to Mapping and Mapping is a kind of Component
|
63
|
+
belongs_to :component_via_mapping, :class_name => 'Component', :foreign_key => :parent_guid
|
61
64
|
|
62
65
|
# maybe Component is a Mapping and maybe Mapping projects Composite and Composite belongs to Composition
|
63
66
|
belongs_to :composition_via_mapping_composite, :class_name => 'Composition', :foreign_key => :mapping_composition_guid
|
@@ -68,20 +71,23 @@ module Concernz
|
|
68
71
|
# maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption traverses to child-Role
|
69
72
|
belongs_to :child_role_via_mapping_absorption, :class_name => 'Role', :foreign_key => :absorption_child_role_id
|
70
73
|
|
71
|
-
# maybe Component is a Mapping and maybe Mapping is an Absorption and maybe Absorption is nested under index-Role
|
72
|
-
belongs_to :index_role_via_mapping_absorption, :class_name => 'Role', :foreign_key => :absorption_index_role_id
|
73
|
-
|
74
74
|
# maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption traverses from parent-Role
|
75
75
|
belongs_to :parent_role_via_mapping_absorption, :class_name => 'Role', :foreign_key => :absorption_parent_role_id
|
76
76
|
|
77
77
|
# maybe Component is an Indicator and Indicator indicates Role played
|
78
78
|
belongs_to :role_via_indicator, :class_name => 'Role', :foreign_key => :indicator_role_id
|
79
79
|
|
80
|
+
# Component is a Mapping and Mapping is an Absorption and maybe Absorption is matched by reverse-Absorption and maybe Absorption is a kind of Mapping and maybe Mapping is a kind of Component
|
81
|
+
has_one :component_via_mapping_absorption_absorption_mapping, :class_name => 'Component', :foreign_key => :absorption_reverse_absorption_guid, :dependent => :destroy
|
82
|
+
|
80
83
|
# Component is a Mapping and maybe Mapping contains Component
|
81
|
-
has_many :members_via_mapping, :class_name => 'Component', :foreign_key => :
|
84
|
+
has_many :members_via_mapping, :class_name => 'Component', :foreign_key => :parent_guid, :dependent => :destroy
|
82
85
|
|
83
86
|
# Component is a Discriminator and Discriminator is involved in Discriminated Role
|
84
87
|
has_many :discriminated_roles_via_discriminator, :class_name => 'DiscriminatedRole', :foreign_key => :discriminator_guid, :dependent => :destroy
|
88
|
+
|
89
|
+
# Component is a Mapping and Mapping is an Absorption and Absorption is involved in Nesting
|
90
|
+
has_many :nestings_via_absorption_mapping, :class_name => 'Nesting', :foreign_key => :absorption_guid, :dependent => :destroy
|
85
91
|
end
|
86
92
|
end
|
87
93
|
end
|
@@ -337,7 +343,7 @@ module Concernz
|
|
337
343
|
# Fact Type is an instance of Concept
|
338
344
|
belongs_to :concept, :foreign_key => :concept_guid
|
339
345
|
|
340
|
-
# maybe Fact Type is
|
346
|
+
# maybe Fact Type is objectified as Entity Type and Entity Type is a kind of Domain Object Type and Domain Object Type is a kind of Object Type
|
341
347
|
belongs_to :object_type_via_entity_type_domain_object_type, :class_name => 'ObjectType', :foreign_key => :entity_type_object_type_id
|
342
348
|
|
343
349
|
# maybe Fact Type is a Type Inheritance and Type Inheritance involves Entity Type and Entity Type is a kind of Domain Object Type and Domain Object Type is a kind of Object Type
|
@@ -369,6 +375,25 @@ module Concernz
|
|
369
375
|
end
|
370
376
|
end
|
371
377
|
|
378
|
+
module Concernz
|
379
|
+
module Nesting
|
380
|
+
extend ActiveSupport::Concern
|
381
|
+
included do
|
382
|
+
self.primary_key = 'nesting_id'
|
383
|
+
|
384
|
+
# Nesting involves Absorption and Absorption is a kind of Mapping and Mapping is a kind of Component
|
385
|
+
belongs_to :component_via_absorption_mapping, :class_name => 'Component', :foreign_key => :absorption_guid
|
386
|
+
|
387
|
+
# Nesting involves Role
|
388
|
+
belongs_to :index_role, :class_name => 'Role', :foreign_key => :index_role_id
|
389
|
+
|
390
|
+
validates :absorption_guid, :presence => true
|
391
|
+
validates :ordinal, :presence => true
|
392
|
+
validates :index_role_id, :presence => true
|
393
|
+
end
|
394
|
+
end
|
395
|
+
end
|
396
|
+
|
372
397
|
module Concernz
|
373
398
|
module ObjectType
|
374
399
|
extend ActiveSupport::Concern
|
@@ -393,7 +418,7 @@ module Concernz
|
|
393
418
|
# Instance is of Object Type and maybe Instance is an instance of Concept
|
394
419
|
has_many :concepts_via_instance, :class_name => 'Concept', :foreign_key => :instance_object_type_id, :dependent => :destroy
|
395
420
|
|
396
|
-
# Object Type is a Domain Object Type and Domain Object Type is an Entity Type and maybe Entity Type
|
421
|
+
# Object Type is a Domain Object Type and Domain Object Type is an Entity Type and maybe Entity Type objectifies Fact Type
|
397
422
|
has_one :fact_type_via_entity_type_domain_object_type, :class_name => 'FactType', :foreign_key => :entity_type_object_type_id, :dependent => :destroy
|
398
423
|
|
399
424
|
# Object Type is a Domain Object Type and Domain Object Type is an Entity Type and Entity Type is involved in Type Inheritance and maybe Type Inheritance is a kind of Fact Type
|
@@ -525,12 +550,12 @@ module Concernz
|
|
525
550
|
# Role is played by Object Type
|
526
551
|
belongs_to :object_type, :foreign_key => :object_type_id
|
527
552
|
|
553
|
+
# maybe Role implies Mirror Role and Mirror Role is a kind of Role
|
554
|
+
belongs_to :role_via_mirror_role, :class_name => 'Role', :foreign_key => :mirror_role_id
|
555
|
+
|
528
556
|
# Absorption traverses to child-Role and maybe Absorption is a kind of Mapping and maybe Mapping is a kind of Component
|
529
557
|
has_many :components_via_mapping_absorption, :class_name => 'Component', :foreign_key => :absorption_child_role_id, :dependent => :destroy
|
530
558
|
|
531
|
-
# maybe Absorption is nested under index-Role and maybe Absorption is a kind of Mapping and maybe Mapping is a kind of Component
|
532
|
-
has_many :components_via_mapping_absorption, :class_name => 'Component', :foreign_key => :absorption_index_role_id, :dependent => :destroy
|
533
|
-
|
534
559
|
# Absorption traverses from parent-Role and maybe Absorption is a kind of Mapping and maybe Mapping is a kind of Component
|
535
560
|
has_many :components_via_mapping_absorption, :class_name => 'Component', :foreign_key => :absorption_parent_role_id, :dependent => :destroy
|
536
561
|
|
@@ -549,6 +574,9 @@ module Concernz
|
|
549
574
|
# Role is involved in Discriminated Role
|
550
575
|
has_many :discriminated_roles, :class_name => 'DiscriminatedRole', :foreign_key => :role_id, :dependent => :destroy
|
551
576
|
|
577
|
+
# Role is involved in Nesting
|
578
|
+
has_many :nestings, :class_name => 'Nesting', :foreign_key => :index_role_id, :dependent => :destroy
|
579
|
+
|
552
580
|
# Role is involved in Play
|
553
581
|
has_many :plays, :class_name => 'Play', :foreign_key => :role_id, :dependent => :destroy
|
554
582
|
|
@@ -561,6 +589,9 @@ module Concernz
|
|
561
589
|
# Role Value is of Role
|
562
590
|
has_many :role_values, :class_name => 'RoleValue', :foreign_key => :role_id, :dependent => :destroy
|
563
591
|
|
592
|
+
# Role is a Mirror Role and maybe Mirror Role is for Role
|
593
|
+
has_one :base_role_via_mirror_role, :class_name => 'Role', :foreign_key => :mirror_role_id, :dependent => :destroy
|
594
|
+
|
564
595
|
# maybe Role is projected from Variable
|
565
596
|
has_one :variable, :class_name => 'Variable', :foreign_key => :projection_id, :dependent => :destroy
|
566
597
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#
|
2
|
-
# schema.rb auto-generated using ActiveFacts for Metamodel on 2015-
|
2
|
+
# schema.rb auto-generated using ActiveFacts for Metamodel on 2015-11-02
|
3
3
|
#
|
4
4
|
|
5
5
|
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
6
|
-
ActiveRecord::Schema.define(:version =>
|
6
|
+
ActiveRecord::Schema.define(:version => 20151102200220) do
|
7
7
|
enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto')
|
8
8
|
create_table "aggregations", :id => false, :force => true do |t|
|
9
9
|
t.column "aggregation_id", :primary_key, :null => false
|
@@ -33,17 +33,18 @@ ActiveRecord::Schema.define(:version => 20151008133030) do
|
|
33
33
|
|
34
34
|
create_table "components", :id => false, :force => true do |t|
|
35
35
|
t.column "guid", :uuid, :default => 'gen_random_uuid()', :primary_key => true, :null => false
|
36
|
-
t.column "
|
36
|
+
t.column "parent_guid", :uuid, :null => true
|
37
37
|
t.column "absorption_child_role_id", :integer, :null => true
|
38
38
|
t.column "absorption_flattens", :boolean, :null => true
|
39
|
-
t.column "absorption_index_role_id", :integer, :null => true
|
40
39
|
t.column "absorption_parent_role_id", :integer, :null => true
|
40
|
+
t.column "absorption_reverse_absorption_guid", :uuid, :null => true
|
41
41
|
t.column "indicator_role_id", :integer, :null => true
|
42
42
|
t.column "mapping_composition_guid", :uuid, :null => true
|
43
43
|
t.column "mapping_object_type_id", :integer, :null => true
|
44
44
|
t.column "name", :string, :limit => 64, :null => true
|
45
45
|
end
|
46
46
|
|
47
|
+
add_index "components", ["absorption_reverse_absorption_guid"], :name => :index_components_on_absorption_reverse_absorption_guid
|
47
48
|
|
48
49
|
create_table "compositions", :id => false, :force => true do |t|
|
49
50
|
t.column "guid", :uuid, :default => 'gen_random_uuid()', :primary_key => true, :null => false
|
@@ -173,6 +174,15 @@ ActiveRecord::Schema.define(:version => 20151008133030) do
|
|
173
174
|
add_index "fact_types", ["type_inheritance_subtype_object_type_id", "type_inheritance_provides_identification"], :name => :index_fact_types_on_type_inheritance_subtype_object_t__04417c92
|
174
175
|
add_index "fact_types", ["type_inheritance_subtype_object_type_id", "type_inheritance_supertype_object_type_id"], :name => :index_fact_types_on_type_inheritance_subtype_object_t__9c8eded7
|
175
176
|
|
177
|
+
create_table "nestings", :id => false, :force => true do |t|
|
178
|
+
t.column "nesting_id", :primary_key, :null => false
|
179
|
+
t.column "absorption_guid", :uuid, :null => false
|
180
|
+
t.column "index_role_id", :integer, :null => false
|
181
|
+
t.column "ordinal", :integer, :limit => 16, :null => false
|
182
|
+
end
|
183
|
+
|
184
|
+
add_index "nestings", ["absorption_guid", "ordinal"], :name => :index_nestings_on_absorption_guid_ordinal, :unique => true
|
185
|
+
|
176
186
|
create_table "object_types", :id => false, :force => true do |t|
|
177
187
|
t.column "object_type_id", :primary_key, :null => false
|
178
188
|
t.column "concept_guid", :uuid, :null => false
|
@@ -229,6 +239,7 @@ ActiveRecord::Schema.define(:version => 20151008133030) do
|
|
229
239
|
t.column "concept_guid", :uuid, :null => false
|
230
240
|
t.column "fact_type_concept_guid", :uuid, :null => false
|
231
241
|
t.column "link_fact_type_concept_guid", :uuid, :null => true
|
242
|
+
t.column "mirror_role_id", :integer, :null => true
|
232
243
|
t.column "object_type_id", :integer, :null => false
|
233
244
|
t.column "ordinal", :integer, :limit => 16, :null => false
|
234
245
|
t.column "role_name", :string, :limit => 64, :null => true
|
@@ -237,6 +248,7 @@ ActiveRecord::Schema.define(:version => 20151008133030) do
|
|
237
248
|
add_index "roles", ["concept_guid"], :name => :index_roles_on_concept_guid, :unique => true
|
238
249
|
add_index "roles", ["fact_type_concept_guid", "ordinal"], :name => :index_roles_on_fact_type_concept_guid_ordinal, :unique => true
|
239
250
|
add_index "roles", ["link_fact_type_concept_guid"], :name => :index_roles_on_link_fact_type_concept_guid
|
251
|
+
add_index "roles", ["mirror_role_id"], :name => :index_roles_on_mirror_role_id
|
240
252
|
|
241
253
|
create_table "role_displays", :id => false, :force => true do |t|
|
242
254
|
t.column "role_display_id", :primary_key, :null => false
|
@@ -379,16 +391,15 @@ ActiveRecord::Schema.define(:version => 20151008133030) do
|
|
379
391
|
add_index :allowed_ranges, [:value_range_maximum_bound_value_id], :unique => false, :name => :index_allowed_ranges_on_value_range_maximum_bound_value_id
|
380
392
|
add_foreign_key :allowed_ranges, :values, :column => :value_range_minimum_bound_value_id, :primary_key => :value_id, :on_delete => :cascade
|
381
393
|
add_index :allowed_ranges, [:value_range_minimum_bound_value_id], :unique => false, :name => :index_allowed_ranges_on_value_range_minimum_bound_value_id
|
382
|
-
add_foreign_key :components, :components, :column => :
|
383
|
-
|
394
|
+
add_foreign_key :components, :components, :column => :absorption_reverse_absorption_guid, :primary_key => :guid, :on_delete => :cascade
|
395
|
+
add_foreign_key :components, :components, :column => :parent_guid, :primary_key => :guid, :on_delete => :cascade
|
396
|
+
add_index :components, [:parent_guid], :unique => false, :name => :index_components_on_parent_guid
|
384
397
|
add_foreign_key :components, :compositions, :column => :mapping_composition_guid, :primary_key => :guid, :on_delete => :cascade
|
385
398
|
add_index :components, [:mapping_composition_guid], :unique => false, :name => :index_components_on_mapping_composition_guid
|
386
399
|
add_foreign_key :components, :object_types, :column => :mapping_object_type_id, :primary_key => :object_type_id, :on_delete => :cascade
|
387
400
|
add_index :components, [:mapping_object_type_id], :unique => false, :name => :index_components_on_mapping_object_type_id
|
388
401
|
add_foreign_key :components, :roles, :column => :absorption_child_role_id, :primary_key => :role_id, :on_delete => :cascade
|
389
402
|
add_index :components, [:absorption_child_role_id], :unique => false, :name => :index_components_on_absorption_child_role_id
|
390
|
-
add_foreign_key :components, :roles, :column => :absorption_index_role_id, :primary_key => :role_id, :on_delete => :cascade
|
391
|
-
add_index :components, [:absorption_index_role_id], :unique => false, :name => :index_components_on_absorption_index_role_id
|
392
403
|
add_foreign_key :components, :roles, :column => :absorption_parent_role_id, :primary_key => :role_id, :on_delete => :cascade
|
393
404
|
add_index :components, [:absorption_parent_role_id], :unique => false, :name => :index_components_on_absorption_parent_role_id
|
394
405
|
add_foreign_key :components, :roles, :column => :indicator_role_id, :primary_key => :role_id, :on_delete => :cascade
|
@@ -435,17 +446,19 @@ ActiveRecord::Schema.define(:version => 20151008133030) do
|
|
435
446
|
add_foreign_key :discriminated_roles, :values, :column => :value_id, :primary_key => :value_id, :on_delete => :cascade
|
436
447
|
add_index :discriminated_roles, [:value_id], :unique => false, :name => :index_discriminated_roles_on_value_id
|
437
448
|
add_foreign_key :fact_types, :concepts, :column => :concept_guid, :primary_key => :guid, :on_delete => :cascade
|
438
|
-
add_index :fact_types, [:concept_guid], :unique => false, :name => :index_fact_types_on_concept_guid
|
439
449
|
add_foreign_key :fact_types, :object_types, :column => :entity_type_object_type_id, :primary_key => :object_type_id, :on_delete => :cascade
|
440
450
|
add_foreign_key :fact_types, :object_types, :column => :type_inheritance_subtype_object_type_id, :primary_key => :object_type_id, :on_delete => :cascade
|
441
451
|
add_index :fact_types, [:type_inheritance_subtype_object_type_id], :unique => false, :name => :index_fact_types_on_type_inheritance_subtype_object_type_id
|
442
452
|
add_foreign_key :fact_types, :object_types, :column => :type_inheritance_supertype_object_type_id, :primary_key => :object_type_id, :on_delete => :cascade
|
443
453
|
add_index :fact_types, [:type_inheritance_supertype_object_type_id], :unique => false, :name => :index_fact_types_on_type_inheritance_supertype_object_type_id
|
454
|
+
add_foreign_key :nestings, :components, :column => :absorption_guid, :primary_key => :guid, :on_delete => :cascade
|
455
|
+
add_index :nestings, [:absorption_guid], :unique => false, :name => :index_nestings_on_absorption_guid
|
456
|
+
add_foreign_key :nestings, :roles, :column => :index_role_id, :primary_key => :role_id, :on_delete => :cascade
|
457
|
+
add_index :nestings, [:index_role_id], :unique => false, :name => :index_nestings_on_index_role_id
|
444
458
|
add_foreign_key :object_types, :concepts, :column => :concept_guid, :primary_key => :guid, :on_delete => :cascade
|
445
459
|
add_foreign_key :object_types, :concepts, :column => :value_type_unit_concept_guid, :primary_key => :guid, :on_delete => :cascade
|
446
460
|
add_index :object_types, [:value_type_unit_concept_guid], :unique => false, :name => :index_object_types_on_value_type_unit_concept_guid
|
447
461
|
add_foreign_key :object_types, :constraints, :column => :value_type_value_constraint_concept_guid, :primary_key => :concept_guid, :on_delete => :cascade
|
448
|
-
add_index :object_types, [:value_type_value_constraint_concept_guid], :unique => false, :name => :index_object_types_on_value_type_value_constraint_concept_guid
|
449
462
|
add_foreign_key :object_types, :object_types, :column => :value_type_supertype_object_type_id, :primary_key => :object_type_id, :on_delete => :cascade
|
450
463
|
add_index :object_types, [:value_type_supertype_object_type_id], :unique => false, :name => :index_object_types_on_value_type_supertype_object_type_id
|
451
464
|
add_foreign_key :plays, :roles, :column => :role_id, :primary_key => :role_id, :on_delete => :cascade
|
@@ -455,18 +468,17 @@ ActiveRecord::Schema.define(:version => 20151008133030) do
|
|
455
468
|
add_foreign_key :plays, :variables, :column => :variable_id, :primary_key => :variable_id, :on_delete => :cascade
|
456
469
|
add_index :plays, [:variable_id], :unique => false, :name => :index_plays_on_variable_id
|
457
470
|
add_foreign_key :populations, :concepts, :column => :concept_guid, :primary_key => :guid, :on_delete => :cascade
|
458
|
-
add_index :populations, [:concept_guid], :unique => false, :name => :index_populations_on_concept_guid
|
459
471
|
add_foreign_key :readings, :fact_types, :column => :fact_type_concept_guid, :primary_key => :concept_guid, :on_delete => :cascade
|
460
472
|
add_index :readings, [:fact_type_concept_guid], :unique => false, :name => :index_readings_on_fact_type_concept_guid
|
461
473
|
add_foreign_key :readings, :role_sequences, :column => :role_sequence_guid, :primary_key => :guid, :on_delete => :cascade
|
462
474
|
add_index :readings, [:role_sequence_guid], :unique => false, :name => :index_readings_on_role_sequence_guid
|
463
475
|
add_foreign_key :roles, :concepts, :column => :concept_guid, :primary_key => :guid, :on_delete => :cascade
|
464
|
-
add_index :roles, [:concept_guid], :unique => false, :name => :index_roles_on_concept_guid
|
465
476
|
add_foreign_key :roles, :fact_types, :column => :link_fact_type_concept_guid, :primary_key => :concept_guid, :on_delete => :cascade
|
466
477
|
add_foreign_key :roles, :fact_types, :column => :fact_type_concept_guid, :primary_key => :concept_guid, :on_delete => :cascade
|
467
478
|
add_index :roles, [:fact_type_concept_guid], :unique => false, :name => :index_roles_on_fact_type_concept_guid
|
468
479
|
add_foreign_key :roles, :object_types, :column => :object_type_id, :primary_key => :object_type_id, :on_delete => :cascade
|
469
480
|
add_index :roles, [:object_type_id], :unique => false, :name => :index_roles_on_object_type_id
|
481
|
+
add_foreign_key :roles, :roles, :column => :mirror_role_id, :primary_key => :role_id, :on_delete => :cascade
|
470
482
|
add_foreign_key :role_displays, :roles, :column => :role_id, :primary_key => :role_id, :on_delete => :cascade
|
471
483
|
add_index :role_displays, [:role_id], :unique => false, :name => :index_role_displays_on_role_id
|
472
484
|
add_foreign_key :role_displays, :shapes, :column => :fact_type_shape_guid, :primary_key => :guid, :on_delete => :cascade
|
data/ruby/Metamodel.rb
CHANGED
@@ -177,8 +177,8 @@ module ::Metamodel
|
|
177
177
|
class Component
|
178
178
|
identified_by :guid
|
179
179
|
one_to_one :guid, :mandatory => true # See Guid.component
|
180
|
-
has_one :mapping, :counterpart => :member # See Mapping.all_member
|
181
180
|
has_one :name # See Name.all_component
|
181
|
+
has_one :parent, :class => "Mapping", :counterpart => :member # See Mapping.all_member
|
182
182
|
end
|
183
183
|
|
184
184
|
class Composition
|
@@ -268,9 +268,6 @@ module ::Metamodel
|
|
268
268
|
has_one :object_type, :mandatory => true # See ObjectType.all_mapping
|
269
269
|
end
|
270
270
|
|
271
|
-
class Nesting < Mapping
|
272
|
-
end
|
273
|
-
|
274
271
|
class PresenceConstraint < Constraint
|
275
272
|
maybe :is_mandatory
|
276
273
|
maybe :is_preferred_identifier
|
@@ -323,6 +320,9 @@ module ::Metamodel
|
|
323
320
|
has_one :role, :mandatory => true # See Role.all_role_value
|
324
321
|
end
|
325
322
|
|
323
|
+
class Scoping < Mapping
|
324
|
+
end
|
325
|
+
|
326
326
|
class SetConstraint < Constraint
|
327
327
|
end
|
328
328
|
|
@@ -396,10 +396,11 @@ module ::Metamodel
|
|
396
396
|
end
|
397
397
|
|
398
398
|
class Absorption < Mapping
|
399
|
+
one_to_one :absorption, :counterpart => :reverse_absorption # See Absorption.reverse_absorption
|
399
400
|
has_one :child_role, :class => Role, :mandatory => true # See Role.all_absorption_as_child_role
|
400
401
|
maybe :flattens
|
401
|
-
has_one :index_role, :class => Role # See Role.all_absorption_as_index_role
|
402
402
|
has_one :parent_role, :class => Role, :mandatory => true # See Role.all_absorption_as_parent_role
|
403
|
+
one_to_one :reverse_absorption, :class => Absorption # See Absorption.absorption_as_reverse_absorption
|
403
404
|
end
|
404
405
|
|
405
406
|
class Aggregation
|
@@ -473,10 +474,21 @@ module ::Metamodel
|
|
473
474
|
class Injection < Mapping
|
474
475
|
end
|
475
476
|
|
477
|
+
class MirrorRole < Role
|
478
|
+
one_to_one :base_role, :class => Role # See Role.mirror_role_as_base_role
|
479
|
+
end
|
480
|
+
|
476
481
|
class ModelNoteShape < Shape
|
477
482
|
has_one :context_note, :mandatory => true # See ContextNote.all_model_note_shape
|
478
483
|
end
|
479
484
|
|
485
|
+
class Nesting
|
486
|
+
identified_by :absorption, :ordinal
|
487
|
+
has_one :absorption, :mandatory => true # See Absorption.all_nesting
|
488
|
+
has_one :index_role, :class => Role, :mandatory => true # See Role.all_nesting_as_index_role
|
489
|
+
has_one :ordinal, :mandatory => true # See Ordinal.all_nesting
|
490
|
+
end
|
491
|
+
|
480
492
|
class ORMDiagram < Diagram
|
481
493
|
end
|
482
494
|
|
@@ -615,7 +627,4 @@ module ::Metamodel
|
|
615
627
|
has_one :value, :mandatory => true # See Value.all_value_type_parameter_restriction
|
616
628
|
end
|
617
629
|
|
618
|
-
class ImplicitBooleanValueType < ValueType
|
619
|
-
end
|
620
|
-
|
621
630
|
end
|
@@ -32,7 +32,7 @@ CREATE TABLE Booking (
|
|
32
32
|
SessionTimeMonthNr int NOT NULL,
|
33
33
|
-- Booking involves Session and Session involves Session Time and Session Time is in Year and Year has Year Nr,
|
34
34
|
SessionTimeYearNr int NOT NULL,
|
35
|
-
-- tickets for Booking have been issued
|
35
|
+
-- tickets for Booking have been issued,
|
36
36
|
TicketsForHaveBeenIssued bit NULL,
|
37
37
|
PRIMARY KEY(BookingNr),
|
38
38
|
UNIQUE(PersonID, SessionCinemaID, SessionTimeYearNr, SessionTimeMonthNr, SessionTimeDay, SessionTimeHour, SessionTimeMinute)
|
@@ -133,7 +133,7 @@ CREATE TABLE Session (
|
|
133
133
|
CinemaID int NOT NULL,
|
134
134
|
-- Session involves Film and Film has Film ID,
|
135
135
|
FilmID int NOT NULL,
|
136
|
-
-- Session is high-demand
|
136
|
+
-- Session is high-demand,
|
137
137
|
IsHighDemand bit NULL,
|
138
138
|
-- Session involves Session Time and Session Time is on Day,
|
139
139
|
SessionTimeDay int NOT NULL CHECK((SessionTimeDay >= 1 AND SessionTimeDay <= 31)),
|
@@ -145,7 +145,7 @@ CREATE TABLE Session (
|
|
145
145
|
SessionTimeMonthNr int NOT NULL CHECK((SessionTimeMonthNr >= 1 AND SessionTimeMonthNr <= 12)),
|
146
146
|
-- Session involves Session Time and Session Time is in Year and Year has Year Nr,
|
147
147
|
SessionTimeYearNr int NOT NULL CHECK((SessionTimeYearNr >= 1900 AND SessionTimeYearNr <= 9999)),
|
148
|
-
-- Session uses allocated seating
|
148
|
+
-- Session uses allocated seating,
|
149
149
|
UsesAllocatedSeating bit NULL,
|
150
150
|
PRIMARY KEY(CinemaID, SessionTimeYearNr, SessionTimeMonthNr, SessionTimeDay, SessionTimeHour, SessionTimeMinute),
|
151
151
|
FOREIGN KEY (CinemaID) REFERENCES Cinema (CinemaID),
|
@@ -16,7 +16,7 @@ GO
|
|
16
16
|
CREATE TABLE Company (
|
17
17
|
-- Company is called Company Name,
|
18
18
|
CompanyName varchar(48) NOT NULL,
|
19
|
-
-- Company is listed
|
19
|
+
-- Company is listed,
|
20
20
|
IsListed bit NULL,
|
21
21
|
PRIMARY KEY(CompanyName)
|
22
22
|
)
|
@@ -41,7 +41,7 @@ CREATE TABLE Employee (
|
|
41
41
|
CompanyName varchar(48) NOT NULL,
|
42
42
|
-- Employee has Employee Nr,
|
43
43
|
EmployeeNr int NOT NULL,
|
44
|
-
-- maybe Employee is a Manager and Manager is ceo
|
44
|
+
-- maybe Employee is a Manager and Manager is ceo,
|
45
45
|
ManagerIsCeo bit NULL,
|
46
46
|
-- maybe Employee is supervised by Manager and Manager is a kind of Employee and Employee has Employee Nr,
|
47
47
|
ManagerNr int NULL,
|
data/sql/server/Genealogy.sql
CHANGED
data/sql/server/Insurance.sql
CHANGED
@@ -9,7 +9,7 @@ CREATE TABLE Asset (
|
|
9
9
|
VehicleEngineNumber varchar NULL,
|
10
10
|
-- maybe Asset is a Vehicle and maybe Vehicle is subject to finance with Finance Institution and Finance Institution is a kind of Company and Company is a kind of Party and Party has Party ID,
|
11
11
|
VehicleFinanceInstitutionID int NULL,
|
12
|
-
-- maybe Asset is a Vehicle and Vehicle has commercial registration
|
12
|
+
-- maybe Asset is a Vehicle and Vehicle has commercial registration,
|
13
13
|
VehicleHasCommercialRegistration bit NULL,
|
14
14
|
-- maybe Asset is a Vehicle and Vehicle is of model-Year and Year has Year Nr,
|
15
15
|
VehicleModelYearNr int NULL,
|
@@ -128,9 +128,9 @@ CREATE TABLE CoverWording (
|
|
128
128
|
GO
|
129
129
|
|
130
130
|
CREATE TABLE LossType (
|
131
|
-
-- Loss Type involves driving
|
131
|
+
-- Loss Type involves driving,
|
132
132
|
InvolvesDriving bit NULL,
|
133
|
-
-- Loss Type is single vehicle incident
|
133
|
+
-- Loss Type is single vehicle incident,
|
134
134
|
IsSingleVehicleIncident bit NULL,
|
135
135
|
-- maybe Loss Type implies Liability and Liability has Liability Code,
|
136
136
|
LiabilityCode char(1) NULL CHECK(LiabilityCode = 'D' OR LiabilityCode = 'L' OR LiabilityCode = 'R' OR LiabilityCode = 'U'),
|
@@ -161,7 +161,7 @@ GO
|
|
161
161
|
CREATE TABLE Party (
|
162
162
|
-- maybe Party is a Company and Company has contact-Person and Person is a kind of Party and Party has Party ID,
|
163
163
|
CompanyContactPersonID int NULL,
|
164
|
-
-- Party is a company
|
164
|
+
-- Party is a company,
|
165
165
|
IsACompany bit NULL,
|
166
166
|
-- Party has Party ID,
|
167
167
|
PartyID int IDENTITY NOT NULL,
|
@@ -187,7 +187,7 @@ CREATE TABLE Party (
|
|
187
187
|
PersonGivenName varchar(256) NULL,
|
188
188
|
-- maybe Party is a Person and Person has Contact Methods and maybe Contact Methods includes home-Phone and Phone has Phone Nr,
|
189
189
|
PersonHomePhoneNr varchar NULL,
|
190
|
-
-- maybe Party is a Person and maybe Person holds License and License is international
|
190
|
+
-- maybe Party is a Person and maybe Person holds License and License is international,
|
191
191
|
PersonIsInternational bit NULL,
|
192
192
|
-- maybe Party is a Person and maybe Person holds License and License has License Number,
|
193
193
|
PersonLicenseNumber varchar NULL,
|
@@ -368,7 +368,7 @@ CREATE TABLE VehicleIncident (
|
|
368
368
|
DrivingHospitalName varchar NULL,
|
369
369
|
-- Vehicle Incident is involved in Driving and maybe Driving followed Intoxication,
|
370
370
|
DrivingIntoxication varchar NULL,
|
371
|
-
-- Vehicle Incident is involved in Driving and maybe Driving is involved in Driving Charge and Driving Charge is a warning
|
371
|
+
-- Vehicle Incident is involved in Driving and maybe Driving is involved in Driving Charge and Driving Charge is a warning,
|
372
372
|
DrivingIsAWarning bit NULL,
|
373
373
|
-- Vehicle Incident is involved in Driving and maybe Driving was without owners consent for nonconsent-Reason,
|
374
374
|
DrivingNonconsentReason varchar NULL,
|