rdf-turtle 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,18 +16,11 @@ Install with `gem install rdf-turtle`
16
16
  ## Usage
17
17
  Instantiate a reader from a local file:
18
18
 
19
- RDF::Turtle::Reader.open("etc/foaf.ttl") do |reader|
20
- reader.each_statement do |statement|
21
- puts statement.inspect
22
- end
23
- end
24
-
25
- or
19
+ graph = RDF::Graph.load("etc/doap.ttl", :format => :ttl)
26
20
 
27
- graph = RDF::Graph.load("etc/foaf.ttl", :format => :ttl)
28
-
21
+ Define `@base` and `@prefix` definitions, and use for serialization using `:base_uri` an `:prefixes` options.
29
22
 
30
- Define `@base` and `@prefix` definitions, and use for serialization using `:base_uri` an `:prefixes` options
23
+ Canonicalize and validate using `:canonicalize` and `:validate` options.
31
24
 
32
25
  Write a graph to a file:
33
26
 
@@ -54,10 +47,7 @@ In some cases, the specification is unclear on certain issues:
54
47
  are subject to unescaping. This means that an IRI which might otherwise be representable using a PNAME
55
48
  cannot if the IRI contains any characters that might need escaping. This implementation currently abides
56
49
  by this restriction. Presumably, this would affect both PNAME\_NS and PNAME\_LN terminals.
57
- * The empty prefix ':' does not have a default definition. In Notation, this definition was '<#>' which is specifically
58
- not intended to be used in Turtle. However, example markup using the empty prefix is common among examples. This
59
- implementation defines the empty prefix as an alias for the current base IRI (either defined using `@base`,
60
- or based on the document's origin).
50
+ (This is being tracked as issues [67](http://www.w3.org/2011/rdf-wg/track/issues/67)).
61
51
  * The EBNF definition of IRI_REF seems malformed, and has no provision for \^, as discussed elsewhere in the spec.
62
52
  We presume that [#0000- ] is intended to be [#0000-#0020].
63
53
  * The list example in section 6 uses a list on it's own, without a predicate or object, which is not allowed
@@ -106,7 +96,7 @@ Using SWAP utilities, this is done as follows:
106
96
  ## Installation
107
97
 
108
98
  The recommended installation method is via [RubyGems](http://rubygems.org/).
109
- To install the latest official release of the `SPARQL::Grammar` gem, do:
99
+ To install the latest official release of the `RDF::Turtle` gem, do:
110
100
 
111
101
  % [sudo] gem install rdf-turtle
112
102
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -359,10 +359,10 @@ module RDF::LL1
359
359
  # of this token.
360
360
  #
361
361
  # @example Matching using the symbolic type
362
- # SPARQL::Grammar::Lexer::Token.new(:NIL) === :NIL #=> true
362
+ # RDF::LL1::Lexer::Token.new(:NIL) === :NIL #=> true
363
363
  #
364
364
  # @example Matching using the string value
365
- # SPARQL::Grammar::Lexer::Token.new(nil, "{") === "{" #=> true
365
+ # RDF::LL1::Lexer::Token.new(nil, "{") === "{" #=> true
366
366
  #
367
367
  # @param [Symbol, String] value
368
368
  # @return [Boolean]
@@ -415,7 +415,7 @@ module RDF::LL1
415
415
  # Raised for errors during lexical analysis.
416
416
  #
417
417
  # @example Raising a lexer error
418
- # raise SPARQL::Grammar::Lexer::Error.new(
418
+ # raise RDF::LL1::Lexer::Error.new(
419
419
  # "invalid token '%' on line 10",
420
420
  # :input => query, :token => '%', :lineno => 9)
421
421
  #
@@ -308,7 +308,6 @@ module RDF::Turtle
308
308
  # Spec confusion, presume that an undefined empty prefix has an empty relative IRI, which uses
309
309
  # string contatnation rules against the in-scope IRI at the time of use
310
310
  def prefix(prefix, iri = nil)
311
- debug("prefix", "'#{prefix}' <#{iri}>")
312
311
  # Relative IRIs are resolved against @base
313
312
  iri = process_iri(iri) if iri
314
313
  super(prefix, iri)
@@ -320,14 +319,13 @@ module RDF::Turtle
320
319
  # Prefixes must be defined, except special case for empty prefix being alias for current @base
321
320
  if prefix(prefix)
322
321
  base = prefix(prefix).to_s
323
- elsif prefix.to_s.empty?
324
- base = base_uri.to_s
325
- else
326
- error("pname", "undefined prefix #{prefix.inspect}") unless prefix(prefix) || prefix.to_s.empty?
322
+ elsif !prefix(prefix)
323
+ error("pname", "undefined prefix #{prefix.inspect}")
324
+ base = ''
327
325
  end
328
326
  suffix = suffix.to_s.sub(/^\#/, "") if base.index("#")
329
327
  debug("pname", "base: '#{base}', suffix: '#{suffix}'")
330
- iri(base + suffix.to_s)
328
+ process_iri(base + suffix.to_s)
331
329
  end
332
330
 
333
331
  # Keep track of allocated BNodes
@@ -342,7 +340,7 @@ module RDF::Turtle
342
340
  # @option options [URI, #to_s] :production
343
341
  # @option options [Token] :token
344
342
  def error(node, message, options = {})
345
- if !@options[:validate] && !options[:fatal]
343
+ if !validate? && !options[:fatal]
346
344
  debug(node, message, options)
347
345
  else
348
346
  raise RDF::ReaderError, message, options[:backtrace]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-turtle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdf
16
- requirement: &2161384420 !ruby/object:Gem::Requirement
16
+ requirement: &2168942220 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.3.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2161384420
24
+ version_requirements: *2168942220
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: yard
27
- requirement: &2161383800 !ruby/object:Gem::Requirement
27
+ requirement: &2168941620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.6.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2161383800
35
+ version_requirements: *2168941620
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &2161383140 !ruby/object:Gem::Requirement
38
+ requirement: &2168941080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.5.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2161383140
46
+ version_requirements: *2168941080
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdf-spec
49
- requirement: &2161382320 !ruby/object:Gem::Requirement
49
+ requirement: &2168940600 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.3.2
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2161382320
57
+ version_requirements: *2168940600
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rdf-isomorphic
60
- requirement: &2161381700 !ruby/object:Gem::Requirement
60
+ requirement: &2168940140 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 0.3.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2161381700
68
+ version_requirements: *2168940140
69
69
  description: Turtle reader/writer for Ruby.
70
70
  email: public-rdf-ruby@w3.org
71
71
  executables: []