rdf-trig 1.1.5.1 → 1.99.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
  SHA1:
3
- metadata.gz: ca2a72f7cb04a1d5e849f9255f9352b199d064de
4
- data.tar.gz: 786a29f56d45192f6f5925290e7a4398b1e51139
3
+ metadata.gz: fc8d552177ba636020bf4802cde8700625ae6430
4
+ data.tar.gz: 7cbfeac9cfe170cf2b0203e29885cad5a711b106
5
5
  SHA512:
6
- metadata.gz: e4bee71adff6065aea202a96ae9b64496b75e89a091d046d5c522baa3d469101ad19471529aaa9fbecae17c1ad53b67b85995c40c498b4183117307dc2c8a086
7
- data.tar.gz: be1c09ea8310797f8b7794d2d236a2343784645703478fdae686e96596294502487228afe63bb474cc444453e0c61b7e46b98acaa1ffd3c91806bbb26891c663
6
+ metadata.gz: ea8fc1b9f68e6ef7cf62455828060b9b58ab2620494482f9184b608491bff3bad50f54146c530dbe5c5700259c61d29f0d896f00e8e8ecd6607e5e4d8e6c553f
7
+ data.tar.gz: 39cc3dbe3ecef648ba547e262635432c4b66a5e8d4aa7e30e9737a0575900d21377d8245f5e61f28625bd3c3487b5dae110f0d2b6904fd0e8769ba1943e8872f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.5.1
1
+ 1.99.0
@@ -5,18 +5,18 @@ module RDF::TriG
5
5
  # @example Obtaining an TriG format class
6
6
  # RDF::Format.for("etc/foaf.trig")
7
7
  # RDF::Format.for(:file_name => "etc/foaf.trig")
8
- # RDF::Format.for(:file_extension => "trig")
8
+ # RDF::Format.for(file_extension: "trig")
9
9
  # RDF::Format.for(:content_type => "application/trig")
10
10
  #
11
11
  # @example Obtaining serialization format MIME types
12
12
  # RDF::Format.content_types #=> {"application/trig" => [RDF::TriG::Format]}
13
13
  #
14
14
  # @example Obtaining serialization format file extension mappings
15
- # RDF::Format.file_extensions #=> {:trig => "application/trig"}
15
+ # RDF::Format.file_extensions #=> {trig: "application/trig"}
16
16
  #
17
17
  # @see http://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'
20
20
  content_encoding 'utf-8'
21
21
 
22
22
  reader { RDF::TriG::Reader }
@@ -65,11 +65,11 @@ module RDF::TriG
65
65
  ##
66
66
  # Iterates the given block for each RDF quad in the input.
67
67
  #
68
- # @yield [subject, predicate, object, context]
68
+ # @yield [subject, predicate, object, graph_name]
69
69
  # @yieldparam [RDF::Resource] subject
70
70
  # @yieldparam [RDF::URI] predicate
71
71
  # @yieldparam [RDF::Value] object
72
- # @yieldparam [RDF::URI] context
72
+ # @yieldparam [RDF::URI] graph_name
73
73
  # @return [void]
74
74
  def each_quad(&block)
75
75
  if block_given?
@@ -88,7 +88,7 @@ module RDF::TriG
88
88
  # @raise [RDF::ReaderError] Checks parameter types and raises if they are incorrect if parsing mode is _validate_.
89
89
  def add_statement(production, statement)
90
90
  error("Statement is invalid: #{statement.inspect.inspect}", production: produciton) if validate? && statement.invalid?
91
- statement.context = @graph_name if @graph_name
91
+ statement.graph_name = @graph_name if @graph_name
92
92
  @callback.call(statement) if statement.subject &&
93
93
  statement.predicate &&
94
94
  statement.object &&
@@ -8,12 +8,12 @@ module RDF::TriG
8
8
  # `subject` and `predicate` to create more compact output
9
9
  # @return [void] `self`
10
10
  def stream_statement(statement)
11
- if statement.context != @streaming_context
11
+ if statement.graph_name != @streaming_graph
12
12
  stream_epilogue
