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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 887391f1fb780fae6998c9ea40bc158d1b68638d
4
- data.tar.gz: ca958351f21cf0b5bf81116982fa9604735b2a42
3
+ metadata.gz: 8e2981653d1f22d1608e717058a8050882dc2b6c
4
+ data.tar.gz: dc5680eabdcf6dd519379e80ffad95e8637a0bcc
5
5
  SHA512:
6
- metadata.gz: d708a24d6ebc6db435c50a2f5aa3a3f7f3dcf416fe7a1104dc9deec10bfb0128853a39ea0e31688bcb49914acd45a3df7298409d7410f8ea36888b019cf09672
7
- data.tar.gz: aa44870543b7485a003e2a1ffe3bf12aa73e5f1c3516825a62819dd9c2eed2ddc47bffdf56b01e8af8a0847520ce68da66e6340bd83db628f80e7a8fa89e7611
6
+ metadata.gz: 7ab00dc1b433b91551196edfae8519ab89f7c99c3a3958df7545014b7d554991a5e0c01916a942d9bc601a95566c17f686d6a655dcc4fe538bcce05130d00180
7
+ data.tar.gz: 539bc7a595f7c12b0fee750af7303aaee6014942e64732f746af42f203be02bee13cb9c4a6b5158e3f270e09e6bde4583a6d8d6c4822133675fa490d3d324816
@@ -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
- Constraint is identified by Concept where
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.Annotation(p, :concept => @entity_type.concept)
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.Annotation(p, :concept => @fact_type.concept)
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.Annotation(p, :concept => vt.concept)
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 hell unless role.fact_type.is_a?(ActiveFacts::Metamodel::TypeInheritance)
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.is_independent # assimilation == 'separate' or assimilation == 'partitioned'
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 is_independent
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 is_independent and !r.to.is_independent
352
- return if !is_independent and r.to.is_independent
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 is_independent
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 is_independent or concept.all_mapping_annotation.include?('separate')
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)
@@ -8,7 +8,7 @@ module ActiveFacts
8
8
  module Version
9
9
  MAJOR = 1
10
10
  MINOR = 5
11
- PATCH = 1
11
+ PATCH = 2
12
12
 
13
13
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
14
14
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activefacts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clifford Heath