rdf-turtle 3.2.1 → 3.3.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
2
  SHA256:
3
- metadata.gz: 57d92c642076069a911db896415fa9dbd3203b6c82a9074e0fc8a53dafb2389d
4
- data.tar.gz: 238620d914ce1ff78d8710e12083d03eacb5f9be7106d0d12ef15c5105445b72
3
+ metadata.gz: 0e3cededb73cd8863f7a82386dc5ae0667edee714910a148df381402c8daf664
4
+ data.tar.gz: 7952f03d779df79e0f02fd5c9281118afeb661fc810ada681e98e4b604941528
5
5
  SHA512:
6
- metadata.gz: 0db24a8c173d7b522ba06e1af9e957c513a551a211d22b6a2d19b7218a79e236f6db1f66b738a1a76e5b96ef6161f432f7ece17dea4af8d3de46520960a89977
7
- data.tar.gz: a2826f9e8fbd34364acc54a117e283067982491e9c8e736ac1c8fcb86aac1f6a3acc43811040242fea19e79019d809fd14dae6b46ecc0568b67775dddd84369d
6
+ metadata.gz: 7d24d8479b3055dff29ac2c958532817d32860e419dd1d9e978ef63bfca8c8c08cf2da93b08353dc488b5489d20d83b2c33959277d3d8b2fd2c4a3d768bcd4bb
7
+ data.tar.gz: 3a3f31bb8ca9e14228596de15a3108d9a30903f9ef947d6fa5338bd038684b44cdc8fee7aa3b4d3ce6f473bda11b8b0501bd6eab76585585863f3a98db25f2ba
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [Turtle][] reader/writer for [RDF.rb][RDF.rb] .
4
4
 
