rdf-raptor 1.1.2 → 1.2.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
- ---
2
- SHA1:
3
- metadata.gz: c42b95d9190c14c278a7070846273170d4a3729d
4
- data.tar.gz: 498f96cf1f00e20fb06cb98611b8a1b42158ec76
5
- SHA512:
6
- metadata.gz: fd1d8457304c061a69c1e77d92ffb34b401783cf45b45bbbebc13cde84c3d7a0ec2fbb6a9543f3f3ffe89c8ad7debf320aece460b3c5a8c3d42b81fc1e9a86dc
7
- data.tar.gz: 6930375299c6a2a6efb71179e8452c1e459b4b9ee832d1b3e536660fc611e122673b2f5fdf11f43eb3603ead34a1a83e801b678a4dd7a1955b245b5535b45c3c
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c280bd4c2d61fce08c1f23c4924e648a43b8d4c2
4
+ data.tar.gz: 0d3f0b2640f3b2c08b1834e2ee4e39d5e7007c5b
5
+ SHA512:
6
+ metadata.gz: 957fac71b4c7d3895241b61dd2d7ed11c2386245608d521ddba60d3bdaceab9162dd39d0eccc3410eb7197ebe0c47623142f642cfc614c41b05ddeaf084d82d2
7
+ data.tar.gz: 9c2bdce799908d6b794cce599b08486dd77f2c6919dc617c12987edf56efdbf5cdafd76edfeee84469f7969dc9689962641bcb47d41a39232183f75684893250
data/README CHANGED
@@ -1,11 +1,11 @@
1
1
  Raptor RDF Parser Plugin for RDF.rb
2
2
  ===================================
3
3
 
4
- This is an [RDF.rb][] plugin that adds support for parsing/serializing [NTriples][],
4
+ This is an [RDF.rb][] extension that adds support for parsing/serializing [NTriples][],
5
5
  [RDF/XML][], [Turtle][], [RDFa][], and [Graphviz][] data using the [Raptor RDF Parser][Raptor]
6
6
  library.
7
7
 
8
- * <http://github.com/ruby-rdf/rdf-raptor>
8
+ * <https://github.com/ruby-rdf/rdf-raptor>
9
9
  * <http://blog.datagraph.org/2010/04/parsing-rdf-with-ruby>
10
10
 
