rdf-rdfxml 2.2.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +3 -3
- data/VERSION +1 -1
- data/lib/rdf/rdfxml/reader.rb +4 -4
- data/lib/rdf/rdfxml/reader/nokogiri.rb +1 -1
- data/lib/rdf/rdfxml/reader/rexml.rb +1 -1
- data/lib/rdf/rdfxml/writer.rb +11 -11
- metadata +42 -105
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cbadda440064b5a3d6301cd100f9547c91d9c91f7ee2ceb8afe2ac129e260b2e
|
4
|
+
data.tar.gz: 0e50ce2dfa36ecff9559fc4995574512e1565cf2656744a85ba2280662331bc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90bec0d3cbf1dc4bf2b5cabca51552dcc4a7773658ff83dc107b49af1f25fa72314c08f1136ef7af39b8bf150f6733719cf7d853a0ed6b4ce1bf1444bfe61fec
|
7
|
+
data.tar.gz: 57ee2dad4d2fce9e7e123ea7a6d10479e0025fc5f712dbcba4c652ec88ae929d87caca1553b8c3dd35c1eba46cb409dc95af5fbd78fa81de977c6cffcbfaee85
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ Install with `gem install rdf-rdfxml`
|
|
18
18
|
|
19
19
|
* 100% free and unencumbered [public domain](http://unlicense.org/) software.
|
20
20
|
* Implements a complete parser for [RDF/XML][].
|
21
|
-
* Compatible with Ruby >= 2.
|
21
|
+
* Compatible with Ruby >= 2.4.
|
22
22
|
|
23
23
|
## Usage:
|
24
24
|
Instantiate a parser and parse source, specifying type and base-URL
|
@@ -40,8 +40,8 @@ Write a graph to a file:
|
|
40
40
|
end
|
41
41
|
|
42
42
|
## Dependencies
|
43
|
-
* [RDF.rb](http://rubygems.org/gems/rdf) (
|
44
|
-
* Soft dependency on [Nokogiri](http://rubygems.org/gems/nokogiri) (>= 1.
|
43
|
+
* [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.1)
|
44
|
+
* Soft dependency on [Nokogiri](http://rubygems.org/gems/nokogiri) (>= 1.10)
|
45
45
|
|
46
46
|
## Documentation
|
47
47
|
Full documentation available on [Rubydoc.info][RDF/XML doc])
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.1.0
|
data/lib/rdf/rdfxml/reader.rb
CHANGED
@@ -41,7 +41,7 @@ module RDF::RDFXML
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# Clone existing evaluation context adding information from element
|
44
|
-
def clone(element, options
|
44
|
+
def clone(element, **options, &cb)
|
45
45
|
new_ec = EvaluationContext.new(@base, nil, @graph)
|
46
46
|
new_ec.uri_mappings = self.uri_mappings.clone
|
47
47
|
new_ec.language = self.language
|
@@ -136,7 +136,7 @@ module RDF::RDFXML
|
|
136
136
|
# @yieldparam [RDF::Reader] reader
|
137
137
|
# @yieldreturn [void] ignored
|
138
138
|
# @raise [Error] Raises RDF::ReaderError if _validate_
|
139
|
-
def initialize(input = $stdin, options
|
139
|
+
def initialize(input = $stdin, **options, &block)
|
140
140
|
super do
|
141
141
|
@library = case options[:library]
|
142
142
|
when nil
|
@@ -156,7 +156,7 @@ module RDF::RDFXML
|
|
156
156
|
self.extend(@implementation)
|
157
157
|
|
158
158
|
input.rewind if input.respond_to?(:rewind)
|
159
|
-
initialize_xml(input, options) rescue log_fatal($!.message)
|
159
|
+
initialize_xml(input, **options) rescue log_fatal($!.message)
|
160
160
|
|
161
161
|
log_error("Empty document") if root.nil?
|
162
162
|
log_error("Synax errors") {doc_errors} if !doc_errors.empty?
|
@@ -427,7 +427,7 @@ module RDF::RDFXML
|
|
427
427
|
else
|
428
428
|
literal_opts[:language] = child_ec.language
|
429
429
|
end
|
430
|
-
literal = RDF::Literal.new(child.inner_text, literal_opts)
|
430
|
+
literal = RDF::Literal.new(child.inner_text, **literal_opts)
|
431
431
|
add_triple(child, subject, predicate, literal)
|
432
432
|
reify(id, child, subject, predicate, literal, ec) if id
|
433
433
|
elsif parseType == "Resource"
|
@@ -227,7 +227,7 @@ module RDF::RDFXML
|
|
227
227
|
#
|
228
228
|
# @param [Hash{Symbol => Object}] options
|
229
229
|
# @return [void]
|
230
|
-
def initialize_xml(input, options
|
230
|
+
def initialize_xml(input, **options)
|
231
231
|
require 'nokogiri' unless defined?(::Nokogiri)
|
232
232
|
@doc = case input
|
233
233
|
when ::Nokogiri::XML::Document
|
@@ -245,7 +245,7 @@ module RDF::RDFXML
|
|
245
245
|
#
|
246
246
|
# @param [Hash{Symbol => Object}] options
|
247
247
|
# @return [void]
|
248
|
-
def initialize_xml(input, options
|
248
|
+
def initialize_xml(input, **options)
|
249
249
|
require 'rexml/document' unless defined?(::REXML)
|
250
250
|
@doc = case input
|
251
251
|
when ::REXML::Document
|
data/lib/rdf/rdfxml/writer.rb
CHANGED
@@ -113,7 +113,7 @@ module RDF::RDFXML
|
|
113
113
|
# URI to use as @href for output stylesheet processing instruction.
|
114
114
|
# @yield [writer]
|
115
115
|
# @yieldparam [RDF::Writer] writer
|
116
|
-
def initialize(output = $stdout, options
|
116
|
+
def initialize(output = $stdout, **options, &block)
|
117
117
|
super
|
118
118
|
end
|
119
119
|
|
@@ -170,7 +170,7 @@ module RDF::RDFXML
|
|
170
170
|
# @return String
|
171
171
|
# The rendered document is returned as a string
|
172
172
|
# Return Haml template for document from `haml_template[:subject]`
|
173
|
-
def render_subject(subject, predicates, options
|
173
|
+
def render_subject(subject, predicates, **options, &block)
|
174
174
|
# extract those properties that can be rendered as attributes
|
175
175
|
attr_props = if [:untyped, :typed].include?(@attributes)
|
176
176
|
options[:property_values].inject({}) do |memo, (prop, values)|
|
@@ -189,7 +189,7 @@ module RDF::RDFXML
|
|
189
189
|
end
|
190
190
|
|
191
191
|
predicates -= attr_props.keys.map {|k| expand_curie(k).to_s}
|
192
|
-
super(subject, predicates, options.merge(attr_props: attr_props), &block)
|
192
|
+
super(subject, predicates, **options.merge(attr_props: attr_props), &block)
|
193
193
|
end
|
194
194
|
# See if we can serialize as attribute.
|
195
195
|
# * untyped attributes that aren't duplicated where xml:lang == @lang
|
@@ -228,8 +228,8 @@ module RDF::RDFXML
|
|
228
228
|
# @yieldreturn [:ignored]
|
229
229
|
# @return String
|
230
230
|
# The rendered document is returned as a string
|
231
|
-
def render_document(subjects, options
|
232
|
-
super(subjects, options.merge(stylesheet: @options[:stylesheet]), &block)
|
231
|
+
def render_document(subjects, **options, &block)
|
232
|
+
super(subjects, **options.merge(stylesheet: @options[:stylesheet]), &block)
|
233
233
|
end
|
234
234
|
|
235
235
|
# Render a single- or multi-valued predicate using `haml_template[:property_value]` or `haml_template[:property_values]`. Yields each object for optional rendering. The block should only render for recursive subject definitions (i.e., where the object is also a subject and is rendered underneath the first referencing subject).
|
@@ -256,7 +256,7 @@ module RDF::RDFXML
|
|
256
256
|
# The block should only return a string for recursive object definitions.
|
257
257
|
# @return String
|
258
258
|
# The rendered document is returned as a string
|
259
|
-
def render_property(predicate, objects, options
|
259
|
+
def render_property(predicate, objects, **options, &block)
|
260
260
|
log_debug {"render_property(#{predicate}): #{objects.inspect}, #{options.inspect}"}
|
261
261
|
# If there are multiple objects, and no :property_values is defined, call recursively with
|
262
262
|
# each object
|
@@ -280,7 +280,7 @@ module RDF::RDFXML
|
|
280
280
|
|
281
281
|
log_debug {"list: #{list.inspect} #{list.to_a}"}
|
282
282
|
log_depth do
|
283
|
-
render_collection(predicate, list, options) do |object|
|
283
|
+
render_collection(predicate, list, **options) do |object|
|
284
284
|
yield(object, true) if block_given?
|
285
285
|
end
|
286
286
|
end
|
@@ -290,7 +290,7 @@ module RDF::RDFXML
|
|
290
290
|
if objects.length > 1
|
291
291
|
# Render each property using property_value template
|
292
292
|
objects.map do |object|
|
293
|
-
log_depth {render_property(predicate, [object], options, &block)}
|
293
|
+
log_depth {render_property(predicate, [object], **options, &block)}
|
294
294
|
end.join(" ")
|
295
295
|
else
|
296
296
|
log_fatal("Missing property template", exception: RDF::WriterError) if template.nil?
|
@@ -301,7 +301,7 @@ module RDF::RDFXML
|
|
301
301
|
property: get_qname(predicate),
|
302
302
|
recurse: log_depth <= @max_depth
|
303
303
|
}.merge(options)
|
304
|
-
hamlify(template, options, &block)
|
304
|
+
hamlify(template, **options, &block)
|
305
305
|
end
|
306
306
|
end
|
307
307
|
|
@@ -319,7 +319,7 @@ module RDF::RDFXML
|
|
319
319
|
# The block should only return a string for recursive object definitions.
|
320
320
|
# @return String
|
321
321
|
# The rendered collection is returned as a string
|
322
|
-
def render_collection(predicate, list, options
|
322
|
+
def render_collection(predicate, list, **options, &block)
|
323
323
|
template = options[:haml] || haml_template[:collection]
|
324
324
|
|
325
325
|
options = {
|
@@ -328,7 +328,7 @@ module RDF::RDFXML
|
|
328
328
|
property: get_qname(predicate),
|
329
329
|
recurse: log_depth <= @max_depth,
|
330
330
|
}.merge(options)
|
331
|
-
hamlify(template, options) do |object|
|
331
|
+
hamlify(template, **options) do |object|
|
332
332
|
yield object
|
333
333
|
end
|
334
334
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-rdfxml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg
|
@@ -9,68 +9,50 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdf
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '2.2'
|
21
|
-
- - "<"
|
18
|
+
- - "~>"
|
22
19
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
20
|
+
version: '3.1'
|
24
21
|
type: :runtime
|
25
22
|
prerelease: false
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
27
24
|
requirements:
|
28
|
-
- - "
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: '2.2'
|
31
|
-
- - "<"
|
25
|
+
- - "~>"
|
32
26
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
27
|
+
version: '3.1'
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
|
-
name: rdf-
|
29
|
+
name: rdf-xsd
|
36
30
|
requirement: !ruby/object:Gem::Requirement
|
37
31
|
requirements:
|
38
|
-
- - "
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '2.2'
|
41
|
-
- - "<"
|
32
|
+
- - "~>"
|
42
33
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
34
|
+
version: '3.1'
|
44
35
|
type: :runtime
|
45
36
|
prerelease: false
|
46
37
|
version_requirements: !ruby/object:Gem::Requirement
|
47
38
|
requirements:
|
48
|
-
- - "
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: '2.2'
|
51
|
-
- - "<"
|
39
|
+
- - "~>"
|
52
40
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
41
|
+
version: '3.1'
|
54
42
|
- !ruby/object:Gem::Dependency
|
55
|
-
name: rdf-
|
43
|
+
name: rdf-rdfa
|
56
44
|
requirement: !ruby/object:Gem::Requirement
|
57
45
|
requirements:
|
58
|
-
- - "
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '2.2'
|
61
|
-
- - "<"
|
46
|
+
- - "~>"
|
62
47
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
48
|
+
version: '3.1'
|
64
49
|
type: :runtime
|
65
50
|
prerelease: false
|
66
51
|
version_requirements: !ruby/object:Gem::Requirement
|
67
52
|
requirements:
|
68
|
-
- - "
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '2.2'
|
71
|
-
- - "<"
|
53
|
+
- - "~>"
|
72
54
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
55
|
+
version: '3.1'
|
74
56
|
- !ruby/object:Gem::Dependency
|
75
57
|
name: htmlentities
|
76
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,162 +87,118 @@ dependencies:
|
|
105
87
|
- - ">="
|
106
88
|
- !ruby/object:Gem::Version
|
107
89
|
version: 0.0.5
|
108
|
-
- !ruby/object:Gem::Dependency
|
109
|
-
name: spira
|
110
|
-
requirement: !ruby/object:Gem::Requirement
|
111
|
-
requirements:
|
112
|
-
- - '='
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
version: 0.0.12
|
115
|
-
type: :development
|
116
|
-
prerelease: false
|
117
|
-
version_requirements: !ruby/object:Gem::Requirement
|
118
|
-
requirements:
|
119
|
-
- - '='
|
120
|
-
- !ruby/object:Gem::Version
|
121
|
-
version: 0.0.12
|
122
90
|
- !ruby/object:Gem::Dependency
|
123
91
|
name: json-ld
|
124
92
|
requirement: !ruby/object:Gem::Requirement
|
125
93
|
requirements:
|
126
94
|
- - ">="
|
127
95
|
- !ruby/object:Gem::Version
|
128
|
-
version: '
|
129
|
-
- - "<"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '4.0'
|
96
|
+
version: '3.1'
|
132
97
|
type: :development
|
133
98
|
prerelease: false
|
134
99
|
version_requirements: !ruby/object:Gem::Requirement
|
135
100
|
requirements:
|
136
101
|
- - ">="
|
137
102
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
139
|
-
- - "<"
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '4.0'
|
103
|
+
version: '3.1'
|
142
104
|
- !ruby/object:Gem::Dependency
|
143
105
|
name: rspec
|
144
106
|
requirement: !ruby/object:Gem::Requirement
|
145
107
|
requirements:
|
146
108
|
- - "~>"
|
147
109
|
- !ruby/object:Gem::Version
|
148
|
-
version: '3.
|
110
|
+
version: '3.9'
|
149
111
|
type: :development
|
150
112
|
prerelease: false
|
151
113
|
version_requirements: !ruby/object:Gem::Requirement
|
152
114
|
requirements:
|
153
115
|
- - "~>"
|
154
116
|
- !ruby/object:Gem::Version
|
155
|
-
version: '3.
|
117
|
+
version: '3.9'
|
156
118
|
- !ruby/object:Gem::Dependency
|
157
119
|
name: rspec-its
|
158
120
|
requirement: !ruby/object:Gem::Requirement
|
159
121
|
requirements:
|
160
122
|
- - "~>"
|
161
123
|
- !ruby/object:Gem::Version
|
162
|
-
version: '1.
|
124
|
+
version: '1.3'
|
163
125
|
type: :development
|
164
126
|
prerelease: false
|
165
127
|
version_requirements: !ruby/object:Gem::Requirement
|
166
128
|
requirements:
|
167
129
|
- - "~>"
|
168
130
|
- !ruby/object:Gem::Version
|
169
|
-
version: '1.
|
131
|
+
version: '1.3'
|
170
132
|
- !ruby/object:Gem::Dependency
|
171
133
|
name: rdf-isomorphic
|
172
134
|
requirement: !ruby/object:Gem::Requirement
|
173
135
|
requirements:
|
174
|
-
- - "
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
version: '2.2'
|
177
|
-
- - "<"
|
136
|
+
- - "~>"
|
178
137
|
- !ruby/object:Gem::Version
|
179
|
-
version: '
|
138
|
+
version: '3.1'
|
180
139
|
type: :development
|
181
140
|
prerelease: false
|
182
141
|
version_requirements: !ruby/object:Gem::Requirement
|
183
142
|
requirements:
|
184
|
-
- - "
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
version: '2.2'
|
187
|
-
- - "<"
|
143
|
+
- - "~>"
|
188
144
|
- !ruby/object:Gem::Version
|
189
|
-
version: '
|
145
|
+
version: '3.1'
|
190
146
|
- !ruby/object:Gem::Dependency
|
191
147
|
name: rdf-turtle
|
192
148
|
requirement: !ruby/object:Gem::Requirement
|
193
149
|
requirements:
|
194
|
-
- - "
|
195
|
-
- !ruby/object:Gem::Version
|
196
|
-
version: '2.2'
|
197
|
-
- - "<"
|
150
|
+
- - "~>"
|
198
151
|
- !ruby/object:Gem::Version
|
199
|
-
version: '
|
152
|
+
version: '3.1'
|
200
153
|
type: :development
|
201
154
|
prerelease: false
|
202
155
|
version_requirements: !ruby/object:Gem::Requirement
|
203
156
|
requirements:
|
204
|
-
- - "
|
205
|
-
- !ruby/object:Gem::Version
|
206
|
-
version: '2.2'
|
207
|
-
- - "<"
|
157
|
+
- - "~>"
|
208
158
|
- !ruby/object:Gem::Version
|
209
|
-
version: '
|
159
|
+
version: '3.1'
|
210
160
|
- !ruby/object:Gem::Dependency
|
211
161
|
name: rdf-spec
|
212
162
|
requirement: !ruby/object:Gem::Requirement
|
213
163
|
requirements:
|
214
|
-
- - "
|
215
|
-
- !ruby/object:Gem::Version
|
216
|
-
version: '2.2'
|
217
|
-
- - "<"
|
164
|
+
- - "~>"
|
218
165
|
- !ruby/object:Gem::Version
|
219
|
-
version: '
|
166
|
+
version: '3.1'
|
220
167
|
type: :development
|
221
168
|
prerelease: false
|
222
169
|
version_requirements: !ruby/object:Gem::Requirement
|
223
170
|
requirements:
|
224
|
-
- - "
|
225
|
-
- !ruby/object:Gem::Version
|
226
|
-
version: '2.2'
|
227
|
-
- - "<"
|
171
|
+
- - "~>"
|
228
172
|
- !ruby/object:Gem::Version
|
229
|
-
version: '
|
173
|
+
version: '3.1'
|
230
174
|
- !ruby/object:Gem::Dependency
|
231
175
|
name: rdf-vocab
|
232
176
|
requirement: !ruby/object:Gem::Requirement
|
233
177
|
requirements:
|
234
|
-
- - "
|
235
|
-
- !ruby/object:Gem::Version
|
236
|
-
version: '2.2'
|
237
|
-
- - "<"
|
178
|
+
- - "~>"
|
238
179
|
- !ruby/object:Gem::Version
|
239
|
-
version: '
|
180
|
+
version: '3.1'
|
240
181
|
type: :development
|
241
182
|
prerelease: false
|
242
183
|
version_requirements: !ruby/object:Gem::Requirement
|
243
184
|
requirements:
|
244
|
-
- - "
|
245
|
-
- !ruby/object:Gem::Version
|
246
|
-
version: '2.2'
|
247
|
-
- - "<"
|
185
|
+
- - "~>"
|
248
186
|
- !ruby/object:Gem::Version
|
249
|
-
version: '
|
187
|
+
version: '3.1'
|
250
188
|
- !ruby/object:Gem::Dependency
|
251
189
|
name: yard
|
252
190
|
requirement: !ruby/object:Gem::Requirement
|
253
191
|
requirements:
|
254
192
|
- - "~>"
|
255
193
|
- !ruby/object:Gem::Version
|
256
|
-
version:
|
194
|
+
version: 0.9.20
|
257
195
|
type: :development
|
258
196
|
prerelease: false
|
259
197
|
version_requirements: !ruby/object:Gem::Requirement
|
260
198
|
requirements:
|
261
199
|
- - "~>"
|
262
200
|
- !ruby/object:Gem::Version
|
263
|
-
version:
|
201
|
+
version: 0.9.20
|
264
202
|
description: RDF::RDFXML is an RDF/XML reader and writer for the RDF.rb library suite.
|
265
203
|
email: public-rdf-ruby@w3.org
|
266
204
|
executables: []
|
@@ -295,15 +233,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
295
233
|
requirements:
|
296
234
|
- - ">="
|
297
235
|
- !ruby/object:Gem::Version
|
298
|
-
version: 2.
|
236
|
+
version: '2.4'
|
299
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
300
238
|
requirements:
|
301
239
|
- - ">="
|
302
240
|
- !ruby/object:Gem::Version
|
303
241
|
version: '0'
|
304
242
|
requirements: []
|
305
|
-
|
306
|
-
rubygems_version: 2.6.14
|
243
|
+
rubygems_version: 3.0.6
|
307
244
|
signing_key:
|
308
245
|
specification_version: 4
|
309
246
|
summary: RDF/XML reader/writer for RDF.rb.
|