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,1000 @@
1
+ CREATE TABLE Aggregation (
2
+ -- Aggregation involves Aggregate and Aggregate has Aggregate Code,
3
+ AggregateCode varchar(32) NOT NULL,
4
+ -- Aggregation involves Variable and Variable has Ordinal position,
5
+ AggregatedVariableOrdinal smallint NOT NULL,
6
+ -- Aggregation involves Variable and Variable is in Query and Query is an instance of Concept and Concept has Guid,
7
+ AggregatedVariableQueryConceptGuid uniqueidentifier NOT NULL,
8
+ -- Aggregation involves Variable and Variable has Ordinal position,
9
+ VariableOrdinal smallint NOT NULL,
10
+ -- Aggregation involves Variable and Variable is in Query and Query is an instance of Concept and Concept has Guid,
11
+ VariableQueryConceptGuid uniqueidentifier NOT NULL,
12
+ PRIMARY KEY(AggregateCode, AggregatedVariableQueryConceptGuid, AggregatedVariableOrdinal)
13
+ )
14
+ GO
15
+
16
+ CREATE TABLE AllowedRange (
17
+ -- Allowed Range involves Value Constraint and Value Constraint is a kind of Constraint and Constraint is an instance of Concept and Concept has Guid,
18
+ ValueConstraintConceptGuid uniqueidentifier NOT NULL,
19
+ -- Allowed Range involves Value Range and maybe Value Range has maximum-Bound and Bound is inclusive,
20
+ ValueRangeMaximumBoundIsInclusive bit NULL,
21
+ -- Allowed Range involves Value Range and maybe Value Range has maximum-Bound and Bound has Value and Value is literal string,
22
+ ValueRangeMaximumBoundValueIsLiteralString bit NULL,
23
+ -- Allowed Range involves Value Range and maybe Value Range has maximum-Bound and Bound has Value and Value is represented by Literal,
24
+ ValueRangeMaximumBoundValueLiteral varchar NULL,
25
+ -- Allowed Range involves Value Range and maybe Value Range has maximum-Bound and Bound has Value and maybe Value is in Unit and Unit is an instance of Concept and Concept has Guid,
26
+ ValueRangeMaximumBoundValueUnitConceptGuid uniqueidentifier NULL,
27
+ -- Allowed Range involves Value Range and maybe Value Range has minimum-Bound and Bound is inclusive,
28
+ ValueRangeMinimumBoundIsInclusive bit NULL,
29
+ -- Allowed Range involves Value Range and maybe Value Range has minimum-Bound and Bound has Value and Value is literal string,
30
+ ValueRangeMinimumBoundValueIsLiteralString bit NULL,
31
+ -- Allowed Range involves Value Range and maybe Value Range has minimum-Bound and Bound has Value and Value is represented by Literal,
32
+ ValueRangeMinimumBoundValueLiteral varchar NULL,
33
+ -- Allowed Range involves Value Range and maybe Value Range has minimum-Bound and Bound has Value and maybe Value is in Unit and Unit is an instance of Concept and Concept has Guid,
34
+ ValueRangeMinimumBoundValueUnitConceptGuid uniqueidentifier NULL,
35
+ UNIQUE(ValueConstraintConceptGuid, ValueRangeMinimumBoundValueLiteral, ValueRangeMinimumBoundValueIsLiteralString, ValueRangeMinimumBoundValueUnitConceptGuid, ValueRangeMinimumBoundIsInclusive, ValueRangeMaximumBoundValueLiteral, ValueRangeMaximumBoundValueIsLiteralString, ValueRangeMaximumBoundValueUnitConceptGuid, ValueRangeMaximumBoundIsInclusive)
36
+ )
37
+ GO
38
+
39
+ CREATE TABLE AlternativeSet (
40
+ -- Alternative Set has Guid,
41
+ Guid uniqueidentifier NOT NULL,
42
+ -- Alternative Set members are exclusive Boolean,
43
+ MembersAreExclusive bit NULL,
44
+ PRIMARY KEY(Guid)
45
+ )
46
+ GO
47
+
48
+ CREATE TABLE Component (
49
+ -- maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption traverses to child-Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
50
+ AbsorptionChildRoleFactTypeConceptGuid uniqueidentifier NULL,
51
+ -- maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption traverses to child-Role and Role fills Ordinal,
52
+ AbsorptionChildRoleOrdinal smallint NULL,
53
+ -- maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption flattens Boolean,
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
+ -- 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
+ AbsorptionParentRoleFactTypeConceptGuid uniqueidentifier NULL,
61
+ -- maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption traverses from parent-Role and Role fills Ordinal,
62
+ AbsorptionParentRoleOrdinal smallint NULL,
63
+ -- Component has Guid,
64
+ Guid uniqueidentifier NOT NULL,
65
+ -- 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,
66
+ IndicatorRoleFactTypeConceptGuid uniqueidentifier NULL,
67
+ -- maybe Component is an Indicator and Indicator indicates Role played and Role fills Ordinal,
68
+ IndicatorRoleOrdinal smallint NULL,
69
+ -- maybe Component is a Mapping and maybe Mapping projects Composite and Composite belongs to Composition and Composition has Guid,
70
+ 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
+ -- maybe Component is a Mapping and Mapping represents Object Type and Object Type is called Name,
74
+ MappingObjectTypeName varchar(64) NULL,
75
+ -- maybe Component is a Mapping and Mapping represents Object Type and Object Type belongs to Vocabulary and Vocabulary is called Name,
76
+ MappingObjectTypeVocabularyName varchar(64) NULL,
77
+ -- maybe Component projects Name,
78
+ Name varchar(64) NULL,
79
+ PRIMARY KEY(Guid),
80
+ FOREIGN KEY (MappingGuid) REFERENCES Component (Guid)
81
+ )
82
+ GO
83
+
84
+ CREATE TABLE Composition (
85
+ -- Composition has Guid,
86
+ Guid uniqueidentifier NOT NULL,
87
+ -- Composition is called Name,
88
+ Name varchar(64) NOT NULL,
89
+ PRIMARY KEY(Guid),
90
+ UNIQUE(Name)
91
+ )
92
+ GO
93
+
94
+ CREATE TABLE Concept (
95
+ -- maybe Context Note is an instance of Concept and maybe Context Note was added by Agreement and maybe Agreement was on Date,
96
+ ContextNoteDate datetime NULL,
97
+ -- maybe Context Note is an instance of Concept and Context Note has Discussion,
98
+ ContextNoteDiscussion varchar NULL,
99
+ -- maybe Context Note is an instance of Concept and Context Note has Context Note Kind,
100
+ ContextNoteKind varchar NULL CHECK(ContextNoteKind = 'as_opposed_to' OR ContextNoteKind = 'because' OR ContextNoteKind = 'so_that' OR ContextNoteKind = 'to_avoid'),
101
+ -- maybe Context Note is an instance of Concept and maybe Context Note applies to relevant-Concept and Concept has Guid,
102
+ ContextNoteRelevantConceptGuid uniqueidentifier NULL,
103
+ -- maybe Fact is an instance of Concept and Fact belongs to Population and Population has Name,
104
+ FactPopulationName varchar(64) NULL,
105
+ -- maybe Fact is an instance of Concept and Fact belongs to Population and maybe Population belongs to Vocabulary and Vocabulary is called Name,
106
+ FactPopulationVocabularyName varchar(64) NULL,
107
+ -- maybe Fact is an instance of Concept and Fact is of Fact Type and Fact Type is an instance of Concept and Concept has Guid,
108
+ FactTypeConceptGuid uniqueidentifier NULL,
109
+ -- Concept has Guid,
110
+ Guid uniqueidentifier NOT NULL,
111
+ -- maybe Concept is implied by Implication Rule and Implication Rule has Implication Rule Name,
112
+ ImplicationRuleName varchar NULL,
113
+ -- maybe Instance is an instance of Concept and maybe Instance objectifies Fact and Fact is an instance of Concept and Concept has Guid,
114
+ InstanceFactConceptGuid uniqueidentifier NULL,
115
+ -- maybe Instance is an instance of Concept and Instance is of Object Type and Object Type is called Name,
116
+ InstanceObjectTypeName varchar(64) NULL,
117
+ -- maybe Instance is an instance of Concept and Instance is of Object Type and Object Type belongs to Vocabulary and Vocabulary is called Name,
118
+ InstanceObjectTypeVocabularyName varchar(64) NULL,
119
+ -- maybe Instance is an instance of Concept and Instance belongs to Population and Population has Name,
120
+ InstancePopulationName varchar(64) NULL,
121
+ -- maybe Instance is an instance of Concept and Instance belongs to Population and maybe Population belongs to Vocabulary and Vocabulary is called Name,
122
+ InstancePopulationVocabularyName varchar(64) NULL,
123
+ -- maybe Instance is an instance of Concept and maybe Instance has Value and Value is literal string,
124
+ InstanceValueIsLiteralString bit NULL,
125
+ -- maybe Instance is an instance of Concept and maybe Instance has Value and Value is represented by Literal,
126
+ InstanceValueLiteral varchar NULL,
127
+ -- maybe Instance is an instance of Concept and maybe Instance has Value and maybe Value is in Unit and Unit is an instance of Concept and Concept has Guid,
128
+ InstanceValueUnitConceptGuid uniqueidentifier NULL,
129
+ -- maybe Concept belongs to Topic and Topic has topic-Name,
130
+ TopicName varchar(64) NULL,
131
+ -- maybe Unit is an instance of Concept and maybe Unit has Coefficient and Coefficient has Denominator,
132
+ UnitCoefficientDenominator int NULL,
133
+ -- maybe Unit is an instance of Concept and maybe Unit has Coefficient and Coefficient is precise,
134
+ UnitCoefficientIsPrecise bit NULL,
135
+ -- maybe Unit is an instance of Concept and maybe Unit has Coefficient and Coefficient has Numerator,
136
+ UnitCoefficientNumerator decimal NULL,
137
+ -- maybe Unit is an instance of Concept and maybe Unit uses coefficient from Ephemera URL,
138
+ UnitEphemeraURL varchar NULL,
139
+ -- maybe Unit is an instance of Concept and Unit is fundamental Boolean,
140
+ UnitIsFundamental bit NULL,
141
+ -- maybe Unit is an instance of Concept and Unit is called Name,
142
+ UnitName varchar(64) NULL,
143
+ -- maybe Unit is an instance of Concept and maybe Unit has Offset,
144
+ UnitOffset decimal NULL,
145
+ -- maybe Unit is an instance of Concept and maybe Unit has plural-Name,
146
+ UnitPluralName varchar(64) NULL,
147
+ -- maybe Unit is an instance of Concept and Unit is in Vocabulary and Vocabulary is called Name,
148
+ UnitVocabularyName varchar(64) NULL,
149
+ PRIMARY KEY(Guid),
150
+ FOREIGN KEY (ContextNoteRelevantConceptGuid) REFERENCES Concept (Guid),
151
+ FOREIGN KEY (InstanceFactConceptGuid) REFERENCES Concept (Guid)
152
+ )
153
+ GO
154
+
155
+ CREATE VIEW dbo.InstanceInConcept_FactConceptGuid (InstanceFactConceptGuid) WITH SCHEMABINDING AS
156
+ SELECT InstanceFactConceptGuid FROM dbo.Concept
157
+ WHERE InstanceFactConceptGuid IS NOT NULL
158
+ GO
159
+
160
+ CREATE UNIQUE CLUSTERED INDEX IX_InstanceInConceptByInstanceFactConceptGuid ON dbo.InstanceInConcept_FactConceptGuid(InstanceFactConceptGuid)
161
+ GO
162
+
163
+ CREATE VIEW dbo.UnitInConcept_Name (UnitName) WITH SCHEMABINDING AS
164
+ SELECT UnitName FROM dbo.Concept
165
+ WHERE UnitName IS NOT NULL
166
+ GO
167
+
168
+ CREATE UNIQUE CLUSTERED INDEX IX_UnitInConceptByUnitName ON dbo.UnitInConcept_Name(UnitName)
169
+ GO
170
+
171
+ CREATE VIEW dbo.UnitInConcept_PluralName (UnitPluralName) WITH SCHEMABINDING AS
172
+ SELECT UnitPluralName FROM dbo.Concept
173
+ WHERE UnitPluralName IS NOT NULL
174
+ GO
175
+
176
+ CREATE UNIQUE CLUSTERED INDEX IX_UnitInConceptByUnitPluralName ON dbo.UnitInConcept_PluralName(UnitPluralName)
177
+ GO
178
+
179
+ CREATE VIEW dbo.UnitInConcept_VocabularyNameName (UnitVocabularyName, UnitName) WITH SCHEMABINDING AS
180
+ SELECT UnitVocabularyName, UnitName FROM dbo.Concept
181
+ WHERE UnitVocabularyName IS NOT NULL
182
+ AND UnitName IS NOT NULL
183
+ GO
184
+
185
+ CREATE UNIQUE CLUSTERED INDEX IX_UnitInConceptByUnitVocabularyNameUnitName ON dbo.UnitInConcept_VocabularyNameName(UnitVocabularyName, UnitName)
186
+ GO
187
+
188
+ CREATE TABLE ConceptAnnotation (
189
+ -- Concept Annotation involves Concept and Concept has Guid,
190
+ ConceptGuid uniqueidentifier NOT NULL,
191
+ -- Concept Annotation involves Annotation,
192
+ MappingAnnotation varchar NOT NULL,
193
+ PRIMARY KEY(ConceptGuid, MappingAnnotation),
194
+ FOREIGN KEY (ConceptGuid) REFERENCES Concept (Guid)
195
+ )
196
+ GO
197
+
198
+ CREATE TABLE [Constraint] (
199
+ -- Constraint is an instance of Concept and Concept has Guid,
200
+ ConceptGuid uniqueidentifier NOT NULL,
201
+ -- maybe Constraint requires Enforcement and maybe Enforcement notifies Agent and Agent has Agent Name,
202
+ EnforcementAgentName varchar NULL,
203
+ -- maybe Constraint requires Enforcement and Enforcement has Enforcement Code,
204
+ EnforcementCode varchar(16) NULL,
205
+ -- maybe Constraint is called Name,
206
+ Name varchar(64) NULL,
207
+ -- maybe Constraint is a Presence Constraint and Presence Constraint is mandatory Boolean,
208
+ PresenceConstraintIsMandatory bit NULL,
209
+ -- maybe Constraint is a Presence Constraint and Presence Constraint is preferred identifier Boolean,
210
+ PresenceConstraintIsPreferredIdentifier bit NULL,
211
+ -- maybe Constraint is a Presence Constraint and maybe Presence Constraint has max-Frequency,
212
+ PresenceConstraintMaxFrequency int NULL CHECK(PresenceConstraintMaxFrequency >= 1),
213
+ -- maybe Constraint is a Presence Constraint and maybe Presence Constraint has min-Frequency,
214
+ PresenceConstraintMinFrequency int NULL CHECK(PresenceConstraintMinFrequency >= 2),
215
+ -- maybe Constraint is a Presence Constraint and Presence Constraint covers Role Sequence and Role Sequence has Guid,
216
+ PresenceConstraintRoleSequenceGuid uniqueidentifier NULL,
217
+ -- maybe Constraint is a Ring Constraint and maybe Ring Constraint has other-Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
218
+ RingConstraintOtherRoleFactTypeConceptGuid uniqueidentifier NULL,
219
+ -- maybe Constraint is a Ring Constraint and maybe Ring Constraint has other-Role and Role fills Ordinal,
220
+ RingConstraintOtherRoleOrdinal smallint NULL,
221
+ -- maybe Constraint is a Ring Constraint and Ring Constraint is of Ring Type,
222
+ RingConstraintRingType varchar NULL,
223
+ -- maybe Constraint is a Ring Constraint and maybe Ring Constraint has Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
224
+ RingConstraintRoleFactTypeConceptGuid uniqueidentifier NULL,
225
+ -- maybe Constraint is a Ring Constraint and maybe Ring Constraint has Role and Role fills Ordinal,
226
+ 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 Boolean,
228
+ SetExclusionConstraintIsMandatory bit NULL,
229
+ -- 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
+ SubsetConstraintSubsetRoleSequenceGuid uniqueidentifier NULL,
231
+ -- maybe Constraint is a Set Constraint and maybe Set Constraint is a Subset Constraint and Subset Constraint covers superset-Role Sequence and Role Sequence has Guid,
232
+ SubsetConstraintSupersetRoleSequenceGuid uniqueidentifier NULL,
233
+ -- maybe Constraint is a Value Constraint and maybe Value Constraint requires matching Regular Expression,
234
+ ValueConstraintRegularExpression varchar NULL,
235
+ -- maybe Constraint is a Value Constraint and maybe Value Constraint applies to Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
236
+ ValueConstraintRoleFactTypeConceptGuid uniqueidentifier NULL,
237
+ -- maybe Constraint is a Value Constraint and maybe Value Constraint applies to Role and Role fills Ordinal,
238
+ ValueConstraintRoleOrdinal smallint NULL,
239
+ -- maybe Constraint belongs to Vocabulary and Vocabulary is called Name,
240
+ VocabularyName varchar(64) NULL,
241
+ PRIMARY KEY(ConceptGuid),
242
+ FOREIGN KEY (ConceptGuid) REFERENCES Concept (Guid)
243
+ )
244
+ GO
245
+
246
+ CREATE VIEW dbo.Constraint_EnforcementAgentNameEnforcementCode (EnforcementAgentName, EnforcementCode) WITH SCHEMABINDING AS
247
+ SELECT EnforcementAgentName, EnforcementCode FROM dbo.[Constraint]
248
+ WHERE EnforcementAgentName IS NOT NULL
249
+ AND EnforcementCode IS NOT NULL
250
+ GO
251
+
252
+ CREATE UNIQUE CLUSTERED INDEX IX_ConstraintByEnforcementAgentNameEnforcementCode ON dbo.Constraint_EnforcementAgentNameEnforcementCode(EnforcementAgentName, EnforcementCode)
253
+ GO
254
+
255
+ CREATE VIEW dbo.SubsetConstraintInConstraint_SubsetConstraintSubsetRoleSequenceGuidSubsetConstraintSupersetRoleSequenceGuid (SubsetConstraintSubsetRoleSequenceGuid, SubsetConstraintSupersetRoleSequenceGuid) WITH SCHEMABINDING AS
256
+ SELECT SubsetConstraintSubsetRoleSequenceGuid, SubsetConstraintSupersetRoleSequenceGuid FROM dbo.[Constraint]
257
+ WHERE SubsetConstraintSubsetRoleSequenceGuid IS NOT NULL
258
+ AND SubsetConstraintSupersetRoleSequenceGuid IS NOT NULL
259
+ GO
260
+
261
+ CREATE UNIQUE CLUSTERED INDEX SetConstraintMustHaveSupertypeConstraint ON dbo.SubsetConstraintInConstraint_SubsetConstraintSubsetRoleSequenceGuidSubsetConstraintSupersetRoleSequenceGuid(SubsetConstraintSubsetRoleSequenceGuid, SubsetConstraintSupersetRoleSequenceGuid)
262
+ GO
263
+
264
+ CREATE VIEW dbo.ValueConstraintInConstraint_ValueConstraintRoleFactTypeConceptGuidValueConstraintRoleOrdinal (ValueConstraintRoleFactTypeConceptGuid, ValueConstraintRoleOrdinal) WITH SCHEMABINDING AS
265
+ SELECT ValueConstraintRoleFactTypeConceptGuid, ValueConstraintRoleOrdinal FROM dbo.[Constraint]
266
+ WHERE ValueConstraintRoleFactTypeConceptGuid IS NOT NULL
267
+ AND ValueConstraintRoleOrdinal IS NOT NULL
268
+ GO
269
+
270
+ CREATE UNIQUE CLUSTERED INDEX IX_ValueConstraintInConstraintByValueConstraintRoleFactTypeConceptGuidValueConstraintRoleOrdinal ON dbo.ValueConstraintInConstraint_ValueConstraintRoleFactTypeConceptGuidValueConstraintRoleOrdinal(ValueConstraintRoleFactTypeConceptGuid, ValueConstraintRoleOrdinal)
271
+ GO
272
+
273
+ CREATE VIEW dbo.Constraint_VocabularyNameName (VocabularyName, Name) WITH SCHEMABINDING AS
274
+ SELECT VocabularyName, Name FROM dbo.[Constraint]
275
+ WHERE VocabularyName IS NOT NULL
276
+ AND Name IS NOT NULL
277
+ GO
278
+
279
+ CREATE UNIQUE CLUSTERED INDEX IX_ConstraintByVocabularyNameName ON dbo.Constraint_VocabularyNameName(VocabularyName, Name)
280
+ GO
281
+
282
+ CREATE TABLE ContextAccordingTo (
283
+ -- Context According To involves Agent and Agent has Agent Name,
284
+ AgentName varchar NOT NULL,
285
+ -- Context According To involves Context Note and Context Note is an instance of Concept and Concept has Guid,
286
+ ContextNoteConceptGuid uniqueidentifier NOT NULL,
287
+ -- maybe Context According To was lodged on Date,
288
+ Date datetime NULL,
289
+ PRIMARY KEY(ContextNoteConceptGuid, AgentName),
290
+ FOREIGN KEY (ContextNoteConceptGuid) REFERENCES Concept (Guid)
291
+ )
292
+ GO
293
+
294
+ CREATE TABLE ContextAgreedBy (
295
+ -- Context Agreed By involves Agent and Agent has Agent Name,
296
+ AgentName varchar NOT NULL,
297
+ -- Context Agreed By involves Agreement and Agreement covers Context Note and Context Note is an instance of Concept and Concept has Guid,
298
+ AgreementContextNoteConceptGuid uniqueidentifier NOT NULL,
299
+ PRIMARY KEY(AgreementContextNoteConceptGuid, AgentName),
300
+ FOREIGN KEY (AgreementContextNoteConceptGuid) REFERENCES Concept (Guid)
301
+ )
302
+ GO
303
+
304
+ CREATE TABLE Derivation (
305
+ -- Derivation involves Unit and Unit is an instance of Concept and Concept has Guid,
306
+ BaseUnitConceptGuid uniqueidentifier NOT NULL,
307
+ -- Derivation involves Unit and Unit is an instance of Concept and Concept has Guid,
308
+ DerivedUnitConceptGuid uniqueidentifier NOT NULL,
309
+ -- maybe Derivation has Exponent,
310
+ Exponent smallint NULL,
311
+ PRIMARY KEY(DerivedUnitConceptGuid, BaseUnitConceptGuid),
312
+ FOREIGN KEY (BaseUnitConceptGuid) REFERENCES Concept (Guid),
313
+ FOREIGN KEY (DerivedUnitConceptGuid) REFERENCES Concept (Guid)
314
+ )
315
+ GO
316
+
317
+ CREATE TABLE Diagram (
318
+ -- Diagram is called Name,
319
+ Name varchar(64) NOT NULL,
320
+ -- Diagram is for Vocabulary and Vocabulary is called Name,
321
+ VocabularyName varchar(64) NOT NULL,
322
+ PRIMARY KEY(VocabularyName, Name)
323
+ )
324
+ GO
325
+
326
+ CREATE TABLE DiscriminatedRole (
327
+ -- Discriminated Role involves Discriminator and Discriminator is a kind of Component and Component has Guid,
328
+ DiscriminatorGuid uniqueidentifier NOT NULL,
329
+ -- Discriminated Role involves Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
330
+ RoleFactTypeConceptGuid uniqueidentifier NOT NULL,
331
+ -- Discriminated Role involves Role and Role fills Ordinal,
332
+ RoleOrdinal smallint NOT NULL,
333
+ -- Discriminated Role involves Value and Value is literal string,
334
+ ValueIsLiteralString bit NULL,
335
+ -- Discriminated Role involves Value and Value is represented by Literal,
336
+ ValueLiteral varchar NOT NULL,
337
+ -- Discriminated Role involves Value and maybe Value is in Unit and Unit is an instance of Concept and Concept has Guid,
338
+ ValueUnitConceptGuid uniqueidentifier NULL,
339
+ PRIMARY KEY(DiscriminatorGuid, RoleFactTypeConceptGuid, RoleOrdinal),
340
+ FOREIGN KEY (DiscriminatorGuid) REFERENCES Component (Guid)
341
+ )
342
+ GO
343
+
344
+ CREATE VIEW dbo.DiscriminatedRole_DiscriminatorGuidValueLiteralValueIsLiteralStringValueUnitConceptGuid (DiscriminatorGuid, ValueLiteral, ValueIsLiteralString, ValueUnitConceptGuid) WITH SCHEMABINDING AS
345
+ SELECT DiscriminatorGuid, ValueLiteral, ValueIsLiteralString, ValueUnitConceptGuid FROM dbo.DiscriminatedRole
346
+ WHERE ValueIsLiteralString IS NOT NULL
347
+ AND ValueUnitConceptGuid IS NOT NULL
348
+ GO
349
+
350
+ CREATE UNIQUE CLUSTERED INDEX IX_DiscriminatedRoleByDiscriminatorGuidValueLiteralValueIsLiteralStringValueUnitConceptGuid ON dbo.DiscriminatedRole_DiscriminatorGuidValueLiteralValueIsLiteralStringValueUnitConceptGuid(DiscriminatorGuid, ValueLiteral, ValueIsLiteralString, ValueUnitConceptGuid)
351
+ GO
352
+
353
+ CREATE TABLE FactType (
354
+ -- Fact Type is an instance of Concept and Concept has Guid,
355
+ ConceptGuid uniqueidentifier NOT NULL,
356
+ -- maybe Fact Type is nested 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
+ EntityTypeName varchar(64) NULL,
358
+ -- maybe Fact Type is nested 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
+ EntityTypeVocabularyName varchar(64) NULL,
360
+ -- maybe Fact Type is a Type Inheritance and maybe Type Inheritance uses Assimilation,
361
+ 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 Boolean,
363
+ TypeInheritanceProvidesIdentification bit NULL,
364
+ -- 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
+ TypeInheritanceSubtypeName varchar(64) NULL,
366
+ -- 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 belongs to Vocabulary and Vocabulary is called Name,
367
+ TypeInheritanceSubtypeVocabularyName varchar(64) NULL,
368
+ -- 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,
369
+ TypeInheritanceSupertypeName varchar(64) NULL,
370
+ -- 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 belongs to Vocabulary and Vocabulary is called Name,
371
+ TypeInheritanceSupertypeVocabularyName varchar(64) NULL,
372
+ PRIMARY KEY(ConceptGuid),
373
+ FOREIGN KEY (ConceptGuid) REFERENCES Concept (Guid)
374
+ )
375
+ GO
376
+
377
+ CREATE VIEW dbo.FactType_EntityTypeVocabularyNameEntityTypeName (EntityTypeVocabularyName, EntityTypeName) WITH SCHEMABINDING AS
378
+ SELECT EntityTypeVocabularyName, EntityTypeName FROM dbo.FactType
379
+ WHERE EntityTypeVocabularyName IS NOT NULL
380
+ AND EntityTypeName IS NOT NULL
381
+ GO
382
+
383
+ CREATE UNIQUE CLUSTERED INDEX IX_FactTypeByEntityTypeVocabularyNameEntityTypeName ON dbo.FactType_EntityTypeVocabularyNameEntityTypeName(EntityTypeVocabularyName, EntityTypeName)
384
+ GO
385
+
386
+ CREATE VIEW dbo.TypeInheritanceInFactType_TypeInheritanceSubtypeVocabularyNameTypeInheritanceSubtypeNameTypeInheritanceProvidesIdentific (TypeInheritanceSubtypeVocabularyName, TypeInheritanceSubtypeName, TypeInheritanceProvidesIdentification) WITH SCHEMABINDING AS
387
+ SELECT TypeInheritanceSubtypeVocabularyName, TypeInheritanceSubtypeName, TypeInheritanceProvidesIdentification FROM dbo.FactType
388
+ WHERE TypeInheritanceSubtypeVocabularyName IS NOT NULL
389
+ AND TypeInheritanceSubtypeName IS NOT NULL
390
+ AND TypeInheritanceProvidesIdentification IS NOT NULL
391
+ GO
392
+
393
+ CREATE UNIQUE CLUSTERED INDEX IX_TypeInheritanceInFactTypeByTypeInheritanceSubtypeVocabularyNameTypeInheritanceSubtypeNameTypeInheritanceProvidesIdent ON dbo.TypeInheritanceInFactType_TypeInheritanceSubtypeVocabularyNameTypeInheritanceSubtypeNameTypeInheritanceProvidesIdentific(TypeInheritanceSubtypeVocabularyName, TypeInheritanceSubtypeName, TypeInheritanceProvidesIdentification)
394
+ GO
395
+
396
+ CREATE VIEW dbo.TypeInheritanceInFactType_TypeInheritanceSubtypeVocabularyNameTypeInheritanceSubtypeNameTypeInheritanceSupertypeVocabula (TypeInheritanceSubtypeVocabularyName, TypeInheritanceSubtypeName, TypeInheritanceSupertypeVocabularyName, TypeInheritanceSupertypeName) WITH SCHEMABINDING AS
397
+ SELECT TypeInheritanceSubtypeVocabularyName, TypeInheritanceSubtypeName, TypeInheritanceSupertypeVocabularyName, TypeInheritanceSupertypeName FROM dbo.FactType
398
+ WHERE TypeInheritanceSubtypeVocabularyName IS NOT NULL
399
+ AND TypeInheritanceSubtypeName IS NOT NULL
400
+ AND TypeInheritanceSupertypeVocabularyName IS NOT NULL
401
+ AND TypeInheritanceSupertypeName IS NOT NULL
402
+ GO
403
+
404
+ CREATE UNIQUE CLUSTERED INDEX TypeInheritanceUQ ON dbo.TypeInheritanceInFactType_TypeInheritanceSubtypeVocabularyNameTypeInheritanceSubtypeNameTypeInheritanceSupertypeVocabula(TypeInheritanceSubtypeVocabularyName, TypeInheritanceSubtypeName, TypeInheritanceSupertypeVocabularyName, TypeInheritanceSupertypeName)
405
+ GO
406
+
407
+ CREATE TABLE ObjectType (
408
+ -- Object Type is an instance of Concept and Concept has Guid,
409
+ ConceptGuid uniqueidentifier NOT NULL,
410
+ -- Object Type is independent Boolean,
411
+ IsIndependent bit NULL,
412
+ -- Object Type is called Name,
413
+ Name varchar(64) NOT NULL,
414
+ -- maybe Object Type uses Pronoun,
415
+ Pronoun varchar(20) NULL CHECK(Pronoun = 'feminine' OR Pronoun = 'masculine' OR Pronoun = 'neuter' OR Pronoun = 'personal'),
416
+ -- maybe Object Type is a Domain Object Type and maybe Domain Object Type is a Value Type and maybe Value Type has Length,
417
+ ValueTypeLength int NULL,
418
+ -- maybe Object Type is a Domain Object Type and maybe Domain Object Type is a Value Type and maybe Value Type has Scale,
419
+ ValueTypeScale int NULL,
420
+ -- maybe Object Type is a Domain Object Type and maybe Domain Object Type is a Value Type and maybe Value Type is subtype of super-Value Type and Value Type is a kind of Domain Object Type and Domain Object Type is a kind of Object Type and Object Type is called Name,
421
+ ValueTypeSupertypeName varchar(64) NULL,
422
+ -- maybe Object Type is a Domain Object Type and maybe Domain Object Type is a Value Type and maybe Value Type is subtype of super-Value Type and Value 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,
423
+ ValueTypeSupertypeVocabularyName varchar(64) NULL,
424
+ -- maybe Object Type is a Domain Object Type and maybe Domain Object Type is a Value Type and maybe Value Type is auto-assigned at Transaction Phase,
425
+ ValueTypeTransactionPhase varchar NULL CHECK(ValueTypeTransactionPhase = 'assert' OR ValueTypeTransactionPhase = 'commit'),
426
+ -- maybe Object Type is a Domain Object Type and maybe Domain Object Type is a Value Type and maybe Value Type is of Unit and Unit is an instance of Concept and Concept has Guid,
427
+ ValueTypeUnitConceptGuid uniqueidentifier NULL,
428
+ -- maybe Object Type is a Domain Object Type and maybe Domain Object Type is a Value Type and maybe Value Type has Value Constraint and Value Constraint is a kind of Constraint and Constraint is an instance of Concept and Concept has Guid,
429
+ ValueTypeValueConstraintConceptGuid uniqueidentifier NULL,
430
+ -- Object Type belongs to Vocabulary and Vocabulary is called Name,
431
+ VocabularyName varchar(64) NOT NULL,
432
+ PRIMARY KEY(VocabularyName, Name),
433
+ UNIQUE(ConceptGuid),
434
+ FOREIGN KEY (ConceptGuid) REFERENCES Concept (Guid),
435
+ FOREIGN KEY (ValueTypeUnitConceptGuid) REFERENCES Concept (Guid),
436
+ FOREIGN KEY (ValueTypeValueConstraintConceptGuid) REFERENCES [Constraint] (ConceptGuid),
437
+ FOREIGN KEY (ValueTypeSupertypeVocabularyName, ValueTypeSupertypeName) REFERENCES ObjectType (VocabularyName, Name)
438
+ )
439
+ GO
440
+
441
+ CREATE VIEW dbo.ValueTypeInObjectType_ValueTypeLengthValueTypeScaleValueTypeSupertypeVocabularyNameValueTypeTransactionPhaseValueTypeUni (ValueTypeLength, ValueTypeScale, ValueTypeSupertypeVocabularyName, ValueTypeTransactionPhase, ValueTypeUnitConceptGuid, ValueTypeValueConstraintConceptGuid, ValueTypeSupertypeName) WITH SCHEMABINDING AS
442
+ SELECT ValueTypeLength, ValueTypeScale, ValueTypeSupertypeVocabularyName, ValueTypeTransactionPhase, ValueTypeUnitConceptGuid, ValueTypeValueConstraintConceptGuid, ValueTypeSupertypeName FROM dbo.ObjectType
443
+ WHERE ValueTypeLength IS NOT NULL
444
+ AND ValueTypeScale IS NOT NULL
445
+ AND ValueTypeSupertypeVocabularyName IS NOT NULL
446
+ AND ValueTypeTransactionPhase IS NOT NULL
447
+ AND ValueTypeUnitConceptGuid IS NOT NULL
448
+ AND ValueTypeValueConstraintConceptGuid IS NOT NULL
449
+ AND ValueTypeSupertypeName IS NOT NULL
450
+ GO
451
+
452
+ CREATE UNIQUE CLUSTERED INDEX DomainObjectTypeMustHaveSupertypeObjectType ON dbo.ValueTypeInObjectType_ValueTypeLengthValueTypeScaleValueTypeSupertypeVocabularyNameValueTypeTransactionPhaseValueTypeUni(ValueTypeLength, ValueTypeScale, ValueTypeSupertypeVocabularyName, ValueTypeTransactionPhase, ValueTypeUnitConceptGuid, ValueTypeValueConstraintConceptGuid, ValueTypeSupertypeName)
453
+ GO
454
+
455
+ CREATE VIEW dbo.ValueTypeInObjectType_ValueTypeValueConstraintConceptGuid (ValueTypeValueConstraintConceptGuid) WITH SCHEMABINDING AS
456
+ SELECT ValueTypeValueConstraintConceptGuid FROM dbo.ObjectType
457
+ WHERE ValueTypeValueConstraintConceptGuid IS NOT NULL
458
+ GO
459
+
460
+ CREATE UNIQUE CLUSTERED INDEX IX_ValueTypeInObjectTypeByValueTypeValueConstraintConceptGuid ON dbo.ValueTypeInObjectType_ValueTypeValueConstraintConceptGuid(ValueTypeValueConstraintConceptGuid)
461
+ GO
462
+
463
+ CREATE TABLE Play (
464
+ -- Play is input Boolean,
465
+ IsInput bit NULL,
466
+ -- Play involves Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
467
+ RoleFactTypeConceptGuid uniqueidentifier NOT NULL,
468
+ -- Play involves Role and Role fills Ordinal,
469
+ RoleOrdinal smallint NOT NULL,
470
+ -- Play involves Step and Step has Guid,
471
+ StepGuid uniqueidentifier NOT NULL,
472
+ -- Play involves Variable and Variable has Ordinal position,
473
+ VariableOrdinal smallint NOT NULL,
474
+ -- Play involves Variable and Variable is in Query and Query is an instance of Concept and Concept has Guid,
475
+ VariableQueryConceptGuid uniqueidentifier NOT NULL,
476
+ PRIMARY KEY(StepGuid, RoleFactTypeConceptGuid, RoleOrdinal)
477
+ )
478
+ GO
479
+
480
+ CREATE TABLE Population (
481
+ -- Population is an instance of Concept and Concept has Guid,
482
+ ConceptGuid uniqueidentifier NOT NULL,
483
+ -- Population has Name,
484
+ Name varchar(64) NOT NULL,
485
+ -- maybe Population belongs to Vocabulary and Vocabulary is called Name,
486
+ VocabularyName varchar(64) NULL,
487
+ UNIQUE(VocabularyName, Name),
488
+ UNIQUE(ConceptGuid),
489
+ FOREIGN KEY (ConceptGuid) REFERENCES Concept (Guid)
490
+ )
491
+ GO
492
+
493
+ CREATE TABLE Reading (
494
+ -- Reading is for Fact Type and Fact Type is an instance of Concept and Concept has Guid,
495
+ FactTypeConceptGuid uniqueidentifier NOT NULL,
496
+ -- Reading is negative Boolean,
497
+ IsNegative bit NULL,
498
+ -- Reading is in Ordinal position,
499
+ Ordinal smallint NOT NULL,
500
+ -- Reading is in Role Sequence and Role Sequence has Guid,
501
+ RoleSequenceGuid uniqueidentifier NOT NULL,
502
+ -- Reading has Text,
503
+ Text varchar(256) NOT NULL,
504
+ PRIMARY KEY(FactTypeConceptGuid, Ordinal),
505
+ FOREIGN KEY (FactTypeConceptGuid) REFERENCES FactType (ConceptGuid)
506
+ )
507
+ GO
508
+
509
+ CREATE TABLE Role (
510
+ -- Role is an instance of Concept and Concept has Guid,
511
+ ConceptGuid uniqueidentifier NOT NULL,
512
+ -- Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
513
+ FactTypeConceptGuid uniqueidentifier NOT NULL,
514
+ -- 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
+ LinkFactTypeConceptGuid uniqueidentifier NULL,
516
+ -- Role is played by Object Type and Object Type is called Name,
517
+ ObjectTypeName varchar(64) NOT NULL,
518
+ -- Role is played by Object Type and Object Type belongs to Vocabulary and Vocabulary is called Name,
519
+ ObjectTypeVocabularyName varchar(64) NOT NULL,
520
+ -- Role fills Ordinal,
521
+ Ordinal smallint NOT NULL,
522
+ -- maybe Role has role-Name,
523
+ RoleName varchar(64) NULL,
524
+ PRIMARY KEY(FactTypeConceptGuid, Ordinal),
525
+ UNIQUE(ConceptGuid),
526
+ FOREIGN KEY (ConceptGuid) REFERENCES Concept (Guid),
527
+ FOREIGN KEY (LinkFactTypeConceptGuid) REFERENCES FactType (ConceptGuid),
528
+ FOREIGN KEY (FactTypeConceptGuid) REFERENCES FactType (ConceptGuid),
529
+ FOREIGN KEY (ObjectTypeVocabularyName, ObjectTypeName) REFERENCES ObjectType (VocabularyName, Name)
530
+ )
531
+ GO
532
+
533
+ CREATE VIEW dbo.Role_LinkFactTypeConceptGuid (LinkFactTypeConceptGuid) WITH SCHEMABINDING AS
534
+ SELECT LinkFactTypeConceptGuid FROM dbo.Role
535
+ WHERE LinkFactTypeConceptGuid IS NOT NULL
536
+ GO
537
+
538
+ CREATE UNIQUE CLUSTERED INDEX IX_RoleByLinkFactTypeConceptGuid ON dbo.Role_LinkFactTypeConceptGuid(LinkFactTypeConceptGuid)
539
+ GO
540
+
541
+ CREATE TABLE RoleDisplay (
542
+ -- Role Display involves Fact Type Shape and Fact Type Shape is a kind of Shape and Shape has Guid,
543
+ FactTypeShapeGuid uniqueidentifier NOT NULL,
544
+ -- Role Display involves Ordinal,
545
+ Ordinal smallint NOT NULL,
546
+ -- Role Display involves Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
547
+ RoleFactTypeConceptGuid uniqueidentifier NOT NULL,
548
+ -- Role Display involves Role and Role fills Ordinal,
549
+ RoleOrdinal smallint NOT NULL,
550
+ PRIMARY KEY(FactTypeShapeGuid, Ordinal),
551
+ FOREIGN KEY (RoleFactTypeConceptGuid, RoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
552
+ )
553
+ GO
554
+
555
+ CREATE TABLE RoleRef (
556
+ -- maybe Role Ref has leading-Adjective,
557
+ LeadingAdjective varchar(64) NULL,
558
+ -- Role Ref involves Ordinal,
559
+ Ordinal smallint NOT NULL,
560
+ -- maybe Role Ref is projected from Play and Play involves Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
561
+ PlayRoleFactTypeConceptGuid uniqueidentifier NULL,
562
+ -- maybe Role Ref is projected from Play and Play involves Role and Role fills Ordinal,
563
+ PlayRoleOrdinal smallint NULL,
564
+ -- maybe Role Ref is projected from Play and Play involves Step and Step has Guid,
565
+ PlayStepGuid uniqueidentifier NULL,
566
+ -- Role Ref involves Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
567
+ RoleFactTypeConceptGuid uniqueidentifier NOT NULL,
568
+ -- Role Ref involves Role and Role fills Ordinal,
569
+ RoleOrdinal smallint NOT NULL,
570
+ -- Role Ref involves Role Sequence and Role Sequence has Guid,
571
+ RoleSequenceGuid uniqueidentifier NOT NULL,
572
+ -- maybe Role Ref has trailing-Adjective,
573
+ TrailingAdjective varchar(64) NULL,
574
+ PRIMARY KEY(RoleSequenceGuid, Ordinal),
575
+ UNIQUE(RoleFactTypeConceptGuid, RoleOrdinal, RoleSequenceGuid),
576
+ FOREIGN KEY (PlayStepGuid, PlayRoleFactTypeConceptGuid, PlayRoleOrdinal) REFERENCES Play (StepGuid, RoleFactTypeConceptGuid, RoleOrdinal),
577
+ FOREIGN KEY (RoleFactTypeConceptGuid, RoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
578
+ )
579
+ GO
580
+
581
+ CREATE VIEW dbo.RoleRef_PlayStepGuidPlayRoleFactTypeConceptGuidPlayRoleOrdinal (PlayStepGuid, PlayRoleFactTypeConceptGuid, PlayRoleOrdinal) WITH SCHEMABINDING AS
582
+ SELECT PlayStepGuid, PlayRoleFactTypeConceptGuid, PlayRoleOrdinal FROM dbo.RoleRef
583
+ WHERE PlayStepGuid IS NOT NULL
584
+ AND PlayRoleFactTypeConceptGuid IS NOT NULL
585
+ AND PlayRoleOrdinal IS NOT NULL
586
+ GO
587
+
588
+ CREATE UNIQUE CLUSTERED INDEX IX_RoleRefByPlayStepGuidPlayRoleFactTypeConceptGuidPlayRoleOrdinal ON dbo.RoleRef_PlayStepGuidPlayRoleFactTypeConceptGuidPlayRoleOrdinal(PlayStepGuid, PlayRoleFactTypeConceptGuid, PlayRoleOrdinal)
589
+ GO
590
+
591
+ CREATE TABLE RoleSequence (
592
+ -- Role Sequence has Guid,
593
+ Guid uniqueidentifier NOT NULL,
594
+ -- Role Sequence has unused dependency to force table in norma Boolean,
595
+ HasUnusedDependencyToForceTableInNorma bit NULL,
596
+ PRIMARY KEY(Guid)
597
+ )
598
+ GO
599
+
600
+ CREATE TABLE RoleValue (
601
+ -- Role Value fulfils Fact and Fact is an instance of Concept and Concept has Guid,
602
+ FactConceptGuid uniqueidentifier NOT NULL,
603
+ -- Role Value is of Instance and Instance is an instance of Concept and Concept has Guid,
604
+ InstanceConceptGuid uniqueidentifier NOT NULL,
605
+ -- Role Value belongs to Population and Population has Name,
606
+ PopulationName varchar(64) NOT NULL,
607
+ -- Role Value belongs to Population and maybe Population belongs to Vocabulary and Vocabulary is called Name,
608
+ PopulationVocabularyName varchar(64) NULL,
609
+ -- Role Value is of Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
610
+ RoleFactTypeConceptGuid uniqueidentifier NOT NULL,
611
+ -- Role Value is of Role and Role fills Ordinal,
612
+ RoleOrdinal smallint NOT NULL,
613
+ PRIMARY KEY(FactConceptGuid, RoleFactTypeConceptGuid, RoleOrdinal),
614
+ FOREIGN KEY (FactConceptGuid) REFERENCES Concept (Guid),
615
+ FOREIGN KEY (InstanceConceptGuid) REFERENCES Concept (Guid),
616
+ FOREIGN KEY (PopulationVocabularyName, PopulationName) REFERENCES Population (VocabularyName, Name),
617
+ FOREIGN KEY (RoleFactTypeConceptGuid, RoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
618
+ )
619
+ GO
620
+
621
+ CREATE TABLE SetComparisonRoles (
622
+ -- Set Comparison Roles involves Ordinal,
623
+ Ordinal smallint NOT NULL,
624
+ -- Set Comparison Roles involves Role Sequence and Role Sequence has Guid,
625
+ RoleSequenceGuid uniqueidentifier NOT NULL,
626
+ -- Set Comparison Roles involves Set Comparison Constraint and Set Comparison Constraint is a kind of Set Constraint and Set Constraint is a kind of Constraint and Constraint is an instance of Concept and Concept has Guid,
627
+ SetComparisonConstraintConceptGuid uniqueidentifier NOT NULL,
628
+ PRIMARY KEY(SetComparisonConstraintConceptGuid, Ordinal),
629
+ UNIQUE(SetComparisonConstraintConceptGuid, RoleSequenceGuid),
630
+ FOREIGN KEY (SetComparisonConstraintConceptGuid) REFERENCES [Constraint] (ConceptGuid),
631
+ FOREIGN KEY (RoleSequenceGuid) REFERENCES RoleSequence (Guid)
632
+ )
633
+ GO
634
+
635
+ CREATE TABLE Shape (
636
+ -- maybe Shape is a Constraint Shape and Constraint Shape is for Constraint and Constraint is an instance of Concept and Concept has Guid,
637
+ ConstraintShapeConstraintConceptGuid uniqueidentifier NULL,
638
+ -- maybe Shape is a Fact Type Shape and maybe Fact Type Shape has Display Role Names Setting,
639
+ FactTypeShapeDisplayRoleNamesSetting varchar NULL CHECK(FactTypeShapeDisplayRoleNamesSetting = 'false' OR FactTypeShapeDisplayRoleNamesSetting = 'true'),
640
+ -- maybe Shape is a Fact Type Shape and Fact Type Shape is for Fact Type and Fact Type is an instance of Concept and Concept has Guid,
641
+ FactTypeShapeFactTypeConceptGuid uniqueidentifier NULL,
642
+ -- maybe Shape is a Fact Type Shape and maybe Fact Type Shape has Rotation Setting,
643
+ FactTypeShapeRotationSetting varchar NULL CHECK(FactTypeShapeRotationSetting = 'left' OR FactTypeShapeRotationSetting = 'right'),
644
+ -- Shape has Guid,
645
+ Guid uniqueidentifier NOT NULL,
646
+ -- Shape is expanded Boolean,
647
+ IsExpanded bit NULL,
648
+ -- maybe Shape is at Location and Location is at X,
649
+ LocationX int NULL,
650
+ -- maybe Shape is at Location and Location is at Y,
651
+ LocationY int NULL,
652
+ -- maybe Shape is a Model Note Shape and Model Note Shape is for Context Note and Context Note is an instance of Concept and Concept has Guid,
653
+ ModelNoteShapeContextNoteConceptGuid uniqueidentifier NULL,
654
+ -- Shape is in ORM Diagram and ORM Diagram is a kind of Diagram and Diagram is called Name,
655
+ ORMDiagramName varchar(64) NOT NULL,
656
+ -- Shape is in ORM Diagram and ORM Diagram is a kind of Diagram and Diagram is for Vocabulary and Vocabulary is called Name,
657
+ ORMDiagramVocabularyName varchar(64) NOT NULL,
658
+ -- maybe Shape is an Object Type Shape and Object Type Shape has expanded reference mode Boolean,
659
+ ObjectTypeShapeHasExpandedReferenceMode bit NULL,
660
+ -- maybe Shape is an Object Type Shape and Object Type Shape is for Object Type and Object Type is called Name,
661
+ ObjectTypeShapeObjectTypeName varchar(64) NULL,
662
+ -- maybe Shape is an Object Type Shape and Object Type Shape is for Object Type and Object Type belongs to Vocabulary and Vocabulary is called Name,
663
+ ObjectTypeShapeObjectTypeVocabularyName varchar(64) NULL,
664
+ -- maybe Shape is an Objectified Fact Type Name Shape and Objectified Fact Type Name Shape is for Fact Type Shape and Fact Type Shape is a kind of Shape and Shape has Guid,
665
+ ObjectifiedFactTypeNameShapeFactTypeShapeGuid uniqueidentifier NULL,
666
+ -- maybe Shape is a Reading Shape and Reading Shape is for Fact Type Shape and Fact Type Shape is a kind of Shape and Shape has Guid,
667
+ ReadingShapeFactTypeShapeGuid uniqueidentifier NULL,
668
+ -- maybe Shape is a Reading Shape and Reading Shape is for Reading and Reading is for Fact Type and Fact Type is an instance of Concept and Concept has Guid,
669
+ ReadingShapeReadingFactTypeConceptGuid uniqueidentifier NULL,
670
+ -- maybe Shape is a Reading Shape and Reading Shape is for Reading and Reading is in Ordinal position,
671
+ ReadingShapeReadingOrdinal smallint NULL,
672
+ -- maybe Shape is a Constraint Shape and maybe Constraint Shape is a Ring Constraint Shape and Ring Constraint Shape is attached to Fact Type Shape and Fact Type Shape is a kind of Shape and Shape has Guid,
673
+ RingConstraintShapeFactTypeShapeGuid uniqueidentifier NULL,
674
+ -- maybe Shape is a Role Name Shape and Role Name Shape is for Role Display and Role Display involves Fact Type Shape and Fact Type Shape is a kind of Shape and Shape has Guid,
675
+ RoleNameShapeRoleDisplayFactTypeShapeGuid uniqueidentifier NULL,
676
+ -- maybe Shape is a Role Name Shape and Role Name Shape is for Role Display and Role Display involves Ordinal,
677
+ RoleNameShapeRoleDisplayOrdinal smallint NULL,
678
+ -- maybe Shape is a Constraint Shape and maybe Constraint Shape is a Value Constraint Shape and maybe Value Constraint Shape is for Object Type Shape and Object Type Shape is a kind of Shape and Shape has Guid,
679
+ ValueConstraintShapeObjectTypeShapeGuid uniqueidentifier NULL,
680
+ -- maybe Shape is a Constraint Shape and maybe Constraint Shape is a Value Constraint Shape and maybe Value Constraint Shape is for Role Display and Role Display involves Fact Type Shape and Fact Type Shape is a kind of Shape and Shape has Guid,
681
+ ValueConstraintShapeRoleDisplayFactTypeShapeGuid uniqueidentifier NULL,
682
+ -- maybe Shape is a Constraint Shape and maybe Constraint Shape is a Value Constraint Shape and maybe Value Constraint Shape is for Role Display and Role Display involves Ordinal,
683
+ ValueConstraintShapeRoleDisplayOrdinal smallint NULL,
684
+ PRIMARY KEY(Guid),
685
+ FOREIGN KEY (ModelNoteShapeContextNoteConceptGuid) REFERENCES Concept (Guid),
686
+ FOREIGN KEY (ConstraintShapeConstraintConceptGuid) REFERENCES [Constraint] (ConceptGuid),
687
+ FOREIGN KEY (ORMDiagramVocabularyName, ORMDiagramName) REFERENCES Diagram (VocabularyName, Name),
688
+ FOREIGN KEY (FactTypeShapeFactTypeConceptGuid) REFERENCES FactType (ConceptGuid),
689
+ FOREIGN KEY (ObjectTypeShapeObjectTypeVocabularyName, ObjectTypeShapeObjectTypeName) REFERENCES ObjectType (VocabularyName, Name),
690
+ FOREIGN KEY (ReadingShapeReadingFactTypeConceptGuid, ReadingShapeReadingOrdinal) REFERENCES Reading (FactTypeConceptGuid, Ordinal),
691
+ FOREIGN KEY (ValueConstraintShapeRoleDisplayFactTypeShapeGuid, ValueConstraintShapeRoleDisplayOrdinal) REFERENCES RoleDisplay (FactTypeShapeGuid, Ordinal),
692
+ FOREIGN KEY (RoleNameShapeRoleDisplayFactTypeShapeGuid, RoleNameShapeRoleDisplayOrdinal) REFERENCES RoleDisplay (FactTypeShapeGuid, Ordinal),
693
+ FOREIGN KEY (RingConstraintShapeFactTypeShapeGuid) REFERENCES Shape (Guid),
694
+ FOREIGN KEY (ValueConstraintShapeObjectTypeShapeGuid) REFERENCES Shape (Guid),
695
+ FOREIGN KEY (ObjectifiedFactTypeNameShapeFactTypeShapeGuid) REFERENCES Shape (Guid),
696
+ FOREIGN KEY (ReadingShapeFactTypeShapeGuid) REFERENCES Shape (Guid)
697
+ )
698
+ GO
699
+
700
+ CREATE VIEW dbo.Shape_ORMDiagramVocabularyNameORMDiagramNameLocationXLocationY (ORMDiagramVocabularyName, ORMDiagramName, LocationX, LocationY) WITH SCHEMABINDING AS
701
+ SELECT ORMDiagramVocabularyName, ORMDiagramName, LocationX, LocationY FROM dbo.Shape
702
+ WHERE LocationX IS NOT NULL
703
+ AND LocationY IS NOT NULL
704
+ GO
705
+
706
+ CREATE UNIQUE CLUSTERED INDEX IX_ShapeByORMDiagramVocabularyNameORMDiagramNameLocationXLocationY ON dbo.Shape_ORMDiagramVocabularyNameORMDiagramNameLocationXLocationY(ORMDiagramVocabularyName, ORMDiagramName, LocationX, LocationY)
707
+ GO
708
+
709
+ CREATE VIEW dbo.ObjectifiedFactTypeNameShapeInShape_ObjectifiedFactTypeNameShapeFactTypeShapeGuid (ObjectifiedFactTypeNameShapeFactTypeShapeGuid) WITH SCHEMABINDING AS
710
+ SELECT ObjectifiedFactTypeNameShapeFactTypeShapeGuid FROM dbo.Shape
711
+ WHERE ObjectifiedFactTypeNameShapeFactTypeShapeGuid IS NOT NULL
712
+ GO
713
+
714
+ CREATE UNIQUE CLUSTERED INDEX IX_ObjectifiedFactTypeNameShapeInShapeByObjectifiedFactTypeNameShapeFactTypeShapeGuid ON dbo.ObjectifiedFactTypeNameShapeInShape_ObjectifiedFactTypeNameShapeFactTypeShapeGuid(ObjectifiedFactTypeNameShapeFactTypeShapeGuid)
715
+ GO
716
+
717
+ CREATE VIEW dbo.ReadingShapeInShape_ReadingShapeFactTypeShapeGuid (ReadingShapeFactTypeShapeGuid) WITH SCHEMABINDING AS
718
+ SELECT ReadingShapeFactTypeShapeGuid FROM dbo.Shape
719
+ WHERE ReadingShapeFactTypeShapeGuid IS NOT NULL
720
+ GO
721
+
722
+ CREATE UNIQUE CLUSTERED INDEX IX_ReadingShapeInShapeByReadingShapeFactTypeShapeGuid ON dbo.ReadingShapeInShape_ReadingShapeFactTypeShapeGuid(ReadingShapeFactTypeShapeGuid)
723
+ GO
724
+
725
+ CREATE VIEW dbo.RoleNameShapeInShape_RoleNameShapeRoleDisplayFactTypeShapeGuidRoleNameShapeRoleDisplayOrdinal (RoleNameShapeRoleDisplayFactTypeShapeGuid, RoleNameShapeRoleDisplayOrdinal) WITH SCHEMABINDING AS
726
+ SELECT RoleNameShapeRoleDisplayFactTypeShapeGuid, RoleNameShapeRoleDisplayOrdinal FROM dbo.Shape
727
+ WHERE RoleNameShapeRoleDisplayFactTypeShapeGuid IS NOT NULL
728
+ AND RoleNameShapeRoleDisplayOrdinal IS NOT NULL
729
+ GO
730
+
731
+ CREATE UNIQUE CLUSTERED INDEX IX_RoleNameShapeInShapeByRoleNameShapeRoleDisplayFactTypeShapeGuidRoleNameShapeRoleDisplayOrdinal ON dbo.RoleNameShapeInShape_RoleNameShapeRoleDisplayFactTypeShapeGuidRoleNameShapeRoleDisplayOrdinal(RoleNameShapeRoleDisplayFactTypeShapeGuid, RoleNameShapeRoleDisplayOrdinal)
732
+ GO
733
+
734
+ CREATE VIEW dbo.ValueConstraintShapeInShape_ValueConstraintShapeRoleDisplayFactTypeShapeGuidValueConstraintShapeRoleDisplayOrdinal (ValueConstraintShapeRoleDisplayFactTypeShapeGuid, ValueConstraintShapeRoleDisplayOrdinal) WITH SCHEMABINDING AS
735
+ SELECT ValueConstraintShapeRoleDisplayFactTypeShapeGuid, ValueConstraintShapeRoleDisplayOrdinal FROM dbo.Shape
736
+ WHERE ValueConstraintShapeRoleDisplayFactTypeShapeGuid IS NOT NULL
737
+ AND ValueConstraintShapeRoleDisplayOrdinal IS NOT NULL
738
+ GO
739
+
740
+ CREATE UNIQUE CLUSTERED INDEX IX_ValueConstraintShapeInShapeByValueConstraintShapeRoleDisplayFactTypeShapeGuidValueConstraintShapeRoleDisplayOrdinal ON dbo.ValueConstraintShapeInShape_ValueConstraintShapeRoleDisplayFactTypeShapeGuidValueConstraintShapeRoleDisplayOrdinal(ValueConstraintShapeRoleDisplayFactTypeShapeGuid, ValueConstraintShapeRoleDisplayOrdinal)
741
+ GO
742
+
743
+ CREATE TABLE Step (
744
+ -- maybe Step falls under Alternative Set and Alternative Set has Guid,
745
+ AlternativeSetGuid uniqueidentifier NULL,
746
+ -- Step specifies Fact Type and Fact Type is an instance of Concept and Concept has Guid,
747
+ FactTypeConceptGuid uniqueidentifier NOT NULL,
748
+ -- Step has Guid,
749
+ Guid uniqueidentifier NOT NULL,
750
+ -- Step is disallowed Boolean,
751
+ IsDisallowed bit NULL,
752
+ -- Step is optional Boolean,
753
+ IsOptional bit NULL,
754
+ PRIMARY KEY(Guid),
755
+ FOREIGN KEY (AlternativeSetGuid) REFERENCES AlternativeSet (Guid),
756
+ FOREIGN KEY (FactTypeConceptGuid) REFERENCES FactType (ConceptGuid)
757
+ )
758
+ GO
759
+
760
+ CREATE TABLE Value (
761
+ -- Value is literal string,
762
+ IsLiteralString bit NULL,
763
+ -- Value is represented by Literal,
764
+ Literal varchar NOT NULL,
765
+ -- maybe Value is in Unit and Unit is an instance of Concept and Concept has Guid,
766
+ UnitConceptGuid uniqueidentifier NULL,
767
+ -- Value is of Value Type and Value Type is a kind of Domain Object Type and Domain Object Type is a kind of Object Type and Object Type is called Name,
768
+ ValueTypeName varchar(64) NOT NULL,
769
+ -- Value is of Value Type and Value 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,
770
+ ValueTypeVocabularyName varchar(64) NOT NULL,
771
+ UNIQUE(Literal, IsLiteralString, UnitConceptGuid),
772
+ FOREIGN KEY (UnitConceptGuid) REFERENCES Concept (Guid),
773
+ FOREIGN KEY (ValueTypeVocabularyName, ValueTypeName) REFERENCES ObjectType (VocabularyName, Name)
774
+ )
775
+ GO
776
+
777
+ CREATE TABLE ValueTypeParameter (
778
+ -- Value Type Parameter requires value of facet-Value Type and Value Type is a kind of Domain Object Type and Domain Object Type is a kind of Object Type and Object Type is called Name,
779
+ FacetValueTypeName varchar(64) NOT NULL,
780
+ -- Value Type Parameter requires value of facet-Value Type and Value 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,
781
+ FacetValueTypeVocabularyName varchar(64) NOT NULL,
782
+ -- Value Type Parameter involves Name,
783
+ Name varchar(64) NOT NULL,
784
+ -- Value Type Parameter involves Value Type and Value Type is a kind of Domain Object Type and Domain Object Type is a kind of Object Type and Object Type is called Name,
785
+ ValueTypeName varchar(64) NOT NULL,
786
+ -- Value Type Parameter involves Value Type and Value 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,
787
+ ValueTypeVocabularyName varchar(64) NOT NULL,
788
+ PRIMARY KEY(ValueTypeVocabularyName, ValueTypeName, Name),
789
+ FOREIGN KEY (FacetValueTypeVocabularyName, FacetValueTypeName) REFERENCES ObjectType (VocabularyName, Name),
790
+ FOREIGN KEY (ValueTypeVocabularyName, ValueTypeName) REFERENCES ObjectType (VocabularyName, Name)
791
+ )
792
+ GO
793
+
794
+ CREATE TABLE ValueTypeParameterRestriction (
795
+ -- Value Type Parameter Restriction has Value and Value is literal string,
796
+ ValueIsLiteralString bit NULL,
797
+ -- Value Type Parameter Restriction has Value and Value is represented by Literal,
798
+ ValueLiteral varchar NOT NULL,
799
+ -- Value Type Parameter Restriction involves Value Type and Value Type is a kind of Domain Object Type and Domain Object Type is a kind of Object Type and Object Type is called Name,
800
+ ValueTypeName varchar(64) NOT NULL,
801
+ -- Value Type Parameter Restriction involves Value Type Parameter and Value Type Parameter involves Name,
802
+ ValueTypeParameterName varchar(64) NOT NULL,
803
+ -- Value Type Parameter Restriction involves Value Type Parameter and Value Type Parameter involves Value Type and Value Type is a kind of Domain Object Type and Domain Object Type is a kind of Object Type and Object Type is called Name,
804
+ ValueTypeParameterValueTypeName varchar(64) NOT NULL,
805
+ -- Value Type Parameter Restriction involves Value Type Parameter and Value Type Parameter involves Value Type and Value 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,
806
+ ValueTypeParameterValueTypeVocabularyName varchar(64) NOT NULL,
807
+ -- Value Type Parameter Restriction involves Value Type and Value 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,
808
+ ValueTypeVocabularyName varchar(64) NOT NULL,
809
+ -- Value Type Parameter Restriction has Value and maybe Value is in Unit and Unit is an instance of Concept and Concept has Guid,
810
+ ValueUnitConceptGuid uniqueidentifier NULL,
811
+ PRIMARY KEY(ValueTypeVocabularyName, ValueTypeName, ValueTypeParameterValueTypeVocabularyName, ValueTypeParameterValueTypeName, ValueTypeParameterName),
812
+ FOREIGN KEY (ValueTypeVocabularyName, ValueTypeName) REFERENCES ObjectType (VocabularyName, Name),
813
+ FOREIGN KEY (ValueLiteral, ValueIsLiteralString, ValueUnitConceptGuid) REFERENCES Value (Literal, IsLiteralString, UnitConceptGuid),
814
+ FOREIGN KEY (ValueTypeParameterValueTypeVocabularyName, ValueTypeParameterValueTypeName, ValueTypeParameterName) REFERENCES ValueTypeParameter (ValueTypeVocabularyName, ValueTypeName, Name)
815
+ )
816
+ GO
817
+
818
+ CREATE TABLE Variable (
819
+ -- Variable is for Object Type and Object Type is called Name,
820
+ ObjectTypeName varchar(64) NOT NULL,
821
+ -- Variable is for Object Type and Object Type belongs to Vocabulary and Vocabulary is called Name,
822
+ ObjectTypeVocabularyName varchar(64) NOT NULL,
823
+ -- Variable has Ordinal position,
824
+ Ordinal smallint NOT NULL,
825
+ -- maybe Variable projects Role and Role belongs to Fact Type and Fact Type is an instance of Concept and Concept has Guid,
826
+ ProjectionFactTypeConceptGuid uniqueidentifier NULL,
827
+ -- maybe Variable projects Role and Role fills Ordinal,
828
+ ProjectionOrdinal smallint NULL,
829
+ -- Variable is in Query and Query is an instance of Concept and Concept has Guid,
830
+ QueryConceptGuid uniqueidentifier NOT NULL,
831
+ -- maybe Variable has role-Name,
832
+ RoleName varchar(64) NULL,
833
+ -- maybe Variable matches nesting over Step and Step has Guid,
834
+ StepGuid uniqueidentifier NULL,
835
+ -- maybe Variable has Subscript,
836
+ Subscript smallint NULL,
837
+ -- maybe Variable is bound to Value and Value is literal string,
838
+ ValueIsLiteralString bit NULL,
839
+ -- maybe Variable is bound to Value and Value is represented by Literal,
840
+ ValueLiteral varchar NULL,
841
+ -- maybe Variable is bound to Value and maybe Value is in Unit and Unit is an instance of Concept and Concept has Guid,
842
+ ValueUnitConceptGuid uniqueidentifier NULL,
843
+ PRIMARY KEY(QueryConceptGuid, Ordinal),
844
+ FOREIGN KEY (QueryConceptGuid) REFERENCES Concept (Guid),
845
+ FOREIGN KEY (ObjectTypeVocabularyName, ObjectTypeName) REFERENCES ObjectType (VocabularyName, Name),
846
+ FOREIGN KEY (ProjectionFactTypeConceptGuid, ProjectionOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal),
847
+ FOREIGN KEY (StepGuid) REFERENCES Step (Guid),
848
+ FOREIGN KEY (ValueLiteral, ValueIsLiteralString, ValueUnitConceptGuid) REFERENCES Value (Literal, IsLiteralString, UnitConceptGuid)
849
+ )
850
+ GO
851
+
852
+ CREATE VIEW dbo.Variable_ProjectionFactTypeConceptGuidProjectionOrdinal (ProjectionFactTypeConceptGuid, ProjectionOrdinal) WITH SCHEMABINDING AS
853
+ SELECT ProjectionFactTypeConceptGuid, ProjectionOrdinal FROM dbo.Variable
854
+ WHERE ProjectionFactTypeConceptGuid IS NOT NULL
855
+ AND ProjectionOrdinal IS NOT NULL
856
+ GO
857
+
858
+ CREATE UNIQUE CLUSTERED INDEX IX_VariableByProjectionFactTypeConceptGuidProjectionOrdinal ON dbo.Variable_ProjectionFactTypeConceptGuidProjectionOrdinal(ProjectionFactTypeConceptGuid, ProjectionOrdinal)
859
+ GO
860
+
861
+ CREATE VIEW dbo.Variable_StepGuid (StepGuid) WITH SCHEMABINDING AS
862
+ SELECT StepGuid FROM dbo.Variable
863
+ WHERE StepGuid IS NOT NULL
864
+ GO
865
+
866
+ CREATE UNIQUE CLUSTERED INDEX IX_VariableByStepGuid ON dbo.Variable_StepGuid(StepGuid)
867
+ GO
868
+
869
+ ALTER TABLE Aggregation
870
+ ADD FOREIGN KEY (AggregatedVariableQueryConceptGuid, AggregatedVariableOrdinal) REFERENCES Variable (QueryConceptGuid, Ordinal)
871
+ GO
872
+
873
+ ALTER TABLE Aggregation
874
+ ADD FOREIGN KEY (VariableQueryConceptGuid, VariableOrdinal) REFERENCES Variable (QueryConceptGuid, Ordinal)
875
+ GO
876
+
877
+ ALTER TABLE AllowedRange
878
+ ADD FOREIGN KEY (ValueConstraintConceptGuid) REFERENCES [Constraint] (ConceptGuid)
879
+ GO
880
+
881
+ ALTER TABLE AllowedRange
882
+ ADD FOREIGN KEY (ValueRangeMaximumBoundValueLiteral, ValueRangeMaximumBoundValueIsLiteralString, ValueRangeMaximumBoundValueUnitConceptGuid) REFERENCES Value (Literal, IsLiteralString, UnitConceptGuid)
883
+ GO
884
+
885
+ ALTER TABLE AllowedRange
886
+ ADD FOREIGN KEY (ValueRangeMinimumBoundValueLiteral, ValueRangeMinimumBoundValueIsLiteralString, ValueRangeMinimumBoundValueUnitConceptGuid) REFERENCES Value (Literal, IsLiteralString, UnitConceptGuid)
887
+ GO
888
+
889
+ ALTER TABLE Component
890
+ ADD FOREIGN KEY (MappingCompositionGuid) REFERENCES Composition (Guid)
891
+ GO
892
+
893
+ ALTER TABLE Component
894
+ ADD FOREIGN KEY (MappingObjectTypeVocabularyName, MappingObjectTypeName) REFERENCES ObjectType (VocabularyName, Name)
895
+ GO
896
+
897
+ ALTER TABLE Component
898
+ ADD FOREIGN KEY (AbsorptionChildRoleFactTypeConceptGuid, AbsorptionChildRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
899
+ GO
900
+
901
+ ALTER TABLE Component
902
+ ADD FOREIGN KEY (AbsorptionIndexRoleFactTypeConceptGuid, AbsorptionIndexRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
903
+ GO
904
+
905
+ ALTER TABLE Component
906
+ ADD FOREIGN KEY (AbsorptionParentRoleFactTypeConceptGuid, AbsorptionParentRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
907
+ GO
908
+
909
+ ALTER TABLE Component
910
+ ADD FOREIGN KEY (IndicatorRoleFactTypeConceptGuid, IndicatorRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
911
+ GO
912
+
913
+ ALTER TABLE Concept
914
+ ADD FOREIGN KEY (FactTypeConceptGuid) REFERENCES FactType (ConceptGuid)
915
+ GO
916
+
917
+ ALTER TABLE Concept
918
+ ADD FOREIGN KEY (InstanceObjectTypeVocabularyName, InstanceObjectTypeName) REFERENCES ObjectType (VocabularyName, Name)
919
+ GO
920
+
921
+ ALTER TABLE Concept
922
+ ADD FOREIGN KEY (FactPopulationVocabularyName, FactPopulationName) REFERENCES Population (VocabularyName, Name)
923
+ GO
924
+
925
+ ALTER TABLE Concept
926
+ ADD FOREIGN KEY (InstancePopulationVocabularyName, InstancePopulationName) REFERENCES Population (VocabularyName, Name)
927
+ GO
928
+
929
+ ALTER TABLE Concept
930
+ ADD FOREIGN KEY (InstanceValueLiteral, InstanceValueIsLiteralString, InstanceValueUnitConceptGuid) REFERENCES Value (Literal, IsLiteralString, UnitConceptGuid)
931
+ GO
932
+
933
+ ALTER TABLE [Constraint]
934
+ ADD FOREIGN KEY (RingConstraintOtherRoleFactTypeConceptGuid, RingConstraintOtherRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
935
+ GO
936
+
937
+ ALTER TABLE [Constraint]
938
+ ADD FOREIGN KEY (RingConstraintRoleFactTypeConceptGuid, RingConstraintRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
939
+ GO
940
+
941
+ ALTER TABLE [Constraint]
942
+ ADD FOREIGN KEY (ValueConstraintRoleFactTypeConceptGuid, ValueConstraintRoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
943
+ GO
944
+
945
+ ALTER TABLE [Constraint]
946
+ ADD FOREIGN KEY (PresenceConstraintRoleSequenceGuid) REFERENCES RoleSequence (Guid)
947
+ GO
948
+
949
+ ALTER TABLE [Constraint]
950
+ ADD FOREIGN KEY (SubsetConstraintSubsetRoleSequenceGuid) REFERENCES RoleSequence (Guid)
951
+ GO
952
+
953
+ ALTER TABLE [Constraint]
954
+ ADD FOREIGN KEY (SubsetConstraintSupersetRoleSequenceGuid) REFERENCES RoleSequence (Guid)
955
+ GO
956
+
957
+ ALTER TABLE DiscriminatedRole
958
+ ADD FOREIGN KEY (RoleFactTypeConceptGuid, RoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
959
+ GO
960
+
961
+ ALTER TABLE DiscriminatedRole
962
+ ADD FOREIGN KEY (ValueLiteral, ValueIsLiteralString, ValueUnitConceptGuid) REFERENCES Value (Literal, IsLiteralString, UnitConceptGuid)
963
+ GO
964
+
965
+ ALTER TABLE FactType
966
+ ADD FOREIGN KEY (EntityTypeVocabularyName, EntityTypeName) REFERENCES ObjectType (VocabularyName, Name)
967
+ GO
968
+
969
+ ALTER TABLE FactType
970
+ ADD FOREIGN KEY (TypeInheritanceSubtypeVocabularyName, TypeInheritanceSubtypeName) REFERENCES ObjectType (VocabularyName, Name)
971
+ GO
972
+
973
+ ALTER TABLE FactType
974
+ ADD FOREIGN KEY (TypeInheritanceSupertypeVocabularyName, TypeInheritanceSupertypeName) REFERENCES ObjectType (VocabularyName, Name)
975
+ GO
976
+
977
+ ALTER TABLE Play
978
+ ADD FOREIGN KEY (RoleFactTypeConceptGuid, RoleOrdinal) REFERENCES Role (FactTypeConceptGuid, Ordinal)
979
+ GO
980
+
981
+ ALTER TABLE Play
982
+ ADD FOREIGN KEY (StepGuid) REFERENCES Step (Guid)
983
+ GO
984
+
985
+ ALTER TABLE Play
986
+ ADD FOREIGN KEY (VariableQueryConceptGuid, VariableOrdinal) REFERENCES Variable (QueryConceptGuid, Ordinal)
987
+ GO
988
+
989
+ ALTER TABLE Reading
990
+ ADD FOREIGN KEY (RoleSequenceGuid) REFERENCES RoleSequence (Guid)
991
+ GO
992
+
993
+ ALTER TABLE RoleDisplay
994
+ ADD FOREIGN KEY (FactTypeShapeGuid) REFERENCES Shape (Guid)
995
+ GO
996
+
997
+ ALTER TABLE RoleRef
998
+ ADD FOREIGN KEY (RoleSequenceGuid) REFERENCES RoleSequence (Guid)
999
+ GO
1000
+