rof 1.2.5 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rof/rdf_context.rb +2 -0
- data/lib/rof/translators/jsonld_to_rof.rb +4 -0
- data/lib/rof/translators/jsonld_to_rof/accumulator.rb +1 -1
- data/lib/rof/translators/jsonld_to_rof/statement_handler.rb +1 -2
- data/lib/rof/version.rb +1 -1
- data/spec/fixtures/DLTP-1007/remediated-z029p269r94.jsonld +127 -0
- data/spec/lib/rof/translators/fedora_to_rof_spec.rb +1 -0
- data/spec/lib/rof/translators/jsonld_to_rof_spec.rb +31 -0
- data/spec/lib/rof/translators/osf_to_rof_spec.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2904ea17597fc64687691d34928f1996007acaef
|
4
|
+
data.tar.gz: 5bab7145ebb3b4390fcb0b45b9848d4286664ccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eec647ac396d07d11c04b8dfa0f72bc199c7b5c9720623f843cdbf1f9c827f8d078015a952a684cf9d52a7ad6b9ef6de472a8ecfde1fc3bd062a25e48487cae3
|
7
|
+
data.tar.gz: 3753abfbb4bdecbc70b89f8068f41e52c830a9affb8d72f4e7ed1ee5797bd2672ecaf6afa745ace2ab96da4ed476f333aa6cae1f77309e90fb5e40eb72d4fd93
|
data/lib/rof/rdf_context.rb
CHANGED
@@ -4,6 +4,7 @@ module ROF
|
|
4
4
|
'dc' => 'http://purl.org/dc/terms/',
|
5
5
|
'ebucore' => 'http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#',
|
6
6
|
'foaf' => 'http://xmlns.com/foaf/0.1/',
|
7
|
+
'hydramata-rel' => 'http://projecthydra.org/ns/relations#',
|
7
8
|
'hydra' => 'http://projecthydra.org/ns/relations#',
|
8
9
|
'mrel' => 'http://id.loc.gov/vocabulary/relators/',
|
9
10
|
'ms' => 'http://www.ndltd.org/standards/metadata/etdms/1.1/',
|
@@ -29,6 +30,7 @@ module ROF
|
|
29
30
|
'fedora-model' => 'info:fedora/fedora-system:def/model#',
|
30
31
|
'pav' => 'http://purl.org/pav/',
|
31
32
|
'hydra' => 'http://projecthydra.org/ns/relations#',
|
33
|
+
'hydramata-rel' => 'http://projecthydra.org/ns/relations#',
|
32
34
|
'hasModel' => { '@id' => 'fedora-model:hasModel', '@type' => '@id' },
|
33
35
|
"hasEditor"=>{"@id"=>"hydra:hasEditor", "@type"=>"@id"},
|
34
36
|
"hasEditorGroup"=>{"@id"=>"hydra:hasEditorGroup", "@type"=>"@id"},
|
@@ -71,6 +71,10 @@ module ROF
|
|
71
71
|
handler.map('role', to: ['metadata', 'dc:contributor', 'ms:role'], force: true)
|
72
72
|
end
|
73
73
|
|
74
|
+
# The $1 will be the PID
|
75
|
+
# @see Related specs for expected behavior
|
76
|
+
REGEXP_FOR_A_CURATE_RDF_SUBJECT = %r{\Ahttps?://curate(?:[\w\.]*).nd.edu/show/([[:alnum:]]+)/?}.freeze
|
77
|
+
|
74
78
|
# @api public
|
75
79
|
#
|
76
80
|
# Convert's the given JSON-LD into an ROF document that can be used to batch ingest into Fedora.
|
@@ -175,7 +175,7 @@ module ROF
|
|
175
175
|
|
176
176
|
def coerce_object_to_string(object)
|
177
177
|
return object if object.nil?
|
178
|
-
if object.to_s =~
|
178
|
+
if object.to_s =~ ROF::Translators::JsonldToRof::REGEXP_FOR_A_CURATE_RDF_SUBJECT
|
179
179
|
return "und:#{$1}"
|
180
180
|
elsif object.respond_to?(:value)
|
181
181
|
return object.value
|
@@ -64,10 +64,9 @@ module ROF
|
|
64
64
|
end
|
65
65
|
|
66
66
|
# Handle the various CurateND environments instead of just curate.nd.edu
|
67
|
-
REGEXP_FOR_A_CURATE_RDF_SUBJECT = %r{https://curate(?:[\w\.]*).nd.edu/show/([^\\]+)/?}.freeze
|
68
67
|
|
69
68
|
def handle_subject
|
70
|
-
return nil unless @statement.subject.to_s =~ REGEXP_FOR_A_CURATE_RDF_SUBJECT
|
69
|
+
return nil unless @statement.subject.to_s =~ ROF::Translators::JsonldToRof::REGEXP_FOR_A_CURATE_RDF_SUBJECT
|
71
70
|
pid = "und:#{$1}"
|
72
71
|
@accumulator.add_pid(pid)
|
73
72
|
end
|
data/lib/rof/version.rb
CHANGED
@@ -0,0 +1,127 @@
|
|
1
|
+
{
|
2
|
+
"@context": {
|
3
|
+
"bibo": "http://purl.org/ontology/bibo/",
|
4
|
+
"dc": "http://purl.org/dc/terms/",
|
5
|
+
"ebucore": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#",
|
6
|
+
"fedora-model": "info:fedora/fedora-system:def/model#",
|
7
|
+
"foaf": "http://xmlns.com/foaf/0.1/",
|
8
|
+
"frels": "info:fedora/fedora-system:def/relations-external#",
|
9
|
+
"hasEditor": {
|
10
|
+
"@id": "hydra:hasEditor",
|
11
|
+
"@type": "@id"
|
12
|
+
},
|
13
|
+
"hasEditorGroup": {
|
14
|
+
"@id": "hydra:hasEditorGroup",
|
15
|
+
"@type": "@id"
|
16
|
+
},
|
17
|
+
"hasMember": {
|
18
|
+
"@id": "frels:hasMember",
|
19
|
+
"@type": "@id"
|
20
|
+
},
|
21
|
+
"hasModel": {
|
22
|
+
"@id": "fedora-model:hasModel",
|
23
|
+
"@type": "@id"
|
24
|
+
},
|
25
|
+
"hasViewer": {
|
26
|
+
"@id": "hydra:hasViewer",
|
27
|
+
"@type": "@id"
|
28
|
+
},
|
29
|
+
"hasViewerGroup": {
|
30
|
+
"@id": "hydra:hasViewerGroup",
|
31
|
+
"@type": "@id"
|
32
|
+
},
|
33
|
+
"hydra": "http://projecthydra.org/ns/relations#",
|
34
|
+
"isEditorOf": {
|
35
|
+
"@id": "hydra:isEditorOf",
|
36
|
+
"@type": "@id"
|
37
|
+
},
|
38
|
+
"isMemberOfCollection": {
|
39
|
+
"@id": "frels:isMemberOfCollection",
|
40
|
+
"@type": "@id"
|
41
|
+
},
|
42
|
+
"isPartOf": {
|
43
|
+
"@id": "frels:isPartOf",
|
44
|
+
"@type": "@id"
|
45
|
+
},
|
46
|
+
"mrel": "http://id.loc.gov/vocabulary/relators/",
|
47
|
+
"ms": "http://www.ndltd.org/standards/metadata/etdms/1.1/",
|
48
|
+
"nd": "https://library.nd.edu/ns/terms/",
|
49
|
+
"pav": "http://purl.org/pav/",
|
50
|
+
"previousVersion": "pav:previousVersion",
|
51
|
+
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
52
|
+
"und": "https://curatesvrpprd.library.nd.edu/show/",
|
53
|
+
"vracore": "http://purl.org/vra/"
|
54
|
+
},
|
55
|
+
"@graph": [
|
56
|
+
{
|
57
|
+
"@id": "_:b0",
|
58
|
+
"dc:contributor": "Dr. Spock",
|
59
|
+
"ms:role": "Committee Member"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"@id": "_:b1",
|
63
|
+
"dc:contributor": "Dr. Quinn",
|
64
|
+
"ms:role": "Committee Chair"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"@id": "_:b2",
|
68
|
+
"dc:contributor": "Dr. Zhivago",
|
69
|
+
"ms:role": "Committee Member"
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"@id": "_:b3",
|
73
|
+
"ms:discipline": "Civil Engineering and Geological Sciences",
|
74
|
+
"ms:level": "Master's Thesis",
|
75
|
+
"ms:name": "MSCE"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"@id": "und:z029p269r94",
|
79
|
+
"dc:contributor": [
|
80
|
+
{
|
81
|
+
"@id": "_:b0"
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"@id": "_:b1"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"@id": "_:b2"
|
88
|
+
}
|
89
|
+
],
|
90
|
+
"dc:creator": "Bob the Builder",
|
91
|
+
"dc:creator#administrative_unit": "University of Notre Dame::College of Engineering::Civil and Environmental Engineering and Earth Sciences::Civil Engineering",
|
92
|
+
"dc:date": "2006-03-24",
|
93
|
+
"dc:date#approved": "2011-01-04",
|
94
|
+
"dc:date#created": "2010-12-20",
|
95
|
+
"dc:dateSubmitted": "2006-04-01",
|
96
|
+
"dc:description#abstract": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
|
97
|
+
"dc:identifier#other": "etd-04012006-182810",
|
98
|
+
"dc:language": "English",
|
99
|
+
"dc:publisher": "University of Notre Dame",
|
100
|
+
"dc:publisher#country": "United States of America",
|
101
|
+
"dc:rights": "All rights reserved",
|
102
|
+
"dc:subject": [
|
103
|
+
"Structural health monitoring",
|
104
|
+
"multipath",
|
105
|
+
"GPS"
|
106
|
+
],
|
107
|
+
"dc:title": "Lorem Ipsum",
|
108
|
+
"hydra:hasEditor": {
|
109
|
+
"@id": "und:qb98mc9021z"
|
110
|
+
},
|
111
|
+
"hydra:hasEditorGroup": {
|
112
|
+
"@id": "und:q524jm23g92"
|
113
|
+
},
|
114
|
+
"mrel:ths": "Dr. Worm",
|
115
|
+
"ms:degree": {
|
116
|
+
"@id": "_:b3"
|
117
|
+
},
|
118
|
+
"nd:accessEdit": "curate_batch_user",
|
119
|
+
"nd:accessReadGroup": "public",
|
120
|
+
"nd:afmodel": "Etd",
|
121
|
+
"nd:depositor": "curate_batch_user",
|
122
|
+
"nd:representativeFile": {
|
123
|
+
"@id": "und:z603qv36b1d"
|
124
|
+
}
|
125
|
+
}
|
126
|
+
]
|
127
|
+
}
|
@@ -35,6 +35,7 @@ RSpec.describe ROF::Translators::FedoraToRof do
|
|
35
35
|
"dc"=>"http://purl.org/dc/terms/",
|
36
36
|
"ebucore"=>"http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#",
|
37
37
|
"foaf"=>"http://xmlns.com/foaf/0.1/",
|
38
|
+
"hydramata-rel"=>"http://projecthydra.org/ns/relations#",
|
38
39
|
'hydra' => 'http://projecthydra.org/ns/relations#',
|
39
40
|
"mrel"=>"http://id.loc.gov/vocabulary/relators/",
|
40
41
|
"ms" => 'http://www.ndltd.org/standards/metadata/etdms/1.1/',
|
@@ -17,6 +17,37 @@ module ROF
|
|
17
17
|
expect(output.first['rights'].fetch('embargo-date')).to eq("2016-11-16")
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
describe 'DLTP-1007 regression' do
|
22
|
+
it 'converts representative XML correctly' do
|
23
|
+
jsonld_from_curatend = JSON.load(File.read(File.join(GEM_ROOT, "spec/fixtures/DLTP-1007/remediated-z029p269r94.jsonld")))
|
24
|
+
output = described_class.call(jsonld_from_curatend, {})
|
25
|
+
expect(output.size).to eq(1)
|
26
|
+
properties = output.first.fetch('properties')
|
27
|
+
expect(properties).to include('<representative>und:z603qv36b1d</representative>')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '::REGEXP_FOR_A_CURATE_RDF_SUBJECT' do
|
32
|
+
it 'handles data as expected' do
|
33
|
+
[
|
34
|
+
["https://curate.nd.edu/downloads/abcd123", nil],
|
35
|
+
["http://curate.nd.edu/downloads/abcd123", nil],
|
36
|
+
["http://curatepprd.nd.edu/downloads/abcd123", nil],
|
37
|
+
["http://curatepprd.nd.edu/show/abcd123", "abcd123"],
|
38
|
+
["https://curatepprd.nd.edu/show/abcd123", "abcd123"],
|
39
|
+
["https://curatepprd.library.nd.edu/show/abcd123", "abcd123"],
|
40
|
+
["https://curate.nd.edu/show/abcd123", "abcd123"],
|
41
|
+
["http://curate.nd.edu/show/abcd123", "abcd123"],
|
42
|
+
["http://mycurate.nd.edu/show/abcd123", nil],
|
43
|
+
["http://curate.nd.edu/show/abcd123/extra", 'abcd123'],
|
44
|
+
].each do |input, expected|
|
45
|
+
input =~ described_class::REGEXP_FOR_A_CURATE_RDF_SUBJECT
|
46
|
+
expect($1).to eq(expected)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
20
51
|
describe '.call' do
|
21
52
|
[
|
22
53
|
'2j62s467216',
|
@@ -37,6 +37,7 @@ RSpec.describe ROF::Translators::OsfToRof do
|
|
37
37
|
"rels-ext"=> {"@context"=> {"@vocab"=>"info:fedora/fedora-system:def/relations-external#",
|
38
38
|
"fedora-model"=>"info:fedora/fedora-system:def/model#",
|
39
39
|
"pav"=>"http://purl.org/pav/",
|
40
|
+
"hydramata-rel"=>"http://projecthydra.org/ns/relations#",
|
40
41
|
"hydra"=>"http://projecthydra.org/ns/relations#",
|
41
42
|
"hasModel"=>{"@id"=>"fedora-model:hasModel", "@type"=>"@id"},
|
42
43
|
"hasEditor"=>{"@id"=>"hydra:hasEditor", "@type"=>"@id"},
|
@@ -52,6 +53,7 @@ RSpec.describe ROF::Translators::OsfToRof do
|
|
52
53
|
"dc"=>"http://purl.org/dc/terms/",
|
53
54
|
"ebucore"=>"http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#",
|
54
55
|
"foaf"=>"http://xmlns.com/foaf/0.1/",
|
56
|
+
"hydramata-rel"=>"http://projecthydra.org/ns/relations#",
|
55
57
|
'hydra' => 'http://projecthydra.org/ns/relations#',
|
56
58
|
"mrel"=>"http://id.loc.gov/vocabulary/relators/",
|
57
59
|
'ms' => 'http://www.ndltd.org/standards/metadata/etdms/1.1/',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Friesen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
@@ -409,6 +409,7 @@ files:
|
|
409
409
|
- lib/rof/version.rb
|
410
410
|
- rof.gemspec
|
411
411
|
- spec/coverage_helper.rb
|
412
|
+
- spec/fixtures/DLTP-1007/remediated-z029p269r94.jsonld
|
412
413
|
- spec/fixtures/DLTP-999/pr76f190f54.jsonld
|
413
414
|
- spec/fixtures/a.json
|
414
415
|
- spec/fixtures/for_utility_load_items_from_json_file/multiple_items.json
|
@@ -497,6 +498,7 @@ specification_version: 4
|
|
497
498
|
summary: Raw Object Format
|
498
499
|
test_files:
|
499
500
|
- spec/coverage_helper.rb
|
501
|
+
- spec/fixtures/DLTP-1007/remediated-z029p269r94.jsonld
|
500
502
|
- spec/fixtures/DLTP-999/pr76f190f54.jsonld
|
501
503
|
- spec/fixtures/a.json
|
502
504
|
- spec/fixtures/for_utility_load_items_from_json_file/multiple_items.json
|