fedora-migrate 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +1 -0
- data/LICENSE +14 -0
- data/README.md +201 -6
- data/config/jetty.yml +2 -2
- data/fedora-migrate.gemspec +7 -6
- data/lib/fedora-migrate.rb +7 -24
- data/lib/fedora_migrate/content_mover.rb +49 -0
- data/lib/fedora_migrate/datastream_mover.rb +19 -34
- data/lib/fedora_migrate/datastream_verification.rb +36 -0
- data/lib/fedora_migrate/dates_mover.rb +14 -0
- data/lib/fedora_migrate/hooks.rb +23 -0
- data/lib/fedora_migrate/migration_options.rb +18 -0
- data/lib/fedora_migrate/mover.rb +12 -0
- data/lib/fedora_migrate/object_mover.rb +20 -9
- data/lib/fedora_migrate/rdf_datastream_mover.rb +31 -14
- data/lib/fedora_migrate/rels_ext_datastream_mover.rb +28 -62
- data/lib/fedora_migrate/repository_migrator.rb +30 -25
- data/lib/fedora_migrate/rubydora_connection.rb +0 -2
- data/lib/fedora_migrate/target_constructor.rb +39 -0
- data/lib/fedora_migrate/version.rb +1 -1
- data/spec/fixtures/objects/scholarsphere_5712mc568.xml +7284 -0
- data/spec/fixtures/objects/scholarsphere_7d279232g.xml +20120 -0
- data/spec/fixtures/objects/scholarsphere_sf2686078.xml +8823 -0
- data/spec/fixtures/objects/scholarsphere_x346dj04v.xml +188 -0
- data/spec/fixtures/objects/scholarsphere_x346dj06d.xml +255 -0
- data/spec/fixtures/objects/scholarsphere_x346dj08z.xml +1242 -0
- data/spec/fixtures/objects/sufia_5m60qr94g.xml +68 -0
- data/spec/fixtures/objects/sufia_5m60qr95r.xml +133 -0
- data/spec/fixtures/objects/sufia_5m60qr961.xml +133 -0
- data/spec/fixtures/objects/sufia_5m60qr979.xml +118 -0
- data/spec/integration/content_versions_spec.rb +24 -1
- data/spec/integration/missing_relationships_spec.rb +30 -0
- data/spec/integration/object_migration_spec.rb +49 -5
- data/spec/integration/rdf_migration_spec.rb +38 -13
- data/spec/integration/relationship_migration_spec.rb +10 -9
- data/spec/integration/repository_migration_spec.rb +46 -19
- data/spec/integration/versions_spec.rb +32 -0
- data/spec/spec_helper.rb +8 -1
- data/spec/support/example_model.rb +56 -0
- data/spec/unit/content_mover_spec.rb +78 -0
- data/spec/unit/datastream_verification_spec.rb +60 -0
- data/spec/unit/dates_mover_spec.rb +33 -0
- data/spec/unit/migration_options_spec.rb +61 -0
- data/spec/unit/mover_spec.rb +35 -1
- data/spec/unit/object_mover_spec.rb +1 -3
- data/spec/unit/rels_ext_datastream_mover_spec.rb +28 -18
- data/spec/unit/repository_migrator_spec.rb +16 -5
- data/spec/unit/target_constructor_spec.rb +34 -0
- data/tasks/dev.rake +1 -1
- metadata +80 -38
- data/LICENSE.txt +0 -22
- data/lib/fedora_migrate/rdf_datastream_parser.rb +0 -29
- data/lib/fedora_migrate/triple_converter.rb +0 -39
- data/spec/fixtures/datastreams/rdf_ntriples_datastream.txt +0 -2
- data/spec/unit/rdf_datastream_mover_spec.rb +0 -8
- data/spec/unit/rdf_datastream_parser_spec.rb +0 -38
- data/spec/unit/triple_converter_spec.rb +0 -35
metadata
CHANGED
@@ -1,73 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fedora-migrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Wead
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: hydra-head
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '9.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '9.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rubydora
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '1.8'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '1.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rchardet
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1.7'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.7'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: equivalent-xml
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,21 +81,21 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: hydra-collections
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '4.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '4.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: jettywrapper
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -109,19 +109,33 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: '10.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: '10.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec
|
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'
|
125
139
|
description: Migrates data (models, datastreams, content) from a Fedora3 repository
|
126
140
|
to Fedora4
|
127
141
|
email:
|
@@ -134,7 +148,7 @@ files:
|
|
134
148
|
- ".rspec"
|
135
149
|
- ".travis.yml"
|
136
150
|
- Gemfile
|
137
|
-
- LICENSE
|
151
|
+
- LICENSE
|
138
152
|
- README.md
|
139
153
|
- Rakefile
|
140
154
|
- config/fedora.yml
|
@@ -143,7 +157,10 @@ files:
|
|
143
157
|
- config/solr.yml
|
144
158
|
- fedora-migrate.gemspec
|
145
159
|
- lib/fedora-migrate.rb
|
160
|
+
- lib/fedora_migrate/content_mover.rb
|
146
161
|
- lib/fedora_migrate/datastream_mover.rb
|
162
|
+
- lib/fedora_migrate/datastream_verification.rb
|
163
|
+
- lib/fedora_migrate/dates_mover.rb
|
147
164
|
- lib/fedora_migrate/errors.rb
|
148
165
|
- lib/fedora_migrate/file_configurator.rb
|
149
166
|
- lib/fedora_migrate/hooks.rb
|
@@ -154,42 +171,54 @@ files:
|
|
154
171
|
- lib/fedora_migrate/permissions.rb
|
155
172
|
- lib/fedora_migrate/permissions_mover.rb
|
156
173
|
- lib/fedora_migrate/rdf_datastream_mover.rb
|
157
|
-
- lib/fedora_migrate/rdf_datastream_parser.rb
|
158
174
|
- lib/fedora_migrate/rels_ext_datastream_mover.rb
|
159
175
|
- lib/fedora_migrate/repository_migrator.rb
|
160
176
|
- lib/fedora_migrate/rights_metadata.rb
|
161
177
|
- lib/fedora_migrate/rubydora_connection.rb
|
162
|
-
- lib/fedora_migrate/
|
178
|
+
- lib/fedora_migrate/target_constructor.rb
|
163
179
|
- lib/fedora_migrate/version.rb
|
164
180
|
- lib/tasks/fedora-migrate.rake
|
165
|
-
- spec/fixtures/datastreams/rdf_ntriples_datastream.txt
|
166
181
|
- spec/fixtures/datastreams/sufia-rb68xc089-characterization.xml
|
167
182
|
- spec/fixtures/objects/f3-migration-a.xml
|
168
183
|
- spec/fixtures/objects/gf-versioned-content.xml
|
184
|
+
- spec/fixtures/objects/scholarsphere_5712mc568.xml
|
185
|
+
- spec/fixtures/objects/scholarsphere_7d279232g.xml
|
186
|
+
- spec/fixtures/objects/scholarsphere_sf2686078.xml
|
187
|
+
- spec/fixtures/objects/scholarsphere_x346dj04v.xml
|
188
|
+
- spec/fixtures/objects/scholarsphere_x346dj06d.xml
|
189
|
+
- spec/fixtures/objects/scholarsphere_x346dj08z.xml
|
169
190
|
- spec/fixtures/objects/sufia-batch-gf-1.xml
|
170
191
|
- spec/fixtures/objects/sufia-batch-gf-2.xml
|
171
192
|
- spec/fixtures/objects/sufia-batch.xml
|
193
|
+
- spec/fixtures/objects/sufia_5m60qr94g.xml
|
194
|
+
- spec/fixtures/objects/sufia_5m60qr95r.xml
|
195
|
+
- spec/fixtures/objects/sufia_5m60qr961.xml
|
196
|
+
- spec/fixtures/objects/sufia_5m60qr979.xml
|
172
197
|
- spec/integration/content_versions_spec.rb
|
173
198
|
- spec/integration/fedora3_interface_spec.rb
|
199
|
+
- spec/integration/missing_relationships_spec.rb
|
174
200
|
- spec/integration/object_migration_spec.rb
|
175
201
|
- spec/integration/permission_migration_spec.rb
|
176
202
|
- spec/integration/rdf_migration_spec.rb
|
177
203
|
- spec/integration/relationship_migration_spec.rb
|
178
204
|
- spec/integration/repository_migration_spec.rb
|
205
|
+
- spec/integration/versions_spec.rb
|
179
206
|
- spec/spec_helper.rb
|
180
207
|
- spec/support/example_model.rb
|
208
|
+
- spec/unit/content_mover_spec.rb
|
181
209
|
- spec/unit/datastream_mover_spec.rb
|
210
|
+
- spec/unit/datastream_verification_spec.rb
|
211
|
+
- spec/unit/dates_mover_spec.rb
|
182
212
|
- spec/unit/fedora_migrate_spec.rb
|
183
213
|
- spec/unit/file_configurator_spec.rb
|
214
|
+
- spec/unit/migration_options_spec.rb
|
184
215
|
- spec/unit/mover_spec.rb
|
185
216
|
- spec/unit/object_mover_spec.rb
|
186
217
|
- spec/unit/permissions_mover_spec.rb
|
187
|
-
- spec/unit/rdf_datastream_mover_spec.rb
|
188
|
-
- spec/unit/rdf_datastream_parser_spec.rb
|
189
218
|
- spec/unit/rels_ext_datastream_mover_spec.rb
|
190
219
|
- spec/unit/repository_migrator_spec.rb
|
191
220
|
- spec/unit/rubydora_connection_spec.rb
|
192
|
-
- spec/unit/
|
221
|
+
- spec/unit/target_constructor_spec.rb
|
193
222
|
- tasks/dev.rake
|
194
223
|
homepage: ''
|
195
224
|
licenses:
|
@@ -216,31 +245,44 @@ signing_key:
|
|
216
245
|
specification_version: 4
|
217
246
|
summary: Migrate Hydra-based repository data from Fedora3 to Fedora4
|
218
247
|
test_files:
|
219
|
-
- spec/fixtures/datastreams/rdf_ntriples_datastream.txt
|
220
248
|
- spec/fixtures/datastreams/sufia-rb68xc089-characterization.xml
|
221
249
|
- spec/fixtures/objects/f3-migration-a.xml
|
222
250
|
- spec/fixtures/objects/gf-versioned-content.xml
|
251
|
+
- spec/fixtures/objects/scholarsphere_5712mc568.xml
|
252
|
+
- spec/fixtures/objects/scholarsphere_7d279232g.xml
|
253
|
+
- spec/fixtures/objects/scholarsphere_sf2686078.xml
|
254
|
+
- spec/fixtures/objects/scholarsphere_x346dj04v.xml
|
255
|
+
- spec/fixtures/objects/scholarsphere_x346dj06d.xml
|
256
|
+
- spec/fixtures/objects/scholarsphere_x346dj08z.xml
|
223
257
|
- spec/fixtures/objects/sufia-batch-gf-1.xml
|
224
258
|
- spec/fixtures/objects/sufia-batch-gf-2.xml
|
225
259
|
- spec/fixtures/objects/sufia-batch.xml
|
260
|
+
- spec/fixtures/objects/sufia_5m60qr94g.xml
|
261
|
+
- spec/fixtures/objects/sufia_5m60qr95r.xml
|
262
|
+
- spec/fixtures/objects/sufia_5m60qr961.xml
|
263
|
+
- spec/fixtures/objects/sufia_5m60qr979.xml
|
226
264
|
- spec/integration/content_versions_spec.rb
|
227
265
|
- spec/integration/fedora3_interface_spec.rb
|
266
|
+
- spec/integration/missing_relationships_spec.rb
|
228
267
|
- spec/integration/object_migration_spec.rb
|
229
268
|
- spec/integration/permission_migration_spec.rb
|
230
269
|
- spec/integration/rdf_migration_spec.rb
|
231
270
|
- spec/integration/relationship_migration_spec.rb
|
232
271
|
- spec/integration/repository_migration_spec.rb
|
272
|
+
- spec/integration/versions_spec.rb
|
233
273
|
- spec/spec_helper.rb
|
234
274
|
- spec/support/example_model.rb
|
275
|
+
- spec/unit/content_mover_spec.rb
|
235
276
|
- spec/unit/datastream_mover_spec.rb
|
277
|
+
- spec/unit/datastream_verification_spec.rb
|
278
|
+
- spec/unit/dates_mover_spec.rb
|
236
279
|
- spec/unit/fedora_migrate_spec.rb
|
237
280
|
- spec/unit/file_configurator_spec.rb
|
281
|
+
- spec/unit/migration_options_spec.rb
|
238
282
|
- spec/unit/mover_spec.rb
|
239
283
|
- spec/unit/object_mover_spec.rb
|
240
284
|
- spec/unit/permissions_mover_spec.rb
|
241
|
-
- spec/unit/rdf_datastream_mover_spec.rb
|
242
|
-
- spec/unit/rdf_datastream_parser_spec.rb
|
243
285
|
- spec/unit/rels_ext_datastream_mover_spec.rb
|
244
286
|
- spec/unit/repository_migrator_spec.rb
|
245
287
|
- spec/unit/rubydora_connection_spec.rb
|
246
|
-
- spec/unit/
|
288
|
+
- spec/unit/target_constructor_spec.rb
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 Adam Wead
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module FedoraMigrate
|
2
|
-
class RDFDatastreamParser
|
3
|
-
|
4
|
-
attr_accessor :subject, :datastream, :statements
|
5
|
-
|
6
|
-
def initialize subject, content
|
7
|
-
@subject = subject
|
8
|
-
@datastream = content
|
9
|
-
@statements = []
|
10
|
-
end
|
11
|
-
|
12
|
-
def parse
|
13
|
-
datastream.split(/\n/).each do |s|
|
14
|
-
triple = FedoraMigrate::TripleConverter.new(s)
|
15
|
-
build_statement(triple) unless triple.predicate.nil?
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def build_statement triple
|
22
|
-
statement = RDF::Statement(RDF::URI.new(subject), triple.predicate, triple.object)
|
23
|
-
Logger.info "using converted rdf triple #{statement}"
|
24
|
-
statements << statement
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module FedoraMigrate
|
2
|
-
class TripleConverter
|
3
|
-
|
4
|
-
attr_accessor :statement, :term
|
5
|
-
|
6
|
-
def initialize statement
|
7
|
-
@statement = statement
|
8
|
-
@term = dc_term_from_predicate
|
9
|
-
end
|
10
|
-
|
11
|
-
def object
|
12
|
-
verify_object
|
13
|
-
statement.split(/"/)[1]
|
14
|
-
end
|
15
|
-
|
16
|
-
def predicate
|
17
|
-
if ::RDF::DC.respond_to?(term)
|
18
|
-
::RDF::DC.send(term)
|
19
|
-
else
|
20
|
-
Logger.warn "tried to add #{object} using the term #{term}, but it doesn't appear to be in RDF::DC"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def verify_object
|
25
|
-
unless statement.match(/"/)
|
26
|
-
Logger.warn "expected a RDF triple statement separated with double-quotes"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def dc_term_from_predicate
|
33
|
-
url = statement.split(/ /)[1].gsub(/<|>/,"")
|
34
|
-
URI(url).path.split("/").last
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe FedoraMigrate::RDFDatastreamParser do
|
4
|
-
|
5
|
-
let(:ds_content) { load_fixture("rdf_ntriples_datastream.txt").read }
|
6
|
-
let(:rdf_subject) { 'http://127.0.0.1:8983/fedora/rest/dev/xp/68/km/41/xp68km41x' }
|
7
|
-
subject { FedoraMigrate::RDFDatastreamParser.new(rdf_subject, ds_content) }
|
8
|
-
|
9
|
-
describe "::new" do
|
10
|
-
it { is_expected.to respond_to(:subject) }
|
11
|
-
it { is_expected.to respond_to(:datastream) }
|
12
|
-
it { is_expected.to respond_to(:statements) }
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "#parse" do
|
16
|
-
|
17
|
-
context "given the raw content from an ActiveFedora::NTriples datastream" do
|
18
|
-
|
19
|
-
subject { FedoraMigrate::RDFDatastreamParser.new(rdf_subject, ds_content) }
|
20
|
-
|
21
|
-
before :each do
|
22
|
-
subject.parse
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should return an array" do
|
26
|
-
expect(subject.statements.count).to eql 2
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should consist of RDF::Statment objects" do
|
30
|
-
expect(subject.statements.first).to be_kind_of(RDF::Statement)
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe FedoraMigrate::TripleConverter do
|
4
|
-
|
5
|
-
context "given an RDF triple / " do
|
6
|
-
subject { FedoraMigrate::TripleConverter.new('<info:fedora/sufia:xp68km39w> <http://purl.org/dc/terms/title> "Sample Migration Object A" .') }
|
7
|
-
specify "it parses the triple for the object" do
|
8
|
-
expect(subject.object).to eql "Sample Migration Object A"
|
9
|
-
end
|
10
|
-
specify "it parses the triple for the predicate" do
|
11
|
-
expect(subject.predicate).to eql ::RDF::DC.title
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
context "given a non-DC RDF triple / " do
|
16
|
-
subject { FedoraMigrate::TripleConverter.new( '<info:fedora/sufia:xp68km39w> <http://purl.org/dc/terms/baz> "Sample Migration Object A" .') }
|
17
|
-
before do
|
18
|
-
expect(FedoraMigrate::Logger).to receive(:warn)
|
19
|
-
end
|
20
|
-
specify "it returns a null predicate" do
|
21
|
-
expect(subject.predicate).to be nil
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "given a malformed triple / " do
|
26
|
-
before do
|
27
|
-
expect(FedoraMigrate::Logger).to receive(:warn)
|
28
|
-
end
|
29
|
-
subject { FedoraMigrate::TripleConverter.new( '<info:fedora/sufia:xp68km39w> <http://purl.org/dc/terms/title> Object not enclosed with quotes .') }
|
30
|
-
specify "it returns a nul object" do
|
31
|
-
expect(subject.object).to be nil
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|