11
11
  [![Gem Version](https://badge.fury.io/rb/rdf-raptor.png)](http://badge.fury.io/rb/rdf-raptor)
@@ -173,12 +173,12 @@ Download
173
173
 
174
174
  To get a local working copy of the development repository, do:
175
175
 
176
- % git clone git://github.com/ruby-rdf/rdf-raptor.git
176
+ % git clone git@github.com:ruby-rdf/rdf-raptor.git
177
177
 
178
178
  Alternatively, download the latest development version as a tarball as
179
179
  follows:
180
180
 
181
- % wget http://github.com/ruby-rdf/rdf-raptor/tarball/master
181
+ % wget https://github.com/ruby-rdf/rdf-raptor/tarball/master
182
182
 
183
183
  Mailing List
184
184
  ------------
@@ -188,15 +188,15 @@ Mailing List
188
188
  Authors
189
189
  -------
190
190
 
191
- * [Arto Bendiken](http://github.com/bendiken) - <http://ar.to/>
192
- * [John Fieber](http://github.com/jfieber) - <http://github.com/jfieber>
191
+ * [Arto Bendiken](https://github.com/bendiken) - <http://ar.to/>
192
+ * [John Fieber](https://github.com/jfieber) - <http://github.com/jfieber>
193
193
 
194
194
  Contributors
195
195
  ------------
196
196
 
197
- * [Ben Lavender](http://github.com/bhuga) - <http://bhuga.net/>
198
- * [David Butler](http://github.com/dwbutler) - <http://github.com/dwbutler>
199
- * [Gregg Kellogg](http://github.com/gkellogg) - <http://greggkellogg.net/>
197
+ * [Ben Lavender](https://github.com/bhuga) - <http://bhuga.net/>
198
+ * [David Butler](https://github.com/dwbutler) - <http://github.com/dwbutler>
199
+ * [Gregg Kellogg](https://github.com/gkellogg) - <http://greggkellogg.net/>
200
200
 
201
201
  License
202
202
  -------
@@ -204,10 +204,10 @@ License
204
204
  This is free and unencumbered public domain software. For more information,
205
205
  see <http://unlicense.org/> or the accompanying [UNLICENSE][] file.
206
206
 
207
- [RDF.rb]: http://ruby-rdf.github.com/rdf
208
- [NTriples]: http://en.wikipedia.org/wiki/N-Triples
207
+ [RDF.rb]: https://ruby-rdf.github.io/rdf
208
+ [NTriples]: https://en.wikipedia.org/wiki/N-Triples
209
209
  [RDF/XML]: http://www.w3.org/TR/REC-rdf-syntax/
210
- [Turtle]: http://en.wikipedia.org/wiki/Turtle_(syntax)
210
+ [Turtle]: https://en.wikipedia.org/wiki/Turtle_(syntax)
211
211
  [RDFa]: http://rdfa.info/
212
212
  [Graphviz]: http://www.graphviz.org/
213
213
  [Raptor]: http://librdf.org/raptor/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.2
1
+ 1.2.0
@@ -41,8 +41,14 @@ module RDF::Raptor
41
41
  def initialize(input = $stdin, options = {}, &block)
42
42
  @format = self.class.format.rapper_format
43
43
  @parser = V2::Parser.new(@format)
44
- @parser.error_handler = ERROR_HANDLER
44
+ @parser.error_handler = ERROR_HANDLER
45
45
  @parser.warning_handler = WARNING_HANDLER
46
+
47
+ @parser.namespace_handler = Proc.new do |user_data, raptor_namespace|
48
+ namespace = V2::Namespace.new(raptor_namespace)
49
+ prefix(namespace.prefix, namespace.uri) if namespace.prefix_length > 0
50
+ end
51
+
46
52
  super
47
53
  end
48
54
 
@@ -11,6 +11,7 @@ module RDF::Raptor::FFI
11
11
  autoload :Statement, 'rdf/raptor/ffi/v2/statement'
12
12
  autoload :URI, 'rdf/raptor/ffi/v2/uri'
13
13
  autoload :Term, 'rdf/raptor/ffi/v2/term'
14
+ autoload :Namespace, 'rdf/raptor/ffi/v2/namespace'
14
15
  autoload :World, 'rdf/raptor/ffi/v2/world'
15
16
 
16
17
  extend ::FFI::Library
@@ -77,13 +78,19 @@ module RDF::Raptor::FFI
77
78
  attach_function :raptor_new_term_from_blank, [:raptor_world, :blank], :raptor_term
78
79
  attach_function :raptor_free_term, [:raptor_term], :void
79
80
 
81
+ # @see http://librdf.org/raptor/api/raptor2-section-xml-namespace.html
82
+ typedef :pointer, :raptor_namespace
83
+ attach_function :raptor_free_namespace, [:raptor_namespace], :void
84
+
80
85
  # @see http://librdf.org/raptor/api/raptor2-section-parser.html
81
86
  callback :raptor_statement_handler, [:pointer, :raptor_statement], :void
87
+ callback :raptor_namespace_handler, [:pointer, :raptor_namespace], :void
82
88
  typedef :pointer, :raptor_parser
83
89
  typedef :string, :mime_type
84
90
  typedef :string, :buffer
85
91
  attach_function :raptor_new_parser, [:raptor_world, :string], :raptor_parser
86
92
  attach_function :raptor_world_guess_parser_name, [:raptor_world, :raptor_uri, :mime_type, :buffer, :size_t, :string], :string
93
+ attach_function :raptor_parser_set_namespace_handler, [:raptor_parser, :pointer, :raptor_namespace_handler], :void
87
94
  #attach_function :raptor_set_error_handler, [:raptor_parser, :pointer, :raptor_message_handler], :void
88
95
  #attach_function :raptor_set_warning_handler, [:raptor_parser, :pointer, :raptor_message_handler], :void
89
96
  attach_function :raptor_parser_set_statement_handler, [:raptor_parser, :pointer, :raptor_statement_handler], :void
@@ -112,9 +119,6 @@ module RDF::Raptor::FFI
112
119
  callback :raptor_iostream_read_bytes_func, [:pointer, :pointer, :size_t, :size_t], :int
113
120
  callback :raptor_iostream_read_eof_func, [:pointer], :int
114
121
 
115
- # @see http://librdf.org/raptor/api-1.4/raptor-section-xml-namespace.html
116
- typedef :pointer, :raptor_namespace
117
-
118
122
  # @see http://librdf.org/raptor/api/raptor2-section-serializer.html
119
123
  typedef :pointer, :raptor_serializer
120
124
  typedef :string, :prefix
@@ -0,0 +1,38 @@
1
+ module RDF::Raptor::FFI::V2
2
+ ##
3
+ # @see http://librdf.org/raptor/api/raptor2-section-xml-namespace.html
4
+ class Namespace < ::FFI::Struct
5
+ include RDF::Raptor::FFI
6
+ # @see https://github.com/dajobe/raptor/blob/f4b2597d4279dcb283bf5c32e5435696fd28a8ec/src/raptor_internal.h#L428
7
+ layout :next, :pointer,
8
+ :nstack, :pointer,
9
+ :prefix, :string,
10
+ :prefix_length, :int,
11
+ :uri, :pointer,
12
+ :depth, :int,
13
+ :is_xml, :int,
14
+ :is_rdf_ms, :int,
15
+ :is_rdf_schema, :int
16
+
17
+ def prefix
18
+ self[:prefix].to_s
19
+ end
20
+
21
+ def prefix_length
22
+ self[:prefix_length]
23
+ end
24
+
25
+ def uri
26
+ RDF::URI.new(V2.raptor_uri_as_string(self[:uri]))
27
+ end
28
+
29
+ ##
30
+ # Releases `libraptor` memory associated with this structure.
31
+ #
32
+ # @return [void]
33
+ def free
34
+ V2.raptor_free_namespace(self) unless ptr.null?
35
+ end
36
+ alias_method :release, :free
37
+ end
38
+ end
@@ -3,7 +3,7 @@ module RDF::Raptor::FFI::V2
3
3
  # This class provides the functionality of turning syntaxes into RDF
4
4
  # triples - RDF parsing.
5
5
  #
6
- # @see http://librdf.org/raptor/api-1.4/raptor-section-parser.html
6
+ # @see http://librdf.org/raptor/api/raptor2-section-parser.html
7
7
  class Parser < ::FFI::ManagedStruct
8
8
  include RDF::Raptor::FFI
9
9
  layout :world, :pointer # the actual layout is private
@@ -62,6 +62,13 @@ module RDF::Raptor::FFI::V2
62
62
  V2.raptor_parser_set_statement_handler(self, self, handler)
63
63
  end
64
64
 
65
+ ##
66
+ # @param [Proc] handler
67
+ # @return [void]
68
+ def namespace_handler=(handler)
69
+ V2.raptor_parser_set_namespace_handler(self, self, handler)
70
+ end
71
+
65
72
  ##
66
73
  # @param [Object] input
67
74
  # the input to parse
metadata CHANGED
@@ -1,107 +1,87 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rdf-raptor
3
- version: !ruby/object:Gem::Version
4
- version: 1.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Arto Bendiken
8
8
  - John Fieber
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-31 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: ffi
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
12
+
13
+ date: 2014-04-06 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ version_requirements: &id001 !ruby/object:Gem::Requirement
17
+ requirements:
18
18
  - - ">="
19
- - !ruby/object:Gem::Version
19
+ - !ruby/object:Gem::Version
20
20
  version: 1.9.3
21
- type: :runtime
21
+ name: ffi
22
+ requirement: *id001
22
23
  prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: 1.9.3
28
- - !ruby/object:Gem::Dependency
29
- name: rdf
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 1.1.0
35
24
  type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
25
+ - !ruby/object:Gem::Dependency
26
+ version_requirements: &id002 !ruby/object:Gem::Requirement
27
+ requirements:
39
28
  - - ">="
40
- - !ruby/object:Gem::Version
29
+ - !ruby/object:Gem::Version
41
30
  version: 1.1.0
42
- - !ruby/object:Gem::Dependency
43
- name: yard
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: 0.8.6
49
- type: :development
31
+ name: rdf
32
+ requirement: *id002
50
33
  prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
34
+ type: :runtime
35
+ - !ruby/object:Gem::Dependency
36
+ version_requirements: &id003 !ruby/object:Gem::Requirement
37
+ requirements:
53
38
  - - ">="
54
- - !ruby/object:Gem::Version
39
+ - !ruby/object:Gem::Version
55
40
  version: 0.8.6
56
- - !ruby/object:Gem::Dependency
57
- name: rspec
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 2.14.0
63
- type: :development
41
+ name: yard
42
+ requirement: *id003
64
43
  prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
44
+ type: :development
45
+ - !ruby/object:Gem::Dependency
46
+ version_requirements: &id004 !ruby/object:Gem::Requirement
47
+ requirements:
67
48
  - - ">="
68
- - !ruby/object:Gem::Version
49
+ - !ruby/object:Gem::Version
69
50
  version: 2.14.0
70
- - !ruby/object:Gem::Dependency
71
- name: rdf-spec
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: 1.1.0
77
- type: :development
51
+ name: rspec
52
+ requirement: *id004
78
53
  prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
54
+ type: :development
55
+ - !ruby/object:Gem::Dependency
56
+ version_requirements: &id005 !ruby/object:Gem::Requirement
57
+ requirements:
81
58
  - - ">="
82
- - !ruby/object:Gem::Version
59
+ - !ruby/object:Gem::Version
83
60
  version: 1.1.0
84
- - !ruby/object:Gem::Dependency
85
- name: rake
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: '0'
61
+ name: rdf-spec
62
+ requirement: *id005
63
+ prerelease: false
91
64
  type: :development
65
+ - !ruby/object:Gem::Dependency
66
+ version_requirements: &id006 !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - &id007
69
+ - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: "0"
72
+ name: rake
73
+ requirement: *id006
92
74
  prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: '0'
98
- description: RDF.rb plugin for parsing/serializing NTriples, RDF/XML, Turtle and RDFa
99
- data using the Raptor RDF Parser library.
75
+ type: :development
76
+ description: RDF.rb plugin for parsing/serializing NTriples, RDF/XML, Turtle and RDFa data using the Raptor RDF Parser library.
100
77
  email: public-rdf-ruby@w3.org
101
78
  executables: []
79
+
102
80
  extensions: []
81
+
103
82
  extra_rdoc_files: []
104
- files:
83
+
84
+ files:
105
85
  - AUTHORS
106
86
  - CREDITS
107
87
  - README
@@ -121,6 +101,7 @@ files:
121
101
  - lib/rdf/raptor/ffi/v2.rb
122
102
  - lib/rdf/raptor/ffi/v2/iostream.rb
123
103
  - lib/rdf/raptor/ffi/v2/iostream_handler.rb
104
+ - lib/rdf/raptor/ffi/v2/namespace.rb
124
105
  - lib/rdf/raptor/ffi/v2/parser.rb
125
106
  - lib/rdf/raptor/ffi/v2/serializer.rb
126
107
  - lib/rdf/raptor/ffi/v2/statement.rb
@@ -135,24 +116,24 @@ files:
135
116
  - lib/rdf/raptor/turtle.rb
136
117
  - lib/rdf/raptor/version.rb
137
118
  homepage: http://ruby-rdf.github.com/rdf-raptor
138
- licenses:
119
+ licenses:
139
120
  - Public Domain
140
121
  metadata: {}
122
+
141
123
  post_install_message:
142
124
  rdoc_options: []
143
- require_paths:
125
+
126
+ require_paths:
144
127
  - lib
145
- required_ruby_version: !ruby/object:Gem::Requirement
146
- requirements:
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
147
130
  - - ">="
148
- - !ruby/object:Gem::Version
131
+ - !ruby/object:Gem::Version
149
132
  version: 1.9.2
150
- required_rubygems_version: !ruby/object:Gem::Requirement
151
- requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- version: '0'
155
- requirements:
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - *id007
136
+ requirements:
156
137
  - libraptor (>= 2.0)
157
138
  rubyforge_project: rdf
158
139
  rubygems_version: 2.2.2
@@ -160,4 +141,5 @@ signing_key:
160
141
  specification_version: 4
161
142
  summary: Raptor RDF Parser plugin for RDF.rb.
162
143
  test_files: []
144
+
163
145
  has_rdoc: false