rdf-aggregate-repo 0.1.0 → 0.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.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/rdf/aggregate_repo.rb +33 -33
  3. metadata +20 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -265,6 +265,39 @@ module RDF
265
265
  enum_graph
266
266
  end
267
267
 
268
+ ##
269
+ # Default graph of this aggregate, either a projection of the source
270
+ # default graph (if `false`), a particular named graph from the
271
+ # last source in which it appears, or a MergeGraph composed of the
272
+ # graphs which compose it.
273
+ #
274
+ # @return [RDF::Graph]
275
+ def default_graph
276
+ @default_graph ||= begin
277
+ case
278
+ when sources.length == 0 || defaults.length == 0
279
+ RDF::Graph.new
280
+ when defaults.length == 1 && sources.length == 1
281
+ RDF::Graph.new((defaults.first || nil), :data => sources.first)
282
+ else
283
+ # Otherwise, create a MergeGraph from the set of pairs of source and context
284
+ RDF::MergeGraph.new(:name => nil) do |graph|
285
+ if defaults == [false]
286
+ graph.sources.each do |s|
287
+ # Add default graph from each source
288
+ source s, false
289
+ end
290
+ else
291
+ defaults.each do |context|
292
+ # add the named graph
293
+ graph.source sources.reverse.detect {|s| s.has_context?(context)}, context
294
+ end
295
+ end
296
+ end
297
+ end
298
+ end
299
+ end
300
+
268
301
  protected
269
302
 
270
303
  ##
@@ -300,38 +333,5 @@ module RDF
300
333
  end
301
334
  end
302
335
  end
303
-
304
- ##
305
- # Default graph of this aggregate, either a projection of the source
306
- # default graph (if `false`), a particular named graph from the
307
- # last source in which it appears, or a MergeGraph composed of the
308
- # graphs which compose it.
309
- #
310
- # @return [RDF::Graph]
311
- def default_graph
312
- @default_graph ||= begin
313
- case
314
- when sources.length == 0 || defaults.length == 0
315
- RDF::Graph.new
316
- when defaults.length == 1 && sources.length == 1
317
- RDF::Graph.new((defaults.first || nil), :data => sources.first)
318
- else
319
- # Otherwise, create a MergeGraph from the set of pairs of source and context
320
- RDF::MergeGraph.new(:name => nil) do
321
- if defaults == [false]
322
- sources.each do |s|
323
- # Add default graph from each source
324
- source s, false
325
- end
326
- else
327
- each_context do |context|
328
- # add the named graph
329
- source sources.reverse.detect {|s| s.has_context?(context)}, context
330
- end
331
- end
332
- end
333
- end
334
- end
335
- end
336
336
  end
337
337
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-aggregate-repo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '1.0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rdf-turtle
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '1.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: rspec
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +124,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
124
  - - ! '>='
109
125
  - !ruby/object:Gem::Version
110
126
  version: '0'
127
+ segments:
128
+ - 0
129
+ hash: 1146318279841752965
111
130
  requirements: []
112
131
  rubyforge_project:
113
132
  rubygems_version: 1.8.25