rdf-aggregate-repo 1.99.0 → 2.0.0.beta1

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: 3a4dd65e6ddcb82e9abbe6477d60a823ba6a443b
4
- data.tar.gz: ee446e02cb255fef1405b856ce582a79b7906ca1
3
+ metadata.gz: e19370895a1ec780837044ffeb3d84f2885a518a
4
+ data.tar.gz: 8b95295c2c31bb85d2afa24d8a7b85fd17037e32
5
5
  SHA512:
6
- metadata.gz: 76ea80547ca6e67842191f92a940eb47d4300184ce30a775ae10f05c90b45f75e2631ecc01606491e57a4ea5295d7c7603c4234684e76d8c38e14c81d66edad1
7
- data.tar.gz: 721aac81e2d62d5fe0f15121f170bb1b31ed5a740039e159dbf7fbd413dcfa19d781d3889a98fc01b2751705121e753a778b1fe340f570a1ab74f52e70a246a8
6
+ metadata.gz: a5a9bc7835d5309698eab9861068826d39b95288363cc1e0ec364174d28d7c79b3656b0a5e69728bda0824fb299a69c485b3e309c15667440b7951944bede808
7
+ data.tar.gz: a90fff7aa898442ad167d572251137f226152b8ccbbbcee40edfebf19ba1bf0cf603b6f0c798cb4fba4d11f776a580d1ea60a7ff3086ebf533e4cb1124c9dbbf
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # RDF::AggregateRepo
2
2
 
