libis-tools 0.9.41 → 0.9.42

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: f9dc7a8cd9d65582c0cf3de6ea1bad9d8fdd3b53
4
- data.tar.gz: 8229aa496f6d9412e628c3a3d2b75f244ec3ba94
3
+ metadata.gz: ccaa2ba1a94d6b88f3b45135a81b62ea9a0a76ac
4
+ data.tar.gz: 74d858081b5baf3a1f3181f9a3ff790a70e942e8
5
5
  SHA512:
6
- metadata.gz: 247b7a642bac76968a5dad8ddd85b926878f6735bf44493c25b4e08a244c74a8435bc0f2d6c47b92732d48dc98489310707835bc4dfd92f153edd6c129d99983
7
- data.tar.gz: 717da212d03e14cb52fe6fbf08c60f71f18e0adf0ba787dc670ce1f1fc69be06cb2b1a90255e9a73c5a6059833970cc02964bfd7e81037857c9c5f0f5d5e35c0
6
+ metadata.gz: add083b5399e12b82820d9674e8568a921d8e0a81473c092512c104d28c2ffd1a73b584eb9fb09f4bec359c71f2440ed69dd8a1ad061f9594bb68600e9a7705b
7
+ data.tar.gz: f65e1a15ef0b042a4ad13c386ce4fcc87f4dcc60db6de59987f621474803d7cd120f91fe0d410288d3446fbbf0d8fec92981a62b0314b19947770847f00d24d8
@@ -14,6 +14,7 @@ module Libis
14
14
 
15
15
  autoload :Kuleuven, 'libis/tools/metadata/mappers/kuleuven'
16
16
  autoload :Flandrica, 'libis/tools/metadata/mappers/flandrica'
17
+ autoload :Scope, 'libis/tools/metadata/mappers/scope'
17
18
 
18
19
  end
19
20
 
@@ -37,7 +37,7 @@ module Libis
37
37
  doc
38
38
  when String
39
39
  # noinspection RubyResolve
40
- File.exist?(doc) ? Libis::Tools::XmlDocument.load(doc) : Libis::Tools::XmlDocument.parse(doc)
40
+ File.exist?(doc) ? Libis::Tools::XmlDocument.open(doc) : Libis::Tools::XmlDocument.parse(doc)
41
41
  when IO
42
42
  Libis::Tools::XmlDocument.parse(doc.read)
43
43
  when Hash
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+
3
+ require 'libis/tools/metadata/dublin_core_record'
4
+ require 'libis/tools/assert'
5
+
6
+ module Libis
7
+ module Tools
8
+ module Metadata
9
+ module Mappers
10
+ # noinspection RubyResolve
11
+
12
+ # Mixin for {::Libis::Tools::Metadata::DublinCoreRecord} to enable conversion of the Scope exported DC record.
13
+ module Scope
14
+
15
+ # Main conversion method.
16
+ # @return [::Libis::Tools::Metadata::DublinCoreRecord]
17
+ def to_dc
18
+ assert(self.is_a? Libis::Tools::Metadata::DublinCoreRecord)
19
+
20
+ doc = Libis::Tools::Metadata::DublinCoreRecord.new(self.to_xml)
21
+
22
+ # add URI annotation
23
+ doc.isPartOf['xsi:type'] = 'dcterms:URI'
24
+
25
+ # rename isPartOf to isReferencedBy
26
+ doc.isPartOf.name = 'isReferencedBy'
27
+
28
+ doc
29
+
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,5 +1,5 @@
1
1
  module Libis
2
2
  module Tools
3
- VERSION = '0.9.41'
3
+ VERSION = '0.9.42'
4
4
  end
5
5
  end
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <dc:record xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
+ <dc:title>Cleo De 5 A 7 (Cleo Tussen 5 En 7)</dc:title>
4
+ <dc:identifier>BE/942855/1927/4898 (ref.code)</dc:identifier>
5
+ <dc:format>digitale kopie (archival material type)</dc:format>
6
+ <dcterms:spatial>Frankrijk</dcterms:spatial>
7
+ <dc:identifier xsi:type="dcterms:URI">http://abs.lias.be/Query/detail.aspx?ID=902581</dc:identifier>
8
+ <dc:source>Collectie filmdossiers Katholieke Filmliga/Filmmagie</dc:source>
9
+ <dcterms:isReferencedBy xsi:type="dcterms:URI">http://abs.lias.be/Query/detail.aspx?ID=886364</dcterms:isReferencedBy>
10
+ <dc:source>BE/942855/1927</dc:source>
11
+ </dc:record>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <dc:record xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
+ <dc:title>Cleo De 5 A 7 (Cleo Tussen 5 En 7)</dc:title>
4
+ <dc:identifier>BE/942855/1927/4898 (ref.code)</dc:identifier>
5
+ <dc:format>digitale kopie (archival material type)</dc:format>
6
+ <dcterms:spatial>Frankrijk</dcterms:spatial>
7
+ <dc:identifier xsi:type="dcterms:URI">http://abs.lias.be/Query/detail.aspx?ID=902581</dc:identifier>
8
+ <dc:source>Collectie filmdossiers Katholieke Filmliga/Filmmagie</dc:source>
9
+ <dcterms:isPartOf>http://abs.lias.be/Query/detail.aspx?ID=886364</dcterms:isPartOf>
10
+ <dc:source>BE/942855/1927</dc:source>
11
+ </dc:record>
@@ -0,0 +1,30 @@
1
+ require_relative '../spec_helper'
2
+ require 'libis/tools'
3
+
4
+ require 'rspec/matchers'
5
+ require 'equivalent-xml'
6
+
7
+ describe 'ScopeMapper' do
8
+
9
+ let(:input) { File.join(File.dirname(__FILE__), 'BE_942855_1927_4898_md.XML')}
10
+ let(:output) { File.join(File.dirname(__FILE__), 'BE_942855_1927_4898_corrected.XML')}
11
+
12
+ it 'Correct Scope output' do
13
+
14
+ input_dc = Libis::Tools::Metadata::DublinCoreRecord.new(input)
15
+ expect(input_dc).to be_a Libis::Tools::Metadata::DublinCoreRecord
16
+
17
+ output_dc = Libis::Tools::Metadata::DublinCoreRecord.new(output)
18
+ expect(output_dc).to be_a Libis::Tools::Metadata::DublinCoreRecord
19
+
20
+ input_dc.extend Libis::Tools::Metadata::Mappers::Scope
21
+ converted_dc = input_dc.to_dc
22
+ expect(converted_dc).to be_a Libis::Tools::Metadata::DublinCoreRecord
23
+
24
+ expect(converted_dc.root).to be_equivalent_to output_dc.root
25
+ converted_dc.root.elements.each_with_index do |element, i|
26
+ expect(element).to be_equivalent_to(output_dc.root.elements[i])
27
+ end
28
+
29
+ end
30
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.41
4
+ version: 0.9.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-28 00:00:00.000000000 Z
11
+ date: 2016-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -271,6 +271,7 @@ files:
271
271
  - lib/libis/tools/metadata/mapper.rb
272
272
  - lib/libis/tools/metadata/mappers/flandrica.rb
273
273
  - lib/libis/tools/metadata/mappers/kuleuven.rb
274
+ - lib/libis/tools/metadata/mappers/scope.rb
274
275
  - lib/libis/tools/metadata/marc21_record.rb
275
276
  - lib/libis/tools/metadata/marc_record.rb
276
277
  - lib/libis/tools/metadata/parser/basic_parser.rb
@@ -309,12 +310,15 @@ files:
309
310
  - spec/deep_struct_spec.rb
310
311
  - spec/logger_spec.rb
311
312
  - spec/metadata/8389207.marc
313
+ - spec/metadata/BE_942855_1927_4898_corrected.XML
314
+ - spec/metadata/BE_942855_1927_4898_md.XML
312
315
  - spec/metadata/dublin_core_parser_spec.rb
313
316
  - spec/metadata/dublin_core_spec.rb
314
317
  - spec/metadata/marc21_parser_data.rb
315
318
  - spec/metadata/marc21_parser_spec.rb
316
319
  - spec/metadata/marc21_spec.rb
317
320
  - spec/metadata/metadata_mapper_spec.rb
321
+ - spec/metadata/scope_mapper_spec.rb
318
322
  - spec/mets_file_spec.rb
319
323
  - spec/parameter_container_spec.rb
320
324
  - spec/parameter_spec.rb
@@ -366,12 +370,15 @@ test_files:
366
370
  - spec/deep_struct_spec.rb
367
371
  - spec/logger_spec.rb
368
372
  - spec/metadata/8389207.marc
373
+ - spec/metadata/BE_942855_1927_4898_corrected.XML
374
+ - spec/metadata/BE_942855_1927_4898_md.XML
369
375
  - spec/metadata/dublin_core_parser_spec.rb
370
376
  - spec/metadata/dublin_core_spec.rb
371
377
  - spec/metadata/marc21_parser_data.rb
372
378
  - spec/metadata/marc21_parser_spec.rb
373
379
  - spec/metadata/marc21_spec.rb
374
380
  - spec/metadata/metadata_mapper_spec.rb
381
+ - spec/metadata/scope_mapper_spec.rb
375
382
  - spec/mets_file_spec.rb
376
383
  - spec/parameter_container_spec.rb
377
384
  - spec/parameter_spec.rb