activefacts-rmap 1.8.0 → 1.8.1

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: c90516da204087884d794d7a74a10d2a28b4e179
4
- data.tar.gz: 6ca131f3866bb26cb487b357f28cf463a76f4427
3
+ metadata.gz: bf33b3400b5c538ad43e3db107ca862a29f5b1f5
4
+ data.tar.gz: 3eb0d4cfa5be71a688a8a41cb138601fd76f6e3d
5
5
  SHA512:
6
- metadata.gz: b24c435653377dd8e767de80374fb738942c298949d15b4fd76109be7aa86386c5a08ae87d837eb78b7e901e25c7be7f49737ae9ae034fb06137061f30c8c412
7
- data.tar.gz: 011ca97e825acbc4a29fdbfb53cb0eca7037bf092551fbe629944aa6249c0a04a1b79eb2fcdf0e364839d2c0f02216d1814bf3129749d7197f01d23b882b75cb
6
+ metadata.gz: d5358ddf562d53888ce4b9213a85e845d43b6b1947692bb8b2661b9ed30214b7c9fc2617ca589aaf674fde0715f584fdc8cba27ed4b1ece4ad68ddce60bd275a
7
+ data.tar.gz: 1c6170b95730f6b6c0ad08249953ea9dd2c63ea78aedabbb240b6190289d7f27d5074d11280eba6418c248e20f1f90b088ba2f75722941e55d444027f2181208
data/Rakefile CHANGED
@@ -4,3 +4,20 @@ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task :default => :spec
7
+
8
+ desc "Bump gem version patch number"
9
+ task :bump do
10
+ path = File.expand_path('../lib/activefacts/rmap/version.rb', __FILE__)
11
+ lines = File.open(path) do |fp| fp.readlines; end
12
+ File.open(path, "w") do |fp|
13
+ fp.write(
14
+ lines.map do |line|
15
+ line.gsub(/(VERSION *= *"[0-9.]*\.)([0-9]+)"\n/) do
16
+ version = "#{$1}#{$2.to_i+1}"
17
+ puts "Version bumped to #{version}\""
18
+ version+"\"\n"
19
+ end
20
+ end*''
21
+ )
22
+ end
23
+ end
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "rake", "~> 10.0"
22
22
  spec.add_development_dependency "rspec", "~> 3.3"
23
23
 
24
- spec.add_runtime_dependency("activefacts-metamodel", ">= 1.8", "~> 1.8.0")
24
+ spec.add_runtime_dependency "activefacts-metamodel", ">= 1.8", "~> 1"
25
25
  end
@@ -53,8 +53,8 @@ module ActiveFacts
53
53
  return true if type.name =~ /^Auto/ || type.transaction_phase
54
54
  type = type.supertype
55
55
  end
56
+ false
56
57
  end
57
- false
58
58
  end
59
59
 
60
60
  class EntityType < DomainObjectType
@@ -87,7 +87,7 @@ module ActiveFacts
87
87
 
88
88
  # Subtypes may be partitioned or separate, in which case they're definitely tables.
89
89
  # Otherwise, if their identification is inherited from a supertype, they're definitely absorbed.
90
- # If theey have separate identification, it might absorb them.
90
+ # If they have separate identification, it might absorb them.
91
91
  if (!supertypes.empty?)
92
92
  as_ti = all_supertype_inheritance.detect{|ti| ti.assimilation}
93
93
  @is_table = as_ti != nil
@@ -274,27 +274,21 @@ module ActiveFacts
274
274
  object_type.references_from.reject{|ref|
275
275
  pi_roles.include?(ref.to_role)
276
276
  }
277
- trace :absorption, "#{object_type.name} has #{non_identifying_refs_from.size} non-identifying functional roles"
278
-
279
- =begin
280
- # This is kinda arbitrary. We need a policy for evaluating optional flips, so we can decide if they "improve" things.
281
- # The flipping that occurs below always eliminates a table by absorption, but this doesn't.
282
-
283
- # If all non-identifying functional roles are one-to-ones that can be flipped, do that:
284
- if non_identifying_refs_from.all? { |ref| ref.role_type == :one_one && (ref.to.is_table || ref.to.tentative) }
285
- trace :absorption, "Flipping references from #{object_type.name}" do
286
- non_identifying_refs_from.each do |ref|
287
- trace :absorption, "Flipping #{ref}"
288
- ref.flip
289
- end
290
- end
291
- non_identifying_refs_from = []
292
- end
293
- =end
277
+ trace :absorption, "#{object_type.name} has #{non_identifying_refs_from.size} non-identifying functional roles" do
278
+ non_identifying_refs_from.each do |ref|
279
+ trace :absorption, "#{ref.inspect}"
280
+ end
281
+ end
282
+
283
+ trace :absorption, "#{object_type.name} has #{object_type.references_to.size} references to it:" do
284
+ object_type.references_to.each do |ref|
285
+ trace :absorption, ref.inspect
286
+ end
287
+ end if object_type.references_to.size > 1
294
288
 
295
289
  if object_type.references_to.size > 1 and
296
290
  non_identifying_refs_from.size > 0
297
- trace :absorption, "#{object_type.name} has non-identifying functional dependencies so 3NF requires it be a table"
291
+ trace :absorption, "#{object_type.name} has #{non_identifying_refs_from.size} non-identifying functional dependencies and #{object_type.references_to.size} absorption paths so 3NF requires it be a table"
298
292
  object_type.definitely_table
299
293
  next object_type
300
294
  end
@@ -303,7 +297,8 @@ module ActiveFacts
303
297
  (
304
298
  non_identifying_refs_from.reject do |ref|
305
299
  !ref.to or ref.to.absorbed_via == ref
306
- end+object_type.references_to
300
+ end +
301
+ object_type.references_to
307
302
  ).reject do |ref|
308
303
  next true if !ref.to.is_table or !ref.is_one_to_one
309
304
 
@@ -318,21 +313,18 @@ module ActiveFacts
318
313
 
319
314
  # If this object can be fully absorbed, do that (might require flipping some references)
320
315
  if absorption_paths.size > 0
321
- trace :absorption, "#{object_type.name} is fully absorbed through #{absorption_paths.inspect}"
322
- absorption_paths.each do |ref|
323
- trace :absorption, "Flipping #{ref} so #{object_type.name} can be absorbed"
324
- ref.flip if object_type == ref.from
325
- end
316
+ trace :absorption, "#{object_type.name} is fully absorbed through #{absorption_paths.inspect}" do
317
+ absorption_paths.each do |ref|
318
+ flip = object_type == ref.from
319
+ ref.flip if flip
320
+ trace :absorption, "#{object_type.name} is FULLY ABSORBED via {ref}#{flip ? ' (flipped)' : ''}"
321
+ end
322
+ end
326
323
  object_type.definitely_not_table
327
324
  next object_type
328
325
  end
329
326
 
330
327
  if non_identifying_refs_from.size == 0
331
- # REVISIT: This allows absorption along a non-mandatory role of a objectified fact type
332
- # and object_type.references_to.all?{|ref| ref.is_mandatory }
333
- # and (!object_type.is_a?(EntityType) ||
334
- # # REVISIT: The roles may be collectively but not individually mandatory.
335
- # object_type.references_to.detect { |ref| !ref.from_role || ref.from_role.is_mandatory })
336
328
  trace :absorption, "#{object_type.name} is fully absorbed in #{object_type.references_to.size} places: #{object_type.references_to.map{|ref| ref.from.name}*", "}"
337
329
  object_type.definitely_not_table
338
330
  next object_type
@@ -1,5 +1,5 @@
1
1
  module Activefacts
2
2
  module RMap
3
- VERSION = "1.8.0"
3
+ VERSION = "1.8.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activefacts-rmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clifford Heath
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-04 00:00:00.000000000 Z
11
+ date: 2015-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: '1.8'
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: 1.8.0
70
+ version: '1'
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: '1.8'
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: 1.8.0
80
+ version: '1'
81
81
  description: Relational mapping for fact models. Part of the ActiveFacts suite.
82
82
  email:
83
83
  - clifford.heath@gmail.com