rdf-turtle 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/History CHANGED
@@ -1,3 +1,10 @@
1
+ ### 0.3.1
2
+ * Sync with rdf-spec 0.3.11 changes due to respec updates.
3
+
4
+ ### 0.3.0
5
+ * Use Ruby native EBNF parser. Still requires cwm to create first/follow rules.
6
+ * Updated to latest specification and EBNF rules.
7
+
1
8
  ### 0.1.1
2
9
  * Improvements to allow reader & writer to be sub-classed for rdf-trig.
3
10
  * Improved error recovery when parsing.
@@ -41,23 +41,9 @@ Full documentation available on [Rubydoc.info][Turtle doc]
41
41
  ### Variations from the spec
42
42
  In some cases, the specification is unclear on certain issues:
43
43
 
44
- * In section 2.1, the [spec][Turtle] indicates that "Literals ,
45
- prefixed names and IRIs may also contain escapes to encode surrounding syntax ...",
46
- however the description in 5.2 indicates that only IRI\_REF and the various STRING\_LITERAL terms
47
- are subject to unescaping. This means that an IRI which might otherwise be representable using a PNAME
48
- cannot if the IRI contains any characters that might need escaping. This implementation currently abides
49
- by this restriction. Presumably, this would affect both PNAME\_NS and PNAME\_LN terminals.
50
- (This is being tracked as issues [67](http://www.w3.org/2011/rdf-wg/track/issues/67)).
51
- * The EBNF definition of IRIREF seems malformed, and has no provision for \^, as discussed elsewhere in the spec.
52
- We presume that [#0000- ] is intended to be [#0000-#0020].
53
- * The list example in section 6 uses a list on it's own, without a predicate or object, which is not allowed
54
- by the grammar (neither is a blankNodeProperyList). Either the EBNF should be updated to allow for these
55
- forms, or the examples should be changed such that ( ... ) and [ ... ] are used only in the context of being
56
- a subject or object. This implementation will generate triples, however an error will be generated if the
57
- parser is run in validation mode.
58
44
  * For the time being, plain literals are generated without an xsd:string datatype, but literals with an xsd:string
59
45
  datatype are saved as non-datatyped triples in the graph. This will be updated in the future when the rest of the
60
- library suite is brought up to date.
46
+ library suite is brought up to date with RDF 1.1.
61
47
 
62
48
  ## Implementation Notes
63
49
  The reader uses a generic LL1 parser {RDF::LL1::Parser} and lexer {RDF::LL1::Lexer}. The parser takes branch and follow
@@ -69,13 +55,9 @@ through a set of regular expressions used to match each type of terminal, descri
69
55
 
70
56
  etc/turtle.bnf is used to to generate a Notation3 representation of the grammar, a transformed LL1 representation and ultimately {RDF::Turtle::Meta}.
71
57
 
72
- Using SWAP utilities, this is done as follows:
58
+ Using local and [SWAP][] utilities, this is done as follows:
73
59
 
74
- python http://www.w3.org/2000/10/swap/grammar/ebnf2turtle.py \
75
- etc/turtle.bnf \
76
- ttl language \
77
- 'http://www.w3.org/ns/formats/Turtle#' > |
78
- sed -e 's/^ ".*"$/ g:seq (&)/' > etc/turtle.n3
60
+ script/ebnf2ttl -f ttl -o etc/turtle.n3 etc/turtle.bnf
79
61
 
80
62
  python http://www.w3.org/2000/10/swap/cwm.py etc/turtle.n3 \
81
63
  http://www.w3.org/2000/10/swap/grammar/ebnf2bnf.n3 \
@@ -86,12 +68,13 @@ Using SWAP utilities, this is done as follows:
86
68
  --grammar etc/turtle-ll1.n3 \
87
69
  --lang 'http://www.w3.org/ns/formats/Turtle#language' \
88
70
  --output lib/rdf/turtle/meta.rb
89
-
90
-
71
+
72
+ Future releases will replace the need for cym using Ruby-native graph inference.
73
+
91
74
  ## Dependencies
92
75
 
93
76
  * [Ruby](http://ruby-lang.org/) (>= 1.8.7) or (>= 1.8.1 with [Backports][])
94
- * [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.3.4)
77
+ * [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.3.1)
95
78
 
96
79
  ## Installation
97
80
 
@@ -133,4 +116,5 @@ see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
133
116
  [N-Triples]: http://www.w3.org/TR/rdf-testcases/#ntriples
134
117
  [Turtle]: http://www.w3.org/TR/2012/WD-turtle-20120710/
135
118
  [Turtle doc]: http://rubydoc.info/github/ruby-rdf/rdf-turtle/master/file/README.markdown
136
- [Turtle EBNF]: http://dvcs.w3.org/hg/rdf/file/8610b8f58685/rdf-turtle/turtle.bnf
119
+ [Turtle EBNF]: http://dvcs.w3.org/hg/rdf/file/8610b8f58685/rdf-turtle/turtle.bnf
120
+ [Swap]: http://www.w3.org/2000/10/swap/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -8,7 +8,7 @@ require 'strscan'
8
8
  # to allow for coloquial variations (such as in the Turtle syntax).
9
9
  #
10
10
  # A rule takes the following form:
11
- # [1] symbol ::= expression
11
+ # \[1\] symbol ::= expression
12
12
  #
13
13
  # Comments include the content between '/*' and '*/'
14
14
  #
@@ -25,47 +25,46 @@ require 'strscan'
25
25
  # grammar in the XML specification has been a long, tedious manual
26
26
  # process. Only when the loop is closed between a fully formal grammar
27
27
  # and a large test data set can we be confident that we have an accurate
28
- # specification of a language [#]_.
28
+ # specification of a language (and even then, only the syntax of the language).
29
29
  #
30
30
  #
31
- # The grammar in the `N3 design note`_ has evolved based on the original
31
+ # The grammar in the [N3 design note][] has evolved based on the original
32
32
  # manual transcription into a python recursive-descent parser and
33
33
  # subsequent development of test cases. Rather than maintain the grammar
34
- # and the parser independently, our goal_ is to formalize the language
34
+ # and the parser independently, our [goal] is to formalize the language
35
35
  # syntax sufficiently to replace the manual implementation with one
36
36
  # derived mechanically from the specification.
37
37
  #
38
38
  #
39
- # .. [#] and even then, only the syntax of the language.
40
- # .. _N3 design note: http://www.w3.org/DesignIssues/Notation3
39
+ # [N3 design note]: http://www.w3.org/DesignIssues/Notation3
41
40
  #
42
41
  # Related Work
43
42
  # ------------
44
43
  #
45
- # Sean Palmer's `n3p announcement`_ demonstrated the feasibility of the
44
+ # Sean Palmer's [n3p announcement][] demonstrated the feasibility of the
46
45
  # approach, though that work did not cover some aspects of N3.
47
46
  #
48
- # In development of the `SPARQL specification`_, Eric Prud'hommeaux
49
- # developed Yacker_, which converts EBNF syntax to perl and C and C++
47
+ # In development of the [SPARQL specification][], Eric Prud'hommeaux
48
+ # developed [Yacker][], which converts EBNF syntax to perl and C and C++
50
49
  # yacc grammars. It includes an interactive facility for checking
51
50
  # strings against the resulting grammars.
52
- # Yosi Scharf used it in `cwm Release 1.1.0rc1`_, which includes
51
+ # Yosi Scharf used it in [cwm Release 1.1.0rc1][], which includes
53
52
  # a SPAQRL parser that is *almost* completely mechanically generated.
54
53
  #
55
54
  # The N3/turtle output from yacker is lower level than the EBNF notation
56
55
  # from the XML specification; it has the ?, +, and * operators compiled
57
56
  # down to pure context-free rules, obscuring the grammar
58
57
  # structure. Since that transformation is straightforwardly expressed in
59
- # semantic web rules (see bnf-rules.n3_), it seems best to keep the RDF
58
+ # semantic web rules (see [bnf-rules.n3][]), it seems best to keep the RDF
60
59
  # expression of the grammar in terms of the higher level EBNF
61
60
  # constructs.
62
61
  #
63
- # .. _goal: http://www.w3.org/2002/02/mid/1086902566.21030.1479.camel@dirk;list=public-cwm-bugs
64
- # .. _n3p announcement: http://lists.w3.org/Archives/Public/public-cwm-talk/2004OctDec/0029.html
65
- # .. _Yacker: http://www.w3.org/1999/02/26-modules/User/Yacker
66
- # .. _SPARQL specification: http://www.w3.org/TR/rdf-sparql-query/
67
- # .. _Cwm Release 1.1.0rc1: http://lists.w3.org/Archives/Public/public-cwm-announce/2005JulSep/0000.html
68
- # .. _bnf-rules.n3: http://www.w3.org/2000/10/swap/grammar/bnf-rules.n3
62
+ # [goal]: http://www.w3.org/2002/02/mid/1086902566.21030.1479.camel@dirk;list=public-cwm-bugs
63
+ # [n3p announcement]: http://lists.w3.org/Archives/Public/public-cwm-talk/2004OctDec/0029.html
64
+ # [Yacker]: http://www.w3.org/1999/02/26-modules/User/Yacker
65
+ # [SPARQL specification]: http://www.w3.org/TR/rdf-sparql-query/
66
+ # [Cwm Release 1.1.0rc1]: http://lists.w3.org/Archives/Public/public-cwm-announce/2005JulSep/0000.html
67
+ # [bnf-rules.n3]: http://www.w3.org/2000/10/swap/grammar/bnf-rules.n3
69
68
  #
70
69
  # Open Issues and Future Work
71
70
  # ---------------------------
@@ -76,57 +75,56 @@ require 'strscan'
76
75
  # captured formally.
77
76
  #
78
77
  # The schema for the EBNF vocabulary used here (``g:seq``, ``g:alt``, ...)
79
- # is not yet published; it should be aligned with `swap/grammar/bnf`_
80
- # and the bnf2html.n3_ rules (and/or the style of linked XHTML grammar
78
+ # is not yet published; it should be aligned with [swap/grammar/bnf][]
79
+ # and the [bnf2html.n3][] rules (and/or the style of linked XHTML grammar
81
80
  # in the SPARQL and XML specificiations).
82
81
  #
83
82
  # It would be interesting to corroborate the claim in the SPARQL spec
84
83
  # that the grammar is LL(1) with a mechanical proof based on N3 rules.
85
84
  #
86
- # .. _swap/grammar/bnf: http://www.w3.org/2000/10/swap/grammar/bnf
87
- # .. _bnf2html.n3: http://www.w3.org/2000/10/swap/grammar/bnf2html.n3
88
- #
89
- #
85
+ # [swap/grammar/bnf]: http://www.w3.org/2000/10/swap/grammar/bnf
86
+ # [bnf2html.n3]: http://www.w3.org/2000/10/swap/grammar/bnf2html.n3
90
87
  #
91
88
  # Background
92
89
  # ----------
93
90
  #
94
- # The `N3 Primer`_ by Tim Berners-Lee introduces RDF and the Semantic
91
+ # The [N3 Primer] by Tim Berners-Lee introduces RDF and the Semantic
95
92
  # web using N3, a teaching and scribbling language. Turtle is a subset
96
93
  # of N3 that maps directly to (and from) the standard XML syntax for
97
94
  # RDF.
98
- #
99
- #
100
- #
101
- # .. _N3 Primer: _http://www.w3.org/2000/10/swap/Primer.html
95
+ #
96
+ # [N3 Primer]: http://www.w3.org/2000/10/swap/Primer.html
102
97
  #
103
98
  # @author Gregg Kellogg
104
99
  class EBNF
105
100
  class Rule
106
- # @attr [Symbol] sym
101
+ # @attr_reader [Symbol] sym
107
102
  attr_reader :sym
108
- # @attr [String] id
103
+ # @attr_reader [String] id
109
104
  attr_reader :id
110
- # @attr [Symbol] kind one of :rule, :token, or :pass
105
+ # @attr_reader [Symbol] kind one of :rule, :token, or :pass
111
106
  attr_accessor :kind
112
- # @attr [Array] expr
107
+ # @attr_reader [Array] expr
113
108
  attr_reader :expr
114
- # @attr [String] orig
109
+ # @attr_reader [String] orig
115
110
  attr_accessor :orig
116
111
 
117
112
  # @param [Integer] id
118
113
  # @param [Symbol] sym
119
114
  # @param [Array] expr
120
- # @param [String] orig
121
115
  # @param [EBNF] ebnf
122
116
  def initialize(id, sym, expr, ebnf)
123
117
  @id, @sym, @expr, @ebnf = id, sym, expr, ebnf
124
118
  end
125
-
119
+
120
+ # Serializes this rule to an S-Expression
121
+ # @return [String]
126
122
  def to_sxp
127
123
  [id, sym, kind, expr].to_sxp
128
124
  end
129
125
 
126
+ # Serializes this rule to an Turtle
127
+ # @return [String]
130
128
  def to_ttl
131
129
  @ebnf.debug("to_ttl") {inspect}
132
130
  comment = orig.strip.
@@ -193,21 +191,21 @@ class EBNF
193
191
  # turn an XML BNF character class into an N3 literal for that
194
192
  # character class (less the outer quote marks)
195
193
  #
196
- # >>> cclass("^<>'{}|^`")
197
- # "[^<>'{}|^`]"
198
- # >>> cclass("#x0300-#x036F")
199
- # "[\\u0300-\\u036F]"
200
- # >>> cclass("#xC0-#xD6")
201
- # "[\\u00C0-\\u00D6]"
202
- # >>> cclass("#x370-#x37D")
203
- # "[\\u0370-\\u037D]"
204
- #
205
- # as in: ECHAR ::= '\' [tbnrf\"']
206
- # >>> cclass("tbnrf\\\"'")
207
- # 'tbnrf\\\\\\"\''
208
- #
209
- # >>> cclass("^#x22#x5C#x0A#x0D")
210
- # '^\\u0022\\\\\\u005C\\u000A\\u000D'
194
+ # >>> cclass("^<>'{}|^`")
195
+ # "[^<>'{}|^`]"
196
+ # >>> cclass("#x0300-#x036F")
197
+ # "[\\u0300-\\u036F]"
198
+ # >>> cclass("#xC0-#xD6")
199
+ # "[\\u00C0-\\u00D6]"
200
+ # >>> cclass("#x370-#x37D")
201
+ # "[\\u0370-\\u037D]"
202
+ #
203
+ # as in: ECHAR ::= '\' [tbnrf\"']
204
+ # >>> cclass("tbnrf\\\"'")
205
+ # 'tbnrf\\\\\\"\''
206
+ #
207
+ # >>> cclass("^#x22#x5C#x0A#x0D")
208
+ # '^\\u0022\\\\\\u005C\\u000A\\u000D'
211
209
  def cclass(txt)
212
210
  '[' +
213
211
  txt.gsub(/\#x[0-9a-fA-F]+/) do |hx|
@@ -229,6 +227,9 @@ class EBNF
229
227
  # in S-Expressions (similar to SPARQL SSE)
230
228
  #
231
229
  # @param [#read, #to_s] input
230
+ # @param [Hash{Symbol => Object}] options
231
+ # @option options [Boolean, Array] :debug
232
+ # Output debug information to an array or STDOUT.
232
233
  def initialize(input, options = {})
233
234
  @options = options
234
235
  @lineno, @depth = 1, 0
@@ -264,6 +265,7 @@ class EBNF
264
265
 
265
266
  ##
266
267
  # Write out parsed syntax string as an S-Expression
268
+ # @return [String]
267
269
  def to_sxp
268
270
  begin
269
271
  require 'sxp'
@@ -276,6 +278,7 @@ class EBNF
276
278
  ##
277
279
  # Write out syntax tree as Turtle
278
280
  # @param [String] prefix for language
281
+ # @param [String] ns URI for language
279
282
  # @return [String]
280
283
  def to_ttl(prefix, ns)
281
284
  token = false
@@ -302,7 +305,7 @@ class EBNF
302
305
 
303
306
  ##
304
307
  # Iterate over rule strings.
305
- # a line that starts with '[' or '@' starts a new rule
308
+ # a line that starts with '\[' or '@' starts a new rule
306
309
  #
307
310
  # @param [StringScanner] scanner
308
311
  # @yield rule_string
@@ -368,31 +371,31 @@ class EBNF
368
371
  #
369
372
  # @example
370
373
  # >>> ebnf("a b c")
371
- # ((seq, [('id', 'a'), ('id', 'b'), ('id', 'c')]), '')
374
+ # ((seq, \[('id', 'a'), ('id', 'b'), ('id', 'c')\]), '')
372
375
  #
373
376
  # >>> ebnf("a? b+ c*")
374
- # ((seq, [(opt, ('id', 'a')), (plus, ('id', 'b')), ('*', ('id', 'c'))]), '')
377
+ # ((seq, \[(opt, ('id', 'a')), (plus, ('id', 'b')), ('*', ('id', 'c'))\]), '')
375
378
  #
376
379
  # >>> ebnf(" | x xlist")
377
- # ((alt, [(seq, []), (seq, [('id', 'x'), ('id', 'xlist')])]), '')
380
+ # ((alt, \[(seq, \[\]), (seq, \[('id', 'x'), ('id', 'xlist')\])\]), '')
378
381
  #
379
382
  # >>> ebnf("a | (b - c)")
380
- # ((alt, [('id', 'a'), (diff, [('id', 'b'), ('id', 'c')])]), '')
383
+ # ((alt, \[('id', 'a'), (diff, \[('id', 'b'), ('id', 'c')\])\]), '')
381
384
  #
382
385
  # >>> ebnf("a b | c d")
383
- # ((alt, [(seq, [('id', 'a'), ('id', 'b')]), (seq, [('id', 'c'), ('id', 'd')])]), '')
386
+ # ((alt, \[(seq, \[('id', 'a'), ('id', 'b')\]), (seq, \[('id', 'c'), ('id', 'd')\])\]), '')
384
387
  #
385
388
  # >>> ebnf("a | b | c")
386
- # ((alt, [('id', 'a'), ('id', 'b'), ('id', 'c')]), '')
389
+ # ((alt, \[('id', 'a'), ('id', 'b'), ('id', 'c')\]), '')
387
390
  #
388
391
  # >>> ebnf("a) b c")
389
392
  # (('id', 'a'), ' b c')
390
393
  #
391
394
  # >>> ebnf("BaseDecl? PrefixDecl*")
392
- # ((seq, [(opt, ('id', 'BaseDecl')), ('*', ('id', 'PrefixDecl'))]), '')
395
+ # ((seq, \[(opt, ('id', 'BaseDecl')), ('*', ('id', 'PrefixDecl'))\]), '')
393
396
  #
394
- # >>> ebnf("NCCHAR1 | diff | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040]")
395
- # ((alt, [('id', 'NCCHAR1'), ("'", diff), (range, '0-9'), (hex, '#x00B7'), (range, '#x0300-#x036F'), (range, '#x203F-#x2040')]), '')
397
+ # >>> ebnf("NCCHAR1 | diff | [0-9] | #x00B7 | [#x0300-#x036F] | \[#x203F-#x2040\]")
398
+ # ((alt, \[('id', 'NCCHAR1'), ("'", diff), (range, '0-9'), (hex, '#x00B7'), (range, '#x0300-#x036F'), (range, '#x203F-#x2040')\]), '')
396
399
  #
397
400
  # @param [String] s
398
401
  # @return [Array]
@@ -411,7 +414,7 @@ class EBNF
411
414
  ##
412
415
  # Parse alt
413
416
  # >>> alt("a | b | c")
414
- # ((alt, [('id', 'a'), ('id', 'b'), ('id', 'c')]), '')
417
+ # ((alt, \[('id', 'a'), ('id', 'b'), ('id', 'c')\]), '')
415
418
  # @param [String] s
416
419
  # @return [Array]
417
420
  def alt(s)
@@ -438,10 +441,10 @@ class EBNF
438
441
  # parse seq
439
442
  #
440
443
  # >>> seq("a b c")
441
- # ((seq, [('id', 'a'), ('id', 'b'), ('id', 'c')]), '')
444
+ # ((seq, \[('id', 'a'), ('id', 'b'), ('id', 'c')\]), '')
442
445
  #
443
446
  # >>> seq("a b? c")
444
- # ((seq, [('id', 'a'), (opt, ('id', 'b')), ('id', 'c')]), '')
447
+ # ((seq, \[('id', 'a'), (opt, ('id', 'b')), ('id', 'c')\]), '')
445
448
  def seq(s)
446
449
  debug("seq") {"(#{s.inspect})"}
447
450
  args = []
@@ -468,7 +471,7 @@ class EBNF
468
471
  # parse diff
469
472
  #
470
473
  # >>> diff("a - b")
471
- # ((diff, [('id', 'a'), ('id', 'b')]), '')
474
+ # ((diff, \[('id', 'a'), ('id', 'b')\]), '')
472
475
  def diff(s)
473
476
  debug("diff") {"(#{s.inspect})"}
474
477
  e1, s = depth {postfix(s)}
@@ -513,7 +516,7 @@ class EBNF
513
516
  end
514
517
  [e, s]
515
518
  end
516
-
519
+
517
520
  ##
518
521
  # parse primary
519
522
  #
@@ -550,10 +553,10 @@ class EBNF
550
553
  # ((range, '0-9'), '')
551
554
  # >>> token("#x00B7")
552
555
  # ((hex, '#x00B7'), '')
553
- # >>> token ("[#x0300-#x036F]")
556
+ # >>> token ("\[#x0300-#x036F\]")
554
557
  # ((range, '#x0300-#x036F'), '')
555
- # >>> token("[^<>'{}|^`]-[#x00-#x20]")
556
- # ((range, "^<>'{}|^`"), '-[#x00-#x20]')
558
+ # >>> token("\[^<>'{}|^`\]-\[#x00-#x20\]")
559
+ # ((range, "^<>'{}|^`"), '-\[#x00-#x20\]')
557
560
  def token(s)
558
561
  s = s.strip
559
562
  case m = s[0,1]
@@ -601,9 +604,15 @@ class EBNF
601
604
 
602
605
  ##
603
606
  # Progress output when debugging
604
- # param [String] node relative location in input
605
- # param [String] message ("")
606
- # yieldreturn [String] added to message
607
+ #
608
+ # @overload debug(node, message)
609
+ # @param [String] node relative location in input
610
+ # @param [String] message ("")
611
+ #
612
+ # @overload debug(message)
613
+ # @param [String] message ("")
614
+ #
615
+ # @yieldreturn [String] added to message
607
616
  def debug(*args)
608
617
  return unless @options[:debug]
609
618
  options = args.last.is_a?(Hash) ? args.pop : {}
@@ -4,16 +4,16 @@ module RDF::LL1
4
4
  ##
5
5
  # Overload StringScanner with file operations
6
6
  #
7
- # FIXME: Only implements the subset required by the Lexer for now.
8
- #
9
- # Reloads scanner as required until EOF.
7
+ # * Reloads scanner as required until EOF.
10
8
  # * Loads to a high-water and reloads when remaining size reaches a low-water.
9
+ #
10
+ # FIXME: Only implements the subset required by the Lexer for now.
11
11
  class Scanner < StringScanner
12
12
  HIGH_WATER = 10240
13
13
  LOW_WATER = 2048 # Hopefully large enough to deal with long multi-line comments
14
14
 
15
15
  ##
16
- # @attr [IO, StringIO]
16
+ # @attr_reader [IO, StringIO]
17
17
  attr_reader :input
18
18
 
19
19
  ##
@@ -370,9 +370,14 @@ module RDF::Turtle
370
370
 
371
371
  ##
372
372
  # Progress output when debugging
373
- # param [String] node relative location in input
374
- # param [String] message ("")
375
- # yieldreturn [String] added to message
373
+ # @overload debug(node, message)
374
+ # @param [String] node relative location in input
375
+ # @param [String] message ("")
376
+ #
377
+ # @overload debug(message)
378
+ # @param [String] message ("")
379
+ #
380
+ # @yieldreturn [String] added to message
376
381
  def debug(*args)
377
382
  return unless @options[:debug] || RDF::Turtle.debug?
378
383
  options = args.last.is_a?(Hash) ? args.pop : {}
@@ -14,7 +14,6 @@ module RDF::Turtle
14
14
  [\\uF900-\\uFDCF]|[\\uFDF0-\\uFFFD]|[\\u{10000}-\\u{EFFFF}]
15
15
  EOS
16
16
  U_CHARS2 = Regexp.compile("\\u00B7|[\\u0300-\\u036F]|[\\u203F-\\u2040]")
17
- # [^<>\"{}|^`\\] - [#x00-#x20]
18
17
  IRI_RANGE = Regexp.compile("[[^<>\"{}|^`\\\\]&&[^\\x00-\\x20]]")
19
18
  else
20
19
  ##
@@ -60,64 +59,64 @@ module RDF::Turtle
60
59
  EOS
61
60
  end
62
61
 
63
- # [27]
62
+ # 27
64
63
  UCHAR = RDF::LL1::Lexer::UCHAR
65
- # [170s]
64
+ # 170s
66
65
  PERCENT = /%[0-9A-Fa-f]{2}/
67
- # [172s]
66
+ # 172s
68
67
  PN_LOCAL_ESC = /\\[_~\.\-\!$\&'\(\)\*\+,;=:\/\?\#@%]/
69
- # [169s]
68
+ # 169s
70
69
  PLX = /#{PERCENT}|#{PN_LOCAL_ESC}/
71
- # [163s]
70
+ # 163s
72
71
  PN_CHARS_BASE = /[A-Z]|[a-z]|#{U_CHARS1}/
73
- # [164s]
72
+ # 164s
74
73
  PN_CHARS_U = /_|#{PN_CHARS_BASE}/
75
- # [166s]
74
+ # 166s
76
75
  PN_CHARS = /-|[0-9]|#{PN_CHARS_U}|#{U_CHARS2}/
77
76
  PN_LOCAL_BODY = /(?:(?:\.|:|#{PN_CHARS}|#{PLX})*(?:#{PN_CHARS}|:|#{PLX}))?/
78
77
  PN_CHARS_BODY = /(?:(?:\.|#{PN_CHARS})*#{PN_CHARS})?/
79
- # [167s]
78
+ # 167s
80
79
  PN_PREFIX = /#{PN_CHARS_BASE}#{PN_CHARS_BODY}/
81
- # [100s]
80
+ # 100s
82
81
  PN_LOCAL = /(?:[0-9]|:|#{PN_CHARS_U}|#{PLX})#{PN_LOCAL_BODY}/
83
- # [154s]
82
+ # 154s
84
83
  EXPONENT = /[eE][+-]?[0-9]+/
85
- # [159s]
84
+ # 159s
86
85
  ECHAR = /\\[tbnrf\\"']/
87
- # [19]
86
+ # 19
88
87
  IRIREF = /<(?:#{IRI_RANGE}|#{UCHAR})*>/
89
- # [139s]
88
+ # 139s
90
89
  PNAME_NS = /#{PN_PREFIX}?:/
91
- # [140s]
90
+ # 140s
92
91
  PNAME_LN = /#{PNAME_NS}#{PN_LOCAL}/
93
- # [141s]
92
+ # 141s
94
93
  BLANK_NODE_LABEL = /_:(?:[0-9]|#{PN_CHARS_U})(#{PN_CHARS}|\.)*/
95
- # [144s]
94
+ # 144s
96
95
  LANGTAG = /@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*/
97
- # [20]
96
+ # 20
98
97
  INTEGER = /[+-]?[0-9]+/
99
- # [21]
98
+ # 21
100
99
  DECIMAL = /[+-]?(?:[0-9]*\.[0-9]+)/
101
- # [22]
100
+ # 22
102
101
  DOUBLE = /[+-]?(?:[0-9]+\.[0-9]*#{EXPONENT}|\.?[0-9]+#{EXPONENT})/
103
- # [23]
102
+ # 23
104
103
  STRING_LITERAL_QUOTE = /'(?:[^\'\\\n\r]|#{ECHAR}|#{UCHAR})*'/
105
- # [24]
104
+ # 24
106
105
  STRING_LITERAL_SINGLE_QUOTE = /"(?:[^\"\\\n\r]|#{ECHAR}|#{UCHAR})*"/
107
- # [25]
106
+ # 25
108
107
  STRING_LITERAL_LONG_SINGLE_QUOTE = /'''(?:(?:'|'')?(?:[^'\\]|#{ECHAR}|#{UCHAR}))*'''/m
109
- # [26]
108
+ # 26
110
109
  STRING_LITERAL_LONG_QUOTE = /"""(?:(?:"|"")?(?:[^"\\]|#{ECHAR}|#{UCHAR}))*"""/m
111
110
 
112
- # [161s]
111
+ # 161s
113
112
  WS = / |\t|\r|\n /
114
- # [160s]
113
+ # 160s
115
114
  NIL = /\(#{WS}*\)/
116
- # [162s]
115
+ # 162s
117
116
  ANON = /\[#{WS}*\]/
118
- # [28t]
117
+ # 28t
119
118
  SPARQL_PREFIX = /prefix/i
120
- # [29t]
119
+ # 29t
121
120
  SPARQL_BASE = /base/i
122
121
 
123
122
  end
@@ -75,7 +75,7 @@ module RDF::Turtle
75
75
  # @option options [Boolean] :standard_prefixes (false)
76
76
  # Add standard prefixes to @prefixes, if necessary.
77
77
  # @option options [String] :default_namespace (nil)
78
- # URI to use as default namespace, same as prefixes[nil]
78
+ # URI to use as default namespace, same as `prefixes[nil]`
79
79
  # @yield [writer] `self`
80
80
  # @yieldparam [RDF::Writer] writer
81
81
  # @yieldreturn [void]
@@ -286,7 +286,7 @@ module RDF::Turtle
286
286
  def top_classes; [RDF::RDFS.Class]; end
287
287
 
288
288
  # Defines order of predicates to to emit at begninning of a resource description. Defaults to
289
- # [rdf:type, rdfs:label, dc:title]
289
+ # `\[rdf:type, rdfs:label, dc:title\]`
290
290
  # @return [Array<URI>]
291
291
  def predicate_order; [RDF.type, RDF::RDFS.label, RDF::DC.title]; end
292
292
 
@@ -393,8 +393,10 @@ module RDF::Turtle
393
393
 
394
394
  ##
395
395
  # Add debug event to debug array, if specified
396
- # param [String] message ("")
397
- # yieldreturn [String] added to message
396
+ #
397
+ # @overload debug(message)
398
+ # @param [String] message ("")
399
+ # @yieldreturn [String] added to message
398
400
  def debug(*args)
399
401
  return unless @options[:debug] || RDF::Turtle.debug?
400
402
  options = args.last.is_a?(Hash) ? args.pop : {}
metadata CHANGED
@@ -1,221 +1,166 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rdf-turtle
3
- version: !ruby/object:Gem::Version
4
- hash: 19
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 0
10
- version: 0.3.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Gregg Kellogg
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-11-06 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-11-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rdf
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- hash: 27
28
- segments:
29
- - 0
30
- - 3
31
- - 4
32
- version: 0.3.4
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.3.11
33
22
  type: :runtime
34
- requirement: *id001
35
23
  prerelease: false
36
- - !ruby/object:Gem::Dependency
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.3.11
30
+ - !ruby/object:Gem::Dependency
37
31
  name: open-uri-cached
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 23
44
- segments:
45
- - 0
46
- - 0
47
- - 4
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
48
37
  version: 0.0.4
49
38
  type: :development
50
- requirement: *id002
51
39
  prerelease: false
52
- - !ruby/object:Gem::Dependency
53
- name: spira
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
55
41
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 7
60
- segments:
61
- - 0
62
- - 0
63
- - 12
64
- version: 0.0.12
65
- type: :development
66
- requirement: *id003
67
- prerelease: false
68
- - !ruby/object:Gem::Dependency
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.0.4
46
+ - !ruby/object:Gem::Dependency
69
47
  name: rspec
70
- version_requirements: &id004 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
71
49
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 47
76
- segments:
77
- - 2
78
- - 8
79
- - 0
80
- version: 2.8.0
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 2.12.0
81
54
  type: :development
82
- requirement: *id004
83
55
  prerelease: false
84
- - !ruby/object:Gem::Dependency
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.12.0
62
+ - !ruby/object:Gem::Dependency
85
63
  name: rdf-isomorphic
86
- version_requirements: &id005 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
87
65
  none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 27
92
- segments:
93
- - 0
94
- - 3
95
- - 4
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
96
69
  version: 0.3.4
97
70
  type: :development
98
- requirement: *id005
99
71
  prerelease: false
100
- - !ruby/object:Gem::Dependency
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.3.4
78
+ - !ruby/object:Gem::Dependency
101
79
  name: json-ld
102
- version_requirements: &id006 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
103
81
  none: false
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 19
108
- segments:
109
- - 0
110
- - 3
111
- - 0
112
- version: 0.3.0
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: 0.3.1
113
86
  type: :development
114
- requirement: *id006
115
87
  prerelease: false
116
- - !ruby/object:Gem::Dependency
117
- name: rdf-spec
118
- version_requirements: &id007 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
119
89
  none: false
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- hash: 27
124
- segments:
125
- - 0
126
- - 3
127
- - 4
128
- version: 0.3.4
129
- type: :development
130
- requirement: *id007
131
- prerelease: false
132
- - !ruby/object:Gem::Dependency
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 0.3.1
94
+ - !ruby/object:Gem::Dependency
133
95
  name: yard
134
- version_requirements: &id008 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
135
97
  none: false
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
139
- hash: 7
140
- segments:
141
- - 0
142
- - 6
143
- - 0
144
- version: 0.6.0
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: 0.8.3
145
102
  type: :development
146
- requirement: *id008
147
103
  prerelease: false
148
- - !ruby/object:Gem::Dependency
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 0.8.3
110
+ - !ruby/object:Gem::Dependency
149
111
  name: sxp
150
- version_requirements: &id009 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
151
113
  none: false
152
- requirements:
153
- - - ">="
154
- - !ruby/object:Gem::Version
155
- hash: 3
156
- segments:
157
- - 0
158
- - 0
159
- - 14
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
160
117
  version: 0.0.14
161
118
  type: :development
162
- requirement: *id009
163
119
  prerelease: false
164
- - !ruby/object:Gem::Dependency
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: 0.0.14
126
+ - !ruby/object:Gem::Dependency
165
127
  name: rdf-spec
166
- version_requirements: &id010 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
167
129
  none: false
168
- requirements:
169
- - - ">="
170
- - !ruby/object:Gem::Version
171
- hash: 3
172
- segments:
173
- - 0
174
- - 3
175
- - 8
176
- version: 0.3.8
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: 0.3.1
177
134
  type: :development
178
- requirement: *id010
179
135
  prerelease: false
180
- - !ruby/object:Gem::Dependency
181
- name: rspec
182
- version_requirements: &id011 !ruby/object:Gem::Requirement
136
+ version_requirements: !ruby/object:Gem::Requirement
183
137
  none: false
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- hash: 35
188
- segments:
189
- - 2
190
- - 11
191
- - 0
192
- version: 2.11.0
193
- type: :development
194
- requirement: *id011
195
- prerelease: false
196
- - !ruby/object:Gem::Dependency
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: 0.3.1
142
+ - !ruby/object:Gem::Dependency
197
143
  name: rake
198
- version_requirements: &id012 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
199
145
  none: false
200
- requirements:
201
- - - ">="
202
- - !ruby/object:Gem::Version
203
- hash: 3
204
- segments:
205
- - 0
206
- version: "0"
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
207
150
  type: :development
208
- requirement: *id012
209
151
  prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
210
158
  description: RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.
211
159
  email: public-rdf-ruby@w3.org
212
160
  executables: []
213
-
214
161
  extensions: []
215
-
216
162
  extra_rdoc_files: []
217
-
218
- files:
163
+ files:
219
164
  - AUTHORS
220
165
  - README.markdown
221
166
  - History
@@ -233,40 +178,29 @@ files:
233
178
  - lib/rdf/turtle/writer.rb
234
179
  - lib/rdf/turtle.rb
235
180
  homepage: http://github.com/ruby-rdf/rdf-turtle
236
- licenses:
181
+ licenses:
237
182
  - Public Domain
238
183
  post_install_message:
239
184
  rdoc_options: []
240
-
241
- require_paths:
185
+ require_paths:
242
186
  - lib
243
- required_ruby_version: !ruby/object:Gem::Requirement
187
+ required_ruby_version: !ruby/object:Gem::Requirement
244
188
  none: false
245
- requirements:
246
- - - ">="
247
- - !ruby/object:Gem::Version
248
- hash: 53
249
- segments:
250
- - 1
251
- - 8
252
- - 1
189
+ requirements:
190
+ - - ! '>='
191
+ - !ruby/object:Gem::Version
253
192
  version: 1.8.1
254
- required_rubygems_version: !ruby/object:Gem::Requirement
193
+ required_rubygems_version: !ruby/object:Gem::Requirement
255
194
  none: false
256
- requirements:
257
- - - ">="
258
- - !ruby/object:Gem::Version
259
- hash: 3
260
- segments:
261
- - 0
262
- version: "0"
195
+ requirements:
196
+ - - ! '>='
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
263
199
  requirements: []
264
-
265
200
  rubyforge_project: rdf-turtle
266
201
  rubygems_version: 1.8.24
267
202
  signing_key:
268
203
  specification_version: 3
269
204
  summary: Turtle reader/writer for Ruby.
270
205
  test_files: []
271
-
272
206
  has_rdoc: false