13
- if statement.context
14
- @output.write "#{format_term(statement.context, options)} {"
13
+ if statement.graph_name
14
+ @output.write "#{format_term(statement.graph_name, options)} {"
15
15
  end
16
- @streaming_context, @streaming_subject, @streaming_predicate = statement.context, statement.subject, statement.predicate
16
+ @streaming_graph, @streaming_subject, @streaming_predicate = statement.graph_name, statement.subject, statement.predicate
17
17
  @output.write "#{format_term(statement.subject, options)} "
18
18
  @output.write "#{format_term(statement.predicate, options)} "
19
19
  elsif statement.subject != @streaming_subject
@@ -38,7 +38,7 @@ module RDF::TriG
38
38
  def stream_epilogue
39
39
  case
40
40
  when @previous_statement.nil? ;
41
- when @streaming_context then @output.puts " }"
41
+ when @streaming_graph then @output.puts " }"
42
42
  else @output.puts " ."
43
43
  end
44
44
  end
@@ -13,7 +13,7 @@ module RDF::TriG
13
13
  # RDF::Writer.for(:trig) #=> RDF::TriG::Writer
14
14
  # RDF::Writer.for("etc/test.trig")
15
15
  # RDF::Writer.for(:file_name => "etc/test.trig")
16
- # RDF::Writer.for(:file_extension => "trig")
16
+ # RDF::Writer.for(file_extension: "trig")
17
17
  # RDF::Writer.for(:content_type => "application/trig")
18
18
  #
19
19
  # @example Serializing RDF repo into an TriG file
@@ -36,7 +36,7 @@ module RDF::TriG
36
36
  # end
37
37
  #
38
38
  # @example Serializing RDF statements to a string in streaming mode
39
- # RDF::TriG::Writer.buffer(:stream => true) do |writer|
39
+ # RDF::TriG::Writer.buffer(stream: true) do |writer|
40
40
  # repo.each_statement do |statement|
41
41
  # writer << statement
42
42
  # end
@@ -45,9 +45,9 @@ module RDF::TriG
45
45
  # The writer will add prefix definitions, and use them for creating @prefix definitions, and minting QNames
46
46
  #
47
47
  # @example Creating @base and @prefix definitions in output
48
- # RDF::TriG::Writer.buffer(:base_uri => "http://example.com/", :prefixes => {
48
+ # RDF::TriG::Writer.buffer(base_uri: "http://example.com/", prefixes: {
49
49
  # nil => "http://example.com/ns#",
50
- # :foaf => "http://xmlns.com/foaf/0.1/"}
50
+ # foaf: "http://xmlns.com/foaf/0.1/"}
51
51
  # ) do |writer|
52
52
  # repo.each_statement do |statement|
53
53
  # writer << statement
@@ -59,27 +59,27 @@ module RDF::TriG
59
59
  include StreamingWriter
60
60
  format RDF::TriG::Format
61
61
 
62
- class ContextFilteredRepo
62
+ class GraphFilteredRepo
63
63
  include RDF::Queryable
64
64
 
65
- def initialize(repo, context)
65
+ def initialize(repo, graph_name)
66
66
  @repo = repo
67
- @context = context
67
+ @graph_name = graph_name
68
68
  end
69
69
 
70
- # Filter statements in repository to those having the specified context
71
- # Returns each statement having the specified context, `false` for default context
70
+ # Filter statements in repository to those having the specified graph_name
71
+ # Returns each statement having the specified graph_name, `false` for default graph
72
72
  # @yield statement
73
73
  # @yieldparam [RDF::Statement] statement
74
74
  # @return [void]
75
75
  # @see [RDF::Queryable]
76
76
  def each
77
77
  @repo.each_statement do |st|
78
- case @context
78
+ case @graph_name
79
79
  when false
80
- yield st if !st.context
80
+ yield st if !st.graph_name
81
81
  else
82
- yield st if st.context == @context
82
+ yield st if st.graph_name == @graph_name
83
83
  end
84
84
  end
85
85
  end
@@ -88,7 +88,7 @@ module RDF::TriG
88
88
  # Proxy Repository#query_pattern
89
89
  # @see RDF::Repository#query_pattern
90
90
  def query_pattern(pattern, &block)
91
- pattern.context = @context || false
91
+ pattern.graph_name = @graph_name || false
92
92
  @repo.send(:query_pattern, pattern, &block)
93
93
  end
94
94
  end
@@ -125,8 +125,8 @@ module RDF::TriG
125
125
  reset
126
126
  super do
127
127
  # Set both @repo and @graph to a new repository.
128
- # When serializing a context, @graph is changed
129
- # to a ContextFilteredRepo
128
+ # When serializing a named graph, @graph is changed
129
+ # to a GraphFilteredRepo
130
130
  @repo = @graph = RDF::Repository.new
131
131
  if block_given?
132
132
  case block.arity
@@ -183,8 +183,8 @@ module RDF::TriG
183
183
  preprocess
184
184
  start_document
185
185
 
186
- order_contexts.each do |ctx|
187
- debug {"context: #{ctx.inspect}"}
186
+ order_graphs.each do |ctx|
187
+ debug {"graph_name: #{ctx.inspect}"}
188
188
  reset
189
189
  @depth = ctx ? 2 : 0
190
190
 
@@ -192,10 +192,10 @@ module RDF::TriG
192
192
  @output.write("\n#{format_term(ctx)} {")
193
193
  end
194
194
 
195
- # Restrict view to the particular context
196
- @graph = ContextFilteredRepo.new(@repo, ctx)
195
+ # Restrict view to the particular graph
196
+ @graph = GraphFilteredRepo.new(@repo, ctx)
197
197
 
198
- # Pre-process statements again, but in the specified context
198
+ # Pre-process statements again, but in the specified graph
199
199
  @graph.each {|st| preprocess_statement(st)}
200
200
  order_subjects.each do |subject|
201
201
  unless is_done?(subject)
@@ -210,31 +210,31 @@ module RDF::TriG
210
210
 
211
211
  protected
212
212
 
213
- # Add additional constraint that the resource must be in a single context
213
+ # Add additional constraint that the resource must be in a single graph
214
214
  def blankNodePropertyList?(subject)
215
- super && resource_in_single_context?(subject)
215
+ super && resource_in_single_graph?(subject)
216
216
  end
217
217
 
218
- # Add additional constraint that the resource must be in a single context
218
+ # Add additional constraint that the resource must be in a single graph
219
219
  def p_squared?(resource, position)
220
- super && resource_in_single_context?(resource)
220
+ super && resource_in_single_graph?(resource)
221
221
  end
222
222
 
223
- def resource_in_single_context?(resource)
224
- contexts = @repo.query(:subject => resource).map(&:context)
225
- contexts += @repo.query(:object => resource).map(&:context)
226
- contexts.uniq.length <= 1
223
+ def resource_in_single_graph?(resource)
224
+ graph_names = @repo.query(subject: resource).map(&:graph_name)
225
+ graph_names += @repo.query(object: resource).map(&:graph_name)
226
+ graph_names.uniq.length <= 1
227
227
  end
228
228
 
229
- # Order contexts for output
230
- def order_contexts
231
- debug("order_contexts") {@repo.contexts.to_a.inspect}
232
- contexts = @repo.contexts.to_a.sort
229
+ # Order graphs for output
230
+ def order_graphs
231
+ debug("order_graphs") {@repo.graph_names.to_a.inspect}
232
+ graph_names = @repo.graph_names.to_a.sort
233
233
 
234
- # include default context, if necessary
235
- contexts.unshift(nil) unless @repo.query(:context => false).to_a.empty?
234
+ # include default graph, if necessary
235
+ graph_names.unshift(nil) unless @repo.query(graph_name: false).to_a.empty?
236
236
 
237
- contexts
237
+ graph_names
238
238
  end
239
239
 
240
240
  # Perform any statement preprocessing required. This is used to perform reference counts and determine required
@@ -242,7 +242,7 @@ module RDF::TriG
242
242
  # @param [Statement] statement
243
243
  def preprocess_statement(statement)
244
244
  super
245
- get_pname(statement.context) if statement.has_context?
245
+ get_pname(statement.graph_name) if statement.has_graph?
246
246
  end
247
247
  end
