rof 0.0.1.pre → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +12 -2
  4. data/Gemfile +1 -0
  5. data/README.md +87 -0
  6. data/bin/.ruby-version +1 -0
  7. data/bin/csv_to_rof +26 -0
  8. data/bin/fedora_to_rof +57 -0
  9. data/bin/osf_to_rof +40 -0
  10. data/bin/rof +78 -0
  11. data/bulk-ingest.md +242 -0
  12. data/labels.md +111 -0
  13. data/lib/rof.rb +20 -1
  14. data/lib/rof/access.rb +57 -0
  15. data/lib/rof/cli.rb +122 -0
  16. data/lib/rof/collection.rb +109 -0
  17. data/lib/rof/compare_rof.rb +92 -0
  18. data/lib/rof/filters/bendo.rb +33 -0
  19. data/lib/rof/filters/date_stamp.rb +36 -0
  20. data/lib/rof/filters/file_to_url.rb +27 -0
  21. data/lib/rof/filters/label.rb +153 -0
  22. data/lib/rof/filters/work.rb +111 -0
  23. data/lib/rof/get_from_fedora.rb +196 -0
  24. data/lib/rof/ingest.rb +204 -0
  25. data/lib/rof/ingesters/rels_ext_ingester.rb +78 -0
  26. data/lib/rof/ingesters/rights_metadata_ingester.rb +68 -0
  27. data/lib/rof/osf_context.rb +19 -0
  28. data/lib/rof/osf_to_rof.rb +122 -0
  29. data/lib/rof/rdf_context.rb +36 -0
  30. data/lib/rof/translate_csv.rb +112 -0
  31. data/lib/rof/utility.rb +84 -0
  32. data/lib/rof/version.rb +2 -2
  33. data/rof.gemspec +17 -0
  34. data/spec/fixtures/a.json +4 -0
  35. data/spec/fixtures/label.json +20 -0
  36. data/spec/fixtures/osf/b6psa.tar.gz +0 -0
  37. data/spec/fixtures/rof/dev0012829m.rof +45 -0
  38. data/spec/fixtures/vcr_tests/fedora_to_rof1.yml +5274 -0
  39. data/spec/fixtures/vecnet-citation.json +73 -0
  40. data/spec/lib/rof/access_spec.rb +36 -0
  41. data/spec/lib/rof/cli_spec.rb +66 -0
  42. data/spec/lib/rof/collection_spec.rb +90 -0
  43. data/spec/lib/rof/compare_rof_spec.rb +263 -0
  44. data/spec/lib/rof/filters/date_stamp_spec.rb +90 -0
  45. data/spec/lib/rof/filters/file_to_url_spec.rb +70 -0
  46. data/spec/lib/rof/filters/label_spec.rb +94 -0
  47. data/spec/lib/rof/filters/work_spec.rb +87 -0
  48. data/spec/lib/rof/ingest_spec.rb +117 -0
  49. data/spec/lib/rof/ingesters/rels_ext_ingester_spec.rb +62 -0
  50. data/spec/lib/rof/ingesters/rights_metadata_ingester_spec.rb +114 -0
  51. data/spec/lib/rof/osf_to_rof_spec.rb +76 -0
  52. data/spec/lib/rof/translate_csv_spec.rb +109 -0
  53. data/spec/lib/rof/utility_spec.rb +64 -0
  54. data/spec/lib/rof_spec.rb +14 -0
  55. data/spec/spec_helper.rb +11 -11
  56. metadata +283 -18
