linkage 0.0.8 → 0.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.yardopts +1 -0
- data/Gemfile +1 -19
- data/Gemfile-java +3 -0
- data/README.markdown +88 -34
- data/Rakefile +16 -15
- data/TODO +4 -0
- data/lib/linkage/comparator.rb +139 -144
- data/lib/linkage/comparators/compare.rb +236 -29
- data/lib/linkage/comparators/strcompare.rb +85 -0
- data/lib/linkage/comparators/within.rb +24 -20
- data/lib/linkage/configuration.rb +44 -466
- data/lib/linkage/dataset.rb +28 -127
- data/lib/linkage/exceptions.rb +5 -0
- data/lib/linkage/field.rb +6 -37
- data/lib/linkage/field_set.rb +3 -3
- data/lib/linkage/match_recorder.rb +22 -0
- data/lib/linkage/match_set.rb +34 -0
- data/lib/linkage/match_sets/csv.rb +39 -0
- data/lib/linkage/match_sets/database.rb +45 -0
- data/lib/linkage/matcher.rb +30 -0
- data/lib/linkage/result_set.rb +25 -110
- data/lib/linkage/result_sets/csv.rb +54 -0
- data/lib/linkage/result_sets/database.rb +42 -0
- data/lib/linkage/runner.rb +57 -16
- data/lib/linkage/score_recorder.rb +30 -0
- data/lib/linkage/score_set.rb +49 -0
- data/lib/linkage/score_sets/csv.rb +64 -0
- data/lib/linkage/score_sets/database.rb +77 -0
- data/lib/linkage/version.rb +1 -1
- data/lib/linkage.rb +14 -17
- data/linkage.gemspec +13 -1
- data/linkage.gemspec-java +32 -0
- data/test/helper.rb +30 -23
- data/test/integration/test_cross_linkage.rb +46 -25
- data/test/integration/test_database_result_set.rb +55 -0
- data/test/integration/test_dual_linkage.rb +19 -94
- data/test/integration/test_self_linkage.rb +100 -203
- data/test/integration/test_within_comparator.rb +24 -77
- data/test/unit/comparators/test_compare.rb +254 -50
- data/test/unit/comparators/test_strcompare.rb +45 -0
- data/test/unit/comparators/test_within.rb +14 -26
- data/test/unit/match_sets/test_csv.rb +78 -0
- data/test/unit/match_sets/test_database.rb +63 -0
- data/test/unit/result_sets/test_csv.rb +111 -0
- data/test/unit/result_sets/test_database.rb +68 -0
- data/test/unit/score_sets/test_csv.rb +151 -0
- data/test/unit/score_sets/test_database.rb +149 -0
- data/test/unit/test_comparator.rb +46 -83
- data/test/unit/test_comparators.rb +4 -0
- data/test/unit/test_configuration.rb +99 -145
- data/test/unit/test_dataset.rb +52 -73
- data/test/unit/test_field.rb +4 -55
- data/test/unit/test_field_set.rb +6 -6
- data/test/unit/test_match_recorder.rb +23 -0
- data/test/unit/test_match_set.rb +23 -0
- data/test/unit/test_match_sets.rb +4 -0
- data/test/unit/test_matcher.rb +44 -0
- data/test/unit/test_result_set.rb +24 -223
- data/test/unit/test_result_sets.rb +4 -0
- data/test/unit/test_runner.rb +122 -17
- data/test/unit/test_runners.rb +4 -0
- data/test/unit/test_score_recorder.rb +25 -0
- data/test/unit/test_score_set.rb +37 -0
- data/test/unit/test_score_sets.rb +4 -0
- metadata +183 -90
- data/Gemfile.lock +0 -92
- data/lib/linkage/comparators/binary.rb +0 -12
- data/lib/linkage/data.rb +0 -175
- data/lib/linkage/decollation.rb +0 -93
- data/lib/linkage/expectation.rb +0 -21
- data/lib/linkage/expectations/exhaustive.rb +0 -63
- data/lib/linkage/expectations/simple.rb +0 -168
- data/lib/linkage/function.rb +0 -148
- data/lib/linkage/functions/binary.rb +0 -30
- data/lib/linkage/functions/cast.rb +0 -54
- data/lib/linkage/functions/length.rb +0 -29
- data/lib/linkage/functions/strftime.rb +0 -33
- data/lib/linkage/functions/trim.rb +0 -30
- data/lib/linkage/group.rb +0 -55
- data/lib/linkage/meta_object.rb +0 -139
- data/lib/linkage/runner/single_threaded.rb +0 -187
- data/lib/linkage/utils.rb +0 -164
- data/lib/linkage/warnings.rb +0 -5
- data/test/integration/test_collation.rb +0 -45
- data/test/integration/test_configuration.rb +0 -268
- data/test/integration/test_dataset.rb +0 -116
- data/test/integration/test_functions.rb +0 -88
- data/test/integration/test_result_set.rb +0 -85
- data/test/integration/test_scoring.rb +0 -84
- data/test/unit/expectations/test_exhaustive.rb +0 -111
- data/test/unit/expectations/test_simple.rb +0 -303
- data/test/unit/functions/test_binary.rb +0 -54
- data/test/unit/functions/test_cast.rb +0 -98
- data/test/unit/functions/test_length.rb +0 -52
- data/test/unit/functions/test_strftime.rb +0 -60
- data/test/unit/functions/test_trim.rb +0 -43
- data/test/unit/runner/test_single_threaded.rb +0 -12
- data/test/unit/test_data.rb +0 -445
- data/test/unit/test_decollation.rb +0 -201
- data/test/unit/test_function.rb +0 -233
- data/test/unit/test_group.rb +0 -38
- data/test/unit/test_meta_object.rb +0 -208
- data/test/unit/test_utils.rb +0 -341
metadata
CHANGED
@@ -1,62 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linkage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0.pre
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jeremy Stephens
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-03-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: sequel
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
28
|
+
name: hashery
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: bundler
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
52
60
|
- !ruby/object:Gem::Version
|
53
61
|
version: '0'
|
54
|
-
type: :
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: test-unit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mocha
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: versionomy
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: sqlite3
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: mysql2
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: guard-test
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: guard-yard
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
55
161
|
prerelease: false
|
56
162
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
163
|
requirements:
|
59
|
-
- -
|
164
|
+
- - '>='
|
60
165
|
- !ruby/object:Gem::Version
|
61
166
|
version: '0'
|
62
167
|
description: Performs record linkage between one or two datasets, using Sequel on
|
@@ -70,146 +175,134 @@ files:
|
|
70
175
|
- .document
|
71
176
|
- .gitignore
|
72
177
|
- .vimrc
|
178
|
+
- .yardopts
|
73
179
|
- Gemfile
|
74
|
-
- Gemfile
|
180
|
+
- Gemfile-java
|
75
181
|
- Guardfile
|
76
182
|
- LICENSE.txt
|
77
183
|
- README.markdown
|
78
184
|
- Rakefile
|
185
|
+
- TODO
|
79
186
|
- VERSION
|
80
187
|
- lib/linkage.rb
|
81
188
|
- lib/linkage/comparator.rb
|
82
|
-
- lib/linkage/comparators/binary.rb
|
83
189
|
- lib/linkage/comparators/compare.rb
|
190
|
+
- lib/linkage/comparators/strcompare.rb
|
84
191
|
- lib/linkage/comparators/within.rb
|
85
192
|
- lib/linkage/configuration.rb
|
86
|
-
- lib/linkage/data.rb
|
87
193
|
- lib/linkage/dataset.rb
|
88
|
-
- lib/linkage/
|
89
|
-
- lib/linkage/expectation.rb
|
90
|
-
- lib/linkage/expectations/exhaustive.rb
|
91
|
-
- lib/linkage/expectations/simple.rb
|
194
|
+
- lib/linkage/exceptions.rb
|
92
195
|
- lib/linkage/field.rb
|
93
196
|
- lib/linkage/field_set.rb
|
94
|
-
- lib/linkage/function.rb
|
95
|
-
- lib/linkage/functions/binary.rb
|
96
|
-
- lib/linkage/functions/cast.rb
|
97
|
-
- lib/linkage/functions/length.rb
|
98
|
-
- lib/linkage/functions/strftime.rb
|
99
|
-
- lib/linkage/functions/trim.rb
|
100
|
-
- lib/linkage/group.rb
|
101
197
|
- lib/linkage/import_buffer.rb
|
102
|
-
- lib/linkage/
|
198
|
+
- lib/linkage/match_recorder.rb
|
199
|
+
- lib/linkage/match_set.rb
|
200
|
+
- lib/linkage/match_sets/csv.rb
|
201
|
+
- lib/linkage/match_sets/database.rb
|
202
|
+
- lib/linkage/matcher.rb
|
103
203
|
- lib/linkage/result_set.rb
|
204
|
+
- lib/linkage/result_sets/csv.rb
|
205
|
+
- lib/linkage/result_sets/database.rb
|
104
206
|
- lib/linkage/runner.rb
|
105
|
-
- lib/linkage/
|
106
|
-
- lib/linkage/
|
207
|
+
- lib/linkage/score_recorder.rb
|
208
|
+
- lib/linkage/score_set.rb
|
209
|
+
- lib/linkage/score_sets/csv.rb
|
210
|
+
- lib/linkage/score_sets/database.rb
|
107
211
|
- lib/linkage/version.rb
|
108
|
-
- lib/linkage/warnings.rb
|
109
212
|
- linkage.gemspec
|
213
|
+
- linkage.gemspec-java
|
110
214
|
- test/config.yml
|
111
215
|
- test/helper.rb
|
112
|
-
- test/integration/test_collation.rb
|
113
|
-
- test/integration/test_configuration.rb
|
114
216
|
- test/integration/test_cross_linkage.rb
|
115
|
-
- test/integration/
|
217
|
+
- test/integration/test_database_result_set.rb
|
116
218
|
- test/integration/test_dual_linkage.rb
|
117
|
-
- test/integration/test_functions.rb
|
118
|
-
- test/integration/test_result_set.rb
|
119
|
-
- test/integration/test_scoring.rb
|
120
219
|
- test/integration/test_self_linkage.rb
|
121
220
|
- test/integration/test_within_comparator.rb
|
122
221
|
- test/unit/comparators/test_compare.rb
|
222
|
+
- test/unit/comparators/test_strcompare.rb
|
123
223
|
- test/unit/comparators/test_within.rb
|
124
|
-
- test/unit/
|
125
|
-
- test/unit/
|
126
|
-
- test/unit/
|
127
|
-
- test/unit/
|
128
|
-
- test/unit/
|
129
|
-
- test/unit/
|
130
|
-
- test/unit/functions/test_trim.rb
|
131
|
-
- test/unit/runner/test_single_threaded.rb
|
224
|
+
- test/unit/match_sets/test_csv.rb
|
225
|
+
- test/unit/match_sets/test_database.rb
|
226
|
+
- test/unit/result_sets/test_csv.rb
|
227
|
+
- test/unit/result_sets/test_database.rb
|
228
|
+
- test/unit/score_sets/test_csv.rb
|
229
|
+
- test/unit/score_sets/test_database.rb
|
132
230
|
- test/unit/test_comparator.rb
|
231
|
+
- test/unit/test_comparators.rb
|
133
232
|
- test/unit/test_configuration.rb
|
134
|
-
- test/unit/test_data.rb
|
135
233
|
- test/unit/test_dataset.rb
|
136
|
-
- test/unit/test_decollation.rb
|
137
234
|
- test/unit/test_field.rb
|
138
235
|
- test/unit/test_field_set.rb
|
139
|
-
- test/unit/test_function.rb
|
140
|
-
- test/unit/test_group.rb
|
141
236
|
- test/unit/test_import_buffer.rb
|
142
237
|
- test/unit/test_linkage.rb
|
143
|
-
- test/unit/
|
238
|
+
- test/unit/test_match_recorder.rb
|
239
|
+
- test/unit/test_match_set.rb
|
240
|
+
- test/unit/test_match_sets.rb
|
241
|
+
- test/unit/test_matcher.rb
|
144
242
|
- test/unit/test_result_set.rb
|
243
|
+
- test/unit/test_result_sets.rb
|
145
244
|
- test/unit/test_runner.rb
|
146
|
-
- test/unit/
|
245
|
+
- test/unit/test_runners.rb
|
246
|
+
- test/unit/test_score_recorder.rb
|
247
|
+
- test/unit/test_score_set.rb
|
248
|
+
- test/unit/test_score_sets.rb
|
147
249
|
homepage: http://github.com/coupler/linkage
|
148
250
|
licenses: []
|
251
|
+
metadata: {}
|
149
252
|
post_install_message:
|
150
253
|
rdoc_options: []
|
151
254
|
require_paths:
|
152
255
|
- lib
|
153
256
|
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
257
|
requirements:
|
156
|
-
- -
|
258
|
+
- - '>='
|
157
259
|
- !ruby/object:Gem::Version
|
158
|
-
version: '
|
159
|
-
segments:
|
160
|
-
- 0
|
161
|
-
hash: -1649246308926950627
|
260
|
+
version: '1.9'
|
162
261
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
|
-
none: false
|
164
262
|
requirements:
|
165
|
-
- -
|
263
|
+
- - '>'
|
166
264
|
- !ruby/object:Gem::Version
|
167
|
-
version:
|
168
|
-
segments:
|
169
|
-
- 0
|
170
|
-
hash: -1649246308926950627
|
265
|
+
version: 1.3.1
|
171
266
|
requirements: []
|
172
267
|
rubyforge_project:
|
173
|
-
rubygems_version:
|
268
|
+
rubygems_version: 2.0.3
|
174
269
|
signing_key:
|
175
|
-
specification_version:
|
270
|
+
specification_version: 4
|
176
271
|
summary: Record linkage library
|
177
272
|
test_files:
|
178
273
|
- test/config.yml
|
179
274
|
- test/helper.rb
|
180
|
-
- test/integration/test_collation.rb
|
181
|
-
- test/integration/test_configuration.rb
|
182
275
|
- test/integration/test_cross_linkage.rb
|
183
|
-
- test/integration/
|
276
|
+
- test/integration/test_database_result_set.rb
|
184
277
|
- test/integration/test_dual_linkage.rb
|
185
|
-
- test/integration/test_functions.rb
|
186
|
-
- test/integration/test_result_set.rb
|
187
|
-
- test/integration/test_scoring.rb
|
188
278
|
- test/integration/test_self_linkage.rb
|
189
279
|
- test/integration/test_within_comparator.rb
|
190
280
|
- test/unit/comparators/test_compare.rb
|
281
|
+
- test/unit/comparators/test_strcompare.rb
|
191
282
|
- test/unit/comparators/test_within.rb
|
192
|
-
- test/unit/
|
193
|
-
- test/unit/
|
194
|
-
- test/unit/
|
195
|
-
- test/unit/
|
196
|
-
- test/unit/
|
197
|
-
- test/unit/
|
198
|
-
- test/unit/functions/test_trim.rb
|
199
|
-
- test/unit/runner/test_single_threaded.rb
|
283
|
+
- test/unit/match_sets/test_csv.rb
|
284
|
+
- test/unit/match_sets/test_database.rb
|
285
|
+
- test/unit/result_sets/test_csv.rb
|
286
|
+
- test/unit/result_sets/test_database.rb
|
287
|
+
- test/unit/score_sets/test_csv.rb
|
288
|
+
- test/unit/score_sets/test_database.rb
|
200
289
|
- test/unit/test_comparator.rb
|
290
|
+
- test/unit/test_comparators.rb
|
201
291
|
- test/unit/test_configuration.rb
|
202
|
-
- test/unit/test_data.rb
|
203
292
|
- test/unit/test_dataset.rb
|
204
|
-
- test/unit/test_decollation.rb
|
205
293
|
- test/unit/test_field.rb
|
206
294
|
- test/unit/test_field_set.rb
|
207
|
-
- test/unit/test_function.rb
|
208
|
-
- test/unit/test_group.rb
|
209
295
|
- test/unit/test_import_buffer.rb
|
210
296
|
- test/unit/test_linkage.rb
|
211
|
-
- test/unit/
|
297
|
+
- test/unit/test_match_recorder.rb
|
298
|
+
- test/unit/test_match_set.rb
|
299
|
+
- test/unit/test_match_sets.rb
|
300
|
+
- test/unit/test_matcher.rb
|
212
301
|
- test/unit/test_result_set.rb
|
302
|
+
- test/unit/test_result_sets.rb
|
213
303
|
- test/unit/test_runner.rb
|
214
|
-
- test/unit/
|
304
|
+
- test/unit/test_runners.rb
|
305
|
+
- test/unit/test_score_recorder.rb
|
306
|
+
- test/unit/test_score_set.rb
|
307
|
+
- test/unit/test_score_sets.rb
|
215
308
|
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
linkage (0.0.8)
|
5
|
-
hashery
|
6
|
-
sequel
|
7
|
-
sequel-collation
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: http://rubygems.org/
|
11
|
-
specs:
|
12
|
-
blockenspiel (0.4.5)
|
13
|
-
coderay (1.0.8)
|
14
|
-
columnize (0.3.6)
|
15
|
-
debugger (1.3.0)
|
16
|
-
columnize (>= 0.3.1)
|
17
|
-
debugger-linecache (~> 1.1.1)
|
18
|
-
debugger-ruby_core_source (~> 1.1.7)
|
19
|
-
debugger-linecache (1.1.2)
|
20
|
-
debugger-ruby_core_source (>= 1.1.1)
|
21
|
-
debugger-ruby_core_source (1.1.7)
|
22
|
-
ffi (1.3.1)
|
23
|
-
ffi (1.3.1-java)
|
24
|
-
guard (1.6.2)
|
25
|
-
listen (>= 0.6.0)
|
26
|
-
lumberjack (>= 1.0.2)
|
27
|
-
pry (>= 0.9.10)
|
28
|
-
terminal-table (>= 1.4.3)
|
29
|
-
thor (>= 0.14.6)
|
30
|
-
guard-test (0.7.0)
|
31
|
-
guard (>= 1.1)
|
32
|
-
test-unit (~> 2.2)
|
33
|
-
guard-yard (2.0.1)
|
34
|
-
guard (>= 1.1.0)
|
35
|
-
yard (>= 0.7.0)
|
36
|
-
hashery (2.1.0)
|
37
|
-
jdbc-mysql (5.1.22.1)
|
38
|
-
jdbc-sqlite3 (3.7.2.1)
|
39
|
-
listen (0.7.2)
|
40
|
-
lumberjack (1.0.2)
|
41
|
-
metaclass (0.0.1)
|
42
|
-
method_source (0.8.1)
|
43
|
-
mocha (0.13.2)
|
44
|
-
metaclass (~> 0.0.1)
|
45
|
-
mysql2 (0.3.11)
|
46
|
-
pry (0.9.11.4)
|
47
|
-
coderay (~> 1.0.5)
|
48
|
-
method_source (~> 0.8)
|
49
|
-
slop (~> 3.4)
|
50
|
-
pry (0.9.11.4-java)
|
51
|
-
coderay (~> 1.0.5)
|
52
|
-
method_source (~> 0.8)
|
53
|
-
slop (~> 3.4)
|
54
|
-
spoon (~> 0.0)
|
55
|
-
rake (10.0.3)
|
56
|
-
rb-inotify (0.8.8)
|
57
|
-
ffi (>= 0.5.0)
|
58
|
-
rdiscount (2.0.7)
|
59
|
-
sequel (3.44.0)
|
60
|
-
sequel-collation (0.1.0)
|
61
|
-
sequel
|
62
|
-
slop (3.4.3)
|
63
|
-
spoon (0.0.1)
|
64
|
-
sqlite3 (1.3.7)
|
65
|
-
terminal-table (1.4.5)
|
66
|
-
test-unit (2.5.4)
|
67
|
-
thor (0.17.0)
|
68
|
-
versionomy (0.4.4)
|
69
|
-
blockenspiel (>= 0.4.5)
|
70
|
-
yard (0.8.4.1)
|
71
|
-
|
72
|
-
PLATFORMS
|
73
|
-
java
|
74
|
-
ruby
|
75
|
-
|
76
|
-
DEPENDENCIES
|
77
|
-
bundler
|
78
|
-
debugger
|
79
|
-
guard-test
|
80
|
-
guard-yard
|
81
|
-
jdbc-mysql
|
82
|
-
jdbc-sqlite3
|
83
|
-
linkage!
|
84
|
-
mocha
|
85
|
-
mysql2
|
86
|
-
rake
|
87
|
-
rb-inotify (~> 0.8.8)
|
88
|
-
rdiscount
|
89
|
-
sqlite3
|
90
|
-
test-unit
|
91
|
-
versionomy
|
92
|
-
yard
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module Linkage
|
2
|
-
module Comparators
|
3
|
-
# @abstract Convenient abstract class for comparators that only return
|
4
|
-
# true/false values (0 or 1).
|
5
|
-
class Binary < Comparator
|
6
|
-
@@score_range = 0..1
|
7
|
-
def self.score_range
|
8
|
-
@@score_range
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/lib/linkage/data.rb
DELETED
@@ -1,175 +0,0 @@
|
|
1
|
-
module Linkage
|
2
|
-
# Superclass to {Field} and {Function}.
|
3
|
-
#
|
4
|
-
# @abstract
|
5
|
-
class Data
|
6
|
-
# A "tree" used to find compatible types.
|
7
|
-
TYPE_CONVERSION_TREE = {
|
8
|
-
TrueClass => [Integer],
|
9
|
-
Integer => [Bignum, Float],
|
10
|
-
Bignum => [BigDecimal],
|
11
|
-
Float => [BigDecimal],
|
12
|
-
BigDecimal => [String],
|
13
|
-
String => nil,
|
14
|
-
DateTime => nil,
|
15
|
-
Date => nil,
|
16
|
-
Time => nil,
|
17
|
-
File => nil
|
18
|
-
}
|
19
|
-
|
20
|
-
# @!attribute [r] name
|
21
|
-
# @return [Symbol] This object's name
|
22
|
-
attr_reader :name
|
23
|
-
|
24
|
-
# @!attribute [r] dataset
|
25
|
-
# @return [Linkage::Dataset, nil] This object's dataset, or nil
|
26
|
-
attr_reader :dataset
|
27
|
-
|
28
|
-
def initialize(name)
|
29
|
-
@name = name
|
30
|
-
end
|
31
|
-
|
32
|
-
def ruby_type
|
33
|
-
raise NotImplementedError
|
34
|
-
end
|
35
|
-
|
36
|
-
def to_expr
|
37
|
-
raise NotImplementedError
|
38
|
-
end
|
39
|
-
|
40
|
-
def collation
|
41
|
-
nil
|
42
|
-
end
|
43
|
-
|
44
|
-
def database_type
|
45
|
-
ds = dataset
|
46
|
-
ds ? ds.database_type : nil
|
47
|
-
end
|
48
|
-
|
49
|
-
def static?
|
50
|
-
raise NotImplementedError
|
51
|
-
end
|
52
|
-
|
53
|
-
# Create a merge field that can hold data from two data sources. If the
|
54
|
-
# fields have different types, the resulting type is determined via a
|
55
|
-
# type-conversion tree.
|
56
|
-
#
|
57
|
-
# @param [Linkage::Data] other
|
58
|
-
# @return [Linkage::MergeField]
|
59
|
-
def merge(other, new_name = nil)
|
60
|
-
schema_1 = self.ruby_type
|
61
|
-
db_type_1 = self.database_type
|
62
|
-
schema_2 = other.ruby_type
|
63
|
-
db_type_2 = other.database_type
|
64
|
-
if schema_1 == schema_2 && db_type_1 == db_type_2
|
65
|
-
result = schema_1
|
66
|
-
else
|
67
|
-
type_1 = schema_1[:type]
|
68
|
-
opts_1 = schema_1[:opts] || {}
|
69
|
-
type_2 = schema_2[:type]
|
70
|
-
opts_2 = schema_2[:opts] || {}
|
71
|
-
result_type = type_1
|
72
|
-
result_opts = schema_1[:opts] ? schema_1[:opts].dup : {}
|
73
|
-
|
74
|
-
# type
|
75
|
-
if type_1 != type_2
|
76
|
-
result_type = first_common_type(type_1, type_2)
|
77
|
-
if result_type.nil?
|
78
|
-
raise "Can't merge #{type_1} (#{name}) with #{type_2} (#{other.name})"
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# text
|
83
|
-
if opts_1[:text] != opts_2[:text]
|
84
|
-
# This can only be of type String.
|
85
|
-
result_opts[:text] = true
|
86
|
-
result_opts.delete(:size)
|
87
|
-
end
|
88
|
-
|
89
|
-
# size
|
90
|
-
if !result_opts[:text] && opts_1[:size] != opts_2[:size]
|
91
|
-
types = [type_1, type_2].uniq
|
92
|
-
if types.length == 1 && types[0] == BigDecimal
|
93
|
-
# Two decimals
|
94
|
-
if opts_1.has_key?(:size) && opts_2.has_key?(:size)
|
95
|
-
s_1 = opts_1[:size]
|
96
|
-
s_2 = opts_2[:size]
|
97
|
-
result_opts[:size] = [ s_1[0] > s_2[0] ? s_1[0] : s_2[0] ]
|
98
|
-
|
99
|
-
if s_1[1] && s_2[1]
|
100
|
-
result_opts[:size][1] = s_1[1] > s_2[1] ? s_1[1] : s_2[1]
|
101
|
-
else
|
102
|
-
result_opts[:size][1] = s_1[1] ? s_1[1] : s_2[1]
|
103
|
-
end
|
104
|
-
else
|
105
|
-
result_opts[:size] = opts_1.has_key?(:size) ? opts_1[:size] : opts_2[:size]
|
106
|
-
end
|
107
|
-
elsif types.include?(String) && types.include?(BigDecimal)
|
108
|
-
# Add one to the precision of the BigDecimal (for the dot)
|
109
|
-
if opts_1.has_key?(:size) && opts_2.has_key?(:size)
|
110
|
-
s_1 = opts_1[:size].is_a?(Array) ? opts_1[:size][0] + 1 : opts_1[:size]
|
111
|
-
s_2 = opts_2[:size].is_a?(Array) ? opts_2[:size][0] + 1 : opts_2[:size]
|
112
|
-
result_opts[:size] = s_1 > s_2 ? s_1 : s_2
|
113
|
-
elsif opts_1.has_key?(:size)
|
114
|
-
result_opts[:size] = opts_1[:size].is_a?(Array) ? opts_1[:size][0] + 1 : opts_1[:size]
|
115
|
-
elsif opts_2.has_key?(:size)
|
116
|
-
result_opts[:size] = opts_2[:size].is_a?(Array) ? opts_2[:size][0] + 1 : opts_2[:size]
|
117
|
-
end
|
118
|
-
else
|
119
|
-
# Treat as two strings
|
120
|
-
if opts_1.has_key?(:size) && opts_2.has_key?(:size)
|
121
|
-
result_opts[:size] = opts_1[:size] > opts_2[:size] ? opts_1[:size] : opts_2[:size]
|
122
|
-
elsif opts_1.has_key?(:size)
|
123
|
-
result_opts[:size] = opts_1[:size]
|
124
|
-
else
|
125
|
-
result_opts[:size] = opts_2[:size]
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
# fixed
|
131
|
-
if opts_1[:fixed] != opts_2[:fixed]
|
132
|
-
# This can only be of type String.
|
133
|
-
result_opts[:fixed] = true
|
134
|
-
end
|
135
|
-
|
136
|
-
# collation
|
137
|
-
if opts_1[:collate] != opts_2[:collate] || db_type_1 != db_type_2
|
138
|
-
result_opts.delete(:collate)
|
139
|
-
end
|
140
|
-
|
141
|
-
result = {:type => result_type}
|
142
|
-
result[:opts] = result_opts unless result_opts.empty?
|
143
|
-
end
|
144
|
-
|
145
|
-
if new_name
|
146
|
-
name = new_name.to_sym
|
147
|
-
else
|
148
|
-
name = self.name == other.name ? self.name : :"#{self.name}_#{other.name}"
|
149
|
-
end
|
150
|
-
MergeField.new(name, result, db_type_1 == db_type_2 ? db_type_1 : nil)
|
151
|
-
end
|
152
|
-
|
153
|
-
private
|
154
|
-
|
155
|
-
def first_common_type(type_1, type_2)
|
156
|
-
types_1 = [type_1] + get_types(type_1)
|
157
|
-
types_2 = [type_2] + get_types(type_2)
|
158
|
-
(types_1 & types_2).first
|
159
|
-
end
|
160
|
-
|
161
|
-
# Get all types that the specified type can be converted to. Order
|
162
|
-
# matters.
|
163
|
-
def get_types(type)
|
164
|
-
result = []
|
165
|
-
types = TYPE_CONVERSION_TREE[type]
|
166
|
-
if types
|
167
|
-
result += types
|
168
|
-
types.each do |t|
|
169
|
-
result |= get_types(t)
|
170
|
-
end
|
171
|
-
end
|
172
|
-
result
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|