rdf 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -4,7 +4,7 @@ RDF.rb: Linked Data for Ruby
4
4
  This is a pure-Ruby library for working with [Resource Description Framework
5
5
  (RDF)][RDF] data.
6
6
 
7
- * <http://github.com/ruby-rdf/rdf>
7
+ * <http://ruby-rdf.github.com/rdf>
8
8
  * <http://blog.datagraph.org/2010/12/rdf-for-ruby>
9
9
  * <http://blog.datagraph.org/2010/03/rdf-for-ruby>
10
10
  * <http://blog.datagraph.org/2010/04/parsing-rdf-with-ruby>
@@ -67,11 +67,11 @@ or
67
67
  ### Reading RDF data in the N-Triples format
68
68
 
69
69
  require 'rdf/ntriples'
70
- graph = RDF::Graph.load("http://rdf.rubyforge.org/doap.nt")
70
+ graph = RDF::Graph.load("http://ruby-rdf.github.com/rdf/etc/doap.nt")
71
71
 
72
72
  or
73
73
 
74
- RDF::Reader.open("http://rdf.rubyforge.org/doap.nt") do |reader|
74
+ RDF::Reader.open("http://ruby-rdf.github.com/rdf/etc/doap.nt") do |reader|
75
75
  reader.each_statement do |statement|
76
76
  puts statement.inspect
77
77
  end
@@ -85,13 +85,13 @@ MimeType or file extension, where available.
85
85
 
86
86
  require 'linkeddata'
87
87
 
88
- graph = RDF::Graph.load("etc/doap.nq", :format => :nquads)
88
+ graph = RDF::Graph.load("http://ruby-rdf.github.com/rdf/etc/doap.nq", :format => :nquads)
89
89
 
90
90
  A specific sub-type of Reader can also be invoked directly:
91
91
 
92
92
  require 'rdf/nquads'
93
93
 
94
- RDF::NQuads::Reader.open("http://rdf.rubyforge.org/doap.nq") do |reader|
94
+ RDF::NQuads::Reader.open("http://ruby-rdf.github.com/rdf/etc/doap.nq") do |reader|
95
95
  reader.each_statement do |statement|
96
96
  puts statement.inspect
97
97
  end
@@ -117,13 +117,13 @@ appropriate writer to use.
117
117
 
118
118
  A specific sub-type of Writer can also be invoked directly:
119
119
 
120
- graph.dump(:nq)
120
+ graph.dump(:nquads)
121
121
 
122
122
  ### Querying RDF data using basic graph patterns (BGPs)
123
123
 
124
124
  require 'rdf/ntriples'
125
125
 
126
- graph = RDF::Graph.load("http://rdf.rubyforge.org/doap.nt")
126
+ graph = RDF::Graph.load("http://ruby-rdf.github.com/rdf/etc/doap.nt")
127
127
  query = RDF::Query.new({
128
128
  :person => {
129
129
  RDF.type => FOAF.Person,
@@ -197,16 +197,17 @@ other gems:
197
197
 
198
198
  * {RDF::NTriples}
199
199
  * {RDF::NQuads}
200
- * [JSON::LD][JSONLD doc] (plugin)
201
- * [RDF::JSON](http://rubydoc.info/github/ruby-rdf/rdf-json/frames) (plugin)
202
- * [RDF::Microdata][Microdata doc] (plugin)
203
- * [RDF::N3][N3 doc] (plugin)
204
- * [RDF::Raptor::RDFXML](http://rdf.rubyforge.org/raptor/) (plugin)
205
- * [RDF::Raptor::Turtle](http://rdf.rubyforge.org/raptor/) (plugin)
206
- * [RDF::RDFa][RDFa doc] (plugin)
207
- * [RDF::RDFXML][RDFXML doc] (plugin)
208
- * [RDF::Trix](http://rubydoc.info/github/ruby-rdf/rdf-trix/frames) (plugin)
209
- * [RDF::Turtle][Turtle doc] (plugin)
200
+ * [JSON::LD][] (plugin)
201
+ * [RDF::JSON][] (plugin)
202
+ * [RDF::Microdata][] (plugin)
203
+ * [RDF::N3][] (plugin)
204
+ * [RDF::Raptor::RDFXML](http://ruby-rdf.github.com/rdf-raptor) (plugin)
205
+ * [RDF::Raptor::Turtle](http://ruby-rdf.github.com/rdf-raptor) (plugin)
206
+ * [RDF::RDFa][] (plugin)
207
+ * [RDF::RDFXML][] (plugin)
208
+ * [RDF::TriG][] (plugin)
209
+ * [RDF::TriX][] (plugin)
210
+ * [RDF::Turtle][] (plugin)
210
211
 
211
212
  The meta-gem [LinkedData][LinkedData doc] includes many of these gems.
212
213
 
@@ -359,3 +360,17 @@ see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
359
360
  [Turtle doc]: http://rubydoc.info/github/ruby-rdf/rdf-turtle/master/frames
360
361
  [SPARQL doc]: http://rubydoc.info/github/ruby-rdf/sparql/frames
361
362
  [SPARQL 1.0]: http://www.w3.org/TR/rdf-sparql-query/
363
+ [RDF.rb]: http://ruby-rdf.github.com/rdf
364
+ [RDF::DO]: http://ruby-rdf.github.com/rdf-do
365
+ [RDF::Mongo]: http://ruby-rdf.github.com/rdf-mongo
366
+ [RDF::Sesame]: http://ruby-rdf.github.com/rdf-sesame
367
+ [RDF::JSON]: http://ruby-rdf.github.com/rdf-json
368
+ [RDF::Microdata]: http://ruby-rdf.github.com/rdf-microdata
369
+ [RDF::N3]: http://ruby-rdf.github.com/rdf-n3
370
+ [RDF::RDFa]: http://ruby-rdf.github.com/rdf-rdfa
371
+ [RDF::RDFXML]: http://ruby-rdf.github.com/rdf-rdfxml
372
+ [RDF::TriX]: http://ruby-rdf.github.com/rdf-trix
373
+ [RDF::Turtle]: http://ruby-rdf.github.com/rdf-turtle
374
+ [RDF::Raptor]: http://ruby-rdf.github.com/rdf-raptor
375
+ [LinkedData]: http://ruby-rdf.github.com/linkeddata
376
+ [JSON::LD]: http://gkellogg.github.com/json-ld
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.7
1
+ 0.3.8
data/lib/rdf/format.rb CHANGED
@@ -119,13 +119,15 @@ module RDF
119
119
  end
120
120
 
121
121
  when Symbol
122
- case format = options
123
- # Special case, since we want this to work despite autoloading
124
- when :ntriples
125
- RDF::NTriples::Format
126
- # For anything else, find a match based on the full class name
127
- else
128
- @@subclasses.detect { |klass| klass.to_sym == format }
122
+ # Try to find a match based on the full class name
123
+ # We want this to work even if autoloading fails
124
+ format = options
125
+ @@subclasses.detect { |klass| klass.to_sym == format } ||
126
+ case format
127
+ when :ntriples
128
+ RDF::NTriples::Format
129
+ when :nquads
130
+ RDF::NQuads::Format
129
131
  end
130
132
  end
131
133
 
@@ -211,7 +213,7 @@ module RDF
211
213
  elements = self.to_s.split("::")
212
214
  sym = elements.pop
213
215
  sym = elements.pop if sym == 'Format'
214
- sym.downcase.to_s.to_sym
216
+ sym.downcase.to_s.to_sym if sym.is_a?(String)
215
217
  end
216
218
 
217
219
  ##
@@ -6,7 +6,7 @@ module RDF; class Literal
6
6
  # @since 0.2.1
7
7
  class Date < Literal
8
8
  DATATYPE = XSD.date
9
- GRAMMAR = %r(\A-?\d{4}-\d{2}-\d{2}(([\+\-]\d{2}:\d{2})|UTC|Z)?\Z).freeze
9
+ GRAMMAR = %r(\A-?\d{4}-\d{2}-\d{2}(([\+\-]\d{2}:\d{2})|UTC|GMT|Z)?\Z).freeze
10
10
  FORMAT = '%Y-%m-%d%Z'.freeze
11
11
 
12
12
  ##
@@ -29,7 +29,7 @@ module RDF; class Literal
29
29
  # @return [RDF::Literal] `self`
30
30
  # @see http://www.w3.org/TR/xmlschema-2/#date
31
31
  def canonicalize!
32
- @string = @object.strftime(FORMAT).sub(/\+00:00|UTC/, 'Z') if self.valid?
32
+ @string = @object.strftime(FORMAT).sub(/\+00:00|UTC|GMT/, 'Z') if self.valid?
33
33
  self
34
34
  end
35
35
 
@@ -50,7 +50,7 @@ module RDF; class Literal
50
50
  #
51
51
  # @return [String]
52
52
  def to_s
53
- @string || @object.strftime(FORMAT).sub(/\+00:00|UTC/, 'Z')
53
+ @string || @object.strftime(FORMAT).sub(/\+00:00|UTC|GMT/, 'Z')
54
54
  end
55
55
 
56
56
  ##
@@ -6,7 +6,7 @@ module RDF; class Literal
6
6
  # @since 0.2.1
7
7
  class DateTime < Literal
8
8
  DATATYPE = XSD.dateTime
9
- GRAMMAR = %r(\A-?\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(([\+\-]\d{2}:\d{2})|UTC|Z)?\Z).freeze
9
+ GRAMMAR = %r(\A-?\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(([\+\-]\d{2}:\d{2})|UTC|GMT|Z)?\Z).freeze
10
10
 
11
11
  ##
12
12
  # @param [DateTime] value
@@ -28,7 +28,7 @@ module RDF; class Literal
28
28
  # @return [RDF::Literal] `self`
29
29
  # @see http://www.w3.org/TR/xmlschema-2/#dateTime
30
30
  def canonicalize!
31
- @string = @object.new_offset(0).strftime('%Y-%m-%dT%H:%M:%S%Z').sub(/\+00:00|UTC/, 'Z') if self.valid?
31
+ @string = @object.new_offset(0).strftime('%Y-%m-%dT%H:%M:%S%Z').sub(/\+00:00|UTC|GMT/, 'Z') if self.valid?
32
32
  self
33
33
  end
34
34
 
@@ -49,7 +49,7 @@ module RDF; class Literal
49
49
  #
50
50
  # @return [String]
51
51
  def to_s
52
- @string || @object.strftime('%Y-%m-%dT%H:%M:%S%Z').sub(/\+00:00|UTC/, 'Z')
52
+ @string || @object.strftime('%Y-%m-%dT%H:%M:%S%Z').sub(/\+00:00|UTC|GMT/, 'Z')
53
53
  end
54
54
 
55
55
  ##
@@ -11,7 +11,7 @@ module RDF; class Literal
11
11
  # @since 0.2.1
12
12
  class Time < Literal
13
13
  DATATYPE = XSD.time
14
- GRAMMAR = %r(\A\d{2}:\d{2}:\d{2}(\.\d+)?(([\+\-]\d{2}:\d{2})|UTC|Z)?\Z).freeze
14
+ GRAMMAR = %r(\A\d{2}:\d{2}:\d{2}(\.\d+)?(([\+\-]\d{2}:\d{2})|UTC|GMT|Z)?\Z).freeze
15
15
 
16
16
  ##
17
17
  # @param [Time] value
@@ -41,7 +41,7 @@ module RDF; class Literal
41
41
  # @return [RDF::Literal] `self`
42
42
  # @see http://www.w3.org/TR/xmlschema-2/#time
43
43
  def canonicalize!
44
- @string = @object.utc.strftime('%H:%M:%S%Z').sub(/\+00:00|UTC/, 'Z') if self.valid?
44
+ @string = @object.utc.strftime('%H:%M:%S%Z').sub(/\+00:00|UTC|GMT/, 'Z') if self.valid?
45
45
  self
46
46
  end
47
47
 
@@ -62,7 +62,7 @@ module RDF; class Literal
62
62
  #
63
63
  # @return [String]
64
64
  def to_s
65
- @string || @object.strftime('%H:%M:%S%Z').sub(/\+00:00|UTC/, 'Z')
65
+ @string || @object.strftime('%H:%M:%S%Z').sub(/\+00:00|UTC|GMT/, 'Z')
66
66
  end
67
67
 
68
68
  ##
@@ -2,6 +2,9 @@ module RDF; class Literal
2
2
  ##
3
3
  # An XML literal.
4
4
  #
5
+ # This class exists mostly as a stub. See RDF::XSD gem for full support.
6
+
7
+ # @see https://github.com/ruby-rdf/rdf-xsd/blob/master/lib/rdf/xsd/xml.rb
5
8
  # @see http://www.w3.org/TR/rdf-concepts/#section-XMLLiteral
6
9
  # @see http://www.w3.org/TR/rdfa-core/#s_xml_literals
7
10
  # @since 0.2.1
@@ -24,7 +27,6 @@ module RDF; class Literal
24
27
  # @return [RDF::Literal] `self`
25
28
  # @see http://www.w3.org/TR/xml-exc-c14n/
26
29
  def canonicalize!
27
- # TODO: implement XML canonicalization
28
30
  self
29
31
  end
30
32
 
@@ -33,7 +35,7 @@ module RDF; class Literal
33
35
  #
34
36
  # @return [String]
35
37
  def to_s
36
- @string || @object.to_s # TODO
38
+ @string || @object.to_s
37
39
  end
38
40
  end # XML
39
41
  end; end # RDF::Literal
metadata CHANGED
@@ -1,97 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rdf
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.8
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 7
10
- version: 0.3.7
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Arto Bendiken
14
9
  - Ben Lavender
15
10
  - Gregg Kellogg
16
11
  autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
-
20
- date: 2012-06-17 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
14
+ date: 2012-08-26 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
23
17
  name: addressable
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirement: !ruby/object:Gem::Requirement
26
19
  none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 11
31
- segments:
32
- - 2
33
- - 2
34
- - 6
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
35
23
  version: 2.2.6
36
24
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: yard
40
25
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ! '>='
30
+ - !ruby/object:Gem::Version
31
+ version: 2.2.6
32
+ - !ruby/object:Gem::Dependency
33
+ name: yard
34
+ requirement: !ruby/object:Gem::Requirement
42
35
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 9
47
- segments:
48
- - 0
49
- - 7
50
- - 5
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
51
39
  version: 0.7.5
52
40
  type: :development
53
- version_requirements: *id002
54
- - !ruby/object:Gem::Dependency
55
- name: rdf-spec
56
41
  prerelease: false
57
- requirement: &id003 !ruby/object:Gem::Requirement
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.7.5
48
+ - !ruby/object:Gem::Dependency
49
+ name: rdf-spec
50
+ requirement: !ruby/object:Gem::Requirement
58
51
  none: false
59
- requirements:
52
+ requirements:
60
53
  - - ~>
61
- - !ruby/object:Gem::Version
62
- hash: 25
63
- segments:
64
- - 0
65
- - 3
66
- - 5
67
- version: 0.3.5
54
+ - !ruby/object:Gem::Version
55
+ version: 0.3.8
68
56
  type: :development
69
- version_requirements: *id003
70
- - !ruby/object:Gem::Dependency
71
- name: rspec
72
57
  prerelease: false
73
- requirement: &id004 !ruby/object:Gem::Requirement
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: 0.3.8
64
+ - !ruby/object:Gem::Dependency
65
+ name: rspec
66
+ requirement: !ruby/object:Gem::Requirement
74
67
  none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- hash: 47
79
- segments:
80
- - 2
81
- - 8
82
- - 0
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
83
71
  version: 2.8.0
84
72
  type: :development
85
- version_requirements: *id004
86
- description: RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data.
73
+ prerelease: false
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: 2.8.0
80
+ description: RDF.rb is a pure-Ruby library for working with Resource Description Framework
81
+ (RDF) data.
87
82
  email: public-rdf-ruby@w3.org
88
- executables:
83
+ executables:
89
84
  - rdf
90
85
  extensions: []
91
-
92
86
  extra_rdoc_files: []
93
-
94
- files:
87
+ files:
95
88
  - AUTHORS
96
89
  - CREDITS
97
90
  - README
@@ -171,41 +164,30 @@ files:
171
164
  - lib/rdf/vocab.rb
172
165
  - lib/rdf/writer.rb
173
166
  - lib/rdf.rb
174
- homepage: http://github.com/ruby-rdf/rdf
175
- licenses:
167
+ homepage: http://ruby-rdf.github.com/rdf
168
+ licenses:
176
169
  - Public Domain
177
170
  post_install_message:
178
171
  rdoc_options: []
179
-
180
- require_paths:
172
+ require_paths:
181
173
  - lib
182
- required_ruby_version: !ruby/object:Gem::Requirement
174
+ required_ruby_version: !ruby/object:Gem::Requirement
183
175
  none: false
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- hash: 53
188
- segments:
189
- - 1
190
- - 8
191
- - 1
176
+ requirements:
177
+ - - ! '>='
178
+ - !ruby/object:Gem::Version
192
179
  version: 1.8.1
193
- required_rubygems_version: !ruby/object:Gem::Requirement
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
194
181
  none: false
195
- requirements:
196
- - - ">="
197
- - !ruby/object:Gem::Version
198
- hash: 3
199
- segments:
200
- - 0
201
- version: "0"
182
+ requirements:
183
+ - - ! '>='
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
202
186
  requirements: []
203
-
204
187
  rubyforge_project: rdf
205
- rubygems_version: 1.8.17
188
+ rubygems_version: 1.8.24
206
189
  signing_key:
207
190
  specification_version: 3
208
191
  summary: A Ruby library for working with Resource Description Framework (RDF) data.
209
192
  test_files: []
210
-
211
193
  has_rdoc: false