rdf-raptor 2.2.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e4024c120a6e8446c7005d1fe0dd26ff2324217a
4
- data.tar.gz: eb27b27c8569b47fcb9f8a9cf2ceddb043f3cae3
2
+ SHA256:
3
+ metadata.gz: dbcabda9177f086bc3b3ace9ccf55b554bef4697a3dd162d97ab626fde5da8a0
4
+ data.tar.gz: 27077358ddb590b9d7a8bd1b03374d0865bce291bdf056f079d168f259b50fb8
5
5
  SHA512:
6
- metadata.gz: 066e90c8325d4a366203eb172a340a2427b95ccddb8faafd369356d3b0436fe4e9b99db42236fd3aae06cd2769a74d5e21fb2dcefce97c043a7dbaa10bdf6db1
7
- data.tar.gz: 219ef70aac776f72b92dbb560b8dedca56baa71193208a228c12ce312d18417c701aa55ccccf425069c827651ee720a3b8508d97d14827b6f437cc1ee3252e89
6
+ metadata.gz: 77adec7f207278ffabc61a176f8f987cf8f23eb17f0591d37ed9fb9c2952ed5a8a5a7e7609d8d400099ca9c738a51644cb6e38eddb1690203cd83336f21716ca
7
+ data.tar.gz: 8ffd16a4a230445c5985a0a1dfa0410dc2f11a1697c24d0d4e51a9565b00adcc320be61939896d9a5c83c956c46946249659add57c28b7a05c6819d302362471
@@ -0,0 +1,36 @@
1
+ # How to contribute
2
+
3
+ Community contributions are essential for keeping Ruby RDF great. We want to keep it as easy as possible to contribute changes that get things working in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
4
+
5
+ ## Development
6
+
7
+ This repository uses [Git Flow](https://github.com/nvie/gitflow) to manage development and release activity. All submissions _must_ be on a feature branch based on the _develop_ branch to ease staging and integration.
8
+
9
+ * create or respond to an issue on the [Github Repository](http://github.com/ruby-rdf/rdf-raptor/issues)
10
+ * Fork and clone the repo:
11
+ `git clone git@github.com:your-username/rdf-raptor.git`
12
+ * Install bundle:
13
+ `bundle install`
14
+ * Create tests in RSpec and make sure you achieve at least 90% code coverage for the feature your adding or behavior being modified.
15
+ * Push to your fork and [submit a pull request][pr].
16
+
17
+ ## Do's and Dont's
18
+ * Do your best to adhere to the existing coding conventions and idioms.
19
+ * Don't use hard tabs, and don't leave trailing whitespace on any line.
20
+ Before committing, run `git diff --check` to make sure of this.
21
+ * Do document every method you add using [YARD][] annotations. Read the
22
+ [tutorial][YARD-GS] or just look at the existing code for examples.
23
+ * Don't touch the `.gemspec` or `VERSION` files. If you need to change them,
24
+ do so on your private branch only.
25
+ * Do feel free to add yourself to the `CREDITS` file and the
26
+ corresponding list in the the `README`. Alphabetical order applies.
27
+ * Don't touch the `AUTHORS` file. If your contributions are significant
28
+ enough, be assured we will eventually add you in there.
29
+ * Do note that in order for us to merge any non-trivial changes (as a rule
30
+ of thumb, additions larger than about 15 lines of code), we need an
31
+ explicit [public domain dedication][PDD] on record from you.
32
+
33
+ [YARD]: http://yardoc.org/
34
+ [YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
35
+ [PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
36
+ [pr]: https://github.com/ruby-rdf/rdf-raptor/compare/
@@ -0,0 +1,222 @@
1
+ Raptor RDF Extension for RDF.rb
2
+ ===================================
3
+
4
+ This is an [RDF.rb][] extension that adds support for parsing/serializing [NTriples][],
5
+ [RDF/XML][], [Turtle][], [RDFa][], and [Graphviz][] data using the [Raptor RDF Parser][Raptor]
6
+ library.
7
+
8
+ * <https://github.com/ruby-rdf/rdf-raptor>
9
+ * <http://blog.datagraph.org/2010/04/parsing-rdf-with-ruby>
10
+
11
+ [![Gem Version](https://badge.fury.io/rb/rdf-raptor.png)](http://badge.fury.io/rb/rdf-raptor)
12
+ [![Build Status](https://travis-ci.org/ruby-rdf/rdf-raptor.png?branch=master)](http://travis-ci.org/ruby-rdf/rdf-raptor)
13
+
14
+ Features
15
+ --------
16
+
17
+ * Uses the fast [Raptor][] C library.
18
+ * Parses and serializes RDF data from/into the NTriples, RDF/XML, and Turtle formats.
19
+ * Extracts RDF statements from XHTML+RDFa documents.
20
+ * Serializes RDF statements into Graphviz format.
21
+ * Provides serialization format autodetection for RDF/XML, Turtle and RDFa.
22
+ * Compatible with any operating system supported by Raptor and Ruby.
23
+ * Compatible with MRI >= 2.4, JRuby and Rubinius.
24
+
25
+ Examples
26
+ --------
27
+
28
+ require 'rdf/raptor'
29
+
30
+ ### Ensuring Raptor is installed and obtaining the version number
31
+
32
+ RDF::Raptor.available? #=> true
33
+ RDF::Raptor.version #=> "2.0.8"
34
+
35
+ ### Parsing RDF statements from an NTriples file
36
+
37
+ RDF::Reader.open("http://datagraph.org/jhacker/foaf.nt") do |reader|
38
+ reader.each_statement do |statement|
39
+ puts statement.inspect
40
+ end
41
+ end
42
+
43
+ ### Parsing RDF statements from an RDF/XML file
44
+
45
+ RDF::Reader.open("http://datagraph.org/jhacker/foaf.rdf") do |reader|
46
+ reader.each_statement do |statement|
47
+ puts statement.inspect
48
+ end
49
+ end
50
+
51
+ ### Parsing RDF statements from a Turtle file
52
+
53
+ RDF::Reader.open("http://datagraph.org/jhacker/foaf.ttl") do |reader|
54
+ reader.each_statement do |statement|
55
+ puts statement.inspect
56
+ end
57
+ end
58
+
59
+ ### Extracting RDF statements from an HTML+RDFa document
60
+
61
+ RDF::Reader.open(url = "http://bblfish.net/", format: :rdfa, base_uri: url) do |reader|
62
+ reader.each_statement do |statement|
63
+ puts statement.inspect
64
+ end
65
+ end
66
+
67
+ ### Serializing RDF statements into an RDF/XML file
68
+
69
+ data = RDF::Repository.load("http://datagraph.org/jhacker/foaf.nt")
70
+
71
+ RDF::Writer.open("output.rdf") do |writer|
72
+ data.each_statement do |statement|
73
+ writer << statement
74
+ end
75
+ end
76
+
77
+ ### Serializing RDF statements into a Turtle file
78
+
79
+ data = RDF::Repository.load("http://datagraph.org/jhacker/foaf.nt")
80
+
81
+ RDF::Writer.open("output.ttl") do |writer|
82
+ data.each_statement do |statement|
83
+ writer << statement
84
+ end
85
+ end
86
+
87
+ ### Obtaining the NTriples format specification class
88
+
89
+ RDF::Format.for(:ntriples) #=> RDF::Raptor::NTriples::Format
90
+ RDF::Format.for("input.nt")
91
+ RDF::Format.for(file_name: "input.nt")
92
+ RDF::Format.for(file_extension: "nt")
93
+ RDF::Format.for(content_type: "application/n-triples")
94
+
95
+ ### Obtaining the RDF/XML format specification class
96
+
97
+ RDF::Format.for(:rdfxml) #=> RDF::Raptor::RDFXML::Format
98
+ RDF::Format.for("input.rdf")
99
+ RDF::Format.for(file_name: "input.rdf")
100
+ RDF::Format.for(file_extension: "rdf")
101
+ RDF::Format.for(content_type: "application/rdf+xml")
102
+
103
+ ### Obtaining the Turtle format specification class
104
+
105
+ RDF::Format.for(:turtle) #=> RDF::Raptor::Turtle::Format
106
+ RDF::Format.for("input.ttl")
107
+ RDF::Format.for(file_name: "input.ttl")
108
+ RDF::Format.for(file_extension: "ttl")
109
+ RDF::Format.for(content_type: "text/turtle")
110
+
111
+ ### Obtaining the RDFa format specification class
112
+
113
+ RDF::Format.for(:rdfa) #=> RDF::Raptor::RDFa::Format
114
+ RDF::Format.for("input.html")
115
+ RDF::Format.for(file_name: "input.html")
116
+ RDF::Format.for(file_extension: "html")
117
+ RDF::Format.for(content_type: "application/xhtml+xml")
118
+
119
+ ### Obtaining the Graphviz format specification class
120
+
121
+ RDF::Format.for(:graphviz) #=> RDF::Raptor::Graphviz::Format
122
+ RDF::Format.for("output.dot")
123
+ RDF::Format.for(file_name: "output.dot")
124
+ RDF::Format.for(file_extension: "")
125
+ RDF::Format.for(content_type: "text/vnd.graphviz")
126
+
127
+ Documentation
128
+ -------------
129
+
130
+ <http://www.rubydoc.info/github/ruby-rdf/rdf-raptor/>
131
+
132
+ * {RDF::Raptor}
133
+ * {RDF::Raptor::NTriples}
134
+ * {RDF::Raptor::Turtle}
135
+ * {RDF::Raptor::RDFXML}
136
+ * {RDF::Raptor::RDFa}
137
+ * {RDF::Raptor::Graphviz}
138
+
139
+ Dependencies
140
+ ------------
141
+
142
+ * [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.1)
143
+ * [FFI](http://rubygems.org/gems/ffi) (~> 1.11)
144
+ * [Raptor][] (>= 2.0), the `libraptor` library or the `rapper` binary
145
+
146
+ Installation
147
+ ------------
148
+
149
+ The recommended installation method is via [RubyGems](http://rubygems.org/).
150
+ To install the latest official release of the `RDF::Raptor` gem, do:
151
+
152
+ % [sudo] gem install rdf-raptor
153
+
154
+ To install the required [Raptor][] command-line tools themselves, look for a
155
+ `raptor` or `raptor-utils` package in your platform's package management
156
+ system. For your convenience, here follow installation instructions for the
157
+ Mac and the most common Linux and BSD distributions:
158
+
159
+ % [sudo] port install raptor # Mac OS X with MacPorts
160
+ % [sudo] fink install raptor-bin # Mac OS X with Fink
161
+ % brew install raptor # Mac OS X with Homebrew
162
+ % [sudo] aptitude install raptor-utils # Ubuntu / Debian with aptitude
163
+ % [sudo] apt-get install libraptor2-0 # Ubuntu / Debian with apt-get
164
+ % [sudo] yum install raptor2 # Fedora / CentOS / RHEL
165
+ % [sudo] zypper install raptor # openSUSE
166
+ % [sudo] emerge raptor # Gentoo Linux
167
+ % [sudo] pacman -S raptor # Arch Linux
168
+ % [sudo] pkg_add -r raptor # FreeBSD
169
+ % [sudo] pkg_add raptor # OpenBSD / NetBSD
170
+
171
+ If the `libraptor2` library is in the standard library search path, and
172
+ the `rapper` command is in the standard command search path, all should
173
+ be well and work fine out of the box. However, if either is in a
174
+ non-standard location, be sure to set the `RDF_RAPTOR_LIBPATH` and/or
175
+ `RDF_RAPTOR_BINPATH` environment variables appropriately before
176
+ requiring `rdf/raptor`.
177
+
178
+ Download
179
+ --------
180
+
181
+ To get a local working copy of the development repository, do:
182
+
183
+ % git clone git@github.com:ruby-rdf/rdf-raptor.git
184
+
185
+ Alternatively, download the latest development version as a tarball as
186
+ follows:
187
+
188
+ % wget https://github.com/ruby-rdf/rdf-raptor/tarball/master
189
+
190
+ Mailing List
191
+ ------------
192
+
193
+ * <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
194
+
195
+ Authors
196
+ -------
197
+
198
+ * [Arto Bendiken](https://github.com/bendiken) - <http://ar.to/>
199
+ * [John Fieber](https://github.com/jfieber) - <http://github.com/jfieber>
200
+
201
+ Contributors
202
+ ------------
203
+
204
+ * [Ben Lavender](https://github.com/bhuga) - <http://bhuga.net/>
205
+ * [David Butler](https://github.com/dwbutler) - <http://github.com/dwbutler>
206
+ * [Gregg Kellogg](https://github.com/gkellogg) - <http://greggkellogg.net/>
207
+
208
+ License
209
+ -------
210
+
211
+ This is free and unencumbered public domain software. For more information,
212
+ see <http://unlicense.org/> or the accompanying [UNLICENSE][] file.
213
+
214
+ [RDF.rb]: https://ruby-rdf.github.io/rdf
215
+ [NTriples]: https://en.wikipedia.org/wiki/N-Triples
216
+ [RDF/XML]: http://www.w3.org/TR/REC-rdf-syntax/
217
+ [Turtle]: https://en.wikipedia.org/wiki/Turtle_(syntax)
218
+ [RDFa]: http://rdfa.info/
219
+ [Graphviz]: http://www.graphviz.org/
220
+ [Raptor]: http://librdf.org/raptor/
221
+ [rapper]: http://librdf.org/raptor/rapper.html
222
+ [UNLICENSE]:https://github.com/ruby-rdf/rdf-raptor/blob/master/UNLICENSE
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.0
1
+ 3.1.0
@@ -27,30 +27,30 @@ module RDF::Raptor
27
27
  # Initializes the CLI reader instance.
28
28
  #
29
29
  # @param [IO, File, RDF::URI, String] input
30
+ # @param [String, #to_s] :base_uri ("file:///dev/stdin")
30
31
  # @param [Hash{Symbol => Object}] options
31
32
  # any additional options (see `RDF::Reader#initialize`)
32
- # @option options [String, #to_s] :base_uri ("file:///dev/stdin")
33
33
  # @yield [reader] `self`
34
34
  # @yieldparam [RDF::Reader] reader
35
35
  # @yieldreturn [void] ignored
36
- def initialize(input = $stdin, options = {}, &block)
36
+ def initialize(input = $stdin, base_uri: nil, **options, &block)
37
37
  raise RDF::ReaderError, "`rapper` binary not found" unless RDF::Raptor.available?
38
38
 
39
39
  format = self.class.format.rapper_format
40
40
  case input
41
41
  when RDF::URI, %r(^(file|http|https|ftp)://)
42
42
  @command = "#{RAPPER} -q -i #{format} -o ntriples '#{input}'"
43
- @command << " '#{options[:base_uri]}'" if options.has_key?(:base_uri)
43
+ @command << " '#{base_uri}'" if options.has_key?(:base_uri)
44
44
  @rapper = IO.popen(@command, 'rb')
45
45
 
46
46
  when File, Tempfile
47
47
  @command = "#{RAPPER} -q -i #{format} -o ntriples '#{File.expand_path(input.path)}'"
48
- @command << " '#{options[:base_uri]}'" if options.has_key?(:base_uri)
48
+ @command << " '#{base_uri}'" if options.has_key?(:base_uri)
49
49
  @rapper = IO.popen(@command, 'rb')
50
50
 
51
51
  else # IO, String
52
52
  @command = "#{RAPPER} -q -i #{format} -o ntriples file:///dev/stdin"
53
- @command << " '#{options[:base_uri]}'" if options.has_key?(:base_uri)
53
+ @command << " '#{base_uri}'" if options.has_key?(:base_uri)
54
54
  @rapper = IO.popen(@command, 'rb+')
55
55
  pid = fork do
56
56
  # process to feed `rapper`
@@ -135,20 +135,20 @@ module RDF::Raptor
135
135
  # @yield [writer] `self`
136
136
  # @yieldparam [RDF::Writer] writer
137
137
  # @yieldreturn [void]
138
- def initialize(output = $stdout, options = {}, &block)
138
+ def initialize(output = $stdout, base_uri: nil, **options, &block)
139
139
  raise RDF::WriterError, "`rapper` binary not found" unless RDF::Raptor.available?
140
140
 
141
141
  format = self.class.format.rapper_format
142
142
  case output
143
143
  when File, IO, StringIO, Tempfile
144
144
  @command = "#{RAPPER} -q -i turtle -o #{format} file:///dev/stdin"
145
- @command << " '#{options[:base_uri]}'" if options.has_key?(:base_uri)
145
+ @command << " '#{base_uri}'" if options.has_key?(:base_uri)
146
146
  @rapper = IO.popen(@command, 'rb+')
147
147
  else
148
148
  raise ArgumentError, "unsupported output type: #{output.inspect}"
149
149
  end
150
- @writer = RDF::NTriples::Writer.new(@rapper, options)
151
- super(output, options, &block)
150
+ @writer = RDF::NTriples::Writer.new(@rapper, **options)
151
+ super(output, base_uri: base_uri, **options, &block)
152
152
  end
153
153
 
154
154
  protected
@@ -40,7 +40,7 @@ module RDF::Raptor
40
40
  # @yield [reader] `self`
41
41
  # @yieldparam [RDF::Reader] reader
42
42
  # @yieldreturn [void] ignored
43
- def initialize(input = $stdin, options = {}, &block)
43
+ def initialize(input = $stdin, **options, &block)
44
44
  @format = self.class.format.rapper_format
45
45
  @parser = V2::Parser.new(@format)
46
46
  @parser.error_handler = ERROR_HANDLER
@@ -75,7 +75,7 @@ module RDF::Raptor
75
75
  # @yieldparam [RDF::Statement] statement
76
76
  # @yieldreturn [void] ignored
77
77
  # @see RDF::Reader#each_statement
78
- def each_statement(options = {}, &block)
78
+ def each_statement(**options, &block)
79
79
  if block_given?
80
80
  if options[:raw]
81
81
  # this is up to an order of magnitude faster...
@@ -92,7 +92,7 @@ module RDF::Raptor
92
92
  raise RDF::ReaderError, "Errors found during processing"
93
93
  end
94
94
  end
95
- enum_for(:each_statement, options)
95
+ enum_for(:each_statement, **options)
96
96
  end
97
97
  alias_method :each, :each_statement
98
98
 
@@ -121,7 +121,7 @@ module RDF::Raptor
121
121
  # @yieldreturn [void] ignored
122
122
  # @return [void]
123
123
  def parse(input, &block)
124
- @parser.parse(input, @options, &block)
124
+ @parser.parse(input, **@options, &block)
125
125
  end
126
126
 
127
127
  GENID = /^genid\d+$/
@@ -156,12 +156,12 @@ module RDF::Raptor
156
156
  # @yield [writer] `self`
157
157
  # @yieldparam [RDF::Writer] writer
158
158
  # @yieldreturn [void] ignored
159
- def initialize(output = $stdout, options = {}, &block)
159
+ def initialize(output = $stdout, **options, &block)
160
160
  @format = self.class.format.rapper_format
161
161
  @serializer = V2::Serializer.new(@format)
162
162
  @serializer.error_handler = ERROR_HANDLER
163
163
  @serializer.warning_handler = WARNING_HANDLER
164
- @serializer.start_to(output, options)
164
+ @serializer.start_to(output, **options)
165
165
  super
166
166
  end
167
167
 
@@ -18,7 +18,7 @@ module RDF::Raptor::FFI::V1
18
18
  # @overload initialize(file)
19
19
  # @param [File, Tempfile] file
20
20
  #
21
- def initialize(ptr_or_obj, options = {})
21
+ def initialize(ptr_or_obj, **options)
22
22
  ptr = case ptr_or_obj
23
23
  when FFI::Pointer
24
24
  ptr_or_obj
@@ -75,16 +75,16 @@ module RDF::Raptor::FFI::V1
75
75
  # @yieldparam [FFI::Pointer] statement
76
76
  # @yieldreturn [void] ignored
77
77
  # @return [void]
78
- def parse(input, options = {}, &block)
78
+ def parse(input, **options, &block)
79
79
  case input
80
80
  when RDF::URI, %r(^(file|https|http|ftp)://)
81
- parse_url(input, options, &block)
81
+ parse_url(input, **options, &block)
82
82
  when File, Tempfile
83
- parse_file(input, options, &block)
83
+ parse_file(input, **options, &block)
84
84
  when IO, StringIO
85
- parse_stream(input, options, &block)
85
+ parse_stream(input, **options, &block)
86
86
  when String
87
- parse_buffer(input, options, &block)
87
+ parse_buffer(input, **options, &block)
88
88
  else
89
89
  raise ArgumentError, "don't know how to parse #{input.inspect}"
90
90
  end
@@ -101,11 +101,11 @@ module RDF::Raptor::FFI::V1
101
101
  # @yieldparam [FFI::Pointer] statement
102
102
  # @yieldreturn [void] ignored
103
103
  # @return [void]
104
- def parse_url(url, options = {}, &block)
104
+ def parse_url(url, base_uri: nil, **options, &block)
105
105
  self.statement_handler = block if block_given?
106
106
 
107
107
  data_url = V1::URI.new((url.respond_to?(:to_uri) ? url.to_uri : url).to_s)
108
- base_uri = options[:base_uri].to_s.empty? ? nil : V1::URI.new(options[:base_uri].to_s)
108
+ base_uri = base_uri.to_s.empty? ? nil : V1::URI.new(base_uri.to_s)
109
109
 
110
110
  result = V1.raptor_parse_uri(self, data_url, base_uri)
111
111
  # TODO: error handling if result.nonzero?
@@ -123,11 +123,11 @@ module RDF::Raptor::FFI::V1
123
123
  # @yieldparam [FFI::Pointer] statement
124
124
  # @yieldreturn [void] ignored
125
125
  # @return [void]
126
- def parse_file(file, options = {}, &block)
126
+ def parse_file(file, base_uri: nil, **options, &block)
127
127
  self.statement_handler = block if block_given?
128
128
 
129
129
  data_url = V1::URI.new("file://#{File.expand_path(file.path)}")
130
- base_uri = options[:base_uri].to_s.empty? ? nil : V1::URI.new(options[:base_uri].to_s)
130
+ base_uri = base_uri.to_s.empty? ? nil : V1::URI.new(base_uri.to_s)
131
131
 
132
132
  result = V1.raptor_parse_file(self, data_url, base_uri)
133
133
  # TODO: error handling if result.nonzero?
@@ -144,11 +144,11 @@ module RDF::Raptor::FFI::V1
144
144
  # @yieldparam [FFI::Pointer] statement
145
145
  # @yieldreturn [void] ignored
146
146
  # @return [void]
147
- def parse_stream(stream, options = {}, &block)
147
+ def parse_stream(stream, base_uri: nil, **options, &block)
148
148
  self.statement_handler = block if block_given?
149
149
 
150
150
  begin
151
- parse_start!((options[:base_uri] || BASE_URI).to_s)
151
+ parse_start!((base_uri || BASE_URI).to_s)
152
152
  loop do
153
153
  parse_chunk(stream.sysread(BUFFER_SIZE))
154
154
  end
@@ -168,10 +168,10 @@ module RDF::Raptor::FFI::V1
168
168
  # @yieldparam [FFI::Pointer] statement
169
169
  # @yieldreturn [void] ignored
170
170
  # @return [void]
171
- def parse_buffer(buffer, options = {}, &block)
171
+ def parse_buffer(buffer, base_uri: nil, **options, &block)
172
172
  self.statement_handler = block if block_given?
173
173
 
174
- parse_start!((options[:base_uri] || BASE_URI).to_s)
174
+ parse_start!((base_uri || BASE_URI).to_s)
175
175
  parse_chunk(buffer.to_str)
176
176
  parse_end!
177
177
  end
@@ -57,9 +57,9 @@ module RDF::Raptor::FFI::V1
57
57
  # @option options [String, #to_s] :base_uri (nil)
58
58
  # the base URI to use when resolving relative URIs
59
59
  # @return [void]
60
- def start_to(output, options = {})
60
+ def start_to(output, **options)
61
61
  if output.respond_to?(:write)
62
- start_to_stream(output, options)
62
+ start_to_stream(output, **options)
63
63
  else
64
64
  raise ArgumentError, "don't know how to serialize to #{output.inspect}"
65
65
  end
@@ -70,9 +70,9 @@ module RDF::Raptor::FFI::V1
70
70
  # @param [Hash{Symbol => Object}] options
71
71
  # any additional options for serializing (see {#start_to})
72
72
  # @return [void]
73
- def start_to_stream(stream, options = {})
73
+ def start_to_stream(stream, **options)
74
74
  iostream = V1::IOStream.new(V1::IOStreamHandler.new(stream), free_iostream: false)
75
- start_to_iostream(iostream, options)
75
+ start_to_iostream(iostream, **options)
76
76
  end
77
77
 
78
78
  ##
@@ -80,7 +80,7 @@ module RDF::Raptor::FFI::V1
80
80
  # @param [Hash{Symbol => Object}] options
81
81
  # any additional options for serializing (see {#start_to})
82
82
  # @return [void]
83
- def start_to_iostream(iostream, options = {})
83
+ def start_to_iostream(iostream, **options)
84
84
  @iostream = iostream # prevents premature GC
85
85
  @base_uri = options[:base_uri].to_s.empty? ? nil : V1::URI.new(options[:base_uri].to_s)
86
86
  if V1.raptor_serialize_start_to_iostream(self, @base_uri, @iostream).nonzero?
@@ -23,7 +23,7 @@ module RDF::Raptor::FFI::V2
23
23
  # @overload initialize(file)
24
24
  # @param [File, Tempfile] file
25
25
  #
26
- def initialize(ptr_or_obj, options = {})
26
+ def initialize(ptr_or_obj, **options)
27
27
  ptr = case ptr_or_obj
28
28
  when FFI::Pointer
29
29
  ptr_or_obj
@@ -82,16 +82,16 @@ module RDF::Raptor::FFI::V2
82
82
  # @yieldparam [FFI::Pointer] statement
83
83
  # @yieldreturn [void] ignored
84
84
  # @return [void]
85
- def parse(input, options = {}, &block)
85
+ def parse(input, **options, &block)
86
86
  case input
87
87
  when RDF::URI, URI, %r(^(file|https|http|ftp)://)
88
- parse_url(input, options, &block)
88
+ parse_url(input, **options, &block)
89
89
  when File, Tempfile
90
- parse_file(input, options, &block)
90
+ parse_file(input, **options, &block)
91
91
  when IO, StringIO
92
- parse_stream(input, options, &block)
92
+ parse_stream(input, **options, &block)
93
93
  when String
94
- parse_buffer(input, options, &block)
94
+ parse_buffer(input, **options, &block)
95
95
  else
96
96
  raise ArgumentError, "don't know how to parse #{input.inspect}"
97
97
  end
@@ -108,7 +108,7 @@ module RDF::Raptor::FFI::V2
108
108
  # @yieldparam [FFI::Pointer] statement
109
109
  # @yieldreturn [void] ignored
110
110
  # @return [void]
111
- def parse_url(url, options = {}, &block)
111
+ def parse_url(url, **options, &block)
112
112
  self.statement_handler = block if block_given?
113
113
 
114
114
  data_url = V2::URI.new((url.respond_to?(:to_uri) ? url.to_uri : url).to_s)
@@ -130,7 +130,7 @@ module RDF::Raptor::FFI::V2
130
130
  # @yieldparam [FFI::Pointer] statement
131
131
  # @yieldreturn [void] ignored
132
132
  # @return [void]
133
- def parse_file(file, options = {}, &block)
133
+ def parse_file(file, **options, &block)
134
134
  self.statement_handler = block if block_given?
135
135
 
136
136
  data_url = V2::URI.new("file://#{File.expand_path(file.path)}")
@@ -151,7 +151,7 @@ module RDF::Raptor::FFI::V2
151
151
  # @yieldparam [FFI::Pointer] statement
152
152
  # @yieldreturn [void] ignored
153
153
  # @return [void]
154
- def parse_stream(stream, options = {}, &block)
154
+ def parse_stream(stream, **options, &block)
155
155
  self.statement_handler = block if block_given?
156
156
 
157
157
  begin
@@ -175,7 +175,7 @@ module RDF::Raptor::FFI::V2
175
175
  # @yieldparam [FFI::Pointer] statement
176
176
  # @yieldreturn [void] ignored
177
177
  # @return [void]
178
- def parse_buffer(buffer, options = {}, &block)
178
+ def parse_buffer(buffer, **options, &block)
179
179
  self.statement_handler = block if block_given?
180
180
 
181
181
  parse_start!((options[:base_uri] || BASE_URI).to_s)
@@ -69,9 +69,9 @@ module RDF::Raptor::FFI::V2
69
69
  # @option options [String, #to_s] :base_uri (nil)
70
70
  # the base URI to use when resolving relative URIs
71
71
  # @return [void]
72
- def start_to(output, options = {})
72
+ def start_to(output, **options)
73
73
  if output.respond_to?(:write)
74
- start_to_stream(output, options)
74
+ start_to_stream(output, **options)
75
75
  else
76
76
  raise ArgumentError, "don't know how to serialize to #{output.inspect}"
77
77
  end
@@ -82,9 +82,9 @@ module RDF::Raptor::FFI::V2
82
82
  # @param [Hash{Symbol => Object}] options
83
83
  # any additional options for serializing (see {#start_to})
84
84
  # @return [void]
85
- def start_to_stream(stream, options = {})
85
+ def start_to_stream(stream, **options)
86
86
  iostream = V2::IOStream.new(V2::IOStreamHandler.new(stream), free_iostream: self[:free_iostream_on_end])
87
- start_to_iostream(iostream, options)
87
+ start_to_iostream(iostream, **options)
88
88
  end
89
89
 
90
90
  ##
@@ -92,9 +92,9 @@ module RDF::Raptor::FFI::V2
92
92
  # @param [Hash{Symbol => Object}] options
93
93
  # any additional options for serializing (see {#start_to})
94
94
  # @return [void]
95
- def start_to_iostream(iostream, options = {})
95
+ def start_to_iostream(iostream, base_uri: nil, **options)
96
96
  @iostream = iostream # prevents premature GC
97
- @base_uri = options[:base_uri].to_s.empty? ? nil : V2::URI.new(options[:base_uri].to_s)
97
+ @base_uri = base_uri.to_s.empty? ? nil : V2::URI.new(base_uri.to_s)
98
98
  if V2.raptor_serializer_start_to_iostream(self, @base_uri, @iostream).nonzero?
99
99
  raise RDF::WriterError, "raptor_serialize_start_to_iostream() failed"
100
100
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-raptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arto Bendiken
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-14 00:00:00.000000000 Z
12
+ date: 2019-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -17,110 +17,98 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.9.10
20
+ version: '1.11'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 1.9.10
27
+ version: '1.11'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rdf
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: '2.2'
35
- - - "<"
32
+ - - "~>"
36
33
  - !ruby/object:Gem::Version
37
- version: '4.0'
34
+ version: '3.1'
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
38
  requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: '2.2'
45
- - - "<"
39
+ - - "~>"
46
40
  - !ruby/object:Gem::Version
47
- version: '4.0'
41
+ version: '3.1'
48
42
  - !ruby/object:Gem::Dependency
49
43
  name: yard
50
44
  requirement: !ruby/object:Gem::Requirement
51
45
  requirements:
52
46
  - - "~>"
53
47
  - !ruby/object:Gem::Version
54
- version: '0.9'
48
+ version: 0.9.20
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
52
  requirements:
59
53
  - - "~>"
60
54
  - !ruby/object:Gem::Version
61
- version: '0.9'
55
+ version: 0.9.20
62
56
  - !ruby/object:Gem::Dependency
63
57
  name: rspec
64
58
  requirement: !ruby/object:Gem::Requirement
65
59
  requirements:
66
60
  - - "~>"
67
61
  - !ruby/object:Gem::Version
68
- version: '3.7'
62
+ version: '3.9'
69
63
  type: :development
70
64
  prerelease: false
71
65
  version_requirements: !ruby/object:Gem::Requirement
72
66
  requirements:
73
67
  - - "~>"
74
68
  - !ruby/object:Gem::Version
75
- version: '3.7'
69
+ version: '3.9'
76
70
  - !ruby/object:Gem::Dependency
77
71
  name: rspec-its
78
72
  requirement: !ruby/object:Gem::Requirement
79
73
  requirements:
80
74
  - - "~>"
81
75
  - !ruby/object:Gem::Version
82
- version: '1.2'
76
+ version: '1.3'
83
77
  type: :development
84
78
  prerelease: false
85
79
  version_requirements: !ruby/object:Gem::Requirement
86
80
  requirements:
87
81
  - - "~>"
88
82
  - !ruby/object:Gem::Version
89
- version: '1.2'
83
+ version: '1.3'
90
84
  - !ruby/object:Gem::Dependency
91
85
  name: rdf-spec
92
86
  requirement: !ruby/object:Gem::Requirement
93
87
  requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '2.2'
97
- - - "<"
88
+ - - "~>"
98
89
  - !ruby/object:Gem::Version
99
- version: '4.0'
90
+ version: '3.1'
100
91
  type: :development
101
92
  prerelease: false
102
93
  version_requirements: !ruby/object:Gem::Requirement
103
94
  requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- version: '2.2'
107
- - - "<"
95
+ - - "~>"
108
96
  - !ruby/object:Gem::Version
109
- version: '4.0'
97
+ version: '3.1'
110
98
  - !ruby/object:Gem::Dependency
111
99
  name: rake
112
100
  requirement: !ruby/object:Gem::Requirement
113
101
  requirements:
114
102
  - - "~>"
115
103
  - !ruby/object:Gem::Version
116
- version: '12.0'
104
+ version: '13.0'
117
105
  type: :development
118
106
  prerelease: false
119
107
  version_requirements: !ruby/object:Gem::Requirement
120
108
  requirements:
121
109
  - - "~>"
122
110
  - !ruby/object:Gem::Version
123
- version: '12.0'
111
+ version: '13.0'
124
112
  description: RDF.rb plugin for parsing/serializing NTriples, RDF/XML, Turtle and RDFa
125
113
  data using the Raptor RDF Parser library.
126
114
  email: public-rdf-ruby@w3.org
@@ -129,8 +117,9 @@ extensions: []
129
117
  extra_rdoc_files: []
130
118
  files:
131
119
  - AUTHORS
120
+ - CONTRIBUTING.md
132
121
  - CREDITS
133
- - README
122
+ - README.md
134
123
  - UNLICENSE
135
124
  - VERSION
136
125
  - etc/doap.ttl
@@ -175,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
175
164
  requirements:
176
165
  - - ">="
177
166
  - !ruby/object:Gem::Version
178
- version: 2.2.2
167
+ version: '2.4'
179
168
  required_rubygems_version: !ruby/object:Gem::Requirement
180
169
  requirements:
181
170
  - - ">="
@@ -183,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
172
  version: '0'
184
173
  requirements:
185
174
  - libraptor2 (>= 2.0)
186
- rubyforge_project:
187
- rubygems_version: 2.6.14
175
+ rubygems_version: 3.0.6
188
176
  signing_key:
189
177
  specification_version: 4
190
178
  summary: Raptor RDF Parser plugin for RDF.rb.
data/README DELETED
@@ -1 +0,0 @@
1
- ./README.md