3
- An aggregate RDF::Repository supporting a subset of named graphs and zero or more named graphs mapped to the default graph.
3
+ An aggregate RDF::Dataset supporting a subset of named graphs and zero or more named graphs mapped to the default graph.
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/rdf-aggregate-repo.png)](http://badge.fury.io/rb/rdf-aggregate-repo)
6
6
  [![Build Status](https://travis-ci.org/ruby-rdf/rdf-aggregate-repo.png?branch=master)](http://travis-ci.org/ruby-rdf/rdf-aggregate-repo)
7
7
 
8
8
  ## Description
9
9
 
10
- Maps named graphs from one or more `RDF::Queryable` instances into a single object, allowing a specific set of _named graphs_ to be seen, as well as a _default graph_ made up from one or more _named graphs_. This is used to implement [SPARQL Datasets][].
10
+ Maps named graphs from one or more `RDF::Queryable` instances into a single dataset, allowing a specific set of _named graphs_ to be seen, as well as a _default graph_ made up from one or more _named graphs_. This is used to implement [RDF Datasets][].
11
11
 
12
12
  ## Examples
13
13
 
@@ -29,8 +29,8 @@ Maps named graphs from one or more `RDF::Queryable` instances into a single obje
29
29
 
30
30
  ## Dependencies
31
31
 
32
- * [Ruby](http://ruby-lang.org/) (>= 1.8.7) or (>= 1.8.1 with [Backports][])
33
- * [RDF.rb][] (>= 1.0)
32
+ * [Ruby](http://ruby-lang.org/) (>= 2.0)
33
+ * [RDF.rb][] (>= 2.0)
34
34
 
35
35
  ## Mailing List
36
36
 
@@ -64,7 +64,7 @@ This is free and unencumbered public domain software. For more information,
64
64
  see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
65
65
 
66
66
  [RDF.rb]: http://ruby-rdf.github.com/
67
- [SPARQL Datasets]: http://www.w3.org/TR/sparql11-query/#rdfDataset
67
+ [RDF Datasets]: https://www.w3.org/TR/rdf11-concepts/#dfn-rdf-dataset
68
68
  [YARD]: http://yardoc.org/
69
69
  [YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
70
70
  [PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.99.0
1
+ 2.0.0.beta1
@@ -156,9 +156,9 @@ module RDF
156
156
  return enum_for(:each) unless block_given?
157
157
 
158
158
  # Add everything to a new graph for de-duplication
159
- tmp = RDF::Graph.new(@graph_name, data: RDF::Repository.new)
159
+ tmp = RDF::Graph.new(graph_name: @graph_name, data: RDF::Repository.new)
160
160
  sources.each do |(source, gn)|
161
- tmp << RDF::Graph.new(gn || nil, data: source)
161
+ tmp << RDF::Graph.new(graph_name: gn || nil, data: source)
162
162
  end
163
163
  tmp.each(&block)
164
164
  end
@@ -186,11 +186,12 @@ module RDF
186
186
  ##
187
187
  # @private
188
188
  # @see RDF::Queryable#query_pattern
189
- def query_pattern(pattern, &block)
189
+ def query_pattern(pattern, options = {}, &block)
190
+ return enum_for(:query_pattern, pattern, options) unless block_given?
190
191
  pattern = pattern.dup
191
192
  sources.each do |(source, gn)|
192
193
  pattern.graph_name = gn
193
- source.send(:query_pattern, pattern, &block)
194
+ source.send(:query_pattern, pattern, options, &block)
194
195
  end
195
196
  end
196
197
  end
@@ -5,7 +5,7 @@ module RDF
5
5
  autoload :VERSION, 'rdf/aggregate_repo/version'
6
6
 
7
7
  ##
8
- # An aggregated RDF repository.
8
+ # An aggregated RDF datset.
9
9
  #
10
10
  # Aggregates the default and named graphs from one or more instances
11
11
  # implementing RDF::Queryable. By default, the aggregate projects
@@ -33,7 +33,7 @@ module RDF
33
33
  # end
34
34
  #
35
35
  # @todo Allow graph names to reassigned with queryable
36
- class AggregateRepo < RDF::Repository
36
+ class AggregateRepo < RDF::Dataset
37
37
  ##
38
38
  # The set of aggregated `queryable` instances included in this aggregate
39
39
  #
@@ -58,16 +58,15 @@ module RDF
58
58
  # @yieldparam [RDF::AggregateRepo] aggregation
59
59
  # @yieldreturn [void] ignored
60
60
  def initialize(*queryable, &block)
61
- @options = queryable.last.is_a?(Hash) ? queryable.last.dup : {}
62
-
61
+ @options = queryable.last.is_a?(Hash) ? queryable.pop.dup : {}
63
62
  @sources = queryable
64
63
  @defaults = []
65
64
  @named_graphs = []
66
65
 
67
66
  if block_given?
68
67
  case block.arity
69
- when 1 then block.call(self)
70
- else instance_eval(&block)
68
+ when 1 then block.call(self)
69
+ else instance_eval(&block)
71
70
  end
72
71
  end
73
72
  end
@@ -112,6 +111,17 @@ module RDF
112
111
 
113
112
  # Repository overrides
114
113
 
114
+ ##
115
+ # @private
116
+ # @see RDF::Enumerable#supports?
117
+ def supports?(feature)
118
+ case feature.to_sym
119
+ when :graph_name then @options[:with_graph_name]
120
+ when :validity then @options.fetch(:with_validity, true)
121
+ else false
122
+ end
123
+ end
124
+
115
125
  ##
116
126
  # Not writable
117
127
  #
@@ -152,7 +162,7 @@ module RDF
152
162
  # @return [Boolean]
153
163
  # @see RDF::Enumerable#has_statement?
154
164
  def has_statement?(statement)
155
- each_graph.to_a.any? {|g| g.has_statement?(statement)}
165
+ each_graph.any? {|g| g.has_statement?(statement) && statement.graph_name == g.graph_name}
156
166
  end
157
167
 
158
168
  ##
@@ -231,7 +241,7 @@ module RDF
231
241
  # Send graph from appropriate source
232
242
  @named_graphs.each do |graph_name|
233
243
  source = sources.reverse.detect {|s| s.has_graph?(graph_name)}
234
- block.call(RDF::Graph.new(graph_name, data: source))
244
+ block.call(RDF::Graph.new(graph_name: graph_name, data: source))
235
245
  end
236
246
  end
237
247
  enum_graph
@@ -251,7 +261,7 @@ module RDF
251
261
  RDF::Graph.new
252
262
  when defaults == [false] && sources.length == 1
253
263
  # Trivial case
254
- RDF::Graph.new(nil, data: sources.first)
264
+ RDF::Graph.new(data: sources.first)
255
265
  else
256
266
  # Otherwise, create a MergeGraph from the set of pairs of source and graph_name
257
267
  RDF::MergeGraph.new(name: nil) do |graph|
@@ -274,8 +284,9 @@ module RDF
274
284
  protected
275
285
 
276
286
  ##
277
- # Queries each constituent graph for RDF statements matching the given `pattern`,
278
- # yielding each matched statement to the given block.
287
+ # Queries each constituent graph for RDF statements matching the given `pattern`, yielding each matched statement to the given block.
288
+ #
289
+ # If called without a block, returns an enumerator
279
290
  #
280
291
  # @param [RDF::Query::Pattern] pattern
281
292
  # the query pattern to match
@@ -284,25 +295,26 @@ module RDF
284
295
  # @yieldreturn [void] ignored
285
296
  # @return [void] ignored
286
297
  # @see RDF::Queryable#query_pattern
287
- def query_pattern(pattern, &block)
298
+ def query_pattern(pattern, options = {}, &block)
299
+ return enum_for(:query_pattern, pattern, options) unless block_given?
288
300
  case pattern.graph_name
289
301
  when nil
290
302
  # Query against all graphs
291
- each_graph {|graph| graph.send(:query_pattern, pattern, &block)}
303
+ each_graph {|graph| graph.send(:query_pattern, pattern, options, &block)}
292
304
  when FalseClass
293
305
  # Query against default graph only
294
- default_graph.send(:query_pattern, pattern, &block)
306
+ default_graph.send(:query_pattern, pattern, options, &block)
295
307
  when RDF::Query::Variable
296
308
  # Query against all named graphs
297
309
  each_graph do |graph|
298
310
  source = sources.reverse.detect {|s| s.has_graph?(graph.graph_name)}
299
- RDF::Graph.new(graph.graph_name, data: source).send(:query_pattern, pattern, &block)
311
+ RDF::Graph.new(graph_name: graph.graph_name, data: source).send(:query_pattern, pattern, options, &block)
300
312
  end
301
313
  else
302
314
  # Query against a specific graph
303
315
  if @named_graphs.include?(pattern.graph_name)
304
316
  source = sources.reverse.detect {|s| s.has_graph?(pattern.graph_name)}
305
- RDF::Graph.new(pattern.graph_name, data: source).send(:query_pattern, pattern, &block)
317
+ RDF::Graph.new(graph_name: pattern.graph_name, data: source).send(:query_pattern, pattern, options, &block)
306
318
  end
307
319
  end
308
320
  end
metadata CHANGED
@@ -1,57 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-aggregate-repo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.99.0
4
+ version: 2.0.0.beta1
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-10-14 00:00:00.000000000 Z
11
+ date: 2016-02-22 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: 2.0.0.beta
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '1.99'
22
+ version: '3'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 2.0.0.beta
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '1.99'
32
+ version: '3'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rdf-spec
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 2.0.0.beta
40
+ - - "<"
32
41
  - !ruby/object:Gem::Version
33
- version: '1.99'
42
+ version: '3'
34
43
  type: :development
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - "~>"
47
+ - - ">="
39
48
  - !ruby/object:Gem::Version
40
- version: '1.99'
49
+ version: 2.0.0.beta
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '3'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: rdf-turtle
43
55
  requirement: !ruby/object:Gem::Requirement
44
56
  requirements:
45
- - - "~>"
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 2.0.0.beta
60
+ - - "<"
46
61
  - !ruby/object:Gem::Version
47
- version: '1.99'
62
+ version: '3'
48
63
  type: :development
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
51
66
  requirements:
52
- - - "~>"
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 2.0.0.beta
70
+ - - "<"
53
71
  - !ruby/object:Gem::Version
54
- version: '1.99'
72
+ version: '3'
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: rspec
57
75
  requirement: !ruby/object:Gem::Requirement
@@ -110,7 +128,7 @@ files:
110
128
  - lib/rdf/aggregate_repo/version.rb
111
129
  homepage: http://ruby-rdf.github.com/rdf-aggregate-repo
112
130
  licenses:
113
- - Public Domain
131
+ - Unlicense
114
132
  metadata: {}
115
133
  post_install_message:
116
134
  rdoc_options: []
@@ -120,15 +138,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
138
  requirements:
121
139
  - - ">="
122
140
  - !ruby/object:Gem::Version
123
- version: 1.9.3
141
+ version: '2.0'
124
142
  required_rubygems_version: !ruby/object:Gem::Requirement
125
143
  requirements:
126
- - - ">="
144
+ - - ">"
127
145
  - !ruby/object:Gem::Version
128
- version: '0'
146
+ version: 1.3.1
129
147
  requirements: []
130
148
  rubyforge_project:
131
- rubygems_version: 2.4.5.1
149
+ rubygems_version: 2.5.1
132
150
  signing_key:
133
151
  specification_version: 4
134
152
  summary: An aggregate RDF::Repository supporting a subset of named graphs and zero