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
data/sql/server/Metamodel.sql
CHANGED
@@ -39,7 +39,7 @@ GO
|
|
39
39
|
CREATE TABLE AlternativeSet (
|
40
40
|
-- Alternative Set has Guid,
|
41
41
|
Guid uniqueidentifier NOT NULL,
|
42
|
-
-- Alternative Set members are exclusive
|
42
|
+
-- Alternative Set members are exclusive,
|
43
43
|
MembersAreExclusive bit NULL,
|
44
44
|
PRIMARY KEY(Guid)
|
45
45
|
)
|
@@ -50,16 +50,14 @@ CREATE TABLE Component (
|
|
50
50
|
AbsorptionChildRoleFactTypeConceptGuid uniqueidentifier NULL,
|
51
51
|
-- maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption traverses to child-Role and Role fills Ordinal,
|
52
52
|
AbsorptionChildRoleOrdinal smallint NULL,
|
53
|
-
-- maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption flattens
|
53
|
+
-- maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption flattens,
|
54
54
|
AbsorptionFlattens bit NULL,
|
55
|
-
-- maybe Component is a Mapping and maybe Mapping is an Absorption and maybe Absorption is nested under index-Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
|
56
|
-
AbsorptionIndexRoleFactTypeConceptGuid uniqueidentifier NULL,
|
57
|
-
-- maybe Component is a Mapping and maybe Mapping is an Absorption and maybe Absorption is nested under index-Role and Role fills Ordinal,
|
58
|
-
AbsorptionIndexRoleOrdinal smallint NULL,
|
59
55
|
-- maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption traverses from parent-Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
|
60
56
|
AbsorptionParentRoleFactTypeConceptGuid uniqueidentifier NULL,
|
61
57
|
-- maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption traverses from parent-Role and Role fills Ordinal,
|
62
58
|
AbsorptionParentRoleOrdinal smallint NULL,
|
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 and Component has Guid,
|
60
|
+
AbsorptionReverseAbsorptionGuid uniqueidentifier NULL,
|
63
61
|
-- Component has Guid,
|
64
62
|
Guid uniqueidentifier NOT NULL,
|
65
63
|
-- maybe Component is an Indicator and Indicator indicates Role played and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
|
@@ -68,19 +66,28 @@ CREATE TABLE Component (
|
|
68
66
|
IndicatorRoleOrdinal smallint NULL,
|
69
67
|
-- maybe Component is a Mapping and maybe Mapping projects Composite and Composite belongs to Composition and Composition has Guid,
|
70
68
|
MappingCompositionGuid uniqueidentifier NULL,
|
71
|
-
-- maybe Component belongs to parent-Mapping and Mapping is a kind of Component and Component has Guid,
|
72
|
-
MappingGuid uniqueidentifier NULL,
|
73
69
|
-- maybe Component is a Mapping and Mapping represents Object Type and Object Type is called Name,
|
74
70
|
MappingObjectTypeName varchar(64) NULL,
|
75
71
|
-- maybe Component is a Mapping and Mapping represents Object Type and Object Type belongs to Vocabulary and Vocabulary is called Name,
|
76
72
|
MappingObjectTypeVocabularyName varchar(64) NULL,
|
77
73
|
-- maybe Component projects Name,
|
78
74
|
Name varchar(64) NULL,
|
75
|
+
-- maybe Component belongs to Mapping and Mapping is a kind of Component and Component has Guid,
|
76
|
+
ParentGuid uniqueidentifier NULL,
|
79
77
|
PRIMARY KEY(Guid),
|
80
|
-
FOREIGN KEY (
|
78
|
+
FOREIGN KEY (AbsorptionReverseAbsorptionGuid) REFERENCES Component (Guid),
|
79
|
+
FOREIGN KEY (ParentGuid) REFERENCES Component (Guid)
|
81
80
|
)
|
82
81
|
GO
|
83
82
|
|
83
|
+
CREATE VIEW dbo.AbsorptionInComponent_ReverseAbsorptionGuid (AbsorptionReverseAbsorptionGuid) WITH SCHEMABINDING AS
|
84
|
+
SELECT AbsorptionReverseAbsorptionGuid FROM dbo.Component
|
85
|
+
WHERE AbsorptionReverseAbsorptionGuid IS NOT NULL
|
86
|
+
GO
|
87
|
+
|
88
|
+
CREATE UNIQUE CLUSTERED INDEX IX_AbsorptionInComponentByAbsorptionReverseAbsorptionGuid ON dbo.AbsorptionInComponent_ReverseAbsorptionGuid(AbsorptionReverseAbsorptionGuid)
|
89
|
+
GO
|
90
|
+
|
84
91
|
CREATE TABLE Composition (
|
85
92
|
-- Composition has Guid,
|
86
93
|
Guid uniqueidentifier NOT NULL,
|
@@ -136,7 +143,7 @@ CREATE TABLE Concept (
|
|
136
143
|
UnitCoefficientNumerator decimal NULL,
|
137
144
|
-- maybe Unit is an instance of Concept and maybe Unit uses coefficient from Ephemera URL,
|
138
145
|
UnitEphemeraURL varchar NULL,
|
139
|
-
-- maybe Unit is an instance of Concept and Unit is fundamental
|
146
|
+
-- maybe Unit is an instance of Concept and Unit is fundamental,
|
140
147
|
UnitIsFundamental bit NULL,
|
141
148
|
-- maybe Unit is an instance of Concept and Unit is called Name,
|
142
149
|
UnitName varchar(64) NULL,
|
@@ -204,9 +211,9 @@ CREATE TABLE [Constraint] (
|
|
204
211
|
EnforcementCode varchar(16) NULL,
|
205
212
|
-- maybe Constraint is called Name,
|
206
213
|
Name varchar(64) NULL,
|
207
|
-
-- maybe Constraint is a Presence Constraint and Presence Constraint is mandatory
|
214
|
+
-- maybe Constraint is a Presence Constraint and Presence Constraint is mandatory,
|
208
215
|
PresenceConstraintIsMandatory bit NULL,
|
209
|
-
-- maybe Constraint is a Presence Constraint and Presence Constraint is preferred identifier
|
216
|
+
-- maybe Constraint is a Presence Constraint and Presence Constraint is preferred identifier,
|
210
217
|
PresenceConstraintIsPreferredIdentifier bit NULL,
|
211
218
|
-- maybe Constraint is a Presence Constraint and maybe Presence Constraint has max-Frequency,
|
212
219
|
PresenceConstraintMaxFrequency int NULL CHECK(PresenceConstraintMaxFrequency >= 1),
|
@@ -224,7 +231,7 @@ CREATE TABLE [Constraint] (
|
|
224
231
|
RingConstraintRoleFactTypeConceptGuid uniqueidentifier NULL,
|
225
232
|
-- maybe Constraint is a Ring Constraint and maybe Ring Constraint has Role and Role fills Ordinal,
|
226
233
|
RingConstraintRoleOrdinal smallint NULL,
|
227
|
-
-- maybe Constraint is a Set Constraint and maybe Set Constraint is a Set Comparison Constraint and maybe Set Comparison Constraint is a Set Exclusion Constraint and Set Exclusion Constraint is mandatory
|
234
|
+
-- maybe Constraint is a Set Constraint and maybe Set Constraint is a Set Comparison Constraint and maybe Set Comparison Constraint is a Set Exclusion Constraint and Set Exclusion Constraint is mandatory,
|
228
235
|
SetExclusionConstraintIsMandatory bit NULL,
|
229
236
|
-- maybe Constraint is a Set Constraint and maybe Set Constraint is a Subset Constraint and Subset Constraint covers subset-Role Sequence and Role Sequence has Guid,
|
230
237
|
SubsetConstraintSubsetRoleSequenceGuid uniqueidentifier NULL,
|
@@ -353,13 +360,13 @@ GO
|
|
353
360
|
CREATE TABLE FactType (
|
354
361
|
-- Fact Type is an instance of Concept and Concept has Guid,
|
355
362
|
ConceptGuid uniqueidentifier NOT NULL,
|
356
|
-
-- maybe Fact Type is
|
363
|
+
-- 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 and Object Type is called Name,
|
357
364
|
EntityTypeName varchar(64) NULL,
|
358
|
-
-- maybe Fact Type is
|
365
|
+
-- 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 and Object Type belongs to Vocabulary and Vocabulary is called Name,
|
359
366
|
EntityTypeVocabularyName varchar(64) NULL,
|
360
367
|
-- maybe Fact Type is a Type Inheritance and maybe Type Inheritance uses Assimilation,
|
361
368
|
TypeInheritanceAssimilation varchar NULL CHECK(TypeInheritanceAssimilation = 'absorbed' OR TypeInheritanceAssimilation = 'partitioned' OR TypeInheritanceAssimilation = 'separate'),
|
362
|
-
-- maybe Fact Type is a Type Inheritance and Type Inheritance provides identification
|
369
|
+
-- maybe Fact Type is a Type Inheritance and Type Inheritance provides identification,
|
363
370
|
TypeInheritanceProvidesIdentification bit NULL,
|
364
371
|
-- 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 and Object Type is called Name,
|
365
372
|
TypeInheritanceSubtypeName varchar(64) NULL,
|
@@ -404,10 +411,24 @@ GO
|
|
404
411
|
CREATE UNIQUE CLUSTERED INDEX TypeInheritanceUQ ON dbo.TypeInheritanceInFactType_TypeInheritanceSubtypeVocabularyNameTypeInheritanceSubtypeNameTypeInheritanceSupertypeVocabula(TypeInheritanceSubtypeVocabularyName, TypeInheritanceSubtypeName, TypeInheritanceSupertypeVocabularyName, TypeInheritanceSupertypeName)
|
405
412
|
GO
|
406
413
|
|
414
|
+
CREATE TABLE Nesting (
|
415
|
+
-- Nesting involves Absorption and Absorption is a kind of Mapping and Mapping is a kind of Component and Component has Guid,
|
416
|
+
AbsorptionGuid uniqueidentifier NOT NULL,
|
417
|
+
-- Nesting involves Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
|
418
|
+
IndexRoleFactTypeConceptGuid uniqueidentifier NOT NULL,
|
419
|
+
-- Nesting involves Role and Role fills Ordinal,
|
420
|
+
IndexRoleOrdinal smallint NOT NULL,
|
421
|
+
-- Nesting involves Ordinal,
|
422
|
+
Ordinal smallint NOT NULL,
|
423
|
+
PRIMARY KEY(AbsorptionGuid, Ordinal),
|
424
|
+
FOREIGN KEY (AbsorptionGuid) REFERENCES Component (Guid)
|
425
|
+
)
|
426
|
+
GO
|
427
|
+
|
407
428
|
CREATE TABLE ObjectType (
|
408
429
|
-- Object Type is an instance of Concept and Concept has Guid,
|
409
430
|
ConceptGuid uniqueidentifier NOT NULL,
|
410
|
-
-- Object Type is independent
|
431
|
+
-- Object Type is independent,
|
411
432
|
IsIndependent bit NULL,
|
412
433
|
-- Object Type is called Name,
|
413
434
|
Name varchar(64) NOT NULL,
|
@@ -461,7 +482,7 @@ CREATE UNIQUE CLUSTERED INDEX IX_ValueTypeInObjectTypeByValueTypeValueConstraint
|
|
461
482
|
GO
|
462
483
|
|
463
484
|
CREATE TABLE Play (
|
464
|
-
-- Play is input
|
485
|
+
-- Play is input,
|
465
486
|
IsInput bit NULL,
|
466
487
|
-- Play involves Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
|
467
488
|
RoleFactTypeConceptGuid uniqueidentifier NOT NULL,
|
@@ -493,7 +514,7 @@ GO
|
|
493
514
|
CREATE TABLE Reading (
|
494
515
|
-- Reading is for Fact Type and Fact Type is an instance of Concept and Concept has Guid,
|
495
516
|
FactTypeConceptGuid uniqueidentifier NOT NULL,
|
496
|
-
-- Reading is negative
|
517
|
+
-- Reading is negative,
|
497
518
|
IsNegative bit NULL,
|
498
519
|
-- Reading is in Ordinal position,
|
499
520
|
Ordinal smallint NOT NULL,
|
@@ -513,6 +534,10 @@ CREATE TABLE Role (
|
|
513
534
|
FactTypeConceptGuid uniqueidentifier NOT NULL,
|
514
535
|
-- maybe implying-Role implies Link Fact Type and Link Fact Type is a kind of Fact Type and Fact Type is an instance of Concept and Concept has Guid,
|
515
536
|
LinkFactTypeConceptGuid uniqueidentifier NULL,
|
537
|
+
-- maybe Role implies Mirror Role and Mirror Role is a kind of Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
|
538
|
+
MirrorRoleFactTypeConceptGuid uniqueidentifier NULL,
|
539
|
+
-- maybe Role implies Mirror Role and Mirror Role is a kind of Role and Role fills Ordinal,
|
540
|
+
MirrorRoleOrdinal smallint NULL,
|
516
541
|
-- Role is played by Object Type and Object Type is called Name,
|
517
542
|
ObjectTypeName varchar(64) NOT NULL,
|
518
543
|
-- Role is played by Object Type and Object Type belongs to Vocabulary and Vocabulary is called Name,
|
@@ -526,7 +551,8 @@ CREATE TABLE Role (
|
|
526
551
|
FOREIGN KEY (ConceptGuid) REFERENCES Concept (Guid),
|
527
552
|
FOREIGN KEY (LinkFactTypeConceptGuid) REFERENCES FactType (ConceptGuid),
|
528
553
|
FOREIGN KEY (FactTypeConceptGuid) REFERENCES FactType (ConceptGuid),
|
529
|
-
FOREIGN KEY (ObjectTypeVocabularyName, ObjectTypeName) REFERENCES ObjectType (VocabularyName, Name)
|
554
|
+
FOREIGN KEY (ObjectTypeVocabularyName, ObjectTypeName) REFERENCES ObjectType (VocabularyName, Name),
|
555
|
+
FOREIGN KEY (MirrorRoleFactTypeConceptGuid, MirrorRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
|
530
556
|
)
|
531
557
|
GO
|
532
558
|
|
@@ -538,6 +564,15 @@ GO
|
|
538
564
|
CREATE UNIQUE CLUSTERED INDEX IX_RoleByLinkFactTypeConceptGuid ON dbo.Role_LinkFactTypeConceptGuid(LinkFactTypeConceptGuid)
|
539
565
|
GO
|
540
566
|
|
567
|
+
CREATE VIEW dbo.Role_MirrorRoleFactTypeConceptGuidMirrorRoleOrdinal (MirrorRoleFactTypeConceptGuid, MirrorRoleOrdinal) WITH SCHEMABINDING AS
|
568
|
+
SELECT MirrorRoleFactTypeConceptGuid, MirrorRoleOrdinal FROM dbo.Role
|
569
|
+
WHERE MirrorRoleFactTypeConceptGuid IS NOT NULL
|
570
|
+
AND MirrorRoleOrdinal IS NOT NULL
|
571
|
+
GO
|
572
|
+
|
573
|
+
CREATE UNIQUE CLUSTERED INDEX IX_RoleByMirrorRoleFactTypeConceptGuidMirrorRoleOrdinal ON dbo.Role_MirrorRoleFactTypeConceptGuidMirrorRoleOrdinal(MirrorRoleFactTypeConceptGuid, MirrorRoleOrdinal)
|
574
|
+
GO
|
575
|
+
|
541
576
|
CREATE TABLE RoleDisplay (
|
542
577
|
-- Role Display involves Fact Type Shape and Fact Type Shape is a kind of Shape and Shape has Guid,
|
543
578
|
FactTypeShapeGuid uniqueidentifier NOT NULL,
|
@@ -591,7 +626,7 @@ GO
|
|
591
626
|
CREATE TABLE RoleSequence (
|
592
627
|
-- Role Sequence has Guid,
|
593
628
|
Guid uniqueidentifier NOT NULL,
|
594
|
-
-- Role Sequence has unused dependency to force table in norma
|
629
|
+
-- Role Sequence has unused dependency to force table in norma,
|
595
630
|
HasUnusedDependencyToForceTableInNorma bit NULL,
|
596
631
|
PRIMARY KEY(Guid)
|
597
632
|
)
|
@@ -643,7 +678,7 @@ CREATE TABLE Shape (
|
|
643
678
|
FactTypeShapeRotationSetting varchar NULL CHECK(FactTypeShapeRotationSetting = 'left' OR FactTypeShapeRotationSetting = 'right'),
|
644
679
|
-- Shape has Guid,
|
645
680
|
Guid uniqueidentifier NOT NULL,
|
646
|
-
-- Shape is expanded
|
681
|
+
-- Shape is expanded,
|
647
682
|
IsExpanded bit NULL,
|
648
683
|
-- maybe Shape is at Location and Location is at X,
|
649
684
|
LocationX int NULL,
|
@@ -655,7 +690,7 @@ CREATE TABLE Shape (
|
|
655
690
|
ORMDiagramName varchar(64) NOT NULL,
|
656
691
|
-- Shape is in ORM Diagram and ORM Diagram is a kind of Diagram and Diagram is for Vocabulary and Vocabulary is called Name,
|
657
692
|
ORMDiagramVocabularyName varchar(64) NOT NULL,
|
658
|
-
-- maybe Shape is an Object Type Shape and Object Type Shape has expanded reference mode
|
693
|
+
-- maybe Shape is an Object Type Shape and Object Type Shape has expanded reference mode,
|
659
694
|
ObjectTypeShapeHasExpandedReferenceMode bit NULL,
|
660
695
|
-- maybe Shape is an Object Type Shape and Object Type Shape is for Object Type and Object Type is called Name,
|
661
696
|
ObjectTypeShapeObjectTypeName varchar(64) NULL,
|
@@ -747,9 +782,9 @@ CREATE TABLE Step (
|
|
747
782
|
FactTypeConceptGuid uniqueidentifier NOT NULL,
|
748
783
|
-- Step has Guid,
|
749
784
|
Guid uniqueidentifier NOT NULL,
|
750
|
-
-- Step is disallowed
|
785
|
+
-- Step is disallowed,
|
751
786
|
IsDisallowed bit NULL,
|
752
|
-
-- Step is optional
|
787
|
+
-- Step is optional,
|
753
788
|
IsOptional bit NULL,
|
754
789
|
PRIMARY KEY(Guid),
|
755
790
|
FOREIGN KEY (AlternativeSetGuid) REFERENCES AlternativeSet (Guid),
|
@@ -898,10 +933,6 @@ ALTER TABLE Component
|
|
898
933
|
ADD FOREIGN KEY (AbsorptionChildRoleFactTypeConceptGuid, AbsorptionChildRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
|
899
934
|
GO
|
900
935
|
|
901
|
-
ALTER TABLE Component
|
902
|
-
ADD FOREIGN KEY (AbsorptionIndexRoleFactTypeConceptGuid, AbsorptionIndexRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
|
903
|
-
GO
|
904
|
-
|
905
936
|
ALTER TABLE Component
|
906
937
|
ADD FOREIGN KEY (AbsorptionParentRoleFactTypeConceptGuid, AbsorptionParentRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
|
907
938
|
GO
|
@@ -974,6 +1005,10 @@ ALTER TABLE FactType
|
|
974
1005
|
ADD FOREIGN KEY (TypeInheritanceSupertypeVocabularyName, TypeInheritanceSupertypeName) REFERENCES ObjectType (VocabularyName, Name)
|
975
1006
|
GO
|
976
1007
|
|
1008
|
+
ALTER TABLE Nesting
|
1009
|
+
ADD FOREIGN KEY (IndexRoleFactTypeConceptGuid, IndexRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
|
1010
|
+
GO
|
1011
|
+
|
977
1012
|
ALTER TABLE Play
|
978
1013
|
ADD FOREIGN KEY (RoleFactTypeConceptGuid, RoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
|
979
1014
|
GO
|
data/sql/server/OilSupply.sql
CHANGED
@@ -35,11 +35,10 @@ CREATE TABLE ProductionForecast (
|
|
35
35
|
-- Production Forecast involves Refinery and Refinery has Refinery Name,
|
36
36
|
RefineryName varchar(80) NOT NULL,
|
37
37
|
-- Production Forecast involves Supply Period and Supply Period is in Month and Month has Month Nr,
|
38
|
-
SupplyPeriodMonthNr int NOT NULL
|
38
|
+
SupplyPeriodMonthNr int NOT NULL,
|
39
39
|
-- Production Forecast involves Supply Period and Supply Period is in Year and Year has Year Nr,
|
40
40
|
SupplyPeriodYearNr int NOT NULL,
|
41
41
|
PRIMARY KEY(RefineryName, SupplyPeriodYearNr, SupplyPeriodMonthNr, ProductName),
|
42
|
-
FOREIGN KEY (SupplyPeriodMonthNr) REFERENCES Month (MonthNr),
|
43
42
|
FOREIGN KEY (ProductName) REFERENCES Product (ProductName)
|
44
43
|
)
|
45
44
|
GO
|
@@ -66,16 +65,25 @@ CREATE TABLE RegionalDemand (
|
|
66
65
|
-- Regional Demand involves Region and Region has Region Name,
|
67
66
|
RegionName varchar NOT NULL,
|
68
67
|
-- Regional Demand involves Supply Period and Supply Period is in Month and Month has Month Nr,
|
69
|
-
SupplyPeriodMonthNr int NOT NULL
|
68
|
+
SupplyPeriodMonthNr int NOT NULL,
|
70
69
|
-- Regional Demand involves Supply Period and Supply Period is in Year and Year has Year Nr,
|
71
70
|
SupplyPeriodYearNr int NOT NULL,
|
72
71
|
PRIMARY KEY(RegionName, SupplyPeriodYearNr, SupplyPeriodMonthNr, ProductName),
|
73
|
-
FOREIGN KEY (SupplyPeriodMonthNr) REFERENCES Month (MonthNr),
|
74
72
|
FOREIGN KEY (ProductName) REFERENCES Product (ProductName),
|
75
73
|
FOREIGN KEY (RegionName) REFERENCES Region (RegionName)
|
76
74
|
)
|
77
75
|
GO
|
78
76
|
|
77
|
+
CREATE TABLE SupplyPeriod (
|
78
|
+
-- Supply Period is in Month and Month has Month Nr,
|
79
|
+
MonthNr int NOT NULL,
|
80
|
+
-- Supply Period is in Year and Year has Year Nr,
|
81
|
+
YearNr int NOT NULL,
|
82
|
+
PRIMARY KEY(YearNr, MonthNr),
|
83
|
+
FOREIGN KEY (MonthNr) REFERENCES Month (MonthNr)
|
84
|
+
)
|
85
|
+
GO
|
86
|
+
|
79
87
|
CREATE TABLE TransportRoute (
|
80
88
|
-- maybe Transport Route incurs Cost per kl,
|
81
89
|
Cost decimal NULL,
|
@@ -103,3 +111,11 @@ ALTER TABLE ProductionForecast
|
|
103
111
|
ADD FOREIGN KEY (RefineryName) REFERENCES Refinery (RefineryName)
|
104
112
|
GO
|
105
113
|
|
114
|
+
ALTER TABLE ProductionForecast
|
115
|
+
ADD FOREIGN KEY (SupplyPeriodYearNr, SupplyPeriodMonthNr) REFERENCES SupplyPeriod (YearNr, MonthNr)
|
116
|
+
GO
|
117
|
+
|
118
|
+
ALTER TABLE RegionalDemand
|
119
|
+
ADD FOREIGN KEY (SupplyPeriodYearNr, SupplyPeriodMonthNr) REFERENCES SupplyPeriod (YearNr, MonthNr)
|
120
|
+
GO
|
121
|
+
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activefacts-examples
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clifford Heath
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
17
20
|
- - "~>"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.10.
|
22
|
+
version: 1.10.6
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.10'
|
24
30
|
- - "~>"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.10.
|
32
|
+
version: 1.10.6
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rake
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,58 +48,36 @@ dependencies:
|
|
42
48
|
name: rspec
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - "
|
51
|
+
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '3.3'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - "
|
58
|
+
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '3.3'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: activefacts
|
62
|
+
name: activefacts
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - ">="
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
-
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: activefacts-orm
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
67
|
+
version: '1.8'
|
68
|
+
- - "~>"
|
74
69
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
70
|
+
version: 1.8.0
|
76
71
|
type: :runtime
|
77
72
|
prerelease: false
|
78
73
|
version_requirements: !ruby/object:Gem::Requirement
|
79
74
|
requirements:
|
80
75
|
- - ">="
|
81
76
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
83
|
-
-
|
84
|
-
name: activefacts-generators
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
77
|
+
version: '1.8'
|
78
|
+
- - "~>"
|
95
79
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
80
|
+
version: 1.8.0
|
97
81
|
description: Example models in the Constellation Query Language for use with ActiveFacts
|
98
82
|
email:
|
99
83
|
- clifford.heath@gmail.com
|
@@ -384,5 +368,5 @@ rubyforge_project:
|
|
384
368
|
rubygems_version: 2.2.2
|
385
369
|
signing_key:
|
386
370
|
specification_version: 4
|
387
|
-
summary: Example models
|
371
|
+
summary: Example models for use with ActiveFacts
|
388
372
|
test_files: []
|