5
- [![Gem Version](https://badge.fury.io/rb/rdf-turtle.png)](https://badge.fury.io/rb/rdf-turtle)
5
+ [![Gem Version](https://badge.fury.io/rb/rdf-turtle.svg)](https://badge.fury.io/rb/rdf-turtle)
6
6
  [![Build Status](https://github.com/ruby-rdf/rdf-turtle/workflows/CI/badge.svg?branch=develop)](https://github.com/ruby-rdf/rdf-turtle/actions?query=workflow%3ACI)
7
7
  [![Coverage Status](https://coveralls.io/repos/ruby-rdf/rdf-turtle/badge.svg?branch=develop)](https://coveralls.io/github/ruby-rdf/rdf-turtle?branch=develop)
8
8
  [![Gitter chat](https://badges.gitter.im/ruby-rdf/rdf.png)](https://gitter.im/ruby-rdf/rdf)
@@ -17,9 +17,9 @@ Install with `gem install rdf-turtle`
17
17
 
18
18
  * 100% free and unencumbered [public domain](https://unlicense.org/) software.
19
19
  * Implements a complete parser for [Turtle][].
20
- * Compatible with Ruby >= 2.6.
20
+ * Compatible with Ruby >= 3.0.
21
21
  * Optional streaming writer, to serialize large graphs
22
- * Provisional support for [Turtle-star][RDF-star].
22
+ * Provisional support for [RDF 1.2][].
23
23
 
24
24
  ## Usage
25
25
  Instantiate a reader from a local file:
@@ -36,15 +36,17 @@ Write a graph to a file:
36
36
  writer << graph
37
37
  end
38
38
 
39
- ## Turtle-star (RDF-star)
39
+ ## RDF 1.2
40
40
 
41
- Both reader and writer include provisional support for [Turtle-star][RDF-star].
41
+ Both reader and writer include provisional support for [RDF 1.2][] quoted triples.
42
+
43
+ Both reader and writer include provisional support for [RDF 1.2][] directional language-tagged strings, which are literals of type `rdf:dirLangString` having both a `language` and `direction`.
42
44
 
43
45
  Internally, an `RDF::Statement` is treated as another resource, along with `RDF::URI` and `RDF::Node`, which allows an `RDF::Statement` to have a `#subject` or `#object` which is also an `RDF::Statement`.
44
46
 
45
47
  **Note: This feature is subject to change or elimination as the standards process progresses.**
46
48
 
47
- ### Serializing a Graph containing embedded statements
49
+ ### Serializing a Graph containing quoted triples
48
50
 
49
51
  require 'rdf/turtle'
50
52
  statement = RDF::Statement(RDF::URI('bob'), RDF::Vocab::FOAF.age, RDF::Literal(23))
@@ -52,7 +54,7 @@ Internally, an `RDF::Statement` is treated as another resource, along with `RDF:
52
54
  graph.dump(:ttl, validate: false, standard_prefixes: true)
53
55
  # => '<<<bob> foaf:age 23>> <ex:certainty> 9.0e-1 .'
54
56
 
55
- ### Reading a Graph containing embedded statements
57
+ ### Reading a Graph containing quoted triples
56
58
 
57
59
  By default, the Turtle reader will reject a document containing a subject resource.
58
60
 
@@ -140,9 +142,9 @@ This version uses a hand-written parser using the Lexer from the [EBNF][] gem in
140
142
 
141
143
  ## Dependencies
142
144
 
143
- * [Ruby](https://ruby-lang.org/) (>= 2.6)
144
- * [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.2)
145
- * [EBNF][] (~> 1.2)
145
+ * [Ruby](https://ruby-lang.org/) (>= 3.0)
146
+ * [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.3)
147
+ * [EBNF][] (~> 2.4)
146
148
 
147
149
  ## Installation
148
150
 
@@ -187,10 +189,10 @@ A copy of the [Turtle EBNF][] and derived parser files are included in the repos
187
189
  [PDD]: https://unlicense.org/#unlicensing-contributions
188
190
  [RDF.rb]: https://ruby-rdf.github.io/rdf
189
191
  [EBNF]: https://rubygems.org/gems/ebnf
190
- [Backports]: https://rubygems.org/gems/backports
191
- [N-Triples]: https://www.w3.org/TR/rdf-testcases/#ntriples
192
- [Turtle]: https://www.w3.org/TR/2012/WD-turtle-20120710/
193
- [RDF-star]: https://w3c.github.io/rdf-star/rdf-star-cg-spec.html
192
+ [N-Triples]: https://www.w3.org/TR/rdf12-n-triples
193
+ [Turtle]: https://www.w3.org/TR/rdf12-turtle
194
+ [RDF 1.1]: https://www.w3.org/TR/rdf11-concepts/
195
+ [RDF 1.2]: https://www.w3.org/TR/rdf12-concepts/
194
196
  [Turtle doc]: https://ruby-rdf.github.io/rdf-turtle/master/file/README.md
195
- [Turtle EBNF]: https://dvcs.w3.org/hg/rdf/file/default/rdf-turtle/turtle.bnf
196
- [Freebase Dumps]: https://developers.google.com/freebase/data
197
+ [Turtle EBNF]: https://w3c.github.io/rdf-turtle/spec/turtle-bnf.html
198
+ [Freebase Dumps]: https://developers.google.com/freebase/data
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.1
1
+ 3.3.0
@@ -79,8 +79,9 @@ module RDF::Turtle
79
79
  if literal_str = match(LITERAL_PLAIN)
80
80
  literal_str = self.class.unescape(literal_str)
81
81
  literal = case
82
- when language = match(RDF::NTriples::Reader::LANGTAG)
83
- RDF::Literal.new(literal_str, language: language)
82
+ when lang_dir = match(RDF::Turtle::Reader::LANG_DIR)
83
+ language, direction = lang_dir.split('--')
84
+ RDF::Literal.new(literal_str, language: language, direction: direction)
84
85
  when datatype = match(/^(\^\^)/)
85
86
  RDF::Literal.new(literal_str, datatype: read_pname(intern: true) || read_uriref || fail_object)
86
87
  else
@@ -36,7 +36,7 @@ module RDF::Turtle
36
36
 
37
37
  terminal(:PREFIX, PREFIX)
38
38
  terminal(:BASE, BASE)
39
- terminal(:LANGTAG, LANGTAG)
39
+ terminal(:LANG_DIR, LANG_DIR)
40
40
 
41
41
  ##
42
42
  # Reader options
@@ -394,7 +394,7 @@ module RDF::Turtle
394
394
  end
395
395
  end
396
396
 
397
- # Read an RDF-star reified statement
397
+ # Read a quoted triple
398
398
  # @return [RDF::Statement]
399
399
  def read_quotedTriple
400
400
  return unless @options[:rdfstar]
@@ -470,8 +470,10 @@ module RDF::Turtle
470
470
  value = @lexer.shift.value[1..-2]
471
471
  error("read_literal", "Unexpected end of file") unless token = @lexer.first
472
472
  case token.type || token.value
473
- when :LANGTAG
474
- literal(value, language: @lexer.shift.value[1..-1].to_sym)
473
+ when :LANG_DIR
474
+ lang_dir = @lexer.shift.value[1..-1]
475
+ language, direction = lang_dir.split('--')
476
+ literal(value, language: language, direction: direction)
475
477
  when '^^'
476
478
  @lexer.shift
477
479
  literal(value, datatype: read_iri)
@@ -484,8 +486,10 @@ module RDF::Turtle
484
486
  value = @lexer.shift.value[3..-4]
485
487
  error("read_literal", "Unexpected end of file") unless token = @lexer.first
486
488
  case token.type || token.value
487
- when :LANGTAG
488
- literal(value, language: @lexer.shift.value[1..-1].to_sym)
489
+ when :LANG_DIR
490
+ lang_dir = @lexer.shift.value[1..-1]
491
+ language, direction = lang_dir.split('--')
492
+ literal(value, language: language, direction: direction)
489
493
  when '^^'
490
494
  @lexer.shift
491
495
  literal(value, datatype: read_iri)
@@ -48,7 +48,7 @@ module RDF::Turtle
48
48
  # 141s
49
49
  BLANK_NODE_LABEL = /_:(?:[0-9]|#{PN_CHARS_U})(?:(?:#{PN_CHARS}|\.)*#{PN_CHARS})?/u.freeze
50
50
  # 144s
51
- LANGTAG = /@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*/u.freeze
51
+ LANG_DIR = /@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*(?:--[a-zA-Z]+)?)/u.freeze
52
52
  # 19
53
53
  INTEGER = /[+-]?[0-9]+/u.freeze
54
54
  # 20
@@ -87,7 +87,7 @@ module RDF::Turtle
87
87
  symbol: :literal_shorthand,
88
88
  datatype: FalseClass,
89
89
  on: ["--no-literal-shorthand"],
90
- description: "Do not ttempt to use Literal shorthands fo numbers and boolean values.") {false},
90
+ description: "Do not attempt to use Literal shorthands fo numbers and boolean values.") {false},
91
91
  ]
92
92
  end
93
93
 
@@ -215,7 +215,7 @@ module RDF::Turtle
215
215
  end
216
216
 
217
217
  pname = case
218
- when @uri_to_pname.has_key?(uri)
218
+ when @uri_to_pname.key?(uri)
219
219
  return @uri_to_pname[uri]
220
220
  when u = @uri_to_prefix.keys.sort_by {|uu| uu.length}.reverse.detect {|uu| uri.index(uu.to_s) == 0}
221
221
  # Use a defined prefix
@@ -296,8 +296,9 @@ module RDF::Turtle
296
296
  in_form ? literal.value : literal.canonicalize.to_s.sub('E', 'e').to_s
297
297
  else
298
298
  text = quoted(literal.value)
299
- text << "@#{literal.language}" if literal.has_language?
300
- text << "^^#{format_uri(literal.datatype)}" if literal.has_datatype?
299
+ text << "@#{literal.language}" if literal.language?
300
+ text << "--#{literal.direction}" if literal.direction?
301
+ text << "^^#{format_uri(literal.datatype)}" if literal.datatype?
301
302
  text
302
303
  end
303
304
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-turtle
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-28 00:00:00.000000000 Z
11
+ date: 2023-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
19
+ version: '3.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.2'
26
+ version: '3.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ebnf
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.3'
33
+ version: '2.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.3'
40
+ version: '2.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: erubis
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.10'
75
+ version: '3.12'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.10'
82
+ version: '3.12'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec-its
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,56 +100,56 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '3.2'
103
+ version: '3.3'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.2'
110
+ version: '3.3'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: json-ld
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '3.2'
117
+ version: '3.3'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '3.2'
124
+ version: '3.3'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rdf-spec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '3.2'
131
+ version: '3.3'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '3.2'
138
+ version: '3.3'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rdf-vocab
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '3.2'
145
+ version: '3.3'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '3.2'
152
+ version: '3.3'
153
153
  description: RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.
154
154
  email: public-rdf-ruby@w3.org
155
155
  executables: []
@@ -186,14 +186,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
186
  requirements:
187
187
  - - ">="
188
188
  - !ruby/object:Gem::Version
189
- version: '2.6'
189
+ version: '3.0'
190
190
  required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.3.3
196
+ rubygems_version: 3.4.19
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: Turtle reader/writer for Ruby.