rof 1.2.8 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rof/translators/jsonld_to_rof.rb +1 -1
- data/lib/rof/translators/jsonld_to_rof/accumulator.rb +29 -1
- data/lib/rof/translators/jsonld_to_rof/predicate_handler.rb +13 -1
- data/lib/rof/version.rb +1 -1
- data/spec/fixtures/DLTP-1021/dltp-1021-document.jsonld +112 -0
- data/spec/fixtures/DLTP-1021/dltp-1021-etd.jsonld +128 -0
- data/spec/lib/rof/translators/jsonld_to_rof/predicate_handler_spec.rb +21 -3
- data/spec/lib/rof/translators/jsonld_to_rof_spec.rb +27 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c1e0d21b13c377bc1616d8435137e09b52cdfd3
|
4
|
+
data.tar.gz: c8d80575b3ef8762150b0536f28ad2308853ee9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e36246f49bf5de267b038b11226d87d04d61947991a4e8a1d86d606a59e86a506d78ef56513f9fdf06d616dc39c5f1fd29fdd19b4200e336e4cf92f926bed86
|
7
|
+
data.tar.gz: e8fbc5e613f51199716a490f002cbaac8fc51c5abfd33d7146edbf771dfb1dcab8f19ec8453c4ba303e1cbb09d7c18c919dde5c9e5989e0eb009669d2289d051
|
@@ -8,7 +8,7 @@ module ROF
|
|
8
8
|
module Translators
|
9
9
|
# @api public
|
10
10
|
#
|
11
|
-
# Responsible for converting JSON LD into an ROF Hash
|
11
|
+
# Responsible for converting JSON LD into an ROF Hash through the `.call` method (using the URI maps defined by the `.register` method)
|
12
12
|
#
|
13
13
|
# @note Some predicates require explicit mapping where as others have an assumed mapping. At present all URLs for @context of JSON-LD documents must be registered.
|
14
14
|
#
|
@@ -9,6 +9,7 @@ module ROF
|
|
9
9
|
# The accumulator is a "passive" object. Things happen to it. All in the name of building the
|
10
10
|
# hash that is ROF.
|
11
11
|
#
|
12
|
+
# @note The #to_rof will convert blank nodes to arrays of strings for objects that don't have blank node dc:contributor.
|
12
13
|
# @note The accumulator is only for one PID. See [ROF::Translators::JsonldToRof::Accumulator#add_pid]
|
13
14
|
class Accumulator
|
14
15
|
# @param [Hash] initial_rof - The base ROF document to which we will be adding elements.
|
@@ -22,7 +23,8 @@ module ROF
|
|
22
23
|
# @return [Hash]
|
23
24
|
def to_rof
|
24
25
|
rof = @rof.deep_dup
|
25
|
-
expand_blank_node_locations!(rof)
|
26
|
+
rof = expand_blank_node_locations!(rof)
|
27
|
+
rof = normalize_contributor!(rof)
|
26
28
|
rof = append_properties_to(rof)
|
27
29
|
rof
|
28
30
|
end
|
@@ -56,6 +58,32 @@ module ROF
|
|
56
58
|
data[slug] << hash if slug
|
57
59
|
end
|
58
60
|
end
|
61
|
+
rof
|
62
|
+
end
|
63
|
+
|
64
|
+
MODELS_THAT_HAVE_DC_CONTRIBUTOR_BLANK_NODES = ['etd'].freeze
|
65
|
+
|
66
|
+
# Convert dc:contributor from blank node to array for non-ETDs - DLTP1021
|
67
|
+
# The implementation that was developed started from the perspective that
|
68
|
+
# the dc:contributor was always a blank node (as implemented in ETDs).
|
69
|
+
# However that is not the case.
|
70
|
+
def normalize_contributor!(rof)
|
71
|
+
return rof unless rof.key?('af-model')
|
72
|
+
return rof unless rof.fetch('metadata', {}).key?('dc:contributor')
|
73
|
+
return rof if MODELS_THAT_HAVE_DC_CONTRIBUTOR_BLANK_NODES.include?(rof['af-model'].first.downcase)
|
74
|
+
contributors = []
|
75
|
+
Array.wrap(rof['metadata']['dc:contributor']).each do |contributor|
|
76
|
+
case contributor
|
77
|
+
when String
|
78
|
+
contributors << contributor
|
79
|
+
when Hash
|
80
|
+
contributors += Array.wrap(contributor.fetch('dc:contributor'))
|
81
|
+
else
|
82
|
+
raise "Unexpected rof['metadata']['contributor'] value #{contributor.inspect}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
rof['metadata']['dc:contributor']= contributors
|
86
|
+
rof
|
59
87
|
end
|
60
88
|
|
61
89
|
def append_properties_to(rof)
|
@@ -20,6 +20,9 @@ module ROF
|
|
20
20
|
#
|
21
21
|
# Parse the RDF predicate and RDF object and add it's contents to the accumulator
|
22
22
|
#
|
23
|
+
# @see ./spec/lib/rof/translators/jsonld_to_rof/predicate_handler_spec.rb for details and usage usage
|
24
|
+
# @see ROF::Translators::JsonldToRof::PredicateHandler.register for setup
|
25
|
+
#
|
23
26
|
# @example
|
24
27
|
# Given the following 4 RDF N-Triples (subject, predicate, object). The first two, with subject "_:b0" represent blank nodes.
|
25
28
|
# The last one with subject "<https://curate.nd.edu/show/zk51vd69n1r>" has an object that points to the "_:b0" blank node.
|
@@ -46,6 +49,8 @@ module ROF
|
|
46
49
|
#
|
47
50
|
# Register a map of an RDF Predicate URL to it's spot in the ROF Hash.
|
48
51
|
#
|
52
|
+
# @see ROF::Translators::JsonldToRof::PredicateHandler.call for usage
|
53
|
+
#
|
49
54
|
# @param [String] url - The URL that we want to match against
|
50
55
|
# @yield The block to configure how we handle RDF Predicates that match the gvien URL
|
51
56
|
# @yieldparam [ROF::JsonldToRof::PredicateHandler::UrlHandler]
|
@@ -65,6 +70,8 @@ module ROF
|
|
65
70
|
end
|
66
71
|
private_class_method :clear_registry!
|
67
72
|
|
73
|
+
# @api private
|
74
|
+
# Responsible for capturing each of the predicate namespaces URLs that we are handling
|
68
75
|
class RegistrySet
|
69
76
|
def initialize
|
70
77
|
@set = []
|
@@ -86,6 +93,7 @@ module ROF
|
|
86
93
|
end
|
87
94
|
private_constant :RegistrySet
|
88
95
|
|
96
|
+
# @api private
|
89
97
|
# For a given URL map all of the predicates; Some predicates require explicit mapping, while others
|
90
98
|
# may use implicit mapping.
|
91
99
|
class UrlHandler
|
@@ -156,7 +164,8 @@ module ROF
|
|
156
164
|
end
|
157
165
|
end
|
158
166
|
|
159
|
-
#
|
167
|
+
# @api private
|
168
|
+
# Responsible for coordinating the extraction of the location
|
160
169
|
class LocationExtractor
|
161
170
|
def initialize(predicate, handlers)
|
162
171
|
@predicate = predicate
|
@@ -172,6 +181,7 @@ module ROF
|
|
172
181
|
end
|
173
182
|
private_constant :LocationExtractor
|
174
183
|
|
184
|
+
# @api private
|
175
185
|
class ImplicitLocationHandler
|
176
186
|
def initialize(url_handler, slug)
|
177
187
|
@url_handler = url_handler
|
@@ -186,6 +196,7 @@ module ROF
|
|
186
196
|
end
|
187
197
|
private_constant :ImplicitLocationHandler
|
188
198
|
|
199
|
+
# @api private
|
189
200
|
class BlockSlugHandler
|
190
201
|
def initialize(url_handler, slug, options, block)
|
191
202
|
@url_handler = url_handler
|
@@ -202,6 +213,7 @@ module ROF
|
|
202
213
|
end
|
203
214
|
private_constant :BlockSlugHandler
|
204
215
|
|
216
|
+
# @api private
|
205
217
|
class ExplicitLocationSlugHandler
|
206
218
|
def initialize(url_handler, slug, options)
|
207
219
|
@url_handler = url_handler
|
data/lib/rof/version.rb
CHANGED
@@ -0,0 +1,112 @@
|
|
1
|
+
{
|
2
|
+
"@context": {
|
3
|
+
"und": "https://curatesvrpprd.library.nd.edu/show/",
|
4
|
+
"bibo": "http://purl.org/ontology/bibo/",
|
5
|
+
"dc": "http://purl.org/dc/terms/",
|
6
|
+
"ebucore": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#",
|
7
|
+
"foaf": "http://xmlns.com/foaf/0.1/",
|
8
|
+
"mrel": "http://id.loc.gov/vocabulary/relators/",
|
9
|
+
"nd": "https://library.nd.edu/ns/terms/",
|
10
|
+
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
11
|
+
"vracore": "http://purl.org/vra/",
|
12
|
+
"frels": "info:fedora/fedora-system:def/relations-external#",
|
13
|
+
"ms": "http://www.ndltd.org/standards/metadata/etdms/1.1/",
|
14
|
+
"pav": "http://purl.org/pav/",
|
15
|
+
"fedora-model": "info:fedora/fedora-system:def/model#",
|
16
|
+
"hydra": "http://projecthydra.org/ns/relations#",
|
17
|
+
"hasModel": {
|
18
|
+
"@id": "fedora-model:hasModel",
|
19
|
+
"@type": "@id"
|
20
|
+
},
|
21
|
+
"hasEditor": {
|
22
|
+
"@id": "hydra:hasEditor",
|
23
|
+
"@type": "@id"
|
24
|
+
},
|
25
|
+
"hasEditorGroup": {
|
26
|
+
"@id": "hydra:hasEditorGroup",
|
27
|
+
"@type": "@id"
|
28
|
+
},
|
29
|
+
"hasViewer": {
|
30
|
+
"@id": "hydra:hasViewer",
|
31
|
+
"@type": "@id"
|
32
|
+
},
|
33
|
+
"hasViewerGroup": {
|
34
|
+
"@id": "hydra:hasViewerGroup",
|
35
|
+
"@type": "@id"
|
36
|
+
},
|
37
|
+
"isPartOf": {
|
38
|
+
"@id": "frels:isPartOf",
|
39
|
+
"@type": "@id"
|
40
|
+
},
|
41
|
+
"isMemberOfCollection": {
|
42
|
+
"@id": "frels:isMemberOfCollection",
|
43
|
+
"@type": "@id"
|
44
|
+
},
|
45
|
+
"isEditorOf": {
|
46
|
+
"@id": "hydra:isEditorOf",
|
47
|
+
"@type": "@id"
|
48
|
+
},
|
49
|
+
"hasMember": {
|
50
|
+
"@id": "frels:hasMember",
|
51
|
+
"@type": "@id"
|
52
|
+
},
|
53
|
+
"previousVersion": "pav:previousVersion"
|
54
|
+
},
|
55
|
+
"@graph":
|
56
|
+
{
|
57
|
+
"@id": "und:h989r21070t",
|
58
|
+
"dc:abstract": "_Barrio Boy_ is the remarkable story of one boy's journey from a Mexican village so small its main street didn't have a name, to the barrio of Sacramento, California, bustling and thriving in the early decades of the twentieth century. With vivid imagery and a rare gift for re-creating a child's sense of time and place, Ernesto Galarza gives an account of the early experiences of his extraordinary life—from revolution in Mexico to segregation in the United States—that will continue to delight readers for generations to come. Since it was first published in 1971, Galarza's classic work has been assigned in high school and undergraduate classrooms across the country, profoundly affecting thousands of students who read this true story of acculturation into American life. To celebrate the 40th anniversary of the publication of Barrio Boy, the University of Notre Dame Press is proud to reissue this best-selling book with a new text design and cover, as well an introduction—by Ilan Stavans, the distinguished cultural critic and editor of the Norton Anthology of Latino Literature—which places Ernesto Galarza and Barrio Boy in historical context.\n\n© University of Notre Dame\n\nCopyright for all content is held by The University of Notre Dame. Reproduction of all or any portion of content constitutes a violation of copyright. You must obtain permission from The University of Notre Dame Press in order to reprint (or adapt) content. p: (574) 631-6346 / e: undpress@nd.edu",
|
59
|
+
"dc:alternative": "Barrio Boy",
|
60
|
+
"dc:contributor": ["Ilan Stavans"],
|
61
|
+
"dc:created": {
|
62
|
+
"@value": "2014-04-30",
|
63
|
+
"@type": "http://www.w3.org/2001/XMLSchema#date"
|
64
|
+
},
|
65
|
+
"dc:creator#administrative_unit": "University of Notre Dame::University of Notre Dame Press",
|
66
|
+
"dc:creator#author": "Ernesto Galarza",
|
67
|
+
"dc:dateSubmitted": {
|
68
|
+
"@value": "2017-03-24Z",
|
69
|
+
"@type": "http://www.w3.org/2001/XMLSchema#date"
|
70
|
+
},
|
71
|
+
"dc:extent": "336 pages",
|
72
|
+
"dc:identifier#isbn": "9780268158613",
|
73
|
+
"dc:issued": "2014-04-30",
|
74
|
+
"dc:modified": {
|
75
|
+
"@value": "2017-05-24Z",
|
76
|
+
"@type": "http://www.w3.org/2001/XMLSchema#date"
|
77
|
+
},
|
78
|
+
"dc:publisher": "University of Notre Dame Press",
|
79
|
+
"dc:source": "http://undpress.nd.edu/books/P01458",
|
80
|
+
"dc:subject": [
|
81
|
+
"Immigration",
|
82
|
+
"Mexico",
|
83
|
+
"Ethnic Studies",
|
84
|
+
"U.S.",
|
85
|
+
"Social Science"
|
86
|
+
],
|
87
|
+
"dc:subject#lcsh": [
|
88
|
+
"Sacramento (Calif)--Biography",
|
89
|
+
"Immigrants--United States--Biography",
|
90
|
+
"Mexican American neighborhoods--California--Sacramento--History--20th century",
|
91
|
+
"Mexican Americans--Biography",
|
92
|
+
"Mexican Americans--Social life and customs--20th century",
|
93
|
+
"Sacramento (Calif)--Social life and customs--20th century",
|
94
|
+
"Nayarit (Mexico)--Biography"
|
95
|
+
],
|
96
|
+
"dc:title": "Barrio Boy: 40th Anniversary Edition",
|
97
|
+
"dc:type": "Book Chapter",
|
98
|
+
"frels:isMemberOfCollection": {
|
99
|
+
"@id": "und:3f462516q01"
|
100
|
+
},
|
101
|
+
"nd:accessEdit": "rtillman",
|
102
|
+
"nd:accessReadGroup": "public",
|
103
|
+
"nd:afmodel": "Document",
|
104
|
+
"nd:alephIdentifier": "002699482",
|
105
|
+
"nd:bendoitem": "h415p843n84",
|
106
|
+
"nd:depositor": "batch_ingest",
|
107
|
+
"nd:owner": "rtillman",
|
108
|
+
"nd:representativeFile": {
|
109
|
+
"@id": "und:hd76rx93h18"
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
@@ -0,0 +1,128 @@
|
|
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:bendoItem": "bendo1234",
|
119
|
+
"nd:accessEdit": "curate_batch_user",
|
120
|
+
"nd:accessReadGroup": "public",
|
121
|
+
"nd:afmodel": "Etd",
|
122
|
+
"nd:depositor": "curate_batch_user",
|
123
|
+
"nd:representativeFile": {
|
124
|
+
"@id": "und:z603qv36b1d"
|
125
|
+
}
|
126
|
+
}
|
127
|
+
]
|
128
|
+
}
|
@@ -15,18 +15,27 @@ module ROF
|
|
15
15
|
end
|
16
16
|
described_class.register('http://purl.org/dc/terms/') do |handler|
|
17
17
|
handler.namespace_prefix('dc:')
|
18
|
-
handler.map('dateTime', to: ['nested', 'dateTime'])
|
19
18
|
handler.within(['metadata'])
|
19
|
+
|
20
|
+
handler.map('dateTime', to: ['nested', 'dateTime'])
|
20
21
|
end
|
21
22
|
described_class.register('http://www.ndltd.org/standards/metadata/etdms/1.1/') do |handler|
|
22
|
-
handler.within(['ms:degree'])
|
23
23
|
handler.namespace_prefix('ms:')
|
24
|
+
handler.within(['ms:degree'])
|
25
|
+
|
24
26
|
handler.map('block-key') do |object, accumulator|
|
25
27
|
accumulator.add_predicate_location_and_value('from-block', object)
|
26
28
|
end
|
27
29
|
handler.map('something', to: ['metadata', 'ms:something'], force: true)
|
28
30
|
handler.map('something', to: ['another', 'somewhere'])
|
29
31
|
end
|
32
|
+
described_class.register('https://jedi.com/') do |handler|
|
33
|
+
handler.namespace_prefix('jedi:')
|
34
|
+
handler.within(['jedi:rank', 'lucas:meta'])
|
35
|
+
|
36
|
+
handler.map('knight', to: ['metadata', 'a-knight'], force: true)
|
37
|
+
handler.map('savant', to: ['metadata'])
|
38
|
+
end
|
30
39
|
spec.run
|
31
40
|
|
32
41
|
described_class.send(:clear_registry!, previous_registry)
|
@@ -44,11 +53,20 @@ module ROF
|
|
44
53
|
})
|
45
54
|
end
|
46
55
|
|
47
|
-
it 'handles
|
56
|
+
it 'handles option without namespace' do
|
48
57
|
described_class.call('https://library.nd.edu/ns/terms/accessRead', object, accumulator)
|
49
58
|
expect(accumulator.to_rof).to eq({ "rights" => { "read" => ["my-object"] } })
|
50
59
|
end
|
51
60
|
|
61
|
+
it 'handles force option by disregarding the prefix and within imperative' do
|
62
|
+
described_class.call('https://jedi.com/knight', 'the-knight', accumulator)
|
63
|
+
described_class.call('https://jedi.com/savant', 'the-savant', accumulator)
|
64
|
+
expect(accumulator.to_rof).to eq({
|
65
|
+
"jedi:rank" => { "lucas:meta" => { "jedi:metadata" => ['the-savant'] } },
|
66
|
+
"metadata" => { "a-knight" => ["the-knight"] }
|
67
|
+
})
|
68
|
+
end
|
69
|
+
|
52
70
|
it 'handles the block option' do
|
53
71
|
described_class.call('http://www.ndltd.org/standards/metadata/etdms/1.1/block-key', 'value' , accumulator)
|
54
72
|
expect(accumulator.to_rof).to eq({ "from-block" => ["value"] })
|
@@ -41,6 +41,33 @@ module ROF
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
+
describe 'DLTP-1021 regression verification' do
|
45
|
+
context 'for non-ETDs' do
|
46
|
+
it 'does not have blank nodes for dc:contributor' do
|
47
|
+
jsonld_from_curatend = JSON.load(File.read(File.join(GEM_ROOT, "spec/fixtures/DLTP-1021/dltp-1021-document.jsonld")))
|
48
|
+
expect(jsonld_from_curatend["@graph"]["nd:afmodel"]).to eq('Document')
|
49
|
+
output = described_class.call(jsonld_from_curatend, {})
|
50
|
+
expect(output.size).to eq(1)
|
51
|
+
object = output.first
|
52
|
+
expect(object.fetch('metadata').fetch('dc:contributor')).to eq(['Ilan Stavans'])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
context 'for ETDs' do
|
56
|
+
it 'keeps the blank nodes for dc:contributor' do
|
57
|
+
jsonld_from_curatend = JSON.load(File.read(File.join(GEM_ROOT, "spec/fixtures/DLTP-1021/dltp-1021-etd.jsonld")))
|
58
|
+
expect(jsonld_from_curatend["@graph"].last['nd:afmodel']).to eq('Etd')
|
59
|
+
output = described_class.call(jsonld_from_curatend, {})
|
60
|
+
expect(output.size).to eq(1)
|
61
|
+
object = output.first
|
62
|
+
expect(object.fetch('metadata').fetch('dc:contributor')).to eq([
|
63
|
+
{ "dc:contributor" => ["Dr. Spock"], "ms:role" => ["Committee Member"] },
|
64
|
+
{ "dc:contributor" => ["Dr. Quinn"], "ms:role" => ["Committee Chair"] },
|
65
|
+
{ "dc:contributor" => ["Dr. Zhivago"], "ms:role" => ["Committee Member"] }
|
66
|
+
])
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
44
71
|
describe '::REGEXP_FOR_A_CURATE_RDF_SUBJECT' do
|
45
72
|
it 'handles data as expected' do
|
46
73
|
[
|
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.9
|
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-
|
11
|
+
date: 2017-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
@@ -411,6 +411,8 @@ files:
|
|
411
411
|
- spec/coverage_helper.rb
|
412
412
|
- spec/fixtures/DLTP-1007/remediated-z029p269r94.jsonld
|
413
413
|
- spec/fixtures/DLTP-1015/dltp1015.jsonld
|
414
|
+
- spec/fixtures/DLTP-1021/dltp-1021-document.jsonld
|
415
|
+
- spec/fixtures/DLTP-1021/dltp-1021-etd.jsonld
|
414
416
|
- spec/fixtures/DLTP-999/pr76f190f54.jsonld
|
415
417
|
- spec/fixtures/a.json
|
416
418
|
- spec/fixtures/for_utility_load_items_from_json_file/multiple_items.json
|
@@ -501,6 +503,8 @@ test_files:
|
|
501
503
|
- spec/coverage_helper.rb
|
502
504
|
- spec/fixtures/DLTP-1007/remediated-z029p269r94.jsonld
|
503
505
|
- spec/fixtures/DLTP-1015/dltp1015.jsonld
|
506
|
+
- spec/fixtures/DLTP-1021/dltp-1021-document.jsonld
|
507
|
+
- spec/fixtures/DLTP-1021/dltp-1021-etd.jsonld
|
504
508
|
- spec/fixtures/DLTP-999/pr76f190f54.jsonld
|
505
509
|
- spec/fixtures/a.json
|
506
510
|
- spec/fixtures/for_utility_load_items_from_json_file/multiple_items.json
|