rdf-rdfxml 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -1,7 +1,10 @@
1
- # RDF::RDFXML reader/writer [![Build Status](https://secure.travis-ci.org/ruby-rdf/rdf-rdfxml.png?branch=master)](http://travis-ci.org/ruby-rdf/rdf-rdfxml)
1
+ # RDF::RDFXML reader/writer
2
2
 
3
3
  [RDF/XML][RDF/XML] parser for [RDF.rb][RDF.rb].
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/rdf-rdfxml.png)](http://badge.fury.io/rb/rdf-rdfxml)
6
+ [![Build Status](https://secure.travis-ci.org/ruby-rdf/rdf-rdfxml.png?branch=master)](http://travis-ci.org/ruby-rdf/rdf-rdfxml)
7
+
5
8
  ## DESCRIPTION
6
9
 
7
10
  RDF::RDFXML is an [RDF/XML][RDF/XML] reader/writer for Ruby using the [RDF.rb][RDF.rb] library suite.
@@ -24,7 +27,7 @@ Instantiate a parser and parse source, specifying type and base-URL
24
27
 
25
28
  ## Dependencies
26
29
  * [RDF.rb](http://rubygems.org/gems/rdf) (>= 1.0)
27
- * Soft dependency on [Nokogiri](http://rubygems.org/gems/nokogiri) (>= 1.5.0)
30
+ * Soft dependency on [Nokogiri](http://rubygems.org/gems/nokogiri) (>= 1.5.9)
28
31
  * Does not run properly on jRuby due to [Nokogiri][] issues.
29
32
 
30
33
  ## Documentation
@@ -41,7 +44,7 @@ Full documentation available on [RubyForge](http://rubydoc.info/github/ruby-rdf/
41
44
 
42
45
  ### Patches
43
46
  * {Array}
44
- * {RDF::Graph}
47
+ * {RDF::Queryable}
45
48
  * {Nokogiri::XML::Node}
46
49
 
47
50
  ## TODO
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -1,5 +1,5 @@
1
1
  module RDF
2
- class Graph
2
+ module Queryable
3
3
  # Resource properties
4
4
  #
5
5
  # Properties arranged as a hash with the predicate Term as index to an array of resources or literals
@@ -142,7 +142,6 @@ module RDF::RDFXML
142
142
  def initialize(input = $stdin, options = {}, &block)
143
143
  super do
144
144
  @debug = options[:debug]
145
- @base_uri = uri(options[:base_uri]) if options[:base_uri]
146
145
 
147
146
  @library = case options[:library]
148
147
  when nil
@@ -188,13 +187,13 @@ module RDF::RDFXML
188
187
 
189
188
  raise "root must be a proxy not a #{root.class}" unless root.is_a?(@implementation::NodeProxy)
190
189
 
191
- add_debug(root, "base_uri: #{@base_uri.inspect}")
190
+ add_debug(root, "base_uri: #{base_uri.inspect}")
192
191
 
193
192
  rdf_nodes = root.xpath("//rdf:RDF", "rdf" => RDF.to_uri.to_s)
194
193
  if rdf_nodes.length == 0
195
194
  # If none found, root element may be processed as an RDF Node
196
195
 
197
- ec = EvaluationContext.new(@base_uri, root, @graph) do |prefix, value|
196
+ ec = EvaluationContext.new(base_uri, root, @graph) do |prefix, value|
198
197
  prefix(prefix, value)
199
198
  end
200
199
 
@@ -205,7 +204,7 @@ module RDF::RDFXML
205
204
  # XXX Skip this element if it's contained within another rdf:RDF element
206
205
 
207
206
  # Extract base, lang and namespaces from parents to create proper evaluation context
208
- ec = EvaluationContext.new(@base_uri, nil, @graph) do |prefix, value|
207
+ ec = EvaluationContext.new(base_uri, nil, @graph) do |prefix, value|
209
208
  prefix(prefix, value)
210
209
  end
211
210
  ec.extract_from_ancestors(node)
@@ -257,7 +256,7 @@ module RDF::RDFXML
257
256
  return unless ::RDF::RDFXML.debug? || @debug
258
257
  message = message + yield if block_given?
259
258
  puts "#{node_path(node)}: #{message}" if ::RDF::RDFXML::debug?
260
- @debug << "#{node_path(node)}: #{message}" if @debug.is_a?(Array)
259
+ @debug << "#{node_path(node)}: #{message}".force_encoding("utf-8") if @debug.is_a?(Array)
261
260
  end
262
261
 
263
262
  # add a statement, object can be literal or URI or bnode
@@ -87,7 +87,7 @@ module RDF::RDFXML
87
87
  # @yieldparam [RDF::Writer] writer
88
88
  def initialize(output = $stdout, options = {}, &block)
89
89
  super do
90
- @graph = RDF::Graph.new
90
+ @graph = RDF::Repository.new
91
91
  @uri_to_qname = {}
92
92
  @uri_to_prefix = {}
93
93
  block.call(self) if block_given?
@@ -352,7 +352,7 @@ module RDF::RDFXML
352
352
  elsif rest.empty?
353
353
  properties.delete(RDF.type.to_s)
354
354
  else
355
- properties[RDF.type.to_s] = [rest].flatten.compact
355
+ properties[RDF.type.to_s] = Array(rest)
356
356
  end
357
357
  prop_list = order_properties(properties)
358
358
  add_debug {"=> property order: #{prop_list.to_sentence}"}
@@ -425,8 +425,9 @@ module RDF::RDFXML
425
425
 
426
426
  o_props = @graph.properties(object)
427
427
 
428
- col = RDF::List.new(object, @graph).to_a
429
- conformant_list = col.all? {|item| !item.literal?} && o_props[RDF.first.to_s]
428
+ list = RDF::List.new(object, @graph)
429
+ col = list.to_a
430
+ conformant_list = list.valid? && col.none?(&:literal?)
430
431
  args = xml_args(object)
431
432
  attrs = args.pop
432
433
 
@@ -506,7 +507,7 @@ module RDF::RDFXML
506
507
  [:untyped, :typed].include?(@attributes) && (
507
508
  prop == RDF.type ||
508
509
  [:typed].include?(@attributes) && object.literal? && object.typed? ||
509
- (object.literal? && object.plain? || @lang && object.language.to_s == @lang.to_s)
510
+ (object.literal? && object.simple? || @lang && object.language.to_s == @lang.to_s)
510
511
  )
511
512
  end
512
513
 
@@ -540,7 +541,7 @@ module RDF::RDFXML
540
541
  def xml_args(object)
541
542
  case object
542
543
  when RDF::Literal
543
- if object.plain?
544
+ if object.simple?
544
545
  [object.value, {}]
545
546
  elsif object.has_language?
546
547
  [object.value, {"xml:lang" => object.language}]
@@ -567,7 +568,7 @@ module RDF::RDFXML
567
568
  message = message + yield if block_given?
568
569
  msg = "#{' ' * @depth}#{message}"
569
570
  STDERR.puts msg if ::RDF::RDFXML.debug?
570
- @debug << msg if @debug.is_a?(Array)
571
+ @debug << msg.force_encoding("utf-8") if @debug.is_a?(Array)
571
572
  end
572
573
  end
573
574
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-rdfxml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Gregg
@@ -9,11 +10,12 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-04-12 00:00:00.000000000 Z
13
+ date: 2013-07-15 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rdf
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
20
  - - ! '>='
19
21
  - !ruby/object:Gem::Version
@@ -21,6 +23,7 @@ dependencies:
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - ! '>='
26
29
  - !ruby/object:Gem::Version
@@ -28,6 +31,7 @@ dependencies:
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: rdf-xsd
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
36
  - - ! '>='
33
37
  - !ruby/object:Gem::Version
@@ -35,6 +39,7 @@ dependencies:
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
44
  - - ! '>='
40
45
  - !ruby/object:Gem::Version
@@ -42,20 +47,23 @@ dependencies:
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: nokogiri
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
52
  - - ! '>='
47
53
  - !ruby/object:Gem::Version
48
- version: 1.5.5
54
+ version: 1.5.9
49
55
  type: :development
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
60
  - - ! '>='
54
61
  - !ruby/object:Gem::Version
55
- version: 1.5.5
62
+ version: 1.5.9
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: equivalent-xml
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
68
  - - ! '>='
61
69
  - !ruby/object:Gem::Version
@@ -63,6 +71,7 @@ dependencies:
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
76
  - - ! '>='
68
77
  - !ruby/object:Gem::Version
@@ -70,6 +79,7 @@ dependencies:
70
79
  - !ruby/object:Gem::Dependency
71
80
  name: open-uri-cached
72
81
  requirement: !ruby/object:Gem::Requirement
82
+ none: false
73
83
  requirements:
74
84
  - - ! '>='
75
85
  - !ruby/object:Gem::Version
@@ -77,6 +87,7 @@ dependencies:
77
87
  type: :development
78
88
  prerelease: false
79
89
  version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
80
91
  requirements:
81
92
  - - ! '>='
82
93
  - !ruby/object:Gem::Version
@@ -84,6 +95,7 @@ dependencies:
84
95
  - !ruby/object:Gem::Dependency
85
96
  name: spira
86
97
  requirement: !ruby/object:Gem::Requirement
98
+ none: false
87
99
  requirements:
88
100
  - - '='
89
101
  - !ruby/object:Gem::Version
@@ -91,13 +103,15 @@ dependencies:
91
103
  type: :development
92
104
  prerelease: false
93
105
  version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
94
107
  requirements:
95
108
  - - '='
96
109
  - !ruby/object:Gem::Version
97
110
  version: 0.0.12
98
111
  - !ruby/object:Gem::Dependency
99
- name: rake
112
+ name: json-ld
100
113
  requirement: !ruby/object:Gem::Requirement
114
+ none: false
101
115
  requirements:
102
116
  - - ! '>='
103
117
  - !ruby/object:Gem::Version
@@ -105,6 +119,7 @@ dependencies:
105
119
  type: :development
106
120
  prerelease: false
107
121
  version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
108
123
  requirements:
109
124
  - - ! '>='
110
125
  - !ruby/object:Gem::Version
@@ -112,6 +127,7 @@ dependencies:
112
127
  - !ruby/object:Gem::Dependency
113
128
  name: rspec
114
129
  requirement: !ruby/object:Gem::Requirement
130
+ none: false
115
131
  requirements:
116
132
  - - ! '>='
117
133
  - !ruby/object:Gem::Version
@@ -119,6 +135,7 @@ dependencies:
119
135
  type: :development
120
136
  prerelease: false
121
137
  version_requirements: !ruby/object:Gem::Requirement
138
+ none: false
122
139
  requirements:
123
140
  - - ! '>='
124
141
  - !ruby/object:Gem::Version
@@ -126,6 +143,7 @@ dependencies:
126
143
  - !ruby/object:Gem::Dependency
127
144
  name: rdf-isomorphic
128
145
  requirement: !ruby/object:Gem::Requirement
146
+ none: false
129
147
  requirements:
130
148
  - - ! '>='
131
149
  - !ruby/object:Gem::Version
@@ -133,20 +151,7 @@ dependencies:
133
151
  type: :development
134
152
  prerelease: false
135
153
  version_requirements: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - ! '>='
138
- - !ruby/object:Gem::Version
139
- version: '0'
140
- - !ruby/object:Gem::Dependency
141
- name: rdf-n3
142
- requirement: !ruby/object:Gem::Requirement
143
- requirements:
144
- - - ! '>='
145
- - !ruby/object:Gem::Version
146
- version: '0'
147
- type: :development
148
- prerelease: false
149
- version_requirements: !ruby/object:Gem::Requirement
154
+ none: false
150
155
  requirements:
151
156
  - - ! '>='
152
157
  - !ruby/object:Gem::Version
@@ -154,6 +159,7 @@ dependencies:
154
159
  - !ruby/object:Gem::Dependency
155
160
  name: rdf-turtle
156
161
  requirement: !ruby/object:Gem::Requirement
162
+ none: false
157
163
  requirements:
158
164
  - - ! '>='
159
165
  - !ruby/object:Gem::Version
@@ -161,6 +167,7 @@ dependencies:
161
167
  type: :development
162
168
  prerelease: false
163
169
  version_requirements: !ruby/object:Gem::Requirement
170
+ none: false
164
171
  requirements:
165
172
  - - ! '>='
166
173
  - !ruby/object:Gem::Version
@@ -168,39 +175,43 @@ dependencies:
168
175
  - !ruby/object:Gem::Dependency
169
176
  name: rdf-spec
170
177
  requirement: !ruby/object:Gem::Requirement
178
+ none: false
171
179
  requirements:
172
180
  - - ! '>='
173
181
  - !ruby/object:Gem::Version
174
- version: '1.0'
182
+ version: '0'
175
183
  type: :development
176
184
  prerelease: false
177
185
  version_requirements: !ruby/object:Gem::Requirement
186
+ none: false
178
187
  requirements:
179
188
  - - ! '>='
180
189
  - !ruby/object:Gem::Version
181
- version: '1.0'
190
+ version: '0'
182
191
  - !ruby/object:Gem::Dependency
183
192
  name: yard
184
193
  requirement: !ruby/object:Gem::Requirement
194
+ none: false
185
195
  requirements:
186
196
  - - ! '>='
187
197
  - !ruby/object:Gem::Version
188
- version: 0.8.3
198
+ version: 0.8.5
189
199
  type: :development
190
200
  prerelease: false
191
201
  version_requirements: !ruby/object:Gem::Requirement
202
+ none: false
192
203
  requirements:
193
204
  - - ! '>='
194
205
  - !ruby/object:Gem::Version
195
- version: 0.8.3
206
+ version: 0.8.5
196
207
  description: RDF::RDFXML is an RDF/XML reader and writer for the RDF.rb library suite.
197
208
  email: public-rdf-ruby@w3.org
198
209
  executables: []
199
210
  extensions: []
200
211
  extra_rdoc_files: []
201
212
  files:
202
- - README.markdown
203
- - History.markdown
213
+ - README.md
214
+ - History.md
204
215
  - AUTHORS
205
216
  - CONTRIBUTORS
206
217
  - VERSION
@@ -219,26 +230,27 @@ files:
219
230
  homepage: http://ruby-rdf.github.com/rdf-rdfxml
220
231
  licenses:
221
232
  - Public Domain
222
- metadata: {}
223
233
  post_install_message:
224
234
  rdoc_options: []
225
235
  require_paths:
226
236
  - lib
227
237
  required_ruby_version: !ruby/object:Gem::Requirement
238
+ none: false
228
239
  requirements:
229
240
  - - ! '>='
230
241
  - !ruby/object:Gem::Version
231
- version: 1.8.1
242
+ version: 1.9.3
232
243
  required_rubygems_version: !ruby/object:Gem::Requirement
244
+ none: false
233
245
  requirements:
234
246
  - - ! '>='
235
247
  - !ruby/object:Gem::Version
236
248
  version: '0'
237
249
  requirements: []
238
250
  rubyforge_project: rdf-rdfxml
239
- rubygems_version: 2.0.3
251
+ rubygems_version: 1.8.25
240
252
  signing_key:
241
- specification_version: 4
253
+ specification_version: 3
242
254
  summary: RDF/XML reader/writer for RDF.rb.
243
255
  test_files: []
244
256
  has_rdoc: false
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YzgyZDI3YzU1ZWM1MDc2YWQxNGYwNWMxZDQ1Mzk2ZDZiZDA1ZDI4Ng==
5
- data.tar.gz: !binary |-
6
- YmJlMzIwNjIxOTEwMzQxMGYxYWZkOWYwMjNlYTkwNDU3MjhiMzg2OQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- OWQwMjljYmExMzE3MDljNTk1YTI1MDJmZTc4MTk2NmU1ZDI3MzRjNzdmNzIz
10
- MDFmODI2NjhmZjc1NWIwMmM4OTE1OGRkZTU3NDg1YWY4YmIyNmRiOWViNTIy
11
- ZjkyNWVhYjU1NDJiODJkNjE1ZmZhMjE5Y2I0NDY1NGQwYzdjNDE=
12
- data.tar.gz: !binary |-
13
- MmUzNmQ4NjA1MGMwNmRkZGEyMWZjZTNmYTM2YmIxN2VlNDA0YjZlOTc4ODAw
14
- M2U5NmUzYzZkMmU0NGZjM2NmYTExMDJjYmI2YzBhOGEwNjE4YWRhMjcxOWQ1
15
- ZTAxNjQ2NDYzYTE4YmM4Y2U3MGQzMThhZTczNWVjZTMwYWNkMDE=