rdf-trig 1.1.3 → 1.1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/rdf/trig.rb +1 -1
  4. data/lib/rdf/trig/reader.rb +53 -29
  5. metadata +85 -73
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbc8f3b38a1aebcc071fc3adb8198ed8e13241c6
4
- data.tar.gz: 872c5fa83a48cf1ce4e9d9493a9e534c994a4554
3
+ metadata.gz: 44b0818c4a3c546d70bf8ce501a1c9b3cd9b8eda
4
+ data.tar.gz: a4eefda4e6adbde26a6035305a6faacd2aad5245
5
5
  SHA512:
6
- metadata.gz: d574184229ba499e3d8d45a77c332742d6e318c860d240be5f51f8ac0fba23c0134469fe4c6d7854dabebec96df4c63766ef0df5c4213e89accd1337e9b9914f
7
- data.tar.gz: ff7a5ca45a60eb6756d5203c3662122e9f5421824186c118f074f51ae082ac4acaafc43d097bb0284f4b64c446a7695e87928730f4aad39457564a29974626d0
6
+ metadata.gz: 069ffbde3d096e4373176d47b8c90c991684aead5bd00d61f1075ccf6c7139330c7a36676ad27e9cef35e040efa12ffeea46db32fd9c217942a7dcd43a345e33
7
+ data.tar.gz: 56bf24467ac25fa8b0ac6e6786280d36dbce870496eeb82d660622986a362a65c59538c105c582873f42a69c704dbaa4860c347ccca439a21320320e07b90e42
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.3
1
+ 1.1.3.1
data/lib/rdf/trig.rb CHANGED
@@ -3,7 +3,7 @@ require 'ebnf'
3
3
 
4
4
  module RDF
5
5
  ##
6
- # **`RDF::TriG`** is an TriG plugin for RDF.rb.
6
+ # **`RDF::TriG`** is an TriG extension for RDF.rb.
7
7
  #
8
8
  # @example Requiring the `RDF::TriG` module
9
9
  # require 'rdf/trig'
@@ -234,37 +234,40 @@ module RDF::TriG
234
234
  # @yieldparam [RDF::Statement] statement
235
235
  # @return [void]
236
236
  def each_statement(&block)
237
- @callback = block
237
+ if block_given?
238
+ @callback = block
238
239
 
239
- parse(@input, START.to_sym, @options.merge(:branch => BRANCH,
240
- :first => FIRST,
241
- :follow => FOLLOW,
242
- :reset_on_start => true)
243
- ) do |context, *data|
244
- case context
245
- when :context
246
- @context = data[1]
247
- when :statement
248
- data << @context if @context
249
- debug("each_statement") {"data: #{data.inspect}, context: #{@context.inspect}"}
250
- loc = data.shift
251
- s = RDF::Statement.from(data, :lineno => lineno)
252
- add_statement(loc, s) unless !s.valid? && validate?
253
- when :trace
254
- level, lineno, depth, *args = data
255
- message = "#{args.join(': ')}"
256
- d_str = depth > 100 ? ' ' * 100 + '+' : ' ' * depth
257
- str = "[#{lineno}](#{level})#{d_str}#{message}"
258
- case @options[:debug]
259
- when Array
260
- @options[:debug] << str
261
- when TrueClass
262
- $stderr.puts str
263
- when Integer
264
- $stderr.puts(str) if level <= @options[:debug]
240
+ parse(@input, START.to_sym, @options.merge(:branch => BRANCH,
241
+ :first => FIRST,
242
+ :follow => FOLLOW,
243
+ :reset_on_start => true)
244
+ ) do |context, *data|
245
+ case context
246
+ when :context
247
+ @context = data[1]
248
+ when :statement
249
+ data << @context if @context
250
+ debug("each_statement") {"data: #{data.inspect}, context: #{@context.inspect}"}
251
+ loc = data.shift
252
+ s = RDF::Statement.from(data, :lineno => lineno)
253
+ add_statement(loc, s) unless !s.valid? && validate?
254
+ when :trace
255
+ level, lineno, depth, *args = data
256
+ message = "#{args.join(': ')}"
257
+ d_str = depth > 100 ? ' ' * 100 + '+' : ' ' * depth
258
+ str = "[#{lineno}](#{level})#{d_str}#{message}"
259
+ case @options[:debug]
260
+ when Array
261
+ @options[:debug] << str
262
+ when TrueClass
263
+ $stderr.puts str
264
+ when Integer
265
+ $stderr.puts(str) if level <= @options[:debug]
266
+ end
265
267
  end
266
268
  end
267
269
  end
270
+ enum_for(:each_statement)
268
271
  rescue EBNF::LL1::Parser::Error, EBNF::LL1::Lexer::Error => e
269
272
  if validate?
270
273
  raise RDF::ReaderError, e.message
@@ -273,6 +276,24 @@ module RDF::TriG
273
276
  end
274
277
  end
275
278
 
279
+ ##
280
+ # Iterates the given block for each RDF quad in the input.
281
+ # This results in flattening each quad into a triple.
282
+ #
283
+ # @yield [subject, predicate, object]
284
+ # @yieldparam [RDF::Resource] subject
285
+ # @yieldparam [RDF::URI] predicate
286
+ # @yieldparam [RDF::Value] object
287
+ # @return [void]
288
+ def each_triple(&block)
289
+ if block_given?
290
+ each_statement do |statement|
291
+ block.call(*statement.to_triple)
292
+ end
293
+ end
294
+ enum_for(:each_quad)
295
+ end
296
+
276
297
  ##
277
298
  # Iterates the given block for each RDF quad in the input.
278
299
  #
@@ -283,9 +304,12 @@ module RDF::TriG
283
304
  # @yieldparam [RDF::URI] context
284
305
  # @return [void]
285
306
  def each_quad(&block)
286
- each_statement do |statement|
287
- block.call(*statement.to_quad)
307
+ if block_given?
308
+ each_statement do |statement|
309
+ block.call(*statement.to_quad)
310
+ end
288
311
  end
312
+ enum_for(:each_quad)
289
313
  end
290
314
  end # class Reader
291
315
  end # module RDF::Turtle
metadata CHANGED
@@ -1,167 +1,179 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-trig
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-13 00:00:00.000000000 Z
11
+ date: 2014-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
15
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.1'
20
- - - ">="
20
+ - - '>='
21
21
  - !ruby/object:Gem::Version
22
22
  version: 1.1.2.1
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: !ruby/object:Gem::Requirement
26
24
  requirements:
27
- - - "~>"
25
+ - - ~>
28
26
  - !ruby/object:Gem::Version
29
27
  version: '1.1'
30
- - - ">="
28
+ - - '>='
31
29
  - !ruby/object:Gem::Version
32
30
  version: 1.1.2.1
31
+ prerelease: false
32
+ type: :runtime
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: ebnf
35
- requirement: !ruby/object:Gem::Requirement
35
+ version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '0.3'
40
+ - - '>='
38
41
  - !ruby/object:Gem::Version
39
42
  version: 0.3.5
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
+ requirement: !ruby/object:Gem::Requirement
43
44
  requirements:
44
- - - ">="
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '0.3'
48
+ - - '>='
45
49
  - !ruby/object:Gem::Version
46
50
  version: 0.3.5
51
+ prerelease: false
52
+ type: :runtime
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: rdf-turtle
49
- requirement: !ruby/object:Gem::Requirement
55
+ version_requirements: !ruby/object:Gem::Requirement
50
56
  requirements:
51
- - - "~>"
57
+ - - ~>
52
58
  - !ruby/object:Gem::Version
53
59
  version: '1.1'
54
- - - ">="
60
+ - - '>='
55
61
  - !ruby/object:Gem::Version
56
62
  version: 1.1.3
57
- type: :runtime
58
- prerelease: false
59
- version_requirements: !ruby/object:Gem::Requirement
63
+ requirement: !ruby/object:Gem::Requirement
60
64
  requirements:
61
- - - "~>"
65
+ - - ~>
62
66
  - !ruby/object:Gem::Version
63
67
  version: '1.1'
64
- - - ">="
68
+ - - '>='
65
69
  - !ruby/object:Gem::Version
66
70
  version: 1.1.3
71
+ prerelease: false
72
+ type: :runtime
67
73
  - !ruby/object:Gem::Dependency
68
74
  name: open-uri-cached
69
- requirement: !ruby/object:Gem::Requirement
75
+ version_requirements: !ruby/object:Gem::Requirement
70
76
  requirements:
71
- - - ">="
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: '0.0'
80
+ - - '>='
72
81
  - !ruby/object:Gem::Version
73
82
  version: 0.0.5
74
- type: :development
75
- prerelease: false
76
- version_requirements: !ruby/object:Gem::Requirement
83
+ requirement: !ruby/object:Gem::Requirement
77
84
  requirements:
78
- - - ">="
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: '0.0'
88
+ - - '>='
79
89
  - !ruby/object:Gem::Version
80
90
  version: 0.0.5
91
+ prerelease: false
92
+ type: :development
81
93
  - !ruby/object:Gem::Dependency
82
94
  name: json-ld
83
- requirement: !ruby/object:Gem::Requirement
95
+ version_requirements: !ruby/object:Gem::Requirement
84
96
  requirements:
85
- - - "~>"
97
+ - - ~>
86
98
  - !ruby/object:Gem::Version
87
99
  version: '1.1'
88
- type: :development
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
100
+ requirement: !ruby/object:Gem::Requirement
91
101
  requirements:
92
- - - "~>"
102
+ - - ~>
93
103
  - !ruby/object:Gem::Version
94
104
  version: '1.1'
105
+ prerelease: false
106
+ type: :development
95
107
  - !ruby/object:Gem::Dependency
96
108
  name: rspec
97
- requirement: !ruby/object:Gem::Requirement
109
+ version_requirements: !ruby/object:Gem::Requirement
98
110
  requirements:
99
- - - "~>"
111
+ - - ~>
100
112
  - !ruby/object:Gem::Version
101
113
  version: '2.14'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
114
+ requirement: !ruby/object:Gem::Requirement
105
115
  requirements:
106
- - - "~>"
116
+ - - ~>
107
117
  - !ruby/object:Gem::Version
108
118
  version: '2.14'
119
+ prerelease: false
120
+ type: :development
109
121
  - !ruby/object:Gem::Dependency
110
122
  name: rdf-isomorphic
111
- requirement: !ruby/object:Gem::Requirement
123
+ version_requirements: !ruby/object:Gem::Requirement
112
124
  requirements:
113
- - - "~>"
125
+ - - ~>
114
126
  - !ruby/object:Gem::Version
115
127
  version: '1.1'
116
- type: :development
117
- prerelease: false
118
- version_requirements: !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
119
129
  requirements:
120
- - - "~>"
130
+ - - ~>
121
131
  - !ruby/object:Gem::Version
122
132
  version: '1.1'
133
+ prerelease: false
134
+ type: :development
123
135
  - !ruby/object:Gem::Dependency
124
136
  name: yard
125
- requirement: !ruby/object:Gem::Requirement
137
+ version_requirements: !ruby/object:Gem::Requirement
126
138
  requirements:
127
- - - ">="
139
+ - - ~>
128
140
  - !ruby/object:Gem::Version
129
- version: 0.8.7
130
- type: :development
131
- prerelease: false
132
- version_requirements: !ruby/object:Gem::Requirement
141
+ version: '0.8'
142
+ requirement: !ruby/object:Gem::Requirement
133
143
  requirements:
134
- - - ">="
144
+ - - ~>
135
145
  - !ruby/object:Gem::Version
136
- version: 0.8.7
146
+ version: '0.8'
147
+ prerelease: false
148
+ type: :development
137
149
  - !ruby/object:Gem::Dependency
138
150
  name: rdf-spec
139
- requirement: !ruby/object:Gem::Requirement
151
+ version_requirements: !ruby/object:Gem::Requirement
140
152
  requirements:
141
- - - "~>"
153
+ - - ~>
142
154
  - !ruby/object:Gem::Version
143
155
  version: '1.1'
144
- type: :development
145
- prerelease: false
146
- version_requirements: !ruby/object:Gem::Requirement
156
+ requirement: !ruby/object:Gem::Requirement
147
157
  requirements:
148
- - - "~>"
158
+ - - ~>
149
159
  - !ruby/object:Gem::Version
150
160
  version: '1.1'
161
+ prerelease: false
162
+ type: :development
151
163
  - !ruby/object:Gem::Dependency
152
164
  name: rake
153
- requirement: !ruby/object:Gem::Requirement
165
+ version_requirements: !ruby/object:Gem::Requirement
154
166
  requirements:
155
- - - ">="
167
+ - - '>='
156
168
  - !ruby/object:Gem::Version
157
169
  version: '0'
158
- type: :development
159
- prerelease: false
160
- version_requirements: !ruby/object:Gem::Requirement
170
+ requirement: !ruby/object:Gem::Requirement
161
171
  requirements:
162
- - - ">="
172
+ - - '>='
163
173
  - !ruby/object:Gem::Version
164
174
  version: '0'
175
+ prerelease: false
176
+ type: :development
165
177
  description: RDF::TriG is an TriG reader/writer for the RDF.rb library suite.
166
178
  email: public-rdf-ruby@w3.org
167
179
  executables: []
@@ -184,24 +196,24 @@ homepage: http://ruby-rdf.github.com/rdf-trig
184
196
  licenses:
185
197
  - Public Domain
186
198
  metadata: {}
187
- post_install_message:
199
+ post_install_message:
188
200
  rdoc_options: []
189
201
  require_paths:
190
202
  - lib
191
203
  required_ruby_version: !ruby/object:Gem::Requirement
192
204
  requirements:
193
- - - ">="
205
+ - - '>='
194
206
  - !ruby/object:Gem::Version
195
207
  version: 1.9.2
196
208
  required_rubygems_version: !ruby/object:Gem::Requirement
197
209
  requirements:
198
- - - ">="
210
+ - - '>='
199
211
  - !ruby/object:Gem::Version
200
212
  version: '0'
201
213
  requirements: []
202
214
  rubyforge_project: rdf-trig
203
215
  rubygems_version: 2.2.2
204
- signing_key:
216
+ signing_key:
205
217
  specification_version: 4
206
218
  summary: TriG reader/writer for Ruby.
207
219
  test_files: []