248
248
  end
metadata CHANGED
@@ -1,26 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-trig
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5.1
4
+ version: 1.99.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: 2015-11-09 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.1'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 1.1.11
23
- - - "<"
24
18
  - !ruby/object:Gem::Version
25
19
  version: '1.99'
26
20
  type: :runtime
@@ -28,12 +22,6 @@ dependencies:
28
22
  version_requirements: !ruby/object:Gem::Requirement
29
23
  requirements:
30
24
  - - "~>"
31
- - !ruby/object:Gem::Version
32
- version: '1.1'
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: 1.1.11
36
- - - "<"
37
25
  - !ruby/object:Gem::Version
38
26
  version: '1.99'
39
27
  - !ruby/object:Gem::Dependency
@@ -66,9 +54,6 @@ dependencies:
66
54
  - - ">="
67
55
  - !ruby/object:Gem::Version
68
56
  version: 1.1.7
69
- - - "<"
70
- - !ruby/object:Gem::Version
71
- version: '1.99'
72
57
  type: :runtime
73
58
  prerelease: false
74
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -79,9 +64,6 @@ dependencies:
79
64
  - - ">="
80
65
  - !ruby/object:Gem::Version
81
66
  version: 1.1.7
82
- - - "<"
83
- - !ruby/object:Gem::Version
84
- version: '1.99'
85
67
  - !ruby/object:Gem::Dependency
86
68
  name: json-ld
87
69
  requirement: !ruby/object:Gem::Requirement
@@ -89,9 +71,6 @@ dependencies:
89
71
  - - "~>"
90
72
  - !ruby/object:Gem::Version
91
73
  version: '1.1'
92
- - - "<"
93
- - !ruby/object:Gem::Version
94
- version: '1.99'
95
74
  type: :development
96
75
  prerelease: false
97
76
  version_requirements: !ruby/object:Gem::Requirement
@@ -99,9 +78,6 @@ dependencies:
99
78
  - - "~>"
100
79
  - !ruby/object:Gem::Version
101
80
  version: '1.1'
102
- - - "<"
103
- - !ruby/object:Gem::Version
104
- version: '1.99'
105
81
  - !ruby/object:Gem::Dependency
106
82
  name: rspec
107
83
  requirement: !ruby/object:Gem::Requirement
@@ -137,9 +113,6 @@ dependencies:
137
113
  - - "~>"
138
114
  - !ruby/object:Gem::Version
139
115
  version: '1.1'
140
- - - "<"
141
- - !ruby/object:Gem::Version
142
- version: '1.99'
143
116
  type: :development
144
117
  prerelease: false
145
118
  version_requirements: !ruby/object:Gem::Requirement
@@ -147,9 +120,6 @@ dependencies:
147
120
  - - "~>"
148
121
  - !ruby/object:Gem::Version
149
122
  version: '1.1'
150
- - - "<"
151
- - !ruby/object:Gem::Version
152
- version: '1.99'
153
123
  - !ruby/object:Gem::Dependency
154
124
  name: yard
155
125
  requirement: !ruby/object:Gem::Requirement
@@ -169,9 +139,6 @@ dependencies:
169
139
  requirement: !ruby/object:Gem::Requirement
170
140
  requirements:
171
141
  - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: '1.1'
174
- - - "<"
175
142
  - !ruby/object:Gem::Version
176
143
  version: '1.99'
177
144
  type: :development
@@ -179,9 +146,6 @@ dependencies:
179
146
  version_requirements: !ruby/object:Gem::Requirement
180
147
  requirements:
181
148
  - - "~>"
182
- - !ruby/object:Gem::Version
183
- version: '1.1'
184
- - - "<"
185
149
  - !ruby/object:Gem::Version
186
150
  version: '1.99'
187
151
  - !ruby/object:Gem::Dependency
@@ -227,7 +191,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
227
191
  requirements:
228
192
  - - ">="
229
193
  - !ruby/object:Gem::Version
230
- version: 1.9.2
194
+ version: 1.9.3
231
195
  required_rubygems_version: !ruby/object:Gem::Requirement
232
196
  requirements:
233
197
  - - ">="