rdf 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/rdf/nquads.rb +18 -3
- data/lib/rdf/reader.rb +2 -2
- data/lib/rdf/version.rb +1 -1
- data/lib/rdf/writer.rb +4 -2
- metadata +8 -7
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
data/lib/rdf/nquads.rb
CHANGED
@@ -4,9 +4,24 @@ module RDF
|
|
4
4
|
#
|
5
5
|
# This has not yet been implemented as of RDF.rb 0.3.x.
|
6
6
|
module NQuads
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
##
|
8
|
+
# N-Quads format specification.
|
9
|
+
#
|
10
|
+
# @example Obtaining an NQuads format class
|
11
|
+
# RDF::Format.for(:nquads) #=> RDF::NQuads::Format
|
12
|
+
# RDF::Format.for("etc/doap.nq")
|
13
|
+
# RDF::Format.for(:file_name => "etc/doap.nq")
|
14
|
+
# RDF::Format.for(:file_extension => "nq")
|
15
|
+
# RDF::Format.for(:content_type => "text/x-nquads")
|
16
|
+
#
|
17
|
+
# @see http://sw.deri.org/2008/07/n-quads/#mediatype
|
18
|
+
class Format < RDF::Format
|
19
|
+
content_type 'text/x-nquads', :extension => :nq
|
20
|
+
content_encoding 'ascii'
|
21
|
+
|
22
|
+
reader { RDF::NQuads::Reader }
|
23
|
+
writer { RDF::NQuads::Writer }
|
24
|
+
end
|
10
25
|
|
11
26
|
class Reader < NTriples::Reader
|
12
27
|
# TODO
|
data/lib/rdf/reader.rb
CHANGED
@@ -118,11 +118,11 @@ module RDF
|
|
118
118
|
format_options = options.dup
|
119
119
|
format_options[:content_type] ||= file.content_type if file.respond_to?(:content_type)
|
120
120
|
format_options[:file_name] ||= filename
|
121
|
-
reader = self.for(format_options)
|
121
|
+
reader = self.for(format_options[:format] || format_options)
|
122
122
|
if reader
|
123
123
|
reader.new(file, options, &block)
|
124
124
|
else
|
125
|
-
raise FormatError, "unknown RDF format: #{
|
125
|
+
raise FormatError, "unknown RDF format: #{format_options.inspect}"
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
data/lib/rdf/version.rb
CHANGED
data/lib/rdf/writer.rb
CHANGED
@@ -147,12 +147,14 @@ module RDF
|
|
147
147
|
#
|
148
148
|
# @param [String, #to_s] filename
|
149
149
|
# @param [Hash{Symbol => Object}] options
|
150
|
-
# any additional options (see {RDF::Writer#initialize})
|
150
|
+
# any additional options (see {RDF::Writer#initialize and {RDF::Format.for}})
|
151
151
|
# @option options [Symbol] :format (nil)
|
152
152
|
# @return [RDF::Writer]
|
153
153
|
def self.open(filename, options = {}, &block)
|
154
154
|
File.open(filename, 'wb') do |file|
|
155
|
-
|
155
|
+
format_options = options.dup
|
156
|
+
format_options[:file_name] ||= filename
|
157
|
+
self.for(options[:format] || format_options).new(file, options, &block)
|
156
158
|
end
|
157
159
|
end
|
158
160
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 3
|
9
|
+
version: 0.3.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Arto Bendiken
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-04-
|
19
|
+
date: 2011-04-11 00:00:00 +02:00
|
20
20
|
default_executable: rdf
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -25,12 +25,13 @@ dependencies:
|
|
25
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
|
-
- - "
|
28
|
+
- - "="
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
segments:
|
31
31
|
- 2
|
32
32
|
- 2
|
33
|
-
|
33
|
+
- 4
|
34
|
+
version: 2.2.4
|
34
35
|
type: :runtime
|
35
36
|
version_requirements: *id001
|
36
37
|
- !ruby/object:Gem::Dependency
|
@@ -74,8 +75,8 @@ dependencies:
|
|
74
75
|
segments:
|
75
76
|
- 0
|
76
77
|
- 3
|
77
|
-
-
|
78
|
-
version: 0.3.
|
78
|
+
- 3
|
79
|
+
version: 0.3.3
|
79
80
|
type: :development
|
80
81
|
version_requirements: *id004
|
81
82
|
description: RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data.
|