@@ -0,0 +1,73 @@
1
+ [{
2
+ "type" : "fobject",
3
+ "pid" : "vecnet:d217qs82g",
4
+ "af-model" : "Citation",
5
+ "rights" : {
6
+ "read-groups" : ["public"],
7
+ "edit" : ["vecnet_batchuser"]
8
+ },
9
+ "metadata" : {
10
+ "@context" : {
11
+ "dc" : "http://purl.org/dc/terms/",
12
+ "rdfs" : "http://www.w3.org/2000/01/rdf-schema#"
13
+ },
14
+ "dc:title" : "Molecular systematics and insecticide resistance in the major African malaria vector Anopheles funestus",
15
+ "dc:creator" : ["Coetzee, M.", "Koekemoer, L. L."],
16
+ "dc:identifier" : ["doi:10.1146/annurev-ento-120811-153628", "issn:1545-4487 (Electronic)", "issn:0066-4170 (Linking)", "23317045"],
17
+ "dc:description" : "Anopheles funestus is one of three major African vectors of malaria. Its distribution extends over much of the tropics and subtropics wherever suitable swampy breeding habitats are present. As with members of the Anopheles gambiae complex, An. funestus shows marked genetic heterogeneity across its range. Currently, two unnamed species are recognized in the group, with molecular and cytogenetic data indicating that more may be present. The control of malaria vectors in Africa has received increased attention in the past decade with the scaling up of insecticide-treated bed nets and indoor residual house spraying. Also in the past decade, the frequency of insecticide-resistant mosquitoes has increased exponentially. Whether this increase is in response to vector control initiatives or because of insecticide use in agriculture is debatable. In this article we examine the progress made on the systematics of the An. funestus group and review research on insecticide resistance and its mechanisms.",
18
+ "dc:language" : "eng",
19
+ "dc:type" : "Article",
20
+ "dc:source" : "Annual review of entomology",
21
+ "dc:references" : "Molecu2013",
22
+ "dc:bibliographicCitation" : "Annu Rev Entomol 58, 393-412. (2013)",
23
+ "rdfs:seeAlso" : "http://www.ncbi.nlm.nih.gov/pubmed/23317045",
24
+ "dc:created" : "2013",
25
+ "dc:modified" : {
26
+ "@value":"2014-03-17Z",
27
+ "@type":"http://www.w3.org/2001/XMLSchema#date"
28
+ },
29
+ "rdfs:domain" : "Citation"
30
+ },
31
+ "properties-meta" : {
32
+ "mime-type" : "text/xml"
33
+ },
34
+ "properties" : "<fields><depositor>vecnet_batchuser</depositor></fields>"
35
+ },
36
+ {
37
+ "type" : "fobject",
38
+ "pid" : "vecnet:h415pf50x",
39
+ "af-model" : "CitationFile",
40
+ "rights" : {
41
+ "read-groups" : ["registered"],
42
+ "edit" : ["vecnet_batchuser"]
43
+ },
44
+ "metadata" : {
45
+ "@context" : {
46
+ "dc" : "http://purl.org/dc/terms/",
47
+ "rdfs" : "http://www.w3.org/2000/01/rdf-schema#"
48
+ },
49
+ "dc:type" : "CitationFile",
50
+ "dc:dateSubmitted" : {
51
+ "@value" : "2014-03-17Z",
52
+ "@type" : "http://www.w3.org/2001/XMLSchema#date"
53
+ },
54
+ "dc:modified" : {
55
+ "@value" : "2014-03-17Z",
56
+ "@type" : "http://www.w3.org/2001/XMLSchema#date"
57
+ },
58
+ "dc:creator" : [ "Vecnet Batchuser", "Maureen Coetzee and Lizette L. Koekemoer" ],
59
+ "dc:title" : "Molecular Systematics and Insecticide Resistance in the Major African Malaria Vector Anopheles funestus"
60
+ },
61
+ "rels-ext" : {
62
+ "isPartOf" : ["vecnet:d217qs82g"]
63
+ },
64
+ "properties" : "<fields><depositor>vecnet_batchuser</depositor></fields>",
65
+ "properties-meta" : {
66
+ "mime-type": "text/xml"
67
+ },
68
+ "content-meta" : {
69
+ "mime-type": "application/pdf",
70
+ "label" : "5772.pdf"
71
+ },
72
+ "content-file" : "5772.pdf"
73
+ }]
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ module ROF
4
+ describe "Access" do
5
+ it "decodes public restricted private" do
6
+ s = Access.decode("public", "user1")
7
+ expect(s).to eq({"read-groups" => ["public"], "edit" => ["user1"]})
8
+
9
+ s = Access.decode("restricted", "user1")
10
+ expect(s).to eq({"read-groups" => ["registered"], "edit" => ["user1"]})
11
+
12
+ s = Access.decode("private", "user1")
13
+ expect(s).to eq({"edit" => ["user1"]})
14
+ end
15
+
16
+ it "handles embargos" do
17
+ s = Access.decode("embargo=2014-12-25", "user1")
18
+ expect(s).to eq({"embargo-date" => "2014-12-25"})
19
+ end
20
+
21
+ it "handles multiple clauses" do
22
+ s = Access.decode("public;editgroup=group1,group2;edit=user2", "user1")
23
+ expect(s).to eq({"read-groups" => ["public"], "edit" => ["user1","user2"], "edit-groups" => ["group1","group2"]})
24
+ end
25
+
26
+ it "removes duplicates" do
27
+ s = Access.decode("edit=user1,user2;edit=user1")
28
+ expect(s).to eq({"edit" => ["user1", "user2"]})
29
+ end
30
+
31
+ it "encodes" do
32
+ s = Access.encode({"read-groups" => ["public"], "edit" => ["user1","user2"], "edit-groups" => ["group1","group2"]})
33
+ expect(s).to eq("readgroup=public;edit=user1,user2;editgroup=group1,group2")
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,66 @@
1
+ require 'spec_helper'
2
+ require 'stringio'
3
+
4
+ describe ROF::CLI do
5
+ it "ingests an array of items" do
6
+ items = [{"pid" => "test:1",
7
+ "type" => "fobject"},
8
+ {"pid" => "test:2",
9
+ "type" => "fobject"}]
10
+ output = StringIO.new
11
+ ROF::CLI.ingest_array(items, [], output)
12
+ expect(output.string).to match(/1\. Verifying test:1 \.\.\.ok\..*\n2\. Verifying test:2 \.\.\.ok\./)
13
+ end
14
+
15
+ it "retrieves a fedora object and converts it to ROF" do
16
+ expected_output = {
17
+ "pid" => "und:dev0012829m",
18
+ "type" => "fobject",
19
+ "af-model" => "GenericFile",
20
+ "rels-ext" => {
21
+ "@context"=> ROF::RelsExtRefContext,
22
+ "@id" => "und:dev0012829m",
23
+ "isPartOf"=> "und:dev00128288"
24
+ },
25
+ "rights" => {
26
+ "read-groups" => ["registered"],
27
+ "edit" => ["dbrower"]
28
+ },
29
+ "properties" => "<fields>\n<depositor>batch_ingest</depositor>\n<owner>dbrower</owner>\n</fields>\n",
30
+ "properties-meta" => {"mime-type" => "text/xml"},
31
+ "metadata" => {
32
+ "@context"=> {
33
+ "bibo"=>"http://purl.org/ontology/bibo/",
34
+ "dc"=>"http://purl.org/dc/terms/",
35
+ "ebucore"=>"http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#",
36
+ "foaf"=>"http://xmlns.com/foaf/0.1/",
37
+ "mrel"=>"http://id.loc.gov/vocabulary/relators/",
38
+ "nd"=>"https://library.nd.edu/ns/terms/",
39
+ "rdfs"=>"http://www.w3.org/2000/01/rdf-schema#",
40
+ "vracore"=>"http://purl.org/vra/",
41
+ "dc:dateSubmitted" => {"@type" => "http://www.w3.org/2001/XMLSchema#date"},
42
+ "dc:created"=>{"@type"=>"http://www.w3.org/2001/XMLSchema#date"},
43
+ "dc:modified" => {"@type" => "http://www.w3.org/2001/XMLSchema#date"}
44
+ },
45
+ "@id" => "info:fedora/und:dev0012829m",
46
+ "dc:dateSubmitted" => "2016-04-12Z",
47
+ "dc:modified" => "2016-04-12Z",
48
+ "dc:title" => "bonnie+chauncey"
49
+ },
50
+ "bendo-item" => "dev0012826k",
51
+ "characterization-meta" => {"mime-type"=>"text/xml"},
52
+ "content-meta" => {"label"=>"bonnie+chauncey", "mime-type"=>"application/octet-stream", "URL"=>"http://libvirt9.library.nd.edu:14000/item/dev0012826k/bonnie+chauncey"},
53
+ "thumbnail-meta" => {"label"=>"File Datastream", "mime-type"=>"image/png"},
54
+ }
55
+ pid = 'und:dev0012829m'
56
+ config = {}
57
+ fedora = {}
58
+ fedora[:url] = 'http://localhost:8080/fedora'
59
+ fedora[:user] = 'fedoraAdmin'
60
+ fedora[:password] = 'fedoraAdmin'
61
+ VCR.use_cassette("fedora_to_rof1") do
62
+ fedora_data = ROF::FedoraToRof.GetFromFedora(pid, fedora, config)
63
+ expect(fedora_data).to eq(expected_output)
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,90 @@
1
+ require 'spec_helper'
2
+
3
+ module ROF
4
+ RSpec.describe Collection do
5
+ let!(:util) { ROF::Utility.new }
6
+ let!(:testobject1) { { 'owner' => 'rtillman', 'pid' => '$(first)'} }
7
+ let!(:testobject2) { { 'owner' => 'rtillman', 'rights' => { 'read-groups' => [ 'public' ], 'edit' => [ 'edit']}} }
8
+ let!(:testobject3) { { 'owner' => 'rtillman', "metadata" => { "dc:title" => "Extensive Reading in Japanese"} } }
9
+ let!(:testobject4) { { 'owner' => 'rtillman', "files" => [ '/it_is_not_there'] } }
10
+
11
+ describe 'set_required_fields' do
12
+ let(:obj) { ROF::Collection.set_required_fields( testobject1, util) }
13
+ let(:obj_rights) { ROF::Collection.set_required_fields( testobject2, util) }
14
+ let(:obj_metadata) { ROF::Collection.set_required_fields( testobject3, util) }
15
+ context 'type' do
16
+ subject { obj['type'] }
17
+ it { is_expected.to eq("fobject") }
18
+ end
19
+ context 'af-model' do
20
+ subject { obj['af-model'] }
21
+ it { is_expected.to eq("Collection") }
22
+ end
23
+ context 'rights' do
24
+ subject { obj_rights['rights'] }
25
+ it { is_expected.to eq({"read-groups"=>["public"], "edit"=>["edit"]}) }
26
+ end
27
+ context 'metadata' do
28
+ subject { obj_metadata['metadata'] }
29
+ it { is_expected.to eq({"dc:title"=>"Extensive Reading in Japanese"}) }
30
+ end
31
+ context 'pid' do
32
+ subject { obj['pid'] }
33
+ it { is_expected.to eq("$(first)") }
34
+ end
35
+ context 'properties' do
36
+ subject { obj['properties'] }
37
+ it { is_expected.to eq "<fields><depositor>batch_ingest</depositor>\n<owner>rtillman</owner>\n</fields>\n" }
38
+ end
39
+ context 'properties--meta' do
40
+ subject { obj['properties-meta'] }
41
+ it { is_expected.to eq({ 'mime-type' => 'text/xml' }) }
42
+ end
43
+ context 'rels-ext' do
44
+ subject { obj['rels-ext'] }
45
+ it { is_expected.to eq({}) }
46
+ end
47
+ end
48
+ describe 'mk_dest_img_name' do
49
+ context 'with file extension' do
50
+ subject { ROF::Collection.mk_dest_img_name('/opt/data/und:12345/flashcrowd.jpg', '-thumb') }
51
+ it { is_expected.to eq("/opt/data/und:12345/flashcrowd-thumb.jpg") }
52
+ end
53
+ context 'without file extension' do
54
+ subject { ROF::Collection.mk_dest_img_name('/opt/data/und:12345/flashcrowd', '-launch') }
55
+ it { is_expected.to eq("/opt/data/und:12345/flashcrowd-launch") }
56
+ end
57
+ end
58
+ describe 'make_images' do
59
+ it 'raises error with non-existent file' do
60
+ expect { ROF::Collection.make_images({}, testobject4, util)}.to raise_error(ROF::Collection::NoFile)
61
+ end
62
+ end
63
+ describe 'find_file_mime' do
64
+ context 'jpg' do
65
+ subject { ROF::Collection.find_file_mime('/opt/data/und:12345/flashcrowd.jpg') }
66
+ it { is_expected.to eq("image/jpeg") }
67
+ end
68
+ context 'JPG' do
69
+ subject { ROF::Collection.find_file_mime('und:12345/flashcrowd.JPG') }
70
+ it { is_expected.to eq("image/jpeg") }
71
+ end
72
+ context 'GIF' do
73
+ subject { ROF::Collection.find_file_mime('und:12345/flashcrowd.GIF') }
74
+ it { is_expected.to eq("image/gif") }
75
+ end
76
+ context 'gif' do
77
+ subject { ROF::Collection.find_file_mime('/und:12345/flashcrowd.gif') }
78
+ it { is_expected.to eq("image/gif") }
79
+ end
80
+ context 'png' do
81
+ subject { ROF::Collection.find_file_mime('death_of_middle_class.png') }
82
+ it { is_expected.to eq("image/png") }
83
+ end
84
+ context 'PNG' do
85
+ subject { ROF::Collection.find_file_mime('death_of_middle_class.PNG') }
86
+ it { is_expected.to eq("image/png") }
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,263 @@
1
+ require 'spec_helper'
2
+
3
+ module ROF
4
+ describe "Compare ROF" do
5
+ it "compares rights metadata different read-groups" do
6
+ fedora = { "rights"=> { "read-groups"=> ["public"], "edit"=> ["rtillman"]}}
7
+ bendo = { "rights"=> {"read-groups"=> ["private"], "edit"=> ["rtillman"]}}
8
+ test_return = CompareRof.compare_rights(fedora, bendo, {})
9
+ expect(test_return).to eq(1)
10
+ end
11
+
12
+ it "compares rights metadata same read-groups" do
13
+ fedora = { "rights"=> { "read-groups"=> ["public"], "edit"=> ["rtillman"]}}
14
+ bendo = { "rights"=> {"read-groups"=> ["public"], "edit"=> ["rtillman"]}}
15
+ test_return = CompareRof.compare_rights(fedora, bendo, {})
16
+ expect(test_return).to eq(0)
17
+ end
18
+
19
+ it "compares rights metadata with different groups" do
20
+ fedora = { "rights"=> { "read-groups"=> ["public"], "edit"=> ["rtillman"]}}
21
+ bendo = { "rights"=> {"edit"=> ["rtillman"]}}
22
+ test_return = CompareRof.compare_rights(fedora, bendo, {})
23
+ expect(test_return).to eq(1)
24
+ end
25
+
26
+ it "compares metadata (same) " do
27
+ fedora = { "metadata"=> { "@context"=> {
28
+ "dc"=> "http://purl.org/dc/terms/",
29
+ "foaf"=> "http://xmlns.com/foaf/0.1/",
30
+ "rdfs"=> "http://www.w3.org/2000/01/rdf-schema#",
31
+ "dc:dateSubmitted"=> {
32
+ "@type"=> "http://www.w3.org/2001/XMLSchema#date"
33
+ },
34
+ "dc:modified"=> {
35
+ "@type"=> "http://www.w3.org/2001/XMLSchema#date"
36
+ }
37
+ },
38
+ "dc:dateSubmitted"=> "2016-07-22Z",
39
+ "dc:modified"=> "2016-07-22Z",
40
+ "dc:title"=> "carmella.jpeg"
41
+ }}
42
+ bendo = { "metadata"=> {
43
+ "dc:dateSubmitted"=> "2016-07-22Z",
44
+ "dc:modified"=> "2016-07-22Z",
45
+ "dc:title"=> "carmella.jpeg"
46
+ }}
47
+ test_return = CompareRof.compare_metadata(fedora, bendo)
48
+ expect(test_return).to eq(0)
49
+ end
50
+
51
+ it "compares metadata (different) " do
52
+ fedora = { "metadata"=> { "@context"=> {
53
+ "dc"=> "http://purl.org/dc/terms/",
54
+ "foaf"=> "http://xmlns.com/foaf/0.1/",
55
+ "rdfs"=> "http://www.w3.org/2000/01/rdf-schema#",
56
+ "dc:dateSubmitted"=> {
57
+ "@type"=> "http://www.w3.org/2001/XMLSchema#date"
58
+ },
59
+ "dc:modified"=> {
60
+ "@type"=> "http://www.w3.org/2001/XMLSchema#date"
61
+ }
62
+ },
63
+ "dc:dateSubmitted"=> "2016-07-22Z",
64
+ "dc:modified"=> "2016-07-22Z",
65
+ "dc:title"=> "carmella.jpeg"
66
+ }}
67
+ bendo = { "metadata"=> {
68
+ "dc:dateSubmitted"=> "2016-07-22Z",
69
+ "dc:modified"=> "2016-07-23Z",
70
+ "dc:title"=> "carmella.jpeg"
71
+ }}
72
+ test_return = CompareRof.compare_metadata(fedora, bendo)
73
+ expect(test_return).to eq(1)
74
+ end
75
+
76
+ it "compares metadata (different types) " do
77
+ # dateSubmitted is a string literal in one and a date type in the other
78
+ fedora = { "metadata"=> { "@context"=> {
79
+ "dc"=> "http://purl.org/dc/terms/",
80
+ "foaf"=> "http://xmlns.com/foaf/0.1/",
81
+ "rdfs"=> "http://www.w3.org/2000/01/rdf-schema#",
82
+ "dc:dateSubmitted"=> {
83
+ "@type"=> "http://www.w3.org/2001/XMLSchema#date"
84
+ },
85
+ "dc:modified"=> {
86
+ "@type"=> "http://www.w3.org/2001/XMLSchema#date"
87
+ }
88
+ },
89
+ "dc:dateSubmitted"=> "2016-07-22Z",
90
+ "dc:modified"=> "2016-07-22Z",
91
+ "dc:title"=> "carmella.jpeg"
92
+ }}
93
+ bendo = { "metadata"=> {
94
+ "@context" => {
95
+ "dc"=> "http://purl.org/dc/terms/",
96
+ },
97
+ "dc:dateSubmitted"=> "2016-07-22Z",
98
+ "dc:modified"=> "2016-07-22Z",
99
+ "dc:title"=> "carmella.jpeg"
100
+ }}
101
+ test_return = CompareRof.compare_metadata(fedora, bendo)
102
+ expect(test_return).to eq(1)
103
+ end
104
+
105
+ it "compares rels-ext (same) " do
106
+ fedora = { "rels-ext"=> {
107
+ "@context"=> {
108
+ "@vocab"=> "info:fedora/fedora-system:def/relations-external#",
109
+ "fedora-model"=> "info:fedora/fedora-system:def/model#",
110
+ "hydra"=> "http://projecthydra.org/ns/relations#",
111
+ "hasModel"=> {
112
+ "@id"=> "fedora-model:hasModel",
113
+ "@type"=> "@id"
114
+ },
115
+ "hasEditor"=> {
116
+ "@id"=> "hydra:hasEditor",
117
+ "@type"=> "@id"
118
+ },
119
+ "hasEditorGroup"=> {
120
+ "@id"=> "hydra:hasEditorGroup",
121
+ "@type"=> "@id"
122
+ },
123
+ "isPartOf"=> {
124
+ "@type"=> "@id"
125
+ },
126
+ "isEditorOf"=> {
127
+ "@id"=> "hydra:isEditorOf",
128
+ "@type"=> "@id"
129
+ },
130
+ "hasMember"=> {
131
+ "@type"=> "@id"
132
+ }
133
+ },
134
+ "isPartOf"=> [
135
+ "und:dev00149x01"
136
+ ]
137
+ }}
138
+ bendo = { "rels-ext"=> {
139
+ "isPartOf"=> [
140
+ "und:dev00149x01"
141
+ ]
142
+ }}
143
+ test_return = CompareRof.compare_rels_ext(fedora, bendo)
144
+ expect(test_return).to eq(0)
145
+ end
146
+
147
+ it "compares rels-ext (different) " do
148
+ fedora = { "rels-ext"=> {
149
+ "@context"=> {
150
+ "@vocab"=> "info:fedora/fedora-system:def/relations-external#",
151
+ "fedora-model"=> "info:fedora/fedora-system:def/model#",
152
+ "hydra"=> "http://projecthydra.org/ns/relations#",
153
+ "hasModel"=> {
154
+ "@id"=> "fedora-model:hasModel",
155
+ "@type"=> "@id"
156
+ },
157
+ "hasEditor"=> {
158
+ "@id"=> "hydra:hasEditor",
159
+ "@type"=> "@id"
160
+ },
161
+ "hasEditorGroup"=> {
162
+ "@id"=> "hydra:hasEditorGroup",
163
+ "@type"=> "@id"
164
+ },
165
+ "isPartOf"=> {
166
+ "@type"=> "@id"
167
+ },
168
+ "isEditorOf"=> {
169
+ "@id"=> "hydra:isEditorOf",
170
+ "@type"=> "@id"
171
+ },
172
+ "hasMember"=> {
173
+ "@type"=> "@id"
174
+ }
175
+ },
176
+ "isPartOf"=> [
177
+ "und:dev00149x01"
178
+ ]
179
+ }}
180
+ bendo = { "rels-ext"=> {
181
+ "isPartOf"=> [
182
+ "und:dev00148x01"
183
+ ]
184
+ }}
185
+ test_return = CompareRof.compare_rels_ext(fedora, bendo)
186
+ expect(test_return).to eq(1)
187
+ end
188
+
189
+ it "compares everything else (same) " do
190
+ fedora = {
191
+ "pid"=> "und:dev00149w5f",
192
+ "type"=> "fobject",
193
+ "af-model"=> "Collection",
194
+ "properties-meta"=> {
195
+ "mime-type"=> "text/xml"
196
+ },
197
+ "properties"=> "<fields><depositor>batch_ingest</depositor>\n\t\t\t\t<owner>rtillman</owner></fields>\n",
198
+ "content-meta"=> {
199
+ "mime-type"=> "image/jpeg"
200
+ },
201
+ "thumbnail-meta"=> {
202
+ "mime-type"=> "image/jpeg"
203
+ },
204
+ "bendo-item"=> "dev00149w5f"
205
+ }
206
+ bendo = {
207
+ "properties-meta"=> {
208
+ "mime-type"=> "text/xml"
209
+ },
210
+ "properties"=> "<fields><depositor>batch_ingest</depositor>\n\t\t\t\t<owner>rtillman</owner></fields>\n",
211
+ "content-meta"=> {
212
+ "mime-type"=> "image/jpeg"
213
+ },
214
+ "af-model"=> "Collection",
215
+ "pid"=> "und:dev00149w5f",
216
+ "thumbnail-meta"=> {
217
+ "mime-type"=> "image/jpeg"
218
+ },
219
+ "type"=> "fobject",
220
+ "bendo-item"=> "dev00149w5f"
221
+ }
222
+ test_return = CompareRof.compare_everything_else(fedora, bendo, {})
223
+ expect(test_return).to eq(0)
224
+ end
225
+
226
+ it "compares everything else (differenet) " do
227
+ fedora = {
228
+ "pid"=> "und:dev00149w5f",
229
+ "type"=> "fobject",
230
+ "af-model"=> "Collection",
231
+ "properties-meta"=> {
232
+ "mime-type"=> "text/xml"
233
+ },
234
+ "properties"=> "<fields><depositor>batch_ingest</depositor>\n\t\t\t\t<owner>msuhovec</owner></fields>\n",
235
+ "content-meta"=> {
236
+ "mime-type"=> "image/jpeg"
237
+ },
238
+ "thumbnail-meta"=> {
239
+ "mime-type"=> "image/jpeg"
240
+ },
241
+ "bendo-item"=> "dev00149w5f"
242
+ }
243
+ bendo = {
244
+ "properties-meta"=> {
245
+ "mime-type"=> "text/xml"
246
+ },
247
+ "properties"=> "<fields><depositor>batch_ingest</depositor>\n\t\t\t\t<owner>rtillman</owner></fields>\n",
248
+ "content-meta"=> {
249
+ "mime-type"=> "image/jpeg"
250
+ },
251
+ "af-model"=> "Collection",
252
+ "pid"=> "und:dev00149w5f",
253
+ "thumbnail-meta"=> {
254
+ "mime-type"=> "image/jpeg"
255
+ },
256
+ "type"=> "fobject",
257
+ "bendo-item"=> "dev00149w5f"
258
+ }
259
+ test_return = CompareRof.compare_everything_else(fedora, bendo, {})
260
+ expect(test_return).to eq(1)
261
+ end
262
+ end
263
+ end