rbbt-util 5.5.60 → 5.5.61

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTllNjc1OWUxMDdmZmNhMzYyZmMyODU5YTczNzBmOWJkMDg1MTRlMQ==
4
+ NzEzYWRlNjc2MzkzNDIzZDI4MDE1ODQxZWZkM2QwZDA0ZWY1ZDdmYw==
5
5
  data.tar.gz: !binary |-
6
- ZTFhYjMxOTg0ZmUwMzBiZDRkMGRlYzU1YzcxNjMyOGMxOTQ1MDdjYg==
6
+ ODM5MjlhNWFlYjhlZmFhZGY2OTFlMzg3Y2EwMjY2ODI3NzMxZmFhMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OWVkOWNhMzlmM2MzOGM5ZjI1MzEyZDZkMzViYjNjMTI0MDVhZDFkZjgzZDEx
10
- ZGZmOWI2MDc0ZjQyMWU4ZGU2MmViNTU0ZWVjOWEzZDdhOGQyNDk2NTk4Yjcz
11
- ZjJlZTkxZWYwYjk5MjhhMGM5MDBlZDk0ZmZkZmY3NDI0ZDA5NGM=
9
+ MzQ4NTkyMTdhNWQ1YzAxNzc2N2RjYWVjYmJiMTZkYTA3YWYxODY3MjAyNzRm
10
+ YzM1MTNjMTdmZmU1MzZiYzk3ZTZjOTQ4NDMzNjFjMWJlMGQ0NzczYWUzYTZl
11
+ MmM3NTIxZGQyZTlkMGVmYjk4MWQ5ZTk2ZDUzYWI2ZjhhYWMxNDA=
12
12
  data.tar.gz: !binary |-
13
- NGRkZmJlZDg0ZmRlNTcxZDdjM2FlYTE0MTFkODc5NGUxZGJjMDIwNzczNjc1
14
- ZjM5YjUxZTEzMGZiNmYxNjY4NGEyMWFiMTY4YjMzYmIwNGU1MzIwZDhlMDc4
15
- MjVmN2Y3NzRiYTU2YzA0M2Q3ODFjN2JhNGM3Mzk2MzVhYWZlNTg=
13
+ ZWExY2RlZjdhNjdhMGE3ZTVkZDdkYTJhNTQ0ZDRmYTM4NDc3YTJlMmZhZjIz
14
+ ZTIwNzBiMTM0Y2E5MjA5NDE3YzRhMzNhNmY5Mjc3MmRhNGQzNzYyOTk4NzQ3
15
+ MjdiYzg4NGYzM2FmYTlhNGJmNDNkYmM4OTM5Y2I3ZWNhY2I4MjU=
@@ -79,6 +79,7 @@ module Association
79
79
  :key_field => all_fields.index(source),
80
80
  :fields => fields.collect{|f| String === f ? all_fields.index(f): f },
81
81
  :type => options[:type].to_s == :flat ? :flat : :double,
82
+ :unnamed => true,
82
83
  :merge => options[:type].to_s == :flat ? false : true
83
84
  })
84
85
 
@@ -35,6 +35,7 @@ module Association
35
35
  new.unnamed = true
36
36
 
37
37
  Association::Index.setup new
38
+
38
39
  new
39
40
  end
40
41
  end
@@ -69,10 +70,12 @@ module Association
69
70
  end
70
71
 
71
72
  def subset(source, target)
72
- return [] if source.nil? or source.empty? or target.nil? or target.empty?
73
+ return [] if source.nil? or source.empty? or (target and target.empty?)
73
74
 
74
75
  matches = source.uniq.inject([]){|acc,e| acc.concat(match(e)) }
75
76
 
77
+ return matches if target.nil?
78
+
76
79
  target_matches = {}
77
80
 
78
81
  matches.each{|code|
@@ -87,6 +90,7 @@ module Association
87
90
 
88
91
  def subset_entities(entities)
89
92
  source, target = select_entities(entities)
93
+ raise "No source entities found" if source.nil?
90
94
  subset source, target
91
95
  end
92
96
  end
@@ -251,8 +251,8 @@ class KnowledgeBase
251
251
 
252
252
  #{{{ Query
253
253
 
254
- def setup(name, matches)
255
- AssociationItem.setup matches, self, name, false
254
+ def setup(name, matches, reverse = false)
255
+ AssociationItem.setup matches, self, name, reverse
256
256
  end
257
257
 
258
258
  def all(name, options={})
@@ -289,7 +289,11 @@ class KnowledgeBase
289
289
  raise "Entities are not a Hash or an AnnotatedArray: #{Misc.fingerprint entities}"
290
290
  end
291
291
  repo = get_index name
292
- setup(name, repo.subset_entities(entities))
292
+ begin
293
+ setup(name, repo.subset_entities(entities))
294
+ rescue
295
+ setup(name, repo.reverse.subset_entities(entities), true)
296
+ end
293
297
  end
294
298
 
295
299
  def translate(entities, type)
@@ -240,8 +240,6 @@ module Misc
240
240
  end
241
241
 
242
242
  def self.fingerprint(obj)
243
- #DEBUG
244
- return "nil" if obj.nil?
245
243
  case obj
246
244
  when nil
247
245
  "nil"
@@ -116,6 +116,7 @@ EOF
116
116
  end
117
117
 
118
118
  study = ARGV.shift.dup
119
+
119
120
  if Open.exists? study
120
121
  dir = study
121
122
  study = Study.setup(File.basename(study))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.60
4
+ version: 5.5.61
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-05 00:00:00.000000000 Z
11
+ date: 2013-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake