activefacts-metamodel 1.8.1 → 1.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e18edf07c9d30ebe02c45d63b87d1dabc328bcc0
4
- data.tar.gz: 775315e7031db7f4b6f30cdf0efbac0cef5e2547
3
+ metadata.gz: 191d182dcc1294a8a95c45837cb280eb7c5f6aa5
4
+ data.tar.gz: dc363ab895323a22cdecc5f6e475a5ca5e833346
5
5
  SHA512:
6
- metadata.gz: 37f78ca38e9bfa027e90114db134f23b022ae0bb6d8b45f28460cb63ce4d728a54df61f9d0fe104ad55a5b80a8b8c776fd4dd70b24e863144c55f3911d0c519c
7
- data.tar.gz: 1efd187a64997af03320b3efb48e068f4ea7ac037bffcf5765e92eded11b88ff1ba136fd196cd6cdf78d0a89b382f6a89485189d2c24e3198a6f2d8a70f9d341
6
+ metadata.gz: 620e4357c3c17757a3e62267350aaa7d8270176dd07ef32ef1a618ab9cbbf35c82f1ad251fc133e1e848351bf88ed44a608ff47fe351d522fe2f8645d9939246
7
+ data.tar.gz: 3f2721be2e27a9ec39b00054c83176add5122f18814b9ef5c6a6c29d00288ba80298043a90b60506bb847c111d45c9db58b474685aa8570e199bc95abfaa69dc
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  if ENV['PWD'] =~ %r{\A#{ENV['HOME']}/work}
6
- $stdout.puts "Using work area gems for #{File.basename(File.dirname(__FILE__))} from activefacts-metamodel"
6
+ $stderr.puts "Using work area gems for #{File.basename(File.dirname(__FILE__))} from activefacts-metamodel"
7
7
  gem 'activefacts-api', path: '/Users/cjh/work/activefacts/api'
8
8
  # gem 'activefacts-api', git: 'git://github.com/cjheath/activefacts-api.git'
9
9
  end
data/Rakefile CHANGED
@@ -6,6 +6,7 @@ RSpec::Core::RakeTask.new(:spec)
6
6
 
7
7
  task :default => :spec
8
8
 
9
+ desc "Bump gem version patch number"
9
10
  task :bump do
10
11
  path = File.expand_path('../lib/activefacts/metamodel/version.rb', __FILE__)
11
12
  lines = File.open(path) do |fp| fp.readlines; end
@@ -21,3 +22,25 @@ task :bump do
21
22
  )
22
23
  end
23
24
  end
25
+
26
+ desc "Generate new CQL from the ORM file"
27
+ task :cql do
28
+ system "afgen --cql orm/Metamodel.orm > Metamodel.cql"
29
+ system "afgen --cql cql/Metamodel.cql 2>/dev/null | diff -ub - Metamodel.cql | tee Metamodel.cql.diffs"
30
+ end
31
+
32
+ desc "Generate new Ruby from the ORM file"
33
+ task :ruby do
34
+ system %q{
35
+ afgen --ruby cql/Metamodel.cql 2>/dev/null |
36
+ sed '2a\
37
+ module ActiveFacts
38
+
39
+ 3s/:://
40
+ 3,$s/^/ /
41
+ $a\
42
+ end
43
+ ' > metamodel.rb
44
+ }
45
+ system "diff -ub lib/activefacts/metamodel/metamodel.rb metamodel.rb"
46
+ end
@@ -24,5 +24,6 @@ This gem provides the core representations for the Fact Modeling tools of Active
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "rspec", "~> 3.3"
26
26
 
27
- spec.add_runtime_dependency "activefacts-api", ">= 1.8", "~> 1.8.4"
27
+ spec.add_runtime_dependency "activefacts-api", ">= 1.8", "~> 1.8.5"
28
+ spec.add_development_dependency "activefacts", "~> 1.8", "~> 1.8.0"
28
29
  end
@@ -22,6 +22,7 @@ Implication Rule Name is written as String;
22
22
  Length is written as Unsigned Integer(32);
23
23
  Literal is written as String;
24
24
  Name is written as String(64);
25
+ Nesting Mode is written as String restricted to {'Array', 'Bag', 'Map', 'Repetition'};
25
26
  Numerator is written as Decimal;
26
27
  Offset is written as Decimal;
27
28
  Ordinal is written as Unsigned Integer(16);
@@ -57,6 +58,7 @@ Component is identified by Guid where
57
58
  Component has one Guid,
58
59
  Guid is of at most one Component;
59
60
  Component projects at most one Name;
61
+ Component has at most one Ordinal rank;
60
62
 
61
63
  Composition is identified by Guid where
62
64
  Composition has one Guid,
@@ -311,6 +313,7 @@ Fact Type Shape is for one Fact Type,
311
313
  Fact Type Shape has at most one Rotation Setting;
312
314
 
313
315
  Injection is a kind of Mapping;
316
+ ValueField is a kind of Injection;
314
317
 
315
318
  Mirror Role is a kind of Role;
316
319
  Mirror Role is for at most one Role (as Base Role),
@@ -323,6 +326,11 @@ Nesting is where
323
326
  Absorption is nested under index-Role in Ordinal position,
324
327
  Absorption in Ordinal position is nested under one Role,
325
328
  Role keys nesting of Absorption at Ordinal priority;
329
+ Absorption uses at most one Nesting Mode;
330
+ Nesting has at most one key-Name;
331
+ Absorption is nested under index Role in Ordinal position
332
+ if and only if
333
+ that Absorption uses some Nesting Mode;
326
334
 
327
335
  ORM Diagram is a kind of Diagram;
328
336
  Shape is in one ORM Diagram,
@@ -267,9 +267,7 @@ module ActiveFacts
267
267
  end
268
268
 
269
269
  def is_mandatory
270
- # REVISIT: An objectification role is always mandatory
271
- # REVISIT: Handle mirror roles
272
- return fact_type.implying_role.is_mandatory if fact_type.is_a?(LinkFactType)
270
+ return true if fact_type.is_a?(LinkFactType) # Handle objectification roles
273
271
  all_role_ref.detect{|rr|
274
272
  rs = rr.role_sequence
275
273
  rs.all_role_ref.size == 1 and
@@ -286,7 +284,8 @@ module ActiveFacts
286
284
  # Return true if this role is functional (has only one instance wrt its player)
287
285
  # A role in an objectified fact type is deemed to refer to the implicit role of the objectification.
288
286
  def is_functional
289
- # REVISIT: Handle mirror and objectification roles
287
+ return true if fact_type.is_a?(LinkFactType) # Handle objectification roles
288
+
290
289
  fact_type.entity_type or
291
290
  fact_type.all_role.size != 2 or
292
291
  uniqueness_constraint
@@ -305,7 +304,8 @@ module ActiveFacts
305
304
 
306
305
  # Is there are internal uniqueness constraint on this role only?
307
306
  def is_unique
308
- # REVISIT: Handle objectification roles
307
+ return true if fact_type.is_a?(LinkFactType) # Handle objectification roles
308
+
309
309
  uniqueness_constraint ? true : false
310
310
  end
311
311
 
@@ -600,6 +600,10 @@ module ActiveFacts
600
600
  end
601
601
  end
602
602
 
603
+ def rank_in_preferred_identifier(role)
604
+ preferred_identifier.role_sequence.all_role_ref_in_order.map(&:role).index(role)
605
+ end
606
+
603
607
  # An array of all direct subtypes:
604
608
  def subtypes
605
609
  # REVISIT: There's no sorting here. Should there be?
@@ -1120,15 +1124,15 @@ module ActiveFacts
1120
1124
 
1121
1125
  class MirrorRole
1122
1126
  def is_mandatory
1123
- true # An objectified fact type must have a player for each role
1127
+ base_role.is_mandatory
1124
1128
  end
1125
1129
 
1126
1130
  def is_unique
1127
- true # A mirror role exists is played exactly once for each objectification
1131
+ base_role.is_unique
1128
1132
  end
1129
1133
 
1130
1134
  def is_functional
1131
- true
1135
+ base_role.is_functional
1132
1136
  end
1133
1137
 
1134
1138
  def uniqueness_constraint
@@ -1343,5 +1347,180 @@ module ActiveFacts
1343
1347
  end
1344
1348
  end
1345
1349
 
1350
+ class Mapping
1351
+ def inspect
1352
+ "#{self.class.basename} (#{rank_kind}) of #{object_type.name}"
1353
+ end
1354
+
1355
+ def show_trace
1356
+ trace :composition, "#{ordinal ? "#{ordinal}: " : ''}#{inspect} #{name ? " (as #{name})" : ''}" do
1357
+ yield if block_given?
1358
+ all_member.sort_by{|member| [member.ordinal, member.name]}.each do |member|
1359
+ member.show_trace
1360
+ end
1361
+ end
1362
+ end
1363
+ end
1364
+
1365
+ class Nesting
1366
+ def show_trace
1367
+ # The index role has a counterpart played by the parent object in the enclosing Absorption
1368
+ reading = index_role.fact_type.default_reading
1369
+ trace :composition, "#{ordinal}: Nesting under #{index_role.object_type.name}#{key_name ? " (as #{key_name})" : ''} in #{reading.inspect}}"
1370
+ end
1371
+ end
1372
+
1373
+ class Absorption
1374
+ def inspect
1375
+ "#{super} in #{parent_role.fact_type.reading_preferably_starting_with_role(parent_role).expand.inspect}"
1376
+ end
1377
+
1378
+ def show_trace
1379
+ super() do
1380
+ if nesting_mode || all_nesting.size > 0
1381
+ trace :composition, "Nested using #{nesting_mode || 'unspecified'} mode" do
1382
+ all_nesting.sort_by(&:ordinal).each(&:show_trace)
1383
+ end
1384
+ end
1385
+ end
1386
+ end
1387
+
1388
+ def is_type_inheritance
1389
+ child_role.fact_type.is_a?(TypeInheritance) && child_role.fact_type
1390
+ end
1391
+
1392
+ def is_supertype_absorption
1393
+ is_type_inheritance && child_role.fact_type.supertype == object_type
1394
+ end
1395
+
1396
+ def is_subtype_absorption
1397
+ is_type_inheritance && parent_role.fact_type.supertype == object_type
1398
+ end
1399
+ end
1400
+
1401
+ class Indicator
1402
+ def inspect
1403
+ "#{self.class.basename} #{role.fact_type.default_reading.inspect}"
1404
+ end
1405
+
1406
+ def show_trace
1407
+ trace :composition, "#{ordinal ? "#{ordinal}: " : ''}#{inspect} #{name ? " (as #{name})" : ''}"
1408
+ end
1409
+ end
1410
+
1411
+ class Discriminator
1412
+ def inspect
1413
+ "#{self.class.basename} #{role.fact_type.default_reading.inspect}"
1414
+ end
1415
+
1416
+ def show_trace
1417
+ trace :composition, "#{ordinal ? "#{ordinal}: " : ''}#{inspect} #{name ? " (as #{name})" : ''}"
1418
+ end
1419
+ end
1420
+
1421
+ class ValueField
1422
+ def inspect
1423
+ "#{self.class.basename} #{object_type.name.inspect}"
1424
+ end
1425
+
1426
+ def show_trace
1427
+ trace :composition, "#{ordinal}: #{inspect} #{name ? " (as #{name})" : ''}"
1428
+ end
1429
+ end
1430
+
1431
+ class Component
1432
+ # The ranking key of a component indicates its importance to its parent:
1433
+ # Ranking assigns a total order, but is computed in groups:
1434
+ RANK_SUPER = 0 # Supertypes, with the identifying supertype first, others alphabetical
1435
+ RANK_IDENT = 1 # Identifying components (absorptions, indicator), in order of the identifier
1436
+ RANK_VALUE = 2 # A ValueField
1437
+ RANK_INJECTION = 3 # Injections, in alphabetical order
1438
+ RANK_DISCRIMINATOR = 4 # Discriminator components, in alphabetical order
1439
+ RANK_FOREIGN = 5 # REVISIT: Foreign key components
1440
+ RANK_INDICATOR = 6 # Indicators in alphabetical order
1441
+ RANK_MANDATORY = 7 # Absorption: unique mandatory
1442
+ RANK_NON_MANDATORY = 8 # Absorption: unique optional
1443
+ RANK_MULTIPLE = 9 # Absorption: manifold
1444
+ RANK_SUBTYPE = 10 # Subtypes in alphabetical order
1445
+ RANK_SCOPING = 11 # Scoping in alphabetical order
1446
+
1447
+ def rank_key
1448
+ parent_et = parent &&
1449
+ parent.object_type.is_a?(EntityType) &&
1450
+ parent.object_type
1451
+
1452
+ case self
1453
+ when Indicator
1454
+ if parent_et && (position = parent_et.rank_in_preferred_identifier(role))
1455
+ [RANK_IDENT, position] # An identifying unary
1456
+ else
1457
+ [RANK_INDICATOR, name || role.role_name || role.fact_type.default_reading] # A non-identifying unary
1458
+ end
1459
+
1460
+ when Discriminator
1461
+ [RANK_DISCRIMINATOR, name || object_type.name]
1462
+
1463
+ when ValueField
1464
+ [RANK_IDENT]
1465
+
1466
+ when Injection
1467
+ [RANK_INJECTION, name || object_type.name] # REVISIT: A different sub-key for ranking may be needed
1468
+
1469
+ when Absorption
1470
+ if is_type_inheritance
1471
+ # We are traversing a type inheritance fact type. Is this object_type the subtype or supertype?
1472
+ if is_supertype_absorption
1473
+ # What's the rank of this supertype?
1474
+ tis = parent_role.object_type.all_type_inheritance_as_subtype.sort_by{|ti| ti.provides_identification ? '' : ti.supertype.name }
1475
+ [RANK_SUPER, child_role.fact_type.provides_identification ? 0 : 1+tis.index(parent_role.fact_type)]
1476
+ else
1477
+ # What's the rank of this subtype?
1478
+ tis = parent_role.object_type.all_type_inheritance_as_supertype.sort_by{|ti| ti.subtype.name }
1479
+ [RANK_SUBTYPE, tis.index(parent_role.fact_type)]
1480
+ end
1481
+ elsif parent_et && (position = parent_et.rank_in_preferred_identifier(child_role))
1482
+ [RANK_IDENT, position]
1483
+ else
1484
+ if parent_role.is_unique
1485
+ [parent_role.is_mandatory ? RANK_MANDATORY : RANK_NON_MANDATORY, name || child_role.role_name || object_type.name]
1486
+ else
1487
+ [RANK_MULTIPLE, name || child_role.role_name || object_type.name]
1488
+ end
1489
+ end
1490
+
1491
+ when Scoping
1492
+ [RANK_SCOPING, name || object_type.name]
1493
+
1494
+ else
1495
+ raise "unexpected #{self.class.basename} in Component#rank_key"
1496
+ end
1497
+ end
1498
+
1499
+ def rank_kind
1500
+ return "composite" if self.class == Mapping
1501
+ case rank_key[0]
1502
+ when RANK_SUPER; "supertype"
1503
+ when RANK_IDENT; "existential"
1504
+ when RANK_VALUE; "self-value"
1505
+ when RANK_INJECTION; "injection"
1506
+ when RANK_DISCRIMINATOR; "discriminator"
1507
+ when RANK_FOREIGN; "foreignkey"
1508
+ when RANK_INDICATOR; "indicator"
1509
+ when RANK_MANDATORY; "mandatory"
1510
+ when RANK_NON_MANDATORY; "optional"
1511
+ when RANK_MULTIPLE; "multiple"
1512
+ when RANK_SUBTYPE; "subtype"
1513
+ when RANK_SCOPING; "scoping"
1514
+ end
1515
+ end
1516
+
1517
+ def inspect
1518
+ "#{self.class.basename}"
1519
+ end
1520
+
1521
+ def show_trace
1522
+ trace :composition, "#{ordinal ? "#{ordinal}: " : ''}#{inspect}#{name ? " (as #{name})" : ''}"
1523
+ end
1524
+ end
1346
1525
  end
1347
1526
  end
@@ -2,68 +2,68 @@ require 'activefacts/api'
2
2
 
3
3
  module ActiveFacts
4
4
  module Metamodel
5
-
5
+
6
6
  class Adjective < String
7
7
  value_type :length => 64
8
8
  end
9
-
9
+
10
10
  class AgentName < String
11
11
  value_type
12
12
  one_to_one :agent # See Agent.agent_name
13
13
  end
14
-
14
+
15
15
  class AggregateCode < String
16
16
  value_type :length => 32
17
17
  one_to_one :aggregate # See Aggregate.aggregate_code
18
18
  end
19
-
19
+
20
20
  class Annotation < String
21
21
  value_type
22
22
  end
23
-
23
+
24
24
  class Assimilation < String
25
25
  value_type
26
26
  restrict 'absorbed', 'partitioned', 'separate'
27
27
  end
28
-
28
+
29
29
  class ContextNoteKind < String
30
30
  value_type
31
31
  restrict 'as_opposed_to', 'because', 'so_that', 'to_avoid'
32
32
  end
33
-
33
+
34
34
  class Date < ::Date
35
35
  value_type
36
36
  end
37
-
37
+
38
38
  class Denominator < UnsignedInteger
39
39
  value_type :length => 32
40
40
  end
41
-
41
+
42
42
  class Discussion < String
43
43
  value_type
44
44
  end
45
-
45
+
46
46
  class DisplayRoleNamesSetting < String
47
47
  value_type
48
48
  restrict 'false', 'true'
49
49
  end
50
-
50
+
51
51
  class EnforcementCode < String
52
52
  value_type :length => 16
53
53
  end
54
-
54
+
55
55
  class EphemeraURL < String
56
56
  value_type
57
57
  end
58
-
58
+
59
59
  class Exponent < SignedInteger
60
60
  value_type :length => 16
61
61
  end
62
-
62
+
63
63
  class Frequency < UnsignedInteger
64
64
  value_type :length => 32
65
65
  end
66
-
66
+
67
67
  class Guid < ::Guid
68
68
  value_type
69
69
  one_to_one :alternative_set # See AlternativeSet.guid
@@ -74,20 +74,20 @@ module ActiveFacts
74
74
  one_to_one :shape # See Shape.guid
75
75
  one_to_one :step # See Step.guid
76
76
  end
77
-
77
+
78
78
  class ImplicationRuleName < String
79
79
  value_type
80
80
  one_to_one :implication_rule # See ImplicationRule.implication_rule_name
81
81
  end
82
-
82
+
83
83
  class Length < UnsignedInteger
84
84
  value_type :length => 32
85
85
  end
86
-
86
+
87
87
  class Literal < String
88
88
  value_type
89
89
  end
90
-
90
+
91
91
  class Name < String
92
92
  value_type :length => 64
93
93
  one_to_one :composition # See Composition.name
@@ -96,118 +96,124 @@ module ActiveFacts
96
96
  one_to_one :unit # See Unit.name
97
97
  one_to_one :vocabulary # See Vocabulary.name
98
98
  end
99
-
99
+
100
+ class NestingMode < String
101
+ value_type
102
+ restrict 'Array', 'Bag', 'Map', 'Repetition'
103
+ end
104
+
100
105
  class Numerator < Decimal
101
106
  value_type
102
107
  end
103
-
108
+
104
109
  class Offset < Decimal
105
110
  value_type
106
111
  end
107
-
112
+
108
113
  class Ordinal < UnsignedInteger
109
114
  value_type :length => 16
110
115
  end
111
-
116
+
112
117
  class Pronoun < String
113
118
  value_type :length => 20
114
119
  restrict 'feminine', 'masculine', 'neuter', 'personal'
115
120
  end
116
-
121
+
117
122
  class RegularExpression < String
118
123
  value_type
119
124
  end
120
-
125
+
121
126
  class RingType < String
122
127
  value_type
123
128
  end
124
-
129
+
125
130
  class RotationSetting < String
126
131
  value_type
127
132
  restrict 'left', 'right'
128
133
  end
129
-
134
+
130
135
  class Scale < UnsignedInteger
131
136
  value_type :length => 32
132
137
  end
133
-
138
+
134
139
  class Subscript < UnsignedInteger
135
140
  value_type :length => 16
136
141
  end
137
-
142
+
138
143
  class Text < String
139
144
  value_type :length => 256
140
145
  end
141
-
146
+
142
147
  class TransactionPhase < String
143
148
  value_type
144
149
  restrict 'assert', 'commit'
145
150
  end
146
-
151
+
147
152
  class X < SignedInteger
148
153
  value_type :length => 32
149
154
  end
150
-
155
+
151
156
  class Y < SignedInteger
152
157
  value_type :length => 32
153
158
  end
154
-
159
+
155
160
  class Agent
156
161
  identified_by :agent_name
157
162
  one_to_one :agent_name, :mandatory => true # See AgentName.agent
158
163
  end
159
-
164
+
160
165
  class Aggregate
161
166
  identified_by :aggregate_code
162
167
  one_to_one :aggregate_code, :mandatory => true # See AggregateCode.aggregate
163
168
  end
164
-
169
+
165
170
  class AlternativeSet
166
171
  identified_by :guid
167
172
  one_to_one :guid, :mandatory => true # See Guid.alternative_set
168
173
  maybe :members_are_exclusive
169
174
  end
170
-
175
+
171
176
  class Coefficient
172
177
  identified_by :numerator, :denominator, :is_precise
173
178
  has_one :denominator, :mandatory => true # See Denominator.all_coefficient
174
179
  maybe :is_precise
175
180
  has_one :numerator, :mandatory => true # See Numerator.all_coefficient
176
181
  end
177
-
182
+
178
183
  class Component
179
184
  identified_by :guid
180
185
  one_to_one :guid, :mandatory => true # See Guid.component
181
186
  has_one :name # See Name.all_component
187
+ has_one :ordinal # See Ordinal.all_component
182
188
  has_one :parent, :class => "Mapping", :counterpart => :member # See Mapping.all_member
183
189
  end
184
-
190
+
185
191
  class Composition
186
192
  identified_by :guid
187
193
  one_to_one :guid, :mandatory => true # See Guid.composition
188
194
  one_to_one :name, :mandatory => true # See Name.composition
189
195
  end
190
-
196
+
191
197
  class Concept
192
198
  identified_by :guid
193
199
  one_to_one :guid, :mandatory => true # See Guid.concept
194
200
  has_one :implication_rule # See ImplicationRule.all_concept
195
201
  has_one :topic # See Topic.all_concept
196
202
  end
197
-
203
+
198
204
  class ConceptAnnotation
199
205
  identified_by :concept, :mapping_annotation
200
206
  has_one :concept, :mandatory => true # See Concept.all_concept_annotation
201
207
  has_one :mapping_annotation, :class => Annotation, :mandatory => true # See Annotation.all_concept_annotation_as_mapping_annotation
202
208
  end
203
-
209
+
204
210
  class Constraint
205
211
  identified_by :concept
206
212
  one_to_one :concept, :mandatory => true # See Concept.constraint
207
213
  has_one :name # See Name.all_constraint
208
214
  has_one :vocabulary # See Vocabulary.all_constraint
209
215
  end
210
-
216
+
211
217
  class ContextNote
212
218
  identified_by :concept
213
219
  one_to_one :concept, :mandatory => true # See Concept.context_note
@@ -215,38 +221,38 @@ module ActiveFacts
215
221
  has_one :discussion, :mandatory => true # See Discussion.all_context_note
216
222
  has_one :relevant_concept, :class => Concept # See Concept.all_context_note_as_relevant_concept
217
223
  end
218
-
224
+
219
225
  class Discriminator < Component
220
226
  end
221
-
227
+
222
228
  class Enforcement
223
229
  identified_by :constraint
224
230
  has_one :agent # See Agent.all_enforcement
225
231
  one_to_one :constraint, :mandatory => true # See Constraint.enforcement
226
232
  has_one :enforcement_code, :mandatory => true # See EnforcementCode.all_enforcement
227
233
  end
228
-
234
+
229
235
  class Fact
230
236
  identified_by :concept
231
237
  one_to_one :concept, :mandatory => true # See Concept.fact
232
238
  has_one :fact_type, :mandatory => true # See FactType.all_fact
233
239
  has_one :population, :mandatory => true # See Population.all_fact
234
240
  end
235
-
241
+
236
242
  class FactType
237
243
  identified_by :concept
238
244
  one_to_one :concept, :mandatory => true # See Concept.fact_type
239
245
  end
240
-
246
+
241
247
  class ImplicationRule
242
248
  identified_by :implication_rule_name
243
249
  one_to_one :implication_rule_name, :mandatory => true # See ImplicationRuleName.implication_rule
244
250
  end
245
-
251
+
246
252
  class Indicator < Component
247
253
  has_one :role, :mandatory => true # See Role.all_indicator
248
254
  end
249
-
255
+
250
256
  class Instance
251
257
  identified_by :concept
252
258
  one_to_one :concept, :mandatory => true # See Concept.instance
@@ -255,20 +261,20 @@ module ActiveFacts
255
261
  has_one :population, :mandatory => true # See Population.all_instance
256
262
  has_one :value # See Value.all_instance
257
263
  end
258
-
264
+
259
265
  class LinkFactType < FactType
260
266
  end
261
-
267
+
262
268
  class Location
263
269
  identified_by :x, :y
264
270
  has_one :x, :mandatory => true # See X.all_location
265
271
  has_one :y, :mandatory => true # See Y.all_location
266
272
  end
267
-
273
+
268
274
  class Mapping < Component
269
275
  has_one :object_type, :mandatory => true # See ObjectType.all_mapping
270
276
  end
271
-
277
+
272
278
  class PresenceConstraint < Constraint
273
279
  maybe :is_mandatory
274
280
  maybe :is_preferred_identifier
@@ -276,12 +282,12 @@ module ActiveFacts
276
282
  has_one :min_frequency, :class => Frequency # See Frequency.all_presence_constraint_as_min_frequency
277
283
  has_one :role_sequence, :mandatory => true # See RoleSequence.all_presence_constraint
278
284
  end
279
-
285
+
280
286
  class Query
281
287
  identified_by :concept
282
288
  one_to_one :concept, :mandatory => true # See Concept.query
283
289
  end
284
-
290
+
285
291
  class Reading
286
292
  identified_by :fact_type, :ordinal
287
293
  has_one :fact_type, :mandatory => true # See FactType.all_reading
@@ -290,13 +296,13 @@ module ActiveFacts
290
296
  has_one :role_sequence, :mandatory => true # See RoleSequence.all_reading
291
297
  has_one :text, :mandatory => true # See Text.all_reading
292
298
  end
293
-
299
+
294
300
  class RingConstraint < Constraint
295
301
  has_one :other_role, :class => "Role" # See Role.all_ring_constraint_as_other_role
296
302
  has_one :ring_type, :mandatory => true # See RingType.all_ring_constraint
297
303
  has_one :role # See Role.all_ring_constraint
298
304
  end
299
-
305
+
300
306
  class Role
301
307
  identified_by :fact_type, :ordinal
302
308
  one_to_one :concept, :mandatory => true # See Concept.role
@@ -306,13 +312,13 @@ module ActiveFacts
306
312
  has_one :ordinal, :mandatory => true # See Ordinal.all_role
307
313
  has_one :role_name, :class => Name # See Name.all_role_as_role_name
308
314
  end
309
-
315
+
310
316
  class RoleSequence
311
317
  identified_by :guid
312
318
  one_to_one :guid, :mandatory => true # See Guid.role_sequence
313
319
  maybe :has_unused_dependency_to_force_table_in_norma
314
320
  end
315
-
321
+
316
322
  class RoleValue
317
323
  identified_by :fact, :role
318
324
  has_one :fact, :mandatory => true # See Fact.all_role_value
@@ -320,13 +326,13 @@ module ActiveFacts
320
326
  has_one :population, :mandatory => true # See Population.all_role_value
321
327
  has_one :role, :mandatory => true # See Role.all_role_value
322
328
  end
323
-
329
+
324
330
  class Scoping < Mapping
325
331
  end
326
-
332
+
327
333
  class SetConstraint < Constraint
328
334
  end
329
-
335
+
330
336
  class Shape
331
337
  identified_by :guid
332
338
  one_to_one :guid, :mandatory => true # See Guid.shape
@@ -334,7 +340,7 @@ module ActiveFacts
334
340
  has_one :location # See Location.all_shape
335
341
  has_one :orm_diagram, :class => "ORMDiagram", :mandatory => true # See ORMDiagram.all_shape
336
342
  end
337
-
343
+
338
344
  class Step
339
345
  identified_by :guid
340
346
  has_one :alternative_set # See AlternativeSet.all_step
@@ -343,17 +349,17 @@ module ActiveFacts
343
349
  maybe :is_disallowed
344
350
  maybe :is_optional
345
351
  end
346
-
352
+
347
353
  class SubsetConstraint < SetConstraint
348
354
  has_one :subset_role_sequence, :class => RoleSequence, :mandatory => true # See RoleSequence.all_subset_constraint_as_subset_role_sequence
349
355
  has_one :superset_role_sequence, :class => RoleSequence, :mandatory => true # See RoleSequence.all_subset_constraint_as_superset_role_sequence
350
356
  end
351
-
357
+
352
358
  class Topic
353
359
  identified_by :topic_name
354
360
  one_to_one :topic_name, :class => Name, :mandatory => true # See Name.topic_as_topic_name
355
361
  end
356
-
362
+
357
363
  class Unit
358
364
  identified_by :concept
359
365
  has_one :coefficient # See Coefficient.all_unit
@@ -365,7 +371,7 @@ module ActiveFacts
365
371
  one_to_one :plural_name, :class => Name, :counterpart => :plural_named_unit # See Name.plural_named_unit
366
372
  has_one :vocabulary, :mandatory => true # See Vocabulary.all_unit
367
373
  end
368
-
374
+
369
375
  class Value
370
376
  identified_by :literal, :is_literal_string, :unit
371
377
  maybe :is_literal_string
@@ -373,12 +379,12 @@ module ActiveFacts
373
379
  has_one :unit # See Unit.all_value
374
380
  has_one :value_type, :mandatory => true # See ValueType.all_value
375
381
  end
376
-
382
+
377
383
  class ValueConstraint < Constraint
378
384
  has_one :regular_expression # See RegularExpression.all_value_constraint
379
385
  one_to_one :role, :counterpart => :role_value_constraint # See Role.role_value_constraint
380
386
  end
381
-
387
+
382
388
  class Variable
383
389
  identified_by :query, :ordinal
384
390
  has_one :object_type, :mandatory => true # See ObjectType.all_variable
@@ -390,109 +396,111 @@ module ActiveFacts
390
396
  has_one :subscript # See Subscript.all_variable
391
397
  has_one :value # See Value.all_variable
392
398
  end
393
-
399
+
394
400
  class Vocabulary
395
401
  identified_by :name
396
402
  one_to_one :name, :mandatory => true # See Name.vocabulary
397
403
  end
398
-
404
+
399
405
  class Absorption < Mapping
400
406
  one_to_one :absorption, :counterpart => :reverse_absorption # See Absorption.reverse_absorption
401
407
  has_one :child_role, :class => Role, :mandatory => true # See Role.all_absorption_as_child_role
402
408
  maybe :flattens
409
+ has_one :nesting_mode # See NestingMode.all_absorption
403
410
  has_one :parent_role, :class => Role, :mandatory => true # See Role.all_absorption_as_parent_role
404
411
  one_to_one :reverse_absorption, :class => Absorption # See Absorption.absorption_as_reverse_absorption
405
412
  end
406
-
413
+
407
414
  class Aggregation
408
415
  identified_by :aggregate, :aggregated_variable
409
416
  has_one :aggregate, :mandatory => true # See Aggregate.all_aggregation
410
417
  has_one :aggregated_variable, :class => Variable, :mandatory => true # See Variable.all_aggregation_as_aggregated_variable
411
418
  has_one :variable, :mandatory => true # See Variable.all_aggregation
412
419
  end
413
-
420
+
414
421
  class Agreement
415
422
  identified_by :context_note
416
423
  one_to_one :context_note, :mandatory => true # See ContextNote.agreement
417
424
  has_one :date # See Date.all_agreement
418
425
  end
419
-
426
+
420
427
  class Bound
421
428
  identified_by :value, :is_inclusive
422
429
  maybe :is_inclusive
423
430
  has_one :value, :mandatory => true # See Value.all_bound
424
431
  end
425
-
432
+
426
433
  class Composite
427
434
  identified_by :mapping
428
435
  has_one :composition, :mandatory => true # See Composition.all_composite
429
436
  one_to_one :mapping, :mandatory => true # See Mapping.composite
430
437
  end
431
-
438
+
432
439
  class ConstraintShape < Shape
433
440
  has_one :constraint, :mandatory => true # See Constraint.all_constraint_shape
434
441
  end
435
-
442
+
436
443
  class ContextAccordingTo
437
444
  identified_by :context_note, :agent
438
445
  has_one :agent, :mandatory => true # See Agent.all_context_according_to
439
446
  has_one :context_note, :mandatory => true # See ContextNote.all_context_according_to
440
447
  has_one :date # See Date.all_context_according_to
441
448
  end
442
-
449
+
443
450
  class ContextAgreedBy
444
451
  identified_by :agreement, :agent
445
452
  has_one :agent, :mandatory => true # See Agent.all_context_agreed_by
446
453
  has_one :agreement, :mandatory => true # See Agreement.all_context_agreed_by
447
454
  end
448
-
455
+
449
456
  class Derivation
450
457
  identified_by :derived_unit, :base_unit
451
458
  has_one :base_unit, :class => Unit, :mandatory => true # See Unit.all_derivation_as_base_unit
452
459
  has_one :derived_unit, :class => Unit, :mandatory => true # See Unit.all_derivation_as_derived_unit
453
460
  has_one :exponent # See Exponent.all_derivation
454
461
  end
455
-
462
+
456
463
  class Diagram
457
464
  identified_by :vocabulary, :name
458
465
  has_one :name, :mandatory => true # See Name.all_diagram
459
466
  has_one :vocabulary, :mandatory => true # See Vocabulary.all_diagram
460
467
  end
461
-
468
+
462
469
  class DiscriminatedRole
463
470
  identified_by :discriminator, :role
464
471
  has_one :discriminator, :mandatory => true # See Discriminator.all_discriminated_role
465
472
  has_one :role, :mandatory => true # See Role.all_discriminated_role
466
473
  has_one :value, :mandatory => true # See Value.all_discriminated_role
467
474
  end
468
-
475
+
469
476
  class FactTypeShape < Shape
470
477
  has_one :display_role_names_setting # See DisplayRoleNamesSetting.all_fact_type_shape
471
478
  has_one :fact_type, :mandatory => true # See FactType.all_fact_type_shape
472
479
  has_one :rotation_setting # See RotationSetting.all_fact_type_shape
473
480
  end
474
-
481
+
475
482
  class Injection < Mapping
476
483
  end
477
-
484
+
478
485
  class MirrorRole < Role
479
486
  one_to_one :base_role, :class => Role # See Role.mirror_role_as_base_role
480
487
  end
481
-
488
+
482
489
  class ModelNoteShape < Shape
483
490
  has_one :context_note, :mandatory => true # See ContextNote.all_model_note_shape
484
491
  end
485
-
492
+
486
493
  class Nesting
487
494
  identified_by :absorption, :ordinal
488
495
  has_one :absorption, :mandatory => true # See Absorption.all_nesting
489
496
  has_one :index_role, :class => Role, :mandatory => true # See Role.all_nesting_as_index_role
490
497
  has_one :ordinal, :mandatory => true # See Ordinal.all_nesting
498
+ has_one :key_name, :class => Name # See Name.all_nesting_as_key_name
491
499
  end
492
-
500
+
493
501
  class ORMDiagram < Diagram
494
502
  end
495
-
503
+
496
504
  class ObjectType
497
505
  identified_by :vocabulary, :name
498
506
  one_to_one :concept, :mandatory => true # See Concept.object_type
@@ -501,16 +509,16 @@ module ActiveFacts
501
509
  has_one :pronoun # See Pronoun.all_object_type
502
510
  has_one :vocabulary, :mandatory => true # See Vocabulary.all_object_type
503
511
  end
504
-
512
+
505
513
  class ObjectTypeShape < Shape
506
514
  maybe :has_expanded_reference_mode
507
515
  has_one :object_type, :mandatory => true # See ObjectType.all_object_type_shape
508
516
  end
509
-
517
+
510
518
  class ObjectifiedFactTypeNameShape < Shape
511
519
  one_to_one :fact_type_shape, :mandatory => true # See FactTypeShape.objectified_fact_type_name_shape
512
520
  end
513
-
521
+
514
522
  class Play
515
523
  identified_by :step, :role
516
524
  has_one :role, :mandatory => true # See Role.all_play
@@ -518,34 +526,34 @@ module ActiveFacts
518
526
  has_one :variable, :mandatory => true # See Variable.all_play
519
527
  maybe :is_input
520
528
  end
521
-
529
+
522
530
  class Population
523
531
  identified_by :vocabulary, :name
524
532
  one_to_one :concept, :mandatory => true # See Concept.population
525
533
  has_one :name, :mandatory => true # See Name.all_population
526
534
  has_one :vocabulary # See Vocabulary.all_population
527
535
  end
528
-
536
+
529
537
  class ReadingShape < Shape
530
538
  one_to_one :fact_type_shape, :mandatory => true # See FactTypeShape.reading_shape
531
539
  has_one :reading, :mandatory => true # See Reading.all_reading_shape
532
540
  end
533
-
541
+
534
542
  class RingConstraintShape < ConstraintShape
535
543
  has_one :fact_type_shape, :mandatory => true # See FactTypeShape.all_ring_constraint_shape
536
544
  end
537
-
545
+
538
546
  class RoleDisplay
539
547
  identified_by :fact_type_shape, :ordinal
540
548
  has_one :fact_type_shape, :mandatory => true # See FactTypeShape.all_role_display
541
549
  has_one :ordinal, :mandatory => true # See Ordinal.all_role_display
542
550
  has_one :role, :mandatory => true # See Role.all_role_display
543
551
  end
544
-
552
+
545
553
  class RoleNameShape < Shape
546
554
  one_to_one :role_display, :mandatory => true # See RoleDisplay.role_name_shape
547
555
  end
548
-
556
+
549
557
  class RoleRef
550
558
  identified_by :role_sequence, :ordinal
551
559
  has_one :ordinal, :mandatory => true # See Ordinal.all_role_ref
@@ -555,48 +563,51 @@ module ActiveFacts
555
563
  one_to_one :play # See Play.role_ref
556
564
  has_one :trailing_adjective, :class => Adjective # See Adjective.all_role_ref_as_trailing_adjective
557
565
  end
558
-
566
+
559
567
  class SetComparisonConstraint < SetConstraint
560
568
  end
561
-
569
+
562
570
  class SetComparisonRoles
563
571
  identified_by :set_comparison_constraint, :ordinal
564
572
  has_one :ordinal, :mandatory => true # See Ordinal.all_set_comparison_roles
565
573
  has_one :role_sequence, :mandatory => true # See RoleSequence.all_set_comparison_roles
566
574
  has_one :set_comparison_constraint, :mandatory => true # See SetComparisonConstraint.all_set_comparison_roles
567
575
  end
568
-
576
+
569
577
  class SetEqualityConstraint < SetComparisonConstraint
570
578
  end
571
-
579
+
572
580
  class SetExclusionConstraint < SetComparisonConstraint
573
581
  maybe :is_mandatory
574
582
  end
575
-
583
+
576
584
  class ValueConstraintShape < ConstraintShape
577
585
  has_one :object_type_shape # See ObjectTypeShape.all_value_constraint_shape
578
586
  one_to_one :role_display # See RoleDisplay.value_constraint_shape
579
587
  end
580
-
588
+
589
+ class ValueField < Injection
590
+ end
591
+
581
592
  class ValueRange
582
593
  identified_by :minimum_bound, :maximum_bound
583
594
  has_one :maximum_bound, :class => Bound # See Bound.all_value_range_as_maximum_bound
584
595
  has_one :minimum_bound, :class => Bound # See Bound.all_value_range_as_minimum_bound
585
596
  end
586
-
597
+
587
598
  class AllowedRange
588
599
  identified_by :value_constraint, :value_range
589
600
  has_one :value_constraint, :mandatory => true # See ValueConstraint.all_allowed_range
590
601
  has_one :value_range, :mandatory => true # See ValueRange.all_allowed_range
591
602
  end
592
-
603
+
593
604
  class DomainObjectType < ObjectType
594
605
  end
595
-
606
+
596
607
  class EntityType < DomainObjectType
597
608
  one_to_one :fact_type # See FactType.entity_type
598
609
  end
599
-
610
+
600
611
  class TypeInheritance < FactType
601
612
  identified_by :subtype, :supertype
602
613
  has_one :subtype, :class => EntityType, :mandatory => true # See EntityType.all_type_inheritance_as_subtype
@@ -604,7 +615,7 @@ module ActiveFacts
604
615
  has_one :assimilation # See Assimilation.all_type_inheritance
605
616
  maybe :provides_identification
606
617
  end
607
-
618
+
608
619
  class ValueType < DomainObjectType
609
620
  has_one :length # See Length.all_value_type
610
621
  has_one :scale # See Scale.all_value_type
@@ -613,20 +624,20 @@ module ActiveFacts
613
624
  has_one :unit # See Unit.all_value_type
614
625
  one_to_one :value_constraint # See ValueConstraint.value_type
615
626
  end
616
-
627
+
617
628
  class ValueTypeParameter
618
629
  identified_by :value_type, :name
619
630
  has_one :name, :mandatory => true # See Name.all_value_type_parameter
620
631
  has_one :value_type, :mandatory => true # See ValueType.all_value_type_parameter
621
632
  has_one :facet_value_type, :class => ValueType, :mandatory => true # See ValueType.all_value_type_parameter_as_facet_value_type
622
633
  end
623
-
634
+
624
635
  class ValueTypeParameterRestriction
625
636
  identified_by :value_type, :value_type_parameter
626
637
  has_one :value_type, :mandatory => true # See ValueType.all_value_type_parameter_restriction
627
638
  has_one :value_type_parameter, :mandatory => true # See ValueTypeParameter.all_value_type_parameter_restriction
628
639
  has_one :value, :mandatory => true # See Value.all_value_type_parameter_restriction
629
640
  end
630
-
641
+
631
642
  end
632
643
  end