hydra-pcdm 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +38 -0
- data/Gemfile +6 -3
- data/README.md +31 -38
- data/Rakefile +14 -4
- data/hydra-pcdm.gemspec +10 -10
- data/lib/hydra/pcdm.rb +13 -12
- data/lib/hydra/pcdm/collection_indexer.rb +2 -4
- data/lib/hydra/pcdm/deep_member_iterator.rb +1 -1
- data/lib/hydra/pcdm/models/collection.rb +0 -1
- data/lib/hydra/pcdm/models/concerns/collection_behavior.rb +18 -5
- data/lib/hydra/pcdm/models/concerns/object_behavior.rb +13 -17
- data/lib/hydra/pcdm/models/concerns/pcdm_behavior.rb +50 -9
- data/lib/hydra/pcdm/models/file.rb +7 -7
- data/lib/hydra/pcdm/models/object.rb +0 -1
- data/lib/hydra/pcdm/object_indexer.rb +1 -2
- data/lib/hydra/pcdm/services/file/add_type.rb +1 -3
- data/lib/hydra/pcdm/services/file/get_mime_type.rb +2 -4
- data/lib/hydra/pcdm/validators/ancestor_validator.rb +3 -11
- data/lib/hydra/pcdm/validators/pcdm_object_validator.rb +2 -2
- data/lib/hydra/pcdm/validators/pcdm_validator.rb +2 -2
- data/lib/hydra/pcdm/version.rb +1 -1
- data/lib/hydra/pcdm/vocab/pcdm_terms.rb +81 -80
- data/lib/hydra/pcdm/vocab/sweet_jpl_terms.rb +12 -0
- data/spec/hydra/pcdm/ancestor_checker_spec.rb +7 -7
- data/spec/hydra/pcdm/collection_indexer_spec.rb +12 -13
- data/spec/hydra/pcdm/deep_member_iterator_spec.rb +16 -16
- data/spec/hydra/pcdm/models/collection_spec.rb +375 -313
- data/spec/hydra/pcdm/models/file_spec.rb +38 -38
- data/spec/hydra/pcdm/models/object_spec.rb +270 -256
- data/spec/hydra/pcdm/object_indexer_spec.rb +4 -4
- data/spec/hydra/pcdm/services/file/get_mime_type_spec.rb +10 -12
- data/spec/hydra/pcdm_spec.rb +21 -26
- metadata +19 -5
- data/lib/hydra/pcdm/vocab/ebucore_terms.rb +0 -33
- data/lib/hydra/pcdm/vocab/sweetjpl_terms.rb +0 -10
@@ -7,14 +7,14 @@ describe Hydra::PCDM::ObjectIndexer do
|
|
7
7
|
let(:indexer) { described_class.new(object) }
|
8
8
|
|
9
9
|
before do
|
10
|
-
allow(object).to receive(:
|
10
|
+
allow(object).to receive(:object_ids).and_return([child_object1.id, child_object2.id])
|
11
11
|
end
|
12
12
|
|
13
|
-
describe
|
13
|
+
describe '#generate_solr_document' do
|
14
14
|
subject { indexer.generate_solr_document }
|
15
15
|
|
16
|
-
it
|
17
|
-
expect(subject['
|
16
|
+
it 'has fields' do
|
17
|
+
expect(subject['object_ids_ssim']).to eq %w(123 456)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -1,24 +1,22 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Hydra::PCDM::GetMimeTypeForFile do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
expect( lambda{described_class.call(["bad input"])}).to raise_error(ArgumentError, error_message)
|
4
|
+
context 'with faulty input' do
|
5
|
+
let(:error_message) { 'supplied argument should be a path to a file' }
|
6
|
+
it 'raises and error' do
|
7
|
+
expect(-> { described_class.call(['bad input']) }).to raise_error(ArgumentError, error_message)
|
9
8
|
end
|
10
9
|
end
|
11
10
|
|
12
|
-
context
|
13
|
-
let(:path) {
|
11
|
+
context 'with a standard file type' do
|
12
|
+
let(:path) { '/path/file.jpg' }
|
14
13
|
subject { described_class.call(path) }
|
15
|
-
it { is_expected.to eql
|
14
|
+
it { is_expected.to eql 'image/jpeg' }
|
16
15
|
end
|
17
16
|
|
18
|
-
context
|
19
|
-
let(:path) {
|
17
|
+
context 'with an unknown file type' do
|
18
|
+
let(:path) { '/path/file.jkl' }
|
20
19
|
subject { described_class.call(path) }
|
21
|
-
it { is_expected.to eql
|
20
|
+
it { is_expected.to eql 'application/octet-stream' }
|
22
21
|
end
|
23
|
-
|
24
22
|
end
|
data/spec/hydra/pcdm_spec.rb
CHANGED
@@ -1,56 +1,51 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Hydra::PCDM do
|
4
|
-
|
5
4
|
let(:coll1) { Hydra::PCDM::Collection.create }
|
6
5
|
let(:obj1) { Hydra::PCDM::Object.create }
|
7
6
|
let(:file1) { Hydra::PCDM::File.new }
|
8
7
|
|
9
8
|
describe 'Validations' do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
expect( Hydra::PCDM.collection? coll1 ).to be true
|
9
|
+
describe '#collection?' do
|
10
|
+
it 'return true for a pcdm collection' do
|
11
|
+
expect(described_class.collection? coll1).to be true
|
14
12
|
end
|
15
13
|
|
16
|
-
it
|
17
|
-
expect(
|
14
|
+
it 'return false for a pcdm object' do
|
15
|
+
expect(described_class.collection? obj1).to be false
|
18
16
|
end
|
19
17
|
|
20
|
-
it
|
21
|
-
expect(
|
18
|
+
it 'return false for a pcdm file' do
|
19
|
+
expect(described_class.collection? file1).to be false
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
25
|
-
describe
|
26
|
-
it
|
27
|
-
expect(
|
23
|
+
describe '#object?' do
|
24
|
+
it 'return false for a pcdm collection' do
|
25
|
+
expect(described_class.object? coll1).to be false
|
28
26
|
end
|
29
27
|
|
30
|
-
it
|
31
|
-
expect(
|
28
|
+
it 'return true for a pcdm object' do
|
29
|
+
expect(described_class.object? obj1).to be true
|
32
30
|
end
|
33
31
|
|
34
|
-
it
|
35
|
-
expect(
|
32
|
+
it 'return false for a pcdm file' do
|
33
|
+
expect(described_class.object? file1).to be false
|
36
34
|
end
|
37
35
|
end
|
38
36
|
|
39
|
-
describe
|
40
|
-
it
|
41
|
-
expect(
|
37
|
+
describe '#file?' do
|
38
|
+
it 'return false for a pcdm collection' do
|
39
|
+
expect(described_class.file? coll1).to be false
|
42
40
|
end
|
43
41
|
|
44
|
-
it
|
45
|
-
expect(
|
42
|
+
it 'return false for a pcdm object' do
|
43
|
+
expect(described_class.file? obj1).to be false
|
46
44
|
end
|
47
45
|
|
48
|
-
it
|
49
|
-
expect(
|
46
|
+
it 'return true for a pcdm file' do
|
47
|
+
expect(described_class.file? file1).to be true
|
50
48
|
end
|
51
49
|
end
|
52
|
-
|
53
50
|
end
|
54
|
-
|
55
51
|
end
|
56
|
-
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-pcdm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- E. Lynette Rayle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: active-fedora
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 9.4.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 9.4.1
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: activefedora-aggregation
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,6 +131,7 @@ extra_rdoc_files: []
|
|
117
131
|
files:
|
118
132
|
- ".coveralls.yml"
|
119
133
|
- ".gitignore"
|
134
|
+
- ".rubocop.yml"
|
120
135
|
- ".travis.yml"
|
121
136
|
- CONTRIBUTING.md
|
122
137
|
- Gemfile
|
@@ -144,9 +159,8 @@ files:
|
|
144
159
|
- lib/hydra/pcdm/validators/pcdm_object_validator.rb
|
145
160
|
- lib/hydra/pcdm/validators/pcdm_validator.rb
|
146
161
|
- lib/hydra/pcdm/version.rb
|
147
|
-
- lib/hydra/pcdm/vocab/ebucore_terms.rb
|
148
162
|
- lib/hydra/pcdm/vocab/pcdm_terms.rb
|
149
|
-
- lib/hydra/pcdm/vocab/
|
163
|
+
- lib/hydra/pcdm/vocab/sweet_jpl_terms.rb
|
150
164
|
- spec/hydra/pcdm/ancestor_checker_spec.rb
|
151
165
|
- spec/hydra/pcdm/collection_indexer_spec.rb
|
152
166
|
- spec/hydra/pcdm/deep_member_iterator_spec.rb
|
@@ -177,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
191
|
version: '0'
|
178
192
|
requirements: []
|
179
193
|
rubyforge_project:
|
180
|
-
rubygems_version: 2.
|
194
|
+
rubygems_version: 2.2.2
|
181
195
|
signing_key:
|
182
196
|
specification_version: 4
|
183
197
|
summary: Portland Common Data Model (PCDM)
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'rdf'
|
2
|
-
module EBUCoreVocabularies
|
3
|
-
class EBUCoreTerms < RDF::StrictVocabulary("http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#")
|
4
|
-
# Property definitions
|
5
|
-
property :filename,
|
6
|
-
comment: ["The name of the file containing the Resource.".freeze],
|
7
|
-
domain: "ebucore:Resource".freeze,
|
8
|
-
range: "xsd:string".freeze,
|
9
|
-
label: "File Name".freeze
|
10
|
-
|
11
|
-
property :fileSize,
|
12
|
-
comment: ["Size of a MediaResource in bytes.".freeze],
|
13
|
-
domain: "ebucore:Resource".freeze,
|
14
|
-
range: "xsd:integer".freeze,
|
15
|
-
label: "File Size".freeze
|
16
|
-
|
17
|
-
property :dateCreated,
|
18
|
-
comment: ["The date of creation of the media resource.".freeze],
|
19
|
-
domain: "ebucore:Resource".freeze,
|
20
|
-
range: "xsd:dateTime".freeze,
|
21
|
-
label: "Date Created".freeze
|
22
|
-
|
23
|
-
property :hasMimeType,
|
24
|
-
comment: ["Has Mime Type.".freeze],
|
25
|
-
range: "xsd:string".freeze,
|
26
|
-
label: "Has Mime Type".freeze
|
27
|
-
|
28
|
-
property :dateModified,
|
29
|
-
comment: ["To indicate the date at which the media resource has been modified.".freeze],
|
30
|
-
range: "xsd:dateTime".freeze,
|
31
|
-
label: "Date Modified".freeze
|
32
|
-
end
|
33
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'rdf'
|
2
|
-
module SweetjplVocabularies
|
3
|
-
class SweetjplTerms < RDF::StrictVocabulary("http://sweet.jpl.nasa.gov/2.2/reprDataFormat.owl#")
|
4
|
-
# Property definitions
|
5
|
-
property :byteOrder,
|
6
|
-
comment: ["Byte Order.".freeze],
|
7
|
-
range: "xsd:string".freeze,
|
8
|
-
label: "Byte Order".freeze
|
9
|
-
end
|
10
|
-
end
|