rdf-trig 2.0.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8ef65ee1b893f7d8014e149e94ea48ee5b8ff995
4
- data.tar.gz: e27c45320cb1bf66df62d8c514cdbc0de5cfbc2b
2
+ SHA256:
3
+ metadata.gz: f1d8dbbc7d4a803a805ddb7dfe29359490d16ceef967164a28272cc9644f27aa
4
+ data.tar.gz: 839cf54eed3bd0f495719d153d01279e715166eeb5a3c4801426928493cc54f8
5
5
  SHA512:
6
- metadata.gz: a7dd961fd0480930e3f2844da6a6ad29d621db0ed60618cf5aa0c77f235e057d586e044ab024e81e14309403d5b854f50f980e0c087c36e5c56ebc930eb1c5aa
7
- data.tar.gz: fd2411a908a2231913f321dfbaba0c7fbb9e0fedfffead6616d1b6352f4d021837068432537cb20496c173dff44d7e7a990e181495da962b4c361cd9e897fe8b
6
+ metadata.gz: 376e7606927e27df2fcf047397641128979a6929cad69a1e164f70fa95ba3b98a4e24bc436bb8a7168aac10eeb5d1ef45abaff6df332cf0d93c18818a7f6c198
7
+ data.tar.gz: 1e4aa2e7619f1d78aa5e7584d1dffdcea6492a32a03784319db88fecd4534ef1fb0578d82426c84c34c44511efa5573d2cbf896aca3801773e2d7668ebc5a135
data/README.md CHANGED
@@ -2,10 +2,9 @@
2
2
 
3
3
  [TriG][] reader/writer for [RDF.rb][RDF.rb] .
4
4
 
5
- [![Gem Version](https://badge.fury.io/rb/rdf-trig.png)](http://badge.fury.io/rb/rdf-trig)
6
- [![Build Status](https://travis-ci.org/ruby-rdf/rdf-trig.png?branch=master)](http://travis-ci.org/ruby-rdf/rdf-trig)
5
+ [![Gem Version](https://badge.fury.io/rb/rdf-trig.png)](https://badge.fury.io/rb/rdf-trig)
6
+ [![Build Status](https://travis-ci.org/ruby-rdf/rdf-trig.png?branch=master)](https://travis-ci.org/ruby-rdf/rdf-trig)
7
7
  [![Coverage Status](https://coveralls.io/repos/ruby-rdf/rdf-trig/badge.svg)](https://coveralls.io/r/ruby-rdf/rdf-trig)
8
- [![Dependency Status](https://gemnasium.com/ruby-rdf/rdf-trig.png)](https://gemnasium.com/ruby-rdf/rdf-trig)
9
8
 
10
9
  ## Description
11
10
  This is a [Ruby][] implementation of a [TriG][] reader and writer for [RDF.rb][].
@@ -15,7 +14,7 @@ RDF::TriG parses [TriG][Trig] into statements or quads. It also serializes to Tr
15
14
 
16
15
  Install with `gem install rdf-trig`
17
16
 
18
- * 100% free and unencumbered [public domain](http://unlicense.org/) software.
17
+ * 100% free and unencumbered [public domain](https://unlicense.org/) software.
19
18
  * Implements a complete parser and serializer for [TriG][].
20
19
  * Compatible with Ruby 2.x, and JRuby 1.7+.
21
20
  * Optional streaming writer, to serialize large graphs
@@ -58,22 +57,22 @@ There is a new `:stream` option to {RDF::TriG::Writer} which is more efficient f
58
57
 
59
58
  ## Dependencies
60
59
 
61
- * [Ruby](http://ruby-lang.org/) (>= 2.0)
62
- * [RDF.rb](http://rubygems.org/gems/rdf) (~> 2.0)
63
- * [rdf-turtle](http://rubygems.org/gems/rdf-turtle) (~> 2.0)
60
+ * [Ruby](https://ruby-lang.org/) (>= 2.2.2)
61
+ * [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.0)
62
+ * [rdf-turtle](https://rubygems.org/gems/rdf-turtle) (~> 3.0)
64
63
 
65
64
  ## Installation
66
65
 
67
- The recommended installation method is via [RubyGems](http://rubygems.org/).
66
+ The recommended installation method is via [RubyGems](https://rubygems.org/).
68
67
  To install the latest official release of the `RDF::TriG` gem, do:
69
68
 
70
69
  % [sudo] gem install rdf-trig
71
70
 
72
71
  ## Mailing List
73
- * <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
72
+ * <https://lists.w3.org/Archives/Public/public-rdf-ruby/>
74
73
 
75
74
  ## Author
76
- * [Gregg Kellogg](http://github.com/gkellogg) - <http://greggkellogg.net/>
75
+ * [Gregg Kellogg](https://github.com/gkellogg) - <https://greggkellogg.net/>
77
76
 
78
77
  ## Contributing
79
78
  * Do your best to adhere to the existing coding conventions and idioms.
@@ -90,18 +89,18 @@ To install the latest official release of the `RDF::TriG` gem, do:
90
89
 
91
90
  ## License
92
91
  This is free and unencumbered public domain software. For more information,
93
- see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
94
-
95
- A copy of the [TriG EBNF][] and derived parser files are included in the repository, which are not covered under the UNLICENSE. These files are covered via the [W3C Document License](http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231).
96
-
97
- [Ruby]: http://ruby-lang.org/
98
- [RDF]: http://www.w3.org/RDF/
99
- [YARD]: http://yardoc.org/
100
- [YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
101
- [PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
102
- [RDF.rb]: http://rubydoc.info/github/ruby-rdf/rdf/master/frames
103
- [Backports]: http://rubygems.org/gems/backports
104
- [TriG]: http://www.w3.org/TR/trig/
105
- [TriG doc]: http://rubydoc.info/github/ruby-rdf/rdf-trig/master/file/README.markdown
106
- [TriG EBNF]: http://dvcs.w3.org/hg/rdf/raw-file/default/trig/trig.bnf
107
- [Turtle doc]: http://rubydoc.info/github/ruby-rdf/rdf-turtle/master/file/README.markdown
92
+ see <https://unlicense.org/> or the accompanying {file:UNLICENSE} file.
93
+
94
+ A copy of the [TriG EBNF][] and derived parser files are included in the repository, which are not covered under the UNLICENSE. These files are covered via the [W3C Document License](https://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231).
95
+
96
+ [Ruby]: https://ruby-lang.org/
97
+ [RDF]: https://www.w3.org/RDF/
98
+ [YARD]: https://yardoc.org/
99
+ [YARD-GS]: https://rubydoc.info/docs/yard/file/docs/GettingStarted.md
100
+ [PDD]: https://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
101
+ [RDF.rb]: https://rubydoc.info/github/ruby-rdf/rdf/master/frames
102
+ [Backports]: https://rubygems.org/gems/backports
103
+ [TriG]: https://www.w3.org/TR/trig/
104
+ [TriG doc]: https://rubydoc.info/github/ruby-rdf/rdf-trig/master/file/README.markdown
105
+ [TriG EBNF]: https://dvcs.w3.org/hg/rdf/raw-file/default/trig/trig.bnf
106
+ [Turtle doc]: https://rubydoc.info/github/ruby-rdf/rdf-turtle/master/file/README.markdown
data/UNLICENSE CHANGED
@@ -21,4 +21,4 @@ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
21
  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
22
  OTHER DEALINGS IN THE SOFTWARE.
23
23
 
24
- For more information, please refer to <http://unlicense.org/>
24
+ For more information, please refer to <https://unlicense.org/>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 3.1.1
@@ -15,11 +15,11 @@ module RDF
15
15
  # end
16
16
  # end
17
17
  #
18
- # @see http://rubydoc.info/github/ruby-rdf/rdf-turtle/
19
- # @see http://rubydoc.info/github/ruby-rdf/rdf/master/
20
- # @see http://www.w3.org/TR/trig/
18
+ # @see https://rubydoc.info/github/ruby-rdf/rdf-turtle/
19
+ # @see https://rubydoc.info/github/ruby-rdf/rdf/master/
20
+ # @see https://www.w3.org/TR/trig/
21
21
  #
22
- # @author [Gregg Kellogg](http://greggkellogg.net/)
22
+ # @author [Gregg Kellogg](https://greggkellogg.net/)
23
23
  module TriG
24
24
  require 'rdf/trig/format'
25
25
  autoload :Reader, 'rdf/trig/reader'
@@ -14,9 +14,9 @@ module RDF::TriG
14
14
  # @example Obtaining serialization format file extension mappings
15
15
  # RDF::Format.file_extensions #=> {trig: "application/trig"}
16
16
  #
17
- # @see http://www.w3.org/TR/rdf-testcases/#ntriples
17
+ # @see https://www.w3.org/TR/rdf-testcases/#ntriples
18
18
  class Format < RDF::Format
19
- content_type 'application/trig', extension: :trig, alias: 'application/x-trig'
19
+ content_type 'application/trig', extension: :trig, alias: 'application/x-trig;q=0.2'
20
20
  content_encoding 'utf-8'
21
21
 
22
22
  reader { RDF::TriG::Reader }
@@ -1,7 +1,7 @@
1
1
  module RDF::TriG
2
2
  ##
3
3
  # Streaming writer interface
4
- # @author [Gregg Kellogg](http://greggkellogg.net/)
4
+ # @author [Gregg Kellogg](https://greggkellogg.net/)
5
5
  module StreamingWriter
6
6
  ##
7
7
  # Write out a statement, retaining current
@@ -11,24 +11,24 @@ module RDF::TriG
11
11
  if statement.graph_name != @streaming_graph
12
12
  stream_epilogue
13
13
  if statement.graph_name
14
- @output.write "#{format_term(statement.graph_name, options)} {"
14
+ @output.write "#{format_term(statement.graph_name, **options)} {"
15
15
  end
16
16
  @streaming_graph, @streaming_subject, @streaming_predicate = statement.graph_name, statement.subject, statement.predicate
17
- @output.write "#{format_term(statement.subject, options)} "
18
- @output.write "#{format_term(statement.predicate, options)} "
17
+ @output.write "#{format_term(statement.subject, **options)} "
18
+ @output.write "#{statement.predicate == RDF.type ? 'a' : format_term(statement.predicate, **options)} "
19
19
  elsif statement.subject != @streaming_subject
20
20
  @output.puts " ." if @previous_statement
21
21
  @output.write "#{indent(@streaming_subject ? 1 : 0)}"
22
22
  @streaming_subject, @streaming_predicate = statement.subject, statement.predicate
23
- @output.write "#{format_term(statement.subject, options)} "
24
- @output.write "#{format_term(statement.predicate, options)} "
23
+ @output.write "#{format_term(statement.subject, **options)} "
24
+ @output.write "#{statement.predicate == RDF.type ? 'a' : format_term(statement.predicate, **options)} "
25
25
  elsif statement.predicate != @streaming_predicate
26
26
  @streaming_predicate = statement.predicate
27
- @output.write ";\n#{indent(@streaming_subject ? 2 : 1)}#{format_term(statement.predicate, options)} "
27
+ @output.write ";\n#{indent(@streaming_subject ? 2 : 1)}#{statement.predicate == RDF.type ? 'a' : format_term(statement.predicate, **options)} "
28
28
  else
29
29
  @output.write ",\n#{indent(@streaming_subject ? 3 : 2)}"
30
30
  end
31
- @output.write("#{format_term(statement.object, options)}")
31
+ @output.write("#{format_term(statement.object, **options)}")
32
32
  @previous_statement = statement
33
33
  end
34
34
 
@@ -54,7 +54,7 @@ module RDF::TriG
54
54
  # end
55
55
  # end
56
56
  #
57
- # @author [Gregg Kellogg](http://greggkellogg.net/)
57
+ # @author [Gregg Kellogg](https://greggkellogg.net/)
58
58
  class Writer < RDF::Turtle::Writer
59
59
  include StreamingWriter
60
60
  format RDF::TriG::Format
@@ -87,7 +87,7 @@ module RDF::TriG
87
87
  # @yieldreturn [void]
88
88
  # @yield [writer]
89
89
  # @yieldparam [RDF::Writer] writer
90
- def initialize(output = $stdout, options = {}, &block)
90
+ def initialize(output = $stdout, **options, &block)
91
91
  super do
92
92
  # Set both @repo and @graph to a new repository.
93
93
  @repo = @graph = RDF::Repository.new
@@ -100,7 +100,6 @@ module RDF::TriG
100
100
  end
101
101
  end
102
102
 
103
-
104
103
  ##
105
104
  # Adds a triple to be serialized
106
105
  # @param [RDF::Resource] subject
@@ -149,7 +148,8 @@ module RDF::TriG
149
148
  preprocess
150
149
  start_document
151
150
 
152
- order_graphs.each do |graph_name|
151
+ @graph_names = order_graphs
152
+ @graph_names.each do |graph_name|
153
153
  log_depth do
154
154
  log_debug {"graph_name: #{graph_name.inspect}"}
155
155
  reset
@@ -164,6 +164,16 @@ module RDF::TriG
164
164
 
165
165
  # Pre-process statements again, but in the specified graph
166
166
  @graph.each {|st| preprocess_statement(st)}
167
+
168
+ # Remove lists that are referenced and have non-list properties,
169
+ # or are present in more than one graph, or have elements
170
+ # that are present in more than one graph;
171
+ # these are legal, but can't be serialized as lists
172
+ @lists.reject! do |node, list|
173
+ ref_count(node) > 0 && prop_count(node) > 0 ||
174
+ list.subjects.any? {|elt| !resource_in_single_graph?(elt)}
175
+ end
176
+
167
177
  order_subjects.each do |subject|
168
178
  unless is_done?(subject)
169
179
  statement(subject)
@@ -180,18 +190,14 @@ module RDF::TriG
180
190
  protected
181
191
 
182
192
  # Add additional constraint that the resource must be in a single graph
183
- def blankNodePropertyList?(subject)
184
- super && resource_in_single_graph?(subject)
185
- end
186
-
187
- # Add additional constraint that the resource must be in a single graph
188
- def p_squared?(resource, position)
189
- super && resource_in_single_graph?(resource)
193
+ # and must not be a graph name
194
+ def blankNodePropertyList?(resource, position)
195
+ super && resource_in_single_graph?(resource) && !@graph_names.include?(resource)
190
196
  end
191
197
 
192
198
  def resource_in_single_graph?(resource)
193
- graph_names = @repo.query(subject: resource).map(&:graph_name)
194
- graph_names += @repo.query(object: resource).map(&:graph_name)
199
+ graph_names = @repo.query({subject: resource}).map(&:graph_name)
200
+ graph_names += @repo.query({object: resource}).map(&:graph_name)
195
201
  graph_names.uniq.length <= 1
196
202
  end
197
203
 
@@ -201,7 +207,7 @@ module RDF::TriG
201
207
  graph_names = @repo.graph_names.to_a.sort
202
208
 
203
209
  # include default graph, if necessary
204
- graph_names.unshift(nil) unless @repo.query(graph_name: false).to_a.empty?
210
+ graph_names.unshift(nil) unless @repo.query({graph_name: false}).to_a.empty?
205
211
 
206
212
  graph_names
207
213
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-trig
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-10 00:00:00.000000000 Z
11
+ date: 2020-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
@@ -16,146 +16,140 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '3.1'
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: '2.0'
26
+ version: '3.1'
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: '1.0'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 1.0.1
33
+ version: '2.0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '1.0'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 1.0.1
40
+ version: '2.0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: rdf-turtle
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '2.0'
47
+ version: '3.1'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
52
  - - "~>"
59
53
  - !ruby/object:Gem::Version
60
- version: '2.0'
54
+ version: '3.1'
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: json-ld
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
59
  - - "~>"
66
60
  - !ruby/object:Gem::Version
67
- version: '2.0'
61
+ version: '3.1'
68
62
  type: :development
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
66
  - - "~>"
73
67
  - !ruby/object:Gem::Version
74
- version: '2.0'
68
+ version: '3.1'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: rspec
77
71
  requirement: !ruby/object:Gem::Requirement
78
72
  requirements:
79
73
  - - "~>"
80
74
  - !ruby/object:Gem::Version
81
- version: '3.2'
75
+ version: '3.9'
82
76
  type: :development
83
77
  prerelease: false
84
78
  version_requirements: !ruby/object:Gem::Requirement
85
79
  requirements:
86
80
  - - "~>"
87
81
  - !ruby/object:Gem::Version
88
- version: '3.2'
82
+ version: '3.9'
89
83
  - !ruby/object:Gem::Dependency
90
84
  name: rspec-its
91
85
  requirement: !ruby/object:Gem::Requirement
92
86
  requirements:
93
87
  - - "~>"
94
88
  - !ruby/object:Gem::Version
95
- version: '1.0'
89
+ version: '1.3'
96
90
  type: :development
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
94
  - - "~>"
101
95
  - !ruby/object:Gem::Version
102
- version: '1.0'
96
+ version: '1.3'
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: rdf-isomorphic
105
99
  requirement: !ruby/object:Gem::Requirement
106
100
  requirements:
107
101
  - - "~>"
108
102
  - !ruby/object:Gem::Version
109
- version: '2.0'
103
+ version: '3.1'
110
104
  type: :development
111
105
  prerelease: false
112
106
  version_requirements: !ruby/object:Gem::Requirement
113
107
  requirements:
114
108
  - - "~>"
115
109
  - !ruby/object:Gem::Version
116
- version: '2.0'
110
+ version: '3.1'
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: yard
119
113
  requirement: !ruby/object:Gem::Requirement
120
114
  requirements:
121
115
  - - "~>"
122
116
  - !ruby/object:Gem::Version
123
- version: '0.8'
117
+ version: 0.9.20
124
118
  type: :development
125
119
  prerelease: false
126
120
  version_requirements: !ruby/object:Gem::Requirement
127
121
  requirements:
128
122
  - - "~>"
129
123
  - !ruby/object:Gem::Version
130
- version: '0.8'
124
+ version: 0.9.20
131
125
  - !ruby/object:Gem::Dependency
132
126
  name: rdf-spec
133
127
  requirement: !ruby/object:Gem::Requirement
134
128
  requirements:
135
129
  - - "~>"
136
130
  - !ruby/object:Gem::Version
137
- version: '2.0'
131
+ version: '3.1'
138
132
  type: :development
139
133
  prerelease: false
140
134
  version_requirements: !ruby/object:Gem::Requirement
141
135
  requirements:
142
136
  - - "~>"
143
137
  - !ruby/object:Gem::Version
144
- version: '2.0'
138
+ version: '3.1'
145
139
  - !ruby/object:Gem::Dependency
146
140
  name: rake
147
141
  requirement: !ruby/object:Gem::Requirement
148
142
  requirements:
149
143
  - - "~>"
150
144
  - !ruby/object:Gem::Version
151
- version: '10'
145
+ version: '13.0'
152
146
  type: :development
153
147
  prerelease: false
154
148
  version_requirements: !ruby/object:Gem::Requirement
155
149
  requirements:
156
150
  - - "~>"
157
151
  - !ruby/object:Gem::Version
158
- version: '10'
152
+ version: '13.0'
159
153
  description: RDF::TriG is an TriG reader/writer for the RDF.rb library suite.
160
154
  email: public-rdf-ruby@w3.org
161
155
  executables: []
@@ -173,7 +167,7 @@ files:
173
167
  - lib/rdf/trig/streaming_writer.rb
174
168
  - lib/rdf/trig/version.rb
175
169
  - lib/rdf/trig/writer.rb
176
- homepage: http://ruby-rdf.github.com/rdf-trig
170
+ homepage: https://github.com/ruby-rdf/rdf-trig
177
171
  licenses:
178
172
  - Unlicense
179
173
  metadata: {}
@@ -185,17 +179,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
179
  requirements:
186
180
  - - ">="
187
181
  - !ruby/object:Gem::Version
188
- version: '2.0'
182
+ version: '2.4'
189
183
  required_rubygems_version: !ruby/object:Gem::Requirement
190
184
  requirements:
191
185
  - - ">="
192
186
  - !ruby/object:Gem::Version
193
187
  version: '0'
194
188
  requirements: []
195
- rubyforge_project: rdf-trig
196
- rubygems_version: 2.4.8
189
+ rubygems_version: 3.1.3
197
190
  signing_key:
198
191
  specification_version: 4
199
192
  summary: TriG reader/writer for Ruby.
200
193
  test_files: []
201
- has_rdoc: false