activefacts 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/CQL/Metamodel.cql +5 -3
- data/lib/activefacts/cql/compiler/entity_type.rb +1 -1
- data/lib/activefacts/cql/compiler/fact_type.rb +1 -1
- data/lib/activefacts/cql/compiler/value_type.rb +1 -1
- data/lib/activefacts/persistence/reference.rb +5 -5
- data/lib/activefacts/persistence/tables.rb +5 -5
- data/lib/activefacts/version.rb +1 -1
- data/lib/activefacts/vocabulary/extensions.rb +4 -0
- data/lib/activefacts/vocabulary/metamodel.rb +6 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e2981653d1f22d1608e717058a8050882dc2b6c
|
4
|
+
data.tar.gz: dc5680eabdcf6dd519379e80ffad95e8637a0bcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ab00dc1b433b91551196edfae8519ab89f7c99c3a3958df7545014b7d554991a5e0c01916a942d9bc601a95566c17f686d6a655dcc4fe538bcce05130d00180
|
7
|
+
data.tar.gz: 539bc7a595f7c12b0fee750af7303aaee6014942e64732f746af42f203be02bee13cb9c4a6b5158e3f270e09e6bde4583a6d8d6c4822133675fa490d3d324816
|
data/examples/CQL/Metamodel.cql
CHANGED
@@ -56,10 +56,12 @@ Coefficient is identified by Numerator and Denominator and Coefficient is precis
|
|
56
56
|
Concept is identified by Guid where
|
57
57
|
Concept has one Guid,
|
58
58
|
Guid is of at most one Concept;
|
59
|
-
Concept has mapping-Annotation,
|
60
|
-
Annotation applies to at most one Concept;
|
61
59
|
|
62
|
-
|
60
|
+
Concept Annotation is where
|
61
|
+
Concept has mapping-Annotation,
|
62
|
+
Annotation applies to Concept;
|
63
|
+
|
64
|
+
Constraint [separate] is identified by Concept where
|
63
65
|
Constraint is an instance of one Concept;
|
64
66
|
Name is of Constraint,
|
65
67
|
Constraint is called at most one Name;
|
@@ -39,7 +39,7 @@ module ActiveFacts
|
|
39
39
|
add_supertype(supertype_name, @identification || i > 0)
|
40
40
|
end
|
41
41
|
@pragmas.each do |p|
|
42
|
-
@constellation.
|
42
|
+
@constellation.ConceptAnnotation(:concept => @entity_type.concept, :mapping_annotation => p)
|
43
43
|
end if @pragmas
|
44
44
|
|
45
45
|
context = CompilationContext.new(@vocabulary)
|
@@ -171,7 +171,7 @@ module ActiveFacts
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
@pragmas.each do |p|
|
174
|
-
@constellation.
|
174
|
+
@constellation.ConceptAnnotation(:concept => @fact_type.concept, :mapping_annotation => p)
|
175
175
|
end if @pragmas
|
176
176
|
|
177
177
|
@clauses.each do |clause|
|
@@ -115,7 +115,7 @@ module ActiveFacts
|
|
115
115
|
@constellation.ValueType(@vocabulary, @name, :concept => :new)
|
116
116
|
vt.is_independent = true if @pragmas.delete('independent')
|
117
117
|
@pragmas.each do |p|
|
118
|
-
@constellation.
|
118
|
+
@constellation.ConceptAnnotation(:concept => vt.concept, :mapping_annotation => p)
|
119
119
|
end if @pragmas
|
120
120
|
vt.supertype = base_type if base_type
|
121
121
|
vt.length = length if length
|
@@ -323,9 +323,9 @@ module ActiveFacts
|
|
323
323
|
|
324
324
|
when :supertype # A subtype absorbs a reference to its supertype when separate, or all when partitioned
|
325
325
|
# REVISIT: Or when partitioned
|
326
|
-
raise
|
326
|
+
raise "Internal error, expected TypeInheritance" unless role.fact_type.is_a?(ActiveFacts::Metamodel::TypeInheritance)
|
327
327
|
counterpart_role = (role.fact_type.all_role.to_a-[role])[0]
|
328
|
-
if role.fact_type.assimilation or counterpart_role.object_type.
|
328
|
+
if role.fact_type.assimilation or counterpart_role.object_type.is_separate
|
329
329
|
trace :references, "supertype #{name} doesn't absorb a reference to separate subtype #{role.fact_type.subtype.name}"
|
330
330
|
else
|
331
331
|
r = ActiveFacts::Persistence::Reference.new(self, role)
|
@@ -335,7 +335,7 @@ module ActiveFacts
|
|
335
335
|
end
|
336
336
|
|
337
337
|
when :subtype # This object is a supertype, which can absorb the subtype unless that's independent
|
338
|
-
if role.fact_type.assimilation or
|
338
|
+
if role.fact_type.assimilation or is_separate
|
339
339
|
ActiveFacts::Persistence::Reference.new(self, role).tabulate
|
340
340
|
# If partitioned, the supertype is absorbed into *each* subtype; a reference to the supertype needs to know which
|
341
341
|
else
|
@@ -348,8 +348,8 @@ module ActiveFacts
|
|
348
348
|
# Decide which way the one-to-one is likely to go; it will be flipped later if necessary.
|
349
349
|
# Force the decision if just one is independent:
|
350
350
|
# REVISIT: Decide whether supertype assimilation can affect this
|
351
|
-
r.tabulate and return if
|
352
|
-
return if !
|
351
|
+
r.tabulate and return if is_separate and !r.to.is_separate
|
352
|
+
return if !is_separate and r.to.is_separate
|
353
353
|
|
354
354
|
if is_a?(ValueType)
|
355
355
|
# Never absorb an entity type into a value type
|
@@ -28,8 +28,8 @@ module ActiveFacts
|
|
28
28
|
return @is_table if @is_table != nil
|
29
29
|
|
30
30
|
# Always a table if marked so:
|
31
|
-
if
|
32
|
-
trace :absorption, "ValueType #{name} is declared independent"
|
31
|
+
if is_separate
|
32
|
+
trace :absorption, "ValueType #{name} is declared independent or separate"
|
33
33
|
@tentative = false
|
34
34
|
return @is_table = true
|
35
35
|
end
|
@@ -73,8 +73,8 @@ module ActiveFacts
|
|
73
73
|
@tentative = false
|
74
74
|
|
75
75
|
# Always a table if marked so
|
76
|
-
if
|
77
|
-
trace :absorption, "EntityType #{name} is declared independent"
|
76
|
+
if is_separate
|
77
|
+
trace :absorption, "EntityType #{name} is declared independent or separate"
|
78
78
|
return @is_table = true
|
79
79
|
end
|
80
80
|
|
@@ -199,7 +199,7 @@ module ActiveFacts
|
|
199
199
|
# Strategy:
|
200
200
|
# 1) Populate references for all ObjectTypes
|
201
201
|
# 2) Decide which ObjectTypes must be and must not be tables
|
202
|
-
# a. ObjectTypes labelled is_independent are tables (See the is_table methods above)
|
202
|
+
# a. ObjectTypes labelled is_independent/separate are tables (See the is_table methods above)
|
203
203
|
# b. Entity types having no references to them must be tables
|
204
204
|
# c. subtypes are not tables unless marked with assimilation = separate or partitioned
|
205
205
|
# d. ValueTypes are never tables unless they independent or can have references (to other ValueTypes)
|
data/lib/activefacts/version.rb
CHANGED
@@ -411,6 +411,10 @@ module ActiveFacts
|
|
411
411
|
class ObjectType
|
412
412
|
# Placeholder for the surrogate transform
|
413
413
|
attr_reader :injected_surrogate_role
|
414
|
+
|
415
|
+
def is_separate
|
416
|
+
is_independent or concept.all_concept_annotation.detect{|ca| ca.mapping_annotation == 'separate'}
|
417
|
+
end
|
414
418
|
end
|
415
419
|
|
416
420
|
class ValueType
|
@@ -19,7 +19,6 @@ module ActiveFacts
|
|
19
19
|
|
20
20
|
class Annotation < String
|
21
21
|
value_type
|
22
|
-
has_one :concept, :counterpart => :mapping_annotation # See Concept.all_mapping_annotation
|
23
22
|
end
|
24
23
|
|
25
24
|
class Assimilation < String
|
@@ -180,6 +179,12 @@ module ActiveFacts
|
|
180
179
|
has_one :topic # See Topic.all_concept
|
181
180
|
end
|
182
181
|
|
182
|
+
class ConceptAnnotation
|
183
|
+
identified_by :concept, :mapping_annotation
|
184
|
+
has_one :concept, :mandatory => true # See Concept.all_concept_annotation
|
185
|
+
has_one :mapping_annotation, :class => Annotation, :mandatory => true # See Annotation.all_concept_annotation_as_mapping_annotation
|
186
|
+
end
|
187
|
+
|
183
188
|
class Constraint
|
184
189
|
identified_by :concept
|
185
190
|
one_to_one :concept, :mandatory => true # See Concept.constraint
|