activefacts-examples 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +10 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +22 -0
  8. data/Rakefile +6 -0
  9. data/activefacts-examples.gemspec +26 -0
  10. data/cql/Address.cql +44 -0
  11. data/cql/Astronomy.cql +35 -0
  12. data/cql/Blog.cql +54 -0
  13. data/cql/CinemaBookings.cql +64 -0
  14. data/cql/CinemaTickets.cql +127 -0
  15. data/cql/CompanyDirectorEmployee.cql +56 -0
  16. data/cql/Death.cql +17 -0
  17. data/cql/Diplomacy.cql +48 -0
  18. data/cql/Genealogy.cql +98 -0
  19. data/cql/Health.cql +78 -0
  20. data/cql/Insurance.cql +320 -0
  21. data/cql/Marriage.cql +18 -0
  22. data/cql/Metamodel.cql +567 -0
  23. data/cql/Monogamy.cql +24 -0
  24. data/cql/MultiInheritance.cql +22 -0
  25. data/cql/MultipleSubtyping.cql +30 -0
  26. data/cql/NonRoleId.cql +14 -0
  27. data/cql/OddIdentifier.cql +18 -0
  28. data/cql/OilSupply.cql +53 -0
  29. data/cql/OneRoleNesting.cql +38 -0
  30. data/cql/OneToOnes.cql +17 -0
  31. data/cql/Orienteering.cql +111 -0
  32. data/cql/PartyModel.cql +38 -0
  33. data/cql/PersonPlaysGame.cql +18 -0
  34. data/cql/RedundantDependency.cql +34 -0
  35. data/cql/SchoolActivities.cql +33 -0
  36. data/cql/SeparateSubtype.cql +30 -0
  37. data/cql/ServiceDirector.cql +276 -0
  38. data/cql/SimplestUnary.cql +12 -0
  39. data/cql/Supervision.cql +34 -0
  40. data/cql/VenueSeating.cql +45 -0
  41. data/cql/WaiterTips.cql +33 -0
  42. data/cql/Warehousing.cql +101 -0
  43. data/cql/WindowInRoomInBldg.cql +28 -0
  44. data/cql/unit.cql +474 -0
  45. data/diagrams/json/Address.json +41 -0
  46. data/diagrams/json/Astronomy.json +31 -0
  47. data/diagrams/json/Blog.json +46 -0
  48. data/diagrams/json/CinemaBookings.json +53 -0
  49. data/diagrams/json/CinemaTickets.json +101 -0
  50. data/diagrams/json/CompanyDirectorEmployee.json +44 -0
  51. data/diagrams/json/Death.json +20 -0
  52. data/diagrams/json/Diplomacy.json +34 -0
  53. data/diagrams/json/Genealogy.json +78 -0
  54. data/diagrams/json/Insurance.json +259 -0
  55. data/diagrams/json/Marriage.json +21 -0
  56. data/diagrams/json/Metamodel.json +318 -0
  57. data/diagrams/json/Monogamy.json +22 -0
  58. data/diagrams/json/MultiInheritance.json +25 -0
  59. data/diagrams/json/MultipleSubtyping.json +22 -0
  60. data/diagrams/json/OilSupply.json +49 -0
  61. data/diagrams/json/OneRoleNesting.json +37 -0
  62. data/diagrams/json/Orienteering.json +94 -0
  63. data/diagrams/json/PersonPlaysGame.json +22 -0
  64. data/diagrams/json/RedundantDependency.json +33 -0
  65. data/diagrams/json/SchoolActivities.json +28 -0
  66. data/diagrams/json/SeparateSubtype.json +29 -0
  67. data/diagrams/json/SimplestUnary.json +15 -0
  68. data/diagrams/json/Supervision.json +27 -0
  69. data/diagrams/json/VenueSeating.json +40 -0
  70. data/diagrams/json/WaiterTips.json +29 -0
  71. data/diagrams/json/Warehousing.json +86 -0
  72. data/diagrams/json/WindowInRoomInBldg.json +31 -0
  73. data/images/Address.SQL.png +0 -0
  74. data/images/Address.png +0 -0
  75. data/images/Blog.png +0 -0
  76. data/images/CinemaBookings.png +0 -0
  77. data/images/CinemaTickets.png +0 -0
  78. data/images/CompanyDirectorEmployee.png +0 -0
  79. data/images/Death.png +0 -0
  80. data/images/Diplomacy.png +0 -0
  81. data/images/DumpMetamodel.bat +2 -0
  82. data/images/Genealogy.png +0 -0
  83. data/images/Insurance/Claim.png +0 -0
  84. data/images/Insurance/Insurance.png +0 -0
  85. data/images/Insurance/Person.png +0 -0
  86. data/images/Insurance/Policy.png +0 -0
  87. data/images/Insurance/Related.png +0 -0
  88. data/images/Insurance/VehicleIncident.png +0 -0
  89. data/images/Marriage.png +0 -0
  90. data/images/Metamodel/Concepts.png +0 -0
  91. data/images/Metamodel/Constraints.png +0 -0
  92. data/images/Metamodel/ContextNote.png +0 -0
  93. data/images/Metamodel/Diagrams.png +0 -0
  94. data/images/Metamodel/Language.png +0 -0
  95. data/images/Metamodel/Legacy.png +0 -0
  96. data/images/Metamodel/Objects.png +0 -0
  97. data/images/Metamodel/Populations.png +0 -0
  98. data/images/Metamodel/Query.png +0 -0
  99. data/images/Metamodel/Units.png +0 -0
  100. data/images/Metamodel/ValueConstraints.png +0 -0
  101. data/images/Metamodel/ValueTypes.png +0 -0
  102. data/images/MetamodelER.bcp +1 -0
  103. data/images/MetamodelER.pdf +0 -0
  104. data/images/MultiInheritance.png +0 -0
  105. data/images/NorthwindER.png +0 -0
  106. data/images/OilSupply.png +0 -0
  107. data/images/Orienteering/Administration.png +0 -0
  108. data/images/Orienteering/Registration.png +0 -0
  109. data/images/Orienteering/Scoring.png +0 -0
  110. data/images/PersonPlaysGame.png +0 -0
  111. data/images/RedundantDependency.png +0 -0
  112. data/images/SchoolActivities.png +0 -0
  113. data/images/SeparateSubtype.png +0 -0
  114. data/images/SimplestUnary.png +0 -0
  115. data/images/Supervision.png +0 -0
  116. data/images/VenueSeating.png +0 -0
  117. data/images/WaiterTips.png +0 -0
  118. data/images/Warehousing.png +0 -0
  119. data/images/WindowInRoomInBldg.png +0 -0
  120. data/metadata/json/Astronomy.json +175 -0
  121. data/metadata/json/CinemaBookings.json +354 -0
  122. data/metadata/json/CinemaTickets.json +768 -0
  123. data/metadata/json/CompanyDirectorEmployee.json +270 -0
  124. data/metadata/json/Diplomacy.json +186 -0
  125. data/metadata/json/Metamodel.json +3214 -0
  126. data/metadata/json/OilSupply.json +411 -0
  127. data/metadata/json/SeparateSubtype.json +157 -0
  128. data/metadata/json/Supervision.json +128 -0
  129. data/metadata/json/VenueSeating.json +209 -0
  130. data/orm/.gitignore +11 -0
  131. data/orm/Address.orm +1268 -0
  132. data/orm/Astronomy.orm +925 -0
  133. data/orm/Blog.orm +1711 -0
  134. data/orm/CinemaBookings.orm +1998 -0
  135. data/orm/CinemaTickets.orm +5060 -0
  136. data/orm/CompanyDirectorEmployee.orm +2094 -0
  137. data/orm/Death.orm +386 -0
  138. data/orm/Diplomacy.orm +1478 -0
  139. data/orm/ExampleModels2010.csproj +764 -0
  140. data/orm/ExampleModels2010.sln +16 -0
  141. data/orm/Genealogy.orm +3209 -0
  142. data/orm/Health.orm +2407 -0
  143. data/orm/Insurance.orm +12727 -0
  144. data/orm/Marriage.orm +493 -0
  145. data/orm/Metamodel.orm +20998 -0
  146. data/orm/Monogamy.orm +328 -0
  147. data/orm/MultiInheritance.orm +537 -0
  148. data/orm/MultipleSubtyping.orm +347 -0
  149. data/orm/OilSupply.orm +2533 -0
  150. data/orm/OneRoleNesting.orm +1237 -0
  151. data/orm/Orienteering.orm +3976 -0
  152. data/orm/PersonPlaysGame.orm +426 -0
  153. data/orm/RedundantDependency.orm +844 -0
  154. data/orm/SchoolActivities.orm +961 -0
  155. data/orm/SeparateSubtype.orm +821 -0
  156. data/orm/SimplestUnary.orm +172 -0
  157. data/orm/Supervision.orm +734 -0
  158. data/orm/VenueSeating.orm +1289 -0
  159. data/orm/WaiterTips.orm +789 -0
  160. data/orm/Warehousing.orm +3792 -0
  161. data/orm/WindowInRoomInBldg.orm +772 -0
  162. data/rails/models/Astronomy.models +17 -0
  163. data/rails/models/CinemaBookings.models +123 -0
  164. data/rails/models/CinemaTickets.models +192 -0
  165. data/rails/models/Diplomacy.models +126 -0
  166. data/rails/models/Metamodel.models +894 -0
  167. data/rails/models/OneRoleNesting.models +18 -0
  168. data/rails/models/SeparateSubtype.models +49 -0
  169. data/rails/models/VenueSeating.models +70 -0
  170. data/rails/schema/Astronomy.schema.rb +25 -0
  171. data/rails/schema/CinemaBookings.schema.rb +78 -0
  172. data/rails/schema/CinemaTickets.schema.rb +132 -0
  173. data/rails/schema/Diplomacy.schema.rb +74 -0
  174. data/rails/schema/Metamodel.schema.rb +538 -0
  175. data/rails/schema/OneRoleNesting.rb +20 -0
  176. data/rails/schema/SeparateSubtype.schema.rb +35 -0
  177. data/rails/schema/VenueSeating.schema.rb +46 -0
  178. data/rails/schema/Warehousing.schema.rb +145 -0
  179. data/ruby/Address.rb +68 -0
  180. data/ruby/Astronomy.rb +55 -0
  181. data/ruby/Blog.rb +84 -0
  182. data/ruby/CinemaBookings.rb +109 -0
  183. data/ruby/CinemaTickets.rb +218 -0
  184. data/ruby/CompanyDirectorEmployee.rb +73 -0
  185. data/ruby/Death.rb +26 -0
  186. data/ruby/Diplomacy.rb +59 -0
  187. data/ruby/Genealogy.rb +173 -0
  188. data/ruby/Insurance.rb +562 -0
  189. data/ruby/Marriage.rb +21 -0
  190. data/ruby/Metamodel.rb +621 -0
  191. data/ruby/Monogamy.rb +27 -0
  192. data/ruby/MultiInheritance.rb +38 -0
  193. data/ruby/OilSupply.rb +112 -0
  194. data/ruby/OneRoleNesting.rb +66 -0
  195. data/ruby/Orienteering.rb +216 -0
  196. data/ruby/PersonPlaysGame.rb +31 -0
  197. data/ruby/RedundantDependency.rb +53 -0
  198. data/ruby/SchoolActivities.rb +49 -0
  199. data/ruby/SeparateSubtype.rb +46 -0
  200. data/ruby/SimplestUnary.rb +10 -0
  201. data/ruby/Supervision.rb +33 -0
  202. data/ruby/TwoValues.rb +14 -0
  203. data/ruby/VenueSeating.rb +64 -0
  204. data/ruby/WaiterTips.rb +49 -0
  205. data/ruby/Warehousing.rb +167 -0
  206. data/ruby/WindowInRoomInBldg.rb +45 -0
  207. data/sql/server/Address.sql +40 -0
  208. data/sql/server/Astronomy.sql +36 -0
  209. data/sql/server/Blog.sql +78 -0
  210. data/sql/server/CinemaBookings.sql +95 -0
  211. data/sql/server/CinemaTickets.sql +191 -0
  212. data/sql/server/CompanyDirectorEmployee.sql +104 -0
  213. data/sql/server/Death.sql +11 -0
  214. data/sql/server/Diplomacy.sql +66 -0
  215. data/sql/server/Genealogy.sql +138 -0
  216. data/sql/server/Health.sql +169 -0
  217. data/sql/server/Insurance.sql +484 -0
  218. data/sql/server/Marriage.sql +30 -0
  219. data/sql/server/Metamodel.sql +1000 -0
  220. data/sql/server/Monogamy.sql +20 -0
  221. data/sql/server/MultiInheritance.sql +27 -0
  222. data/sql/server/OilSupply.sql +105 -0
  223. data/sql/server/OneRoleNesting.sql +29 -0
  224. data/sql/server/Orienteering.sql +186 -0
  225. data/sql/server/PersonPlaysGame.sql +9 -0
  226. data/sql/server/RedundantDependency.sql +54 -0
  227. data/sql/server/SchoolActivities.sql +30 -0
  228. data/sql/server/SeparateSubtype.sql +33 -0
  229. data/sql/server/SimplestUnary.sql +9 -0
  230. data/sql/server/Supervision.sql +30 -0
  231. data/sql/server/VenueSeating.sql +54 -0
  232. data/sql/server/WaiterTips.sql +31 -0
  233. data/sql/server/Warehousing.sql +203 -0
  234. data/sql/server/WindowInRoomInBldg.sql +13 -0
  235. data/transform/surrogate/Address.absorption +2 -0
  236. data/transform/surrogate/Blog.absorption +5 -0
  237. data/transform/surrogate/CinemaBookings.absorption +7 -0
  238. data/transform/surrogate/CompanyDirectorEmployee.absorption +7 -0
  239. data/transform/surrogate/Death.absorption +1 -0
  240. data/transform/surrogate/Diplomacy-revised.absorption +6 -0
  241. data/transform/surrogate/Diplomacy.absorption +6 -0
  242. data/transform/surrogate/Genealogy.absorption +8 -0
  243. data/transform/surrogate/Insurance.absorption +18 -0
  244. data/transform/surrogate/Marriage.absorption +2 -0
  245. data/transform/surrogate/Metamodel.absorption +25 -0
  246. data/transform/surrogate/Monogamy.absorption +1 -0
  247. data/transform/surrogate/MultiInheritance.absorption +1 -0
  248. data/transform/surrogate/MultipleSubtyping.absorption +1 -0
  249. data/transform/surrogate/OilSupply.absorption +8 -0
  250. data/transform/surrogate/OneRoleNesting.absorption +1 -0
  251. data/transform/surrogate/Orienteering.absorption +11 -0
  252. data/transform/surrogate/PersonPlaysGame.absorption +1 -0
  253. data/transform/surrogate/RedundantDependency.absorption +3 -0
  254. data/transform/surrogate/SchoolActivities.absorption +3 -0
  255. data/transform/surrogate/SeparateSubtype.absorption +3 -0
  256. data/transform/surrogate/SimplestUnary.absorption +1 -0
  257. data/transform/surrogate/Supervision.absorption +2 -0
  258. data/transform/surrogate/WaiterTips.absorption +3 -0
  259. data/transform/surrogate/Warehousing.absorption +12 -0
  260. data/transform/surrogate/WindowInRoomInBldg.absorption +1 -0
  261. data/transform/surrogate/unit.absorption +0 -0
  262. metadata +374 -0
@@ -0,0 +1,894 @@
1
+
2
+ module Concernz
3
+ module Aggregation
4
+ extend ActiveSupport::Concern
5
+ included do
6
+ self.primary_key = 'aggregation_id'
7
+
8
+ # Aggregation involves Variable
9
+ belongs_to :aggregated_variable, :class_name => 'Variable', :foreign_key => :aggregated_variable_id
10
+
11
+ # Aggregation involves Variable
12
+ belongs_to :variable, :foreign_key => :variable_id
13
+
14
+ validates :aggregate_code, :presence => true
15
+ validates :variable_id, :presence => true
16
+ validates :aggregated_variable_id, :presence => true
17
+ end
18
+ end
19
+ end
20
+
21
+ module Concernz
22
+ module AllowedRange
23
+ extend ActiveSupport::Concern
24
+ included do
25
+ self.primary_key = 'allowed_range_id'
26
+
27
+ # Allowed Range involves Value Constraint and Value Constraint is a kind of Constraint
28
+ belongs_to :constraint_via_value_constraint, :class_name => 'Constraint', :foreign_key => :value_constraint_concept_guid
29
+
30
+ # Allowed Range involves Value Range and maybe Value Range has maximum-Bound and Bound has Value
31
+ belongs_to :value_via_value_range_maximum_bound, :class_name => 'Value', :foreign_key => :value_range_maximum_bound_value_id
32
+
33
+ # Allowed Range involves Value Range and maybe Value Range has minimum-Bound and Bound has Value
34
+ belongs_to :value_via_value_range_minimum_bound, :class_name => 'Value', :foreign_key => :value_range_minimum_bound_value_id
35
+
36
+ validates :value_constraint_concept_guid, :presence => true
37
+ end
38
+ end
39
+ end
40
+
41
+ module Concernz
42
+ module AlternativeSet
43
+ extend ActiveSupport::Concern
44
+ included do
45
+ self.primary_key = 'guid'
46
+
47
+ # maybe Alternative Set covers Step
48
+ has_many :steps, :class_name => 'Step', :foreign_key => :alternative_set_guid, :dependent => :destroy
49
+ end
50
+ end
51
+ end
52
+
53
+ module Concernz
54
+ module Component
55
+ extend ActiveSupport::Concern
56
+ included do
57
+ self.primary_key = 'guid'
58
+
59
+ # maybe Component belongs to parent-Mapping and Mapping is a kind of Component
60
+ belongs_to :component_via_mapping, :class_name => 'Component', :foreign_key => :mapping_guid
61
+
62
+ # maybe Component is a Mapping and maybe Mapping projects Composite and Composite belongs to Composition
63
+ belongs_to :composition_via_mapping_composite, :class_name => 'Composition', :foreign_key => :mapping_composition_guid
64
+
65
+ # maybe Component is a Mapping and Mapping represents Object Type
66
+ belongs_to :object_type_via_mapping, :class_name => 'ObjectType', :foreign_key => :mapping_object_type_id
67
+
68
+ # maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption traverses to child-Role
69
+ belongs_to :child_role_via_mapping_absorption, :class_name => 'Role', :foreign_key => :absorption_child_role_id
70
+
71
+ # maybe Component is a Mapping and maybe Mapping is an Absorption and maybe Absorption is nested under index-Role
72
+ belongs_to :index_role_via_mapping_absorption, :class_name => 'Role', :foreign_key => :absorption_index_role_id
73
+
74
+ # maybe Component is a Mapping and maybe Mapping is an Absorption and Absorption traverses from parent-Role
75
+ belongs_to :parent_role_via_mapping_absorption, :class_name => 'Role', :foreign_key => :absorption_parent_role_id
76
+
77
+ # maybe Component is an Indicator and Indicator indicates Role played
78
+ belongs_to :role_via_indicator, :class_name => 'Role', :foreign_key => :indicator_role_id
79
+
80
+ # Component is a Mapping and maybe Mapping contains Component
81
+ has_many :members_via_mapping, :class_name => 'Component', :foreign_key => :mapping_guid, :dependent => :destroy
82
+
83
+ # Component is a Discriminator and Discriminator is involved in Discriminated Role
84
+ has_many :discriminated_roles_via_discriminator, :class_name => 'DiscriminatedRole', :foreign_key => :discriminator_guid, :dependent => :destroy
85
+ end
86
+ end
87
+ end
88
+
89
+ module Concernz
90
+ module Composition
91
+ extend ActiveSupport::Concern
92
+ included do
93
+ self.primary_key = 'guid'
94
+
95
+ # Composition contains Composite and maybe Composite consists of Mapping and maybe Mapping is a kind of Component
96
+ has_many :components_via_mapping_composite, :class_name => 'Component', :foreign_key => :mapping_composition_guid, :dependent => :destroy
97
+
98
+ validates :name, :presence => true
99
+ end
100
+ end
101
+ end
102
+
103
+ module Concernz
104
+ module Concept
105
+ extend ActiveSupport::Concern
106
+ included do
107
+ self.primary_key = 'guid'
108
+
109
+ # maybe Context Note is an instance of Concept and maybe Context Note applies to relevant-Concept
110
+ belongs_to :relevant_concept_via_context_note, :class_name => 'Concept', :foreign_key => :context_note_relevant_concept_guid
111
+
112
+ # maybe Instance is an instance of Concept and maybe Instance objectifies Fact and Fact is an instance of Concept
113
+ belongs_to :concept_via_instance_fact, :class_name => 'Concept', :foreign_key => :instance_fact_concept_guid
114
+
115
+ # maybe Fact is an instance of Concept and Fact is of Fact Type
116
+ belongs_to :fact_type_via_fact, :class_name => 'FactType', :foreign_key => :fact_type_concept_guid
117
+
118
+ # maybe Instance is an instance of Concept and Instance is of Object Type
119
+ belongs_to :object_type_via_instance, :class_name => 'ObjectType', :foreign_key => :instance_object_type_id
120
+
121
+ # maybe Fact is an instance of Concept and Fact belongs to Population
122
+ belongs_to :population_via_fact, :class_name => 'Population', :foreign_key => :fact_population_id
123
+
124
+ # maybe Instance is an instance of Concept and Instance belongs to Population
125
+ belongs_to :population_via_instance, :class_name => 'Population', :foreign_key => :instance_population_id
126
+
127
+ # maybe Instance is an instance of Concept and maybe Instance has Value
128
+ belongs_to :value_via_instance, :class_name => 'Value', :foreign_key => :instance_value_id
129
+
130
+ # Concept is involved in Concept Annotation
131
+ has_many :concept_annotations, :class_name => 'ConceptAnnotation', :foreign_key => :concept_guid, :dependent => :destroy
132
+
133
+ # maybe Concept has Context Note and maybe Context Note is an instance of Concept
134
+ has_many :concepts_via_context_note, :class_name => 'Concept', :foreign_key => :context_note_relevant_concept_guid, :dependent => :destroy
135
+
136
+ # Fact is an instance of Concept and maybe Fact is objectified as Instance and maybe Instance is an instance of Concept
137
+ has_one :concept_via_instance_fact, :class_name => 'Concept', :foreign_key => :instance_fact_concept_guid, :dependent => :destroy
138
+
139
+ # Constraint is an instance of Concept
140
+ has_one :constraint, :class_name => 'Constraint', :foreign_key => :concept_guid, :dependent => :destroy
141
+
142
+ # Context Note is an instance of Concept and Context Note is involved in Context According To
143
+ has_many :context_according_tos_via_context_note, :class_name => 'ContextAccordingTo', :foreign_key => :context_note_concept_guid, :dependent => :destroy
144
+
145
+ # Context Note is an instance of Concept and Context Note was added by Agreement and Agreement is involved in Context Agreed By
146
+ has_many :context_agreed_bies_via_agreement_context_note, :class_name => 'ContextAgreedBy', :foreign_key => :agreement_context_note_concept_guid, :dependent => :destroy
147
+
148
+ # Unit is an instance of Concept and Unit is involved in Derivation
149
+ has_many :derivations_via_unit, :class_name => 'Derivation', :foreign_key => :base_unit_concept_guid, :dependent => :destroy
150
+
151
+ # Unit is an instance of Concept and Unit is involved in Derivation
152
+ has_many :derivations_via_unit, :class_name => 'Derivation', :foreign_key => :derived_unit_concept_guid, :dependent => :destroy
153
+
154
+ # Fact Type is an instance of Concept
155
+ has_one :fact_type, :class_name => 'FactType', :foreign_key => :concept_guid, :dependent => :destroy
156
+
157
+ # Object Type is an instance of Concept
158
+ has_one :object_type, :class_name => 'ObjectType', :foreign_key => :concept_guid, :dependent => :destroy
159
+
160
+ # Unit is an instance of Concept and maybe Value Type is of Unit and maybe Value Type is a kind of Domain Object Type and maybe Domain Object Type is a kind of Object Type
161
+ has_many :object_types_via_domain_object_type_value_type_unit, :class_name => 'ObjectType', :foreign_key => :value_type_unit_concept_guid, :dependent => :destroy
162
+
163
+ # Population is an instance of Concept
164
+ has_one :population, :class_name => 'Population', :foreign_key => :concept_guid, :dependent => :destroy
165
+
166
+ # Fact is an instance of Concept and Fact includes Role Value
167
+ has_many :role_values_via_fact, :class_name => 'RoleValue', :foreign_key => :fact_concept_guid, :dependent => :destroy
168
+
169
+ # Instance is an instance of Concept and Instance plays Role Value
170
+ has_many :role_values_via_instance, :class_name => 'RoleValue', :foreign_key => :instance_concept_guid, :dependent => :destroy
171
+
172
+ # Role is an instance of Concept
173
+ has_one :role, :class_name => 'Role', :foreign_key => :concept_guid, :dependent => :destroy
174
+
175
+ # Context Note is an instance of Concept and Model Note Shape is for Context Note and maybe Model Note Shape is a kind of Shape
176
+ has_many :shapes_via_model_note_shape_context_note, :class_name => 'Shape', :foreign_key => :model_note_shape_context_note_concept_guid, :dependent => :destroy
177
+
178
+ # Unit is an instance of Concept and maybe Unit is of Value
179
+ has_many :values_via_unit, :class_name => 'Value', :foreign_key => :unit_concept_guid, :dependent => :destroy
180
+
181
+ # Query is an instance of Concept and Query includes Variable
182
+ has_many :variables_via_query, :class_name => 'Variable', :foreign_key => :query_concept_guid, :dependent => :destroy
183
+ end
184
+ end
185
+ end
186
+
187
+ module Concernz
188
+ module ConceptAnnotation
189
+ extend ActiveSupport::Concern
190
+ included do
191
+ self.primary_key = 'concept_annotation_id'
192
+
193
+ # Concept Annotation involves Concept
194
+ belongs_to :concept, :foreign_key => :concept_guid
195
+
196
+ validates :concept_guid, :presence => true
197
+ validates :mapping_annotation, :presence => true
198
+ end
199
+ end
200
+ end
201
+
202
+ module Concernz
203
+ module Constraint
204
+ extend ActiveSupport::Concern
205
+ included do
206
+ self.primary_key = 'concept_guid'
207
+
208
+ # Constraint is an instance of Concept
209
+ belongs_to :concept, :foreign_key => :concept_guid
210
+
211
+ # maybe Constraint is a Ring Constraint and maybe Ring Constraint has other-Role
212
+ belongs_to :other_role_via_ring_constraint, :class_name => 'Role', :foreign_key => :ring_constraint_other_role_id
213
+
214
+ # maybe Constraint is a Ring Constraint and maybe Ring Constraint has Role
215
+ belongs_to :role_via_ring_constraint, :class_name => 'Role', :foreign_key => :ring_constraint_role_id
216
+
217
+ # maybe Constraint is a Value Constraint and maybe Value Constraint applies to Role
218
+ belongs_to :role_via_value_constraint, :class_name => 'Role', :foreign_key => :value_constraint_role_id
219
+
220
+ # maybe Constraint is a Presence Constraint and Presence Constraint covers Role Sequence
221
+ belongs_to :role_sequence_via_presence_constraint, :class_name => 'RoleSequence', :foreign_key => :presence_constraint_role_sequence_guid
222
+
223
+ # maybe Constraint is a Set Constraint and maybe Set Constraint is a Subset Constraint and Subset Constraint covers subset-Role Sequence
224
+ belongs_to :subset_role_sequence_via_set_constraint_subset_constraint, :class_name => 'RoleSequence', :foreign_key => :subset_constraint_subset_role_sequence_guid
225
+
226
+ # maybe Constraint is a Set Constraint and maybe Set Constraint is a Subset Constraint and Subset Constraint covers superset-Role Sequence
227
+ belongs_to :superset_role_sequence_via_set_constraint_subset_constraint, :class_name => 'RoleSequence', :foreign_key => :subset_constraint_superset_role_sequence_guid
228
+
229
+ # Constraint is a Value Constraint and Value Constraint is involved in Allowed Range
230
+ has_many :allowed_ranges_via_value_constraint, :class_name => 'AllowedRange', :foreign_key => :value_constraint_concept_guid, :dependent => :destroy
231
+
232
+ # Constraint is a Value Constraint and maybe Value Constraint constrains Value Type and maybe Value Type is a kind of Domain Object Type and maybe Domain Object Type is a kind of Object Type
233
+ has_one :object_type_via_domain_object_type_value_type_value_constraint, :class_name => 'ObjectType', :foreign_key => :value_type_value_constraint_concept_guid, :dependent => :destroy
234
+
235
+ # Constraint is a Set Constraint and Set Constraint is a Set Comparison Constraint and Set Comparison Constraint is involved in Set Comparison Roles
236
+ has_many :set_comparison_roles_via_set_comparison_constraint_set_constraint, :class_name => 'SetComparisonRoles', :foreign_key => :set_comparison_constraint_concept_guid, :dependent => :destroy
237
+
238
+ # Constraint Shape is for Constraint and maybe Constraint Shape is a kind of Shape
239
+ has_many :shapes_via_constraint_shape, :class_name => 'Shape', :foreign_key => :constraint_shape_constraint_concept_guid, :dependent => :destroy
240
+
241
+ validates :concept_guid, :presence => true
242
+ end
243
+ end
244
+ end
245
+
246
+ module Concernz
247
+ module ContextAccordingTo
248
+ extend ActiveSupport::Concern
249
+ included do
250
+ self.primary_key = 'context_according_to_id'
251
+
252
+ # Context According To involves Context Note and Context Note is an instance of Concept
253
+ belongs_to :concept_via_context_note, :class_name => 'Concept', :foreign_key => :context_note_concept_guid
254
+
255
+ validates :agent_name, :presence => true
256
+ validates :context_note_concept_guid, :presence => true
257
+ end
258
+ end
259
+ end
260
+
261
+ module Concernz
262
+ module ContextAgreedBy
263
+ extend ActiveSupport::Concern
264
+ included do
265
+ self.primary_key = 'context_agreed_by_id'
266
+
267
+ # Context Agreed By involves Agreement and Agreement covers Context Note and Context Note is an instance of Concept
268
+ belongs_to :concept_via_agreement_context_note, :class_name => 'Concept', :foreign_key => :agreement_context_note_concept_guid
269
+
270
+ validates :agent_name, :presence => true
271
+ validates :agreement_context_note_concept_guid, :presence => true
272
+ end
273
+ end
274
+ end
275
+
276
+ module Concernz
277
+ module Derivation
278
+ extend ActiveSupport::Concern
279
+ included do
280
+ self.primary_key = 'derivation_id'
281
+
282
+ # Derivation involves Unit and Unit is an instance of Concept
283
+ belongs_to :concept_via_unit, :class_name => 'Concept', :foreign_key => :base_unit_concept_guid
284
+
285
+ # Derivation involves Unit and Unit is an instance of Concept
286
+ belongs_to :concept_via_unit, :class_name => 'Concept', :foreign_key => :derived_unit_concept_guid
287
+
288
+ validates :base_unit_concept_guid, :presence => true
289
+ validates :derived_unit_concept_guid, :presence => true
290
+ end
291
+ end
292
+ end
293
+
294
+ module Concernz
295
+ module Diagram
296
+ extend ActiveSupport::Concern
297
+ included do
298
+ self.primary_key = 'diagram_id'
299
+
300
+ # Diagram is an ORM Diagram and ORM Diagram includes Shape
301
+ has_many :shapes_via_orm_diagram, :class_name => 'Shape', :foreign_key => :orm_diagram_id, :dependent => :destroy
302
+
303
+ validates :name, :presence => true
304
+ validates :vocabulary_name, :presence => true
305
+ end
306
+ end
307
+ end
308
+
309
+ module Concernz
310
+ module DiscriminatedRole
311
+ extend ActiveSupport::Concern
312
+ included do
313
+ self.primary_key = 'discriminated_role_id'
314
+
315
+ # Discriminated Role involves Discriminator and Discriminator is a kind of Component
316
+ belongs_to :component_via_discriminator, :class_name => 'Component', :foreign_key => :discriminator_guid
317
+
318
+ # Discriminated Role involves Role
319
+ belongs_to :role, :foreign_key => :role_id
320
+
321
+ # Discriminated Role involves Value
322
+ belongs_to :value, :foreign_key => :value_id
323
+
324
+ validates :discriminator_guid, :presence => true
325
+ validates :role_id, :presence => true
326
+ validates :value_id, :presence => true
327
+ end
328
+ end
329
+ end
330
+
331
+ module Concernz
332
+ module FactType
333
+ extend ActiveSupport::Concern
334
+ included do
335
+ self.primary_key = 'concept_guid'
336
+
337
+ # Fact Type is an instance of Concept
338
+ belongs_to :concept, :foreign_key => :concept_guid
339
+
340
+ # 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
341
+ belongs_to :object_type_via_entity_type_domain_object_type, :class_name => 'ObjectType', :foreign_key => :entity_type_object_type_id
342
+
343
+ # 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
344
+ belongs_to :object_type_via_type_inheritance_entity_type_domain_object_type, :class_name => 'ObjectType', :foreign_key => :type_inheritance_subtype_object_type_id
345
+
346
+ # 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
347
+ belongs_to :object_type_via_type_inheritance_entity_type_domain_object_type, :class_name => 'ObjectType', :foreign_key => :type_inheritance_supertype_object_type_id
348
+
349
+ # Fact is of Fact Type and maybe Fact is an instance of Concept
350
+ has_many :concepts_via_fact, :class_name => 'Concept', :foreign_key => :fact_type_concept_guid, :dependent => :destroy
351
+
352
+ # Fact Type has Reading
353
+ has_many :readings, :class_name => 'Reading', :foreign_key => :fact_type_concept_guid, :dependent => :destroy
354
+
355
+ # Fact Type contains Role
356
+ has_many :roles, :class_name => 'Role', :foreign_key => :fact_type_concept_guid, :dependent => :destroy
357
+
358
+ # Fact Type is a Link Fact Type and maybe Link Fact Type has implying-Role
359
+ has_one :implying_role_via_link_fact_type, :class_name => 'Role', :foreign_key => :link_fact_type_concept_guid, :dependent => :destroy
360
+
361
+ # Fact Type has Fact Type Shape and maybe Fact Type Shape is a kind of Shape
362
+ has_many :shapes_via_fact_type_shape, :class_name => 'Shape', :foreign_key => :fact_type_shape_fact_type_concept_guid, :dependent => :destroy
363
+
364
+ # Fact Type directs Step
365
+ has_many :steps, :class_name => 'Step', :foreign_key => :fact_type_concept_guid, :dependent => :destroy
366
+
367
+ validates :concept_guid, :presence => true
368
+ end
369
+ end
370
+ end
371
+
372
+ module Concernz
373
+ module ObjectType
374
+ extend ActiveSupport::Concern
375
+ included do
376
+ self.primary_key = 'object_type_id'
377
+
378
+ # Object Type is an instance of Concept
379
+ belongs_to :concept, :foreign_key => :concept_guid
380
+
381
+ # 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
382
+ belongs_to :concept_via_domain_object_type_value_type_unit, :class_name => 'Concept', :foreign_key => :value_type_unit_concept_guid
383
+
384
+ # 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
385
+ belongs_to :constraint_via_domain_object_type_value_type_value_constraint, :class_name => 'Constraint', :foreign_key => :value_type_value_constraint_concept_guid
386
+
387
+ # 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
388
+ belongs_to :object_type_via_domain_object_type_value_type_value_type_domain_object_type, :class_name => 'ObjectType', :foreign_key => :value_type_supertype_object_type_id
389
+
390
+ # Mapping represents Object Type and maybe Mapping is a kind of Component
391
+ has_many :components_via_mapping, :class_name => 'Component', :foreign_key => :mapping_object_type_id, :dependent => :destroy
392
+
393
+ # Instance is of Object Type and maybe Instance is an instance of Concept
394
+ has_many :concepts_via_instance, :class_name => 'Concept', :foreign_key => :instance_object_type_id, :dependent => :destroy
395
+
396
+ # Object Type is a Domain Object Type and Domain Object Type is an Entity Type and maybe Entity Type nests Fact Type
397
+ has_one :fact_type_via_entity_type_domain_object_type, :class_name => 'FactType', :foreign_key => :entity_type_object_type_id, :dependent => :destroy
398
+
399
+ # Object Type is a Domain Object Type and Domain Object Type is an Entity Type and Entity Type is involved in Type Inheritance and maybe Type Inheritance is a kind of Fact Type
400
+ has_many :fact_types_via_type_inheritance_entity_type_domain_object_type, :class_name => 'FactType', :foreign_key => :type_inheritance_subtype_object_type_id, :dependent => :destroy
401
+ has_many :entity_types, :through => :fact_types_via_type_inheritance_entity_type_domain_object_type
402
+
403
+ # Object Type is a Domain Object Type and Domain Object Type is an Entity Type and Entity Type is involved in Type Inheritance and maybe Type Inheritance is a kind of Fact Type
404
+ has_many :fact_types_via_type_inheritance_entity_type_domain_object_type, :class_name => 'FactType', :foreign_key => :type_inheritance_supertype_object_type_id, :dependent => :destroy
405
+ has_many :entity_types, :through => :fact_types_via_type_inheritance_entity_type_domain_object_type
406
+
407
+ # Object Type is a Domain Object Type and Domain Object Type is a Value Type and maybe Value Type is supertype of Value Type and maybe Value Type is a kind of Domain Object Type and maybe Domain Object Type is a kind of Object Type
408
+ has_many :object_types_via_domain_object_type_value_type_value_type_domain_object_type, :class_name => 'ObjectType', :foreign_key => :value_type_supertype_object_type_id, :dependent => :destroy
409
+
410
+ # Object Type plays Role
411
+ has_many :roles, :class_name => 'Role', :foreign_key => :object_type_id, :dependent => :destroy
412
+
413
+ # Object Type has Object Type Shape and maybe Object Type Shape is a kind of Shape
414
+ has_many :shapes_via_object_type_shape, :class_name => 'Shape', :foreign_key => :object_type_shape_object_type_id, :dependent => :destroy
415
+
416
+ # Object Type is a Domain Object Type and Domain Object Type is a Value Type and Value Type is involved in Value Type Parameter Restriction
417
+ has_many :value_type_parameter_restrictions_via_value_type_domain_object_type, :class_name => 'ValueTypeParameterRestriction', :foreign_key => :value_type_object_type_id, :dependent => :destroy
418
+
419
+ # Object Type is a Domain Object Type and Domain Object Type is a Value Type and Value Type Parameter requires value of facet-Value Type
420
+ has_many :value_type_parameters_via_value_type_domain_object_type, :class_name => 'ValueTypeParameter', :foreign_key => :facet_value_type_object_type_id, :dependent => :destroy
421
+
422
+ # Object Type is a Domain Object Type and Domain Object Type is a Value Type and Value Type is involved in Value Type Parameter
423
+ has_many :value_type_parameters_via_value_type_domain_object_type, :class_name => 'ValueTypeParameter', :foreign_key => :value_type_object_type_id, :dependent => :destroy
424
+
425
+ # Object Type is a Domain Object Type and Domain Object Type is a Value Type and Value Type has Value
426
+ has_many :values_via_value_type_domain_object_type, :class_name => 'Value', :foreign_key => :value_type_object_type_id, :dependent => :destroy
427
+
428
+ # Object Type is referenced in Variable
429
+ has_many :variables, :class_name => 'Variable', :foreign_key => :object_type_id, :dependent => :destroy
430
+
431
+ validates :concept_guid, :presence => true
432
+ validates :name, :presence => true
433
+ validates :vocabulary_name, :presence => true
434
+ end
435
+ end
436
+ end
437
+
438
+ module Concernz
439
+ module Play
440
+ extend ActiveSupport::Concern
441
+ included do
442
+ self.primary_key = 'play_id'
443
+
444
+ # Play involves Role
445
+ belongs_to :role, :foreign_key => :role_id
446
+
447
+ # Play involves Step
448
+ belongs_to :step, :foreign_key => :step_guid
449
+
450
+ # Play involves Variable
451
+ belongs_to :variable, :foreign_key => :variable_id
452
+
453
+ # maybe Play projects Role Ref
454
+ has_one :role_ref, :class_name => 'RoleRef', :foreign_key => :play_id, :dependent => :destroy
455
+
456
+ validates :role_id, :presence => true
457
+ validates :step_guid, :presence => true
458
+ validates :variable_id, :presence => true
459
+ end
460
+ end
461
+ end
462
+
463
+ module Concernz
464
+ module Population
465
+ extend ActiveSupport::Concern
466
+ included do
467
+ self.primary_key = 'population_id'
468
+
469
+ # Population is an instance of Concept
470
+ belongs_to :concept, :foreign_key => :concept_guid
471
+
472
+ # Population includes Fact and maybe Fact is an instance of Concept
473
+ has_many :concepts_via_fact, :class_name => 'Concept', :foreign_key => :fact_population_id, :dependent => :destroy
474
+
475
+ # Population includes Instance and maybe Instance is an instance of Concept
476
+ has_many :concepts_via_instance, :class_name => 'Concept', :foreign_key => :instance_population_id, :dependent => :destroy
477
+
478
+ # Population includes Role Value
479
+ has_many :role_values, :class_name => 'RoleValue', :foreign_key => :population_id, :dependent => :destroy
480
+
481
+ validates :concept_guid, :presence => true
482
+ validates :name, :presence => true
483
+ end
484
+ end
485
+ end
486
+
487
+ module Concernz
488
+ module Reading
489
+ extend ActiveSupport::Concern
490
+ included do
491
+ self.primary_key = 'reading_id'
492
+
493
+ # Reading is for Fact Type
494
+ belongs_to :fact_type, :foreign_key => :fact_type_concept_guid
495
+
496
+ # Reading is in Role Sequence
497
+ belongs_to :role_sequence, :foreign_key => :role_sequence_guid
498
+
499
+ # Reading has Reading Shape and maybe Reading Shape is a kind of Shape
500
+ has_many :shapes_via_reading_shape, :class_name => 'Shape', :foreign_key => :reading_shape_reading_id, :dependent => :destroy
501
+
502
+ validates :fact_type_concept_guid, :presence => true
503
+ validates :ordinal, :presence => true
504
+ validates :role_sequence_guid, :presence => true
505
+ validates :text, :presence => true
506
+ end
507
+ end
508
+ end
509
+
510
+ module Concernz
511
+ module Role
512
+ extend ActiveSupport::Concern
513
+ included do
514
+ self.primary_key = 'role_id'
515
+
516
+ # Role is an instance of Concept
517
+ belongs_to :concept, :foreign_key => :concept_guid
518
+
519
+ # maybe implying-Role implies Link Fact Type and Link Fact Type is a kind of Fact Type
520
+ belongs_to :fact_type_via_link_fact_type, :class_name => 'FactType', :foreign_key => :link_fact_type_concept_guid
521
+
522
+ # Role belongs to Fact Type
523
+ belongs_to :fact_type, :foreign_key => :fact_type_concept_guid
524
+
525
+ # Role is played by Object Type
526
+ belongs_to :object_type, :foreign_key => :object_type_id
527
+
528
+ # Absorption traverses to child-Role and maybe Absorption is a kind of Mapping and maybe Mapping is a kind of Component
529
+ has_many :components_via_mapping_absorption, :class_name => 'Component', :foreign_key => :absorption_child_role_id, :dependent => :destroy
530
+
531
+ # maybe Absorption is nested under index-Role and maybe Absorption is a kind of Mapping and maybe Mapping is a kind of Component
532
+ has_many :components_via_mapping_absorption, :class_name => 'Component', :foreign_key => :absorption_index_role_id, :dependent => :destroy
533
+
534
+ # Absorption traverses from parent-Role and maybe Absorption is a kind of Mapping and maybe Mapping is a kind of Component
535
+ has_many :components_via_mapping_absorption, :class_name => 'Component', :foreign_key => :absorption_parent_role_id, :dependent => :destroy
536
+
537
+ # Indicator indicates Role played and maybe Indicator is a kind of Component
538
+ has_many :components_via_indicator, :class_name => 'Component', :foreign_key => :indicator_role_id, :dependent => :destroy
539
+
540
+ # maybe other-Role is of Ring Constraint and maybe Ring Constraint is a kind of Constraint
541
+ has_many :constraints_via_ring_constraint, :class_name => 'Constraint', :foreign_key => :ring_constraint_other_role_id, :dependent => :destroy
542
+
543
+ # maybe Role is of Ring Constraint and maybe Ring Constraint is a kind of Constraint
544
+ has_many :constraints_via_ring_constraint, :class_name => 'Constraint', :foreign_key => :ring_constraint_role_id, :dependent => :destroy
545
+
546
+ # maybe Role has role-Value Constraint and maybe Value Constraint is a kind of Constraint
547
+ has_one :constraint_via_value_constraint, :class_name => 'Constraint', :foreign_key => :value_constraint_role_id, :dependent => :destroy
548
+
549
+ # Role is involved in Discriminated Role
550
+ has_many :discriminated_roles, :class_name => 'DiscriminatedRole', :foreign_key => :role_id, :dependent => :destroy
551
+
552
+ # Role is involved in Play
553
+ has_many :plays, :class_name => 'Play', :foreign_key => :role_id, :dependent => :destroy
554
+
555
+ # Role is involved in Role Display
556
+ has_many :role_displays, :class_name => 'RoleDisplay', :foreign_key => :role_id, :dependent => :destroy
557
+
558
+ # Role is involved in Role Ref
559
+ has_many :role_refs, :class_name => 'RoleRef', :foreign_key => :role_id, :dependent => :destroy
560
+
561
+ # Role Value is of Role
562
+ has_many :role_values, :class_name => 'RoleValue', :foreign_key => :role_id, :dependent => :destroy
563
+
564
+ # maybe Role is projected from Variable
565
+ has_one :variable, :class_name => 'Variable', :foreign_key => :projection_id, :dependent => :destroy
566
+
567
+ validates :concept_guid, :presence => true
568
+ validates :fact_type_concept_guid, :presence => true
569
+ validates :object_type_id, :presence => true
570
+ validates :ordinal, :presence => true
571
+ end
572
+ end
573
+ end
574
+
575
+ module Concernz
576
+ module RoleDisplay
577
+ extend ActiveSupport::Concern
578
+ included do
579
+ self.primary_key = 'role_display_id'
580
+
581
+ # Role Display involves Role
582
+ belongs_to :role, :foreign_key => :role_id
583
+
584
+ # Role Display involves Fact Type Shape and Fact Type Shape is a kind of Shape
585
+ belongs_to :shape_via_fact_type_shape, :class_name => 'Shape', :foreign_key => :fact_type_shape_guid
586
+
587
+ # Role Display has Role Name Shape and maybe Role Name Shape is a kind of Shape
588
+ has_one :shape_via_role_name_shape, :class_name => 'Shape', :foreign_key => :role_name_shape_role_display_id, :dependent => :destroy
589
+
590
+ # maybe Role Display has Value Constraint Shape and maybe Value Constraint Shape is a kind of Constraint Shape and maybe Constraint Shape is a kind of Shape
591
+ has_one :shape_via_constraint_shape_value_constraint_shape, :class_name => 'Shape', :foreign_key => :value_constraint_shape_role_display_id, :dependent => :destroy
592
+
593
+ validates :fact_type_shape_guid, :presence => true
594
+ validates :ordinal, :presence => true
595
+ validates :role_id, :presence => true
596
+ end
597
+ end
598
+ end
599
+
600
+ module Concernz
601
+ module RoleRef
602
+ extend ActiveSupport::Concern
603
+ included do
604
+ self.primary_key = 'role_ref_id'
605
+
606
+ # maybe Role Ref is projected from Play
607
+ belongs_to :play, :foreign_key => :play_id
608
+
609
+ # Role Ref involves Role
610
+ belongs_to :role, :foreign_key => :role_id
611
+
612
+ # Role Ref involves Role Sequence
613
+ belongs_to :role_sequence, :foreign_key => :role_sequence_guid
614
+
615
+ validates :ordinal, :presence => true
616
+ validates :role_id, :presence => true
617
+ validates :role_sequence_guid, :presence => true
618
+ end
619
+ end
620
+ end
621
+
622
+ module Concernz
623
+ module RoleSequence
624
+ extend ActiveSupport::Concern
625
+ included do
626
+ self.primary_key = 'guid'
627
+
628
+ # Presence Constraint covers Role Sequence and maybe Presence Constraint is a kind of Constraint
629
+ has_many :constraints_via_presence_constraint, :class_name => 'Constraint', :foreign_key => :presence_constraint_role_sequence_guid, :dependent => :destroy
630
+
631
+ # Subset Constraint covers subset-Role Sequence and maybe Subset Constraint is a kind of Set Constraint and maybe Set Constraint is a kind of Constraint
632
+ has_many :constraints_via_set_constraint_subset_constraint, :class_name => 'Constraint', :foreign_key => :subset_constraint_subset_role_sequence_guid, :dependent => :destroy
633
+
634
+ # Subset Constraint covers superset-Role Sequence and maybe Subset Constraint is a kind of Set Constraint and maybe Set Constraint is a kind of Constraint
635
+ has_many :constraints_via_set_constraint_subset_constraint, :class_name => 'Constraint', :foreign_key => :subset_constraint_superset_role_sequence_guid, :dependent => :destroy
636
+
637
+ # Role Sequence is for Reading
638
+ has_many :readings, :class_name => 'Reading', :foreign_key => :role_sequence_guid, :dependent => :destroy
639
+
640
+ # Role Sequence is involved in Role Ref
641
+ has_many :role_refs, :class_name => 'RoleRef', :foreign_key => :role_sequence_guid, :dependent => :destroy
642
+
643
+ # Role Sequence is involved in Set Comparison Roles
644
+ has_many :set_comparison_roles, :class_name => 'SetComparisonRoles', :foreign_key => :role_sequence_guid, :dependent => :destroy
645
+ end
646
+ end
647
+ end
648
+
649
+ module Concernz
650
+ module RoleValue
651
+ extend ActiveSupport::Concern
652
+ included do
653
+ self.primary_key = 'role_value_id'
654
+
655
+ # Role Value fulfils Fact and Fact is an instance of Concept
656
+ belongs_to :concept_via_fact, :class_name => 'Concept', :foreign_key => :fact_concept_guid
657
+
658
+ # Role Value is of Instance and Instance is an instance of Concept
659
+ belongs_to :concept_via_instance, :class_name => 'Concept', :foreign_key => :instance_concept_guid
660
+
661
+ # Role Value belongs to Population
662
+ belongs_to :population, :foreign_key => :population_id
663
+
664
+ # Role Value is of Role
665
+ belongs_to :role, :foreign_key => :role_id
666
+
667
+ validates :fact_concept_guid, :presence => true
668
+ validates :instance_concept_guid, :presence => true
669
+ validates :population_id, :presence => true
670
+ validates :role_id, :presence => true
671
+ end
672
+ end
673
+ end
674
+
675
+ module Concernz
676
+ module SetComparisonRoles
677
+ extend ActiveSupport::Concern
678
+ included do
679
+ self.primary_key = 'set_comparison_roles_id'
680
+
681
+ # 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
682
+ belongs_to :constraint_via_set_comparison_constraint_set_constraint, :class_name => 'Constraint', :foreign_key => :set_comparison_constraint_concept_guid
683
+
684
+ # Set Comparison Roles involves Role Sequence
685
+ belongs_to :role_sequence, :foreign_key => :role_sequence_guid
686
+
687
+ validates :ordinal, :presence => true
688
+ validates :role_sequence_guid, :presence => true
689
+ validates :set_comparison_constraint_concept_guid, :presence => true
690
+ end
691
+ end
692
+ end
693
+
694
+ module Concernz
695
+ module Shape
696
+ extend ActiveSupport::Concern
697
+ included do
698
+ self.primary_key = 'guid'
699
+
700
+ # maybe Shape is a Model Note Shape and Model Note Shape is for Context Note and Context Note is an instance of Concept
701
+ belongs_to :concept_via_model_note_shape_context_note, :class_name => 'Concept', :foreign_key => :model_note_shape_context_note_concept_guid
702
+
703
+ # maybe Shape is a Constraint Shape and Constraint Shape is for Constraint
704
+ belongs_to :constraint_via_constraint_shape, :class_name => 'Constraint', :foreign_key => :constraint_shape_constraint_concept_guid
705
+
706
+ # Shape is in ORM Diagram and ORM Diagram is a kind of Diagram
707
+ belongs_to :diagram_via_orm_diagram, :class_name => 'Diagram', :foreign_key => :orm_diagram_id
708
+
709
+ # maybe Shape is a Fact Type Shape and Fact Type Shape is for Fact Type
710
+ belongs_to :fact_type_via_fact_type_shape, :class_name => 'FactType', :foreign_key => :fact_type_shape_fact_type_concept_guid
711
+
712
+ # maybe Shape is an Object Type Shape and Object Type Shape is for Object Type
713
+ belongs_to :object_type_via_object_type_shape, :class_name => 'ObjectType', :foreign_key => :object_type_shape_object_type_id
714
+
715
+ # maybe Shape is a Reading Shape and Reading Shape is for Reading
716
+ belongs_to :reading_via_reading_shape, :class_name => 'Reading', :foreign_key => :reading_shape_reading_id
717
+
718
+ # maybe Shape is a Constraint Shape and maybe Constraint Shape is a Value Constraint Shape and maybe Value Constraint Shape is for Role Display
719
+ belongs_to :role_display_via_constraint_shape_value_constraint_shape, :class_name => 'RoleDisplay', :foreign_key => :value_constraint_shape_role_display_id
720
+
721
+ # maybe Shape is a Role Name Shape and Role Name Shape is for Role Display
722
+ belongs_to :role_display_via_role_name_shape, :class_name => 'RoleDisplay', :foreign_key => :role_name_shape_role_display_id
723
+
724
+ # 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
725
+ belongs_to :shape_via_constraint_shape_ring_constraint_shape_fact_type_shape, :class_name => 'Shape', :foreign_key => :ring_constraint_shape_fact_type_shape_guid
726
+
727
+ # 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
728
+ belongs_to :shape_via_constraint_shape_value_constraint_shape_object_type_shape, :class_name => 'Shape', :foreign_key => :value_constraint_shape_object_type_shape_guid
729
+
730
+ # 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
731
+ belongs_to :shape_via_objectified_fact_type_name_shape_fact_type_shape, :class_name => 'Shape', :foreign_key => :objectified_fact_type_name_shape_fact_type_shape_guid
732
+
733
+ # maybe Shape is a Reading Shape and Reading Shape is for Fact Type Shape and Fact Type Shape is a kind of Shape
734
+ belongs_to :shape_via_reading_shape_fact_type_shape, :class_name => 'Shape', :foreign_key => :reading_shape_fact_type_shape_guid
735
+
736
+ # Shape is a Fact Type Shape and Fact Type Shape is involved in Role Display
737
+ has_many :role_displays_via_fact_type_shape, :class_name => 'RoleDisplay', :foreign_key => :fact_type_shape_guid, :dependent => :destroy
738
+
739
+ # Shape is a Fact Type Shape and Fact Type Shape has Objectified Fact Type Name Shape and maybe Objectified Fact Type Name Shape is a kind of Shape
740
+ has_one :shape_via_objectified_fact_type_name_shape_fact_type_shape, :class_name => 'Shape', :foreign_key => :objectified_fact_type_name_shape_fact_type_shape_guid, :dependent => :destroy
741
+
742
+ # Shape is a Fact Type Shape and Fact Type Shape has Reading Shape and maybe Reading Shape is a kind of Shape
743
+ has_one :shape_via_reading_shape_fact_type_shape, :class_name => 'Shape', :foreign_key => :reading_shape_fact_type_shape_guid, :dependent => :destroy
744
+
745
+ # Shape is a Fact Type Shape and Ring Constraint Shape is attached to Fact Type Shape and maybe Ring Constraint Shape is a kind of Constraint Shape and maybe Constraint Shape is a kind of Shape
746
+ has_many :shapes_via_constraint_shape_ring_constraint_shape_fact_type_shape, :class_name => 'Shape', :foreign_key => :ring_constraint_shape_fact_type_shape_guid, :dependent => :destroy
747
+
748
+ # Shape is an Object Type Shape and maybe Object Type Shape has Value Constraint Shape and maybe Value Constraint Shape is a kind of Constraint Shape and maybe Constraint Shape is a kind of Shape
749
+ has_many :shapes_via_constraint_shape_value_constraint_shape_object_type_shape, :class_name => 'Shape', :foreign_key => :value_constraint_shape_object_type_shape_guid, :dependent => :destroy
750
+
751
+ validates :orm_diagram_id, :presence => true
752
+ end
753
+ end
754
+ end
755
+
756
+ module Concernz
757
+ module Step
758
+ extend ActiveSupport::Concern
759
+ included do
760
+ self.primary_key = 'guid'
761
+
762
+ # maybe Step falls under Alternative Set
763
+ belongs_to :alternative_set, :foreign_key => :alternative_set_guid
764
+
765
+ # Step specifies Fact Type
766
+ belongs_to :fact_type, :foreign_key => :fact_type_concept_guid
767
+
768
+ # Step is involved in Play
769
+ has_many :plays, :class_name => 'Play', :foreign_key => :step_guid, :dependent => :destroy
770
+
771
+ # maybe Step nests as Variable
772
+ has_one :objectification_variable, :class_name => 'Variable', :foreign_key => :step_guid, :dependent => :destroy
773
+
774
+ validates :fact_type_concept_guid, :presence => true
775
+ end
776
+ end
777
+ end
778
+
779
+ module Concernz
780
+ module Value
781
+ extend ActiveSupport::Concern
782
+ included do
783
+ self.primary_key = 'value_id'
784
+
785
+ # maybe Value is in Unit and Unit is an instance of Concept
786
+ belongs_to :concept_via_unit, :class_name => 'Concept', :foreign_key => :unit_concept_guid
787
+
788
+ # 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
789
+ belongs_to :object_type_via_value_type_domain_object_type, :class_name => 'ObjectType', :foreign_key => :value_type_object_type_id
790
+
791
+ # Value is of Bound and maybe Value Range has maximum-Bound and Value Range is involved in Allowed Range
792
+ has_many :allowed_ranges_via_value_range_maximum_bound, :class_name => 'AllowedRange', :foreign_key => :value_range_maximum_bound_value_id, :dependent => :destroy
793
+
794
+ # Value is of Bound and maybe Value Range has minimum-Bound and Value Range is involved in Allowed Range
795
+ has_many :allowed_ranges_via_value_range_minimum_bound, :class_name => 'AllowedRange', :foreign_key => :value_range_minimum_bound_value_id, :dependent => :destroy
796
+
797
+ # maybe Instance has Value and maybe Instance is an instance of Concept
798
+ has_many :concepts_via_instance, :class_name => 'Concept', :foreign_key => :instance_value_id, :dependent => :destroy
799
+
800
+ # Value is involved in Discriminated Role
801
+ has_many :discriminated_roles, :class_name => 'DiscriminatedRole', :foreign_key => :value_id, :dependent => :destroy
802
+
803
+ # Value Type Parameter Restriction has Value
804
+ has_many :value_type_parameter_restrictions, :class_name => 'ValueTypeParameterRestriction', :foreign_key => :value_id, :dependent => :destroy
805
+
806
+ # maybe Variable is bound to Value
807
+ has_many :variables, :class_name => 'Variable', :foreign_key => :value_id, :dependent => :destroy
808
+
809
+ validates :literal, :presence => true
810
+ validates :value_type_object_type_id, :presence => true
811
+ end
812
+ end
813
+ end
814
+
815
+ module Concernz
816
+ module ValueTypeParameter
817
+ extend ActiveSupport::Concern
818
+ included do
819
+ self.primary_key = 'value_type_parameter_id'
820
+
821
+ # 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
822
+ belongs_to :object_type_via_value_type_domain_object_type, :class_name => 'ObjectType', :foreign_key => :facet_value_type_object_type_id
823
+
824
+ # 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
825
+ belongs_to :object_type_via_value_type_domain_object_type, :class_name => 'ObjectType', :foreign_key => :value_type_object_type_id
826
+
827
+ # Value Type Parameter is involved in Value Type Parameter Restriction
828
+ has_many :value_type_parameter_restrictions, :class_name => 'ValueTypeParameterRestriction', :foreign_key => :value_type_parameter_id, :dependent => :destroy
829
+
830
+ validates :name, :presence => true
831
+ validates :value_type_object_type_id, :presence => true
832
+ validates :facet_value_type_object_type_id, :presence => true
833
+ end
834
+ end
835
+ end
836
+
837
+ module Concernz
838
+ module ValueTypeParameterRestriction
839
+ extend ActiveSupport::Concern
840
+ included do
841
+ self.primary_key = 'value_type_parameter_restriction_id'
842
+
843
+ # 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
844
+ belongs_to :object_type_via_value_type_domain_object_type, :class_name => 'ObjectType', :foreign_key => :value_type_object_type_id
845
+
846
+ # Value Type Parameter Restriction has Value
847
+ belongs_to :value, :foreign_key => :value_id
848
+
849
+ # Value Type Parameter Restriction involves Value Type Parameter
850
+ belongs_to :value_type_parameter, :foreign_key => :value_type_parameter_id
851
+
852
+ validates :value_id, :presence => true
853
+ validates :value_type_object_type_id, :presence => true
854
+ validates :value_type_parameter_id, :presence => true
855
+ end
856
+ end
857
+ end
858
+
859
+ module Concernz
860
+ module Variable
861
+ extend ActiveSupport::Concern
862
+ included do
863
+ self.primary_key = 'variable_id'
864
+
865
+ # Variable is in Query and Query is an instance of Concept
866
+ belongs_to :concept_via_query, :class_name => 'Concept', :foreign_key => :query_concept_guid
867
+
868
+ # Variable is for Object Type
869
+ belongs_to :object_type, :foreign_key => :object_type_id
870
+
871
+ # maybe Variable projects Role
872
+ belongs_to :projection, :class_name => 'Role', :foreign_key => :projection_id
873
+
874
+ # maybe Variable matches nesting over Step
875
+ belongs_to :step, :foreign_key => :step_guid
876
+
877
+ # maybe Variable is bound to Value
878
+ belongs_to :value, :foreign_key => :value_id
879
+
880
+ # Variable is involved in Aggregation
881
+ has_many :aggregations, :class_name => 'Aggregation', :foreign_key => :aggregated_variable_id, :dependent => :destroy
882
+
883
+ # Variable is involved in Aggregation
884
+ has_many :aggregations, :class_name => 'Aggregation', :foreign_key => :variable_id, :dependent => :destroy
885
+
886
+ # Variable is involved in Play
887
+ has_many :plays, :class_name => 'Play', :foreign_key => :variable_id, :dependent => :destroy
888
+
889
+ validates :object_type_id, :presence => true
890
+ validates :ordinal, :presence => true
891
+ validates :query_concept_guid, :presence => true
892
+ end
893
+ end
894
+ end