ld4l-ore_rdf 0.0.6 → 0.0.7
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 +4 -4
- data/README.md +1 -1
- data/lib/ld4l/ore_rdf/models/aggregation.rb +50 -0
- data/lib/ld4l/ore_rdf/models/aggregation_resource.rb +1 -1
- data/lib/ld4l/ore_rdf/models/proxy_resource.rb +1 -1
- data/lib/ld4l/ore_rdf/services/aggregation/add_aggregated_resource.rb +3 -2
- data/lib/ld4l/ore_rdf/services/aggregation/add_aggregated_resources.rb +1 -1
- data/lib/ld4l/ore_rdf/services/proxy/create.rb +3 -3
- data/lib/ld4l/ore_rdf/version.rb +1 -1
- data/spec/ld4l/ore_rdf/models/aggregation_resource_spec.rb +37 -37
- data/spec/ld4l/ore_rdf/models/proxy_resource_spec.rb +9 -9
- data/spec/ld4l/ore_rdf/services/aggregation/add_aggregated_resource_spec.rb +5 -5
- data/spec/ld4l/ore_rdf/services/aggregation/add_aggregated_resources_spec.rb +10 -10
- data/spec/ld4l/ore_rdf/services/aggregation/find_spec.rb +1 -1
- data/spec/ld4l/ore_rdf/services/proxy/create_spec.rb +3 -3
- data/spec/ld4l/ore_rdf/services/proxy/find_spec.rb +8 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1314057adc8534d80d0ce5eb7916deec18a98afa
|
4
|
+
data.tar.gz: 466427737650c339d24ab57cbb3245f5056a836c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ad2757c009676508fb003cc30eb1b7aca2af85bdcf18c49df2578c41ab5b622df02db02c3b11123b2d09dafc59de290e70e57f3e7cd9ca0c756032524ca49bd
|
7
|
+
data.tar.gz: 5b4ed442b085221dee72b7228b5f226a77ebc4c03cbc01fd3150b73a73249b0eb6b3de272aeaea8bb888030aadc20b291e2856001b6aa950a2ae3cbb3d9d1b92
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ p = LD4L::FoafRDF::Person.new('p4')
|
|
50
50
|
agg10 = LD4L::OreRDF::CreateAggregation.call( :id=>'agg10', :title=>'My Resources', :description=>'Resources that I like', :owner=>p )
|
51
51
|
|
52
52
|
LD4L::OreRDF::AddAggregatedResource.call( agg10,'http://exmple.org/resource_1')
|
53
|
-
LD4L::OreRDF::AddAggregatedResource.call( agg10'http://exmple.org/resource_2')
|
53
|
+
LD4L::OreRDF::AddAggregatedResource.call( agg10,'http://exmple.org/resource_2')
|
54
54
|
LD4L::OreRDF::AddAggregatedResource.call( agg10,'http://exmple.org/resource_3')
|
55
55
|
|
56
56
|
LD4L::OreRDF::PersistAggregation.call(agg10)
|
@@ -3,6 +3,38 @@ module LD4L
|
|
3
3
|
module OreRDF
|
4
4
|
class Aggregation < DoublyLinkedList
|
5
5
|
|
6
|
+
@@clear_first_callback = lambda { |aggregation| aggregation.first_proxy = [] }
|
7
|
+
@@clear_last_callback = lambda { |aggregation| aggregation.last_proxy = [] }
|
8
|
+
@@update_first_callback = lambda { |aggregation, proxies| aggregation.first_proxy = proxies.first }
|
9
|
+
@@update_last_callback = lambda { |aggregation, proxies| aggregation.last_proxy = proxies.last }
|
10
|
+
|
11
|
+
@@clear_next_callback = lambda { |proxies, idx| proxies[idx].next_proxy = [] }
|
12
|
+
@@clear_prev_callback = lambda { |proxies, idx| proxies[idx].prev_proxy = [] }
|
13
|
+
@@update_next_callback = lambda { |proxies, idx| proxies[idx].next_proxy = proxies[idx+1] }
|
14
|
+
@@update_prev_callback = lambda { |proxies, idx| proxies[idx].prev_proxy = proxies[idx-1] }
|
15
|
+
|
16
|
+
@@find_first_callback = lambda do |aggregation, proxies|
|
17
|
+
first_proxy = aggregation.first_proxy
|
18
|
+
return first_proxy.first if first_proxy && !first_proxy.empty?
|
19
|
+
|
20
|
+
# if first isn't set, try to figure out first by looking for an item with prev_proxy == nil
|
21
|
+
# NOTE: If multiple items have prev_proxy == nil, it will return the first one it finds.
|
22
|
+
first_idx = proxies.index { |proxy| proxy.prev_proxy == [] }
|
23
|
+
first_idx ? proxies[first_idx] : nil
|
24
|
+
end
|
25
|
+
@@find_last_callback = lambda do |aggregation, proxies|
|
26
|
+
last_proxy = aggregation.last_proxy
|
27
|
+
return last_proxy.first if last_proxy && !last_proxy.empty?
|
28
|
+
|
29
|
+
# if last isn't set, try to figure out last by looking for an item with next_proxy == nil
|
30
|
+
# NOTE: If multiple items have next_proxy == nil, it will return the first one it finds.
|
31
|
+
last_idx = proxies.index { |proxy| proxy.next_proxy == [] }
|
32
|
+
last_idx ? proxies[last_idx] : nil
|
33
|
+
end
|
34
|
+
@@find_next_callback = lambda { |proxies, current_proxy| current_proxy.next_proxy.first }
|
35
|
+
@@find_prev_callback = lambda { |proxies, current_proxy| current_proxy.prev_proxy.first }
|
36
|
+
|
37
|
+
|
6
38
|
def self.initialize
|
7
39
|
super
|
8
40
|
end
|
@@ -15,6 +47,24 @@ module LD4L
|
|
15
47
|
new_args.delete(:proxy_resources)
|
16
48
|
new_args.delete(:aggregation_resource)
|
17
49
|
end
|
50
|
+
new_args = {} if args.empty?
|
51
|
+
|
52
|
+
# set callbacks
|
53
|
+
new_args[:clear_first_callback] = @@clear_first_callback
|
54
|
+
new_args[:clear_last_callback] = @@clear_last_callback
|
55
|
+
new_args[:update_first_callback] = @@update_first_callback
|
56
|
+
new_args[:update_last_callback] = @@update_last_callback
|
57
|
+
|
58
|
+
new_args[:clear_next_callback] = @@clear_next_callback
|
59
|
+
new_args[:clear_prev_callback] = @@clear_prev_callback
|
60
|
+
new_args[:update_next_callback] = @@update_next_callback
|
61
|
+
new_args[:update_prev_callback] = @@update_prev_callback
|
62
|
+
|
63
|
+
new_args[:find_first_callback] = @@find_first_callback
|
64
|
+
new_args[:find_last_callback] = @@find_last_callback
|
65
|
+
new_args[:find_next_callback] = @@find_next_callback
|
66
|
+
new_args[:find_prev_callback] = @@find_prev_callback
|
67
|
+
|
18
68
|
super(new_args)
|
19
69
|
end
|
20
70
|
|
@@ -26,7 +26,7 @@ module LD4L
|
|
26
26
|
property :owner, :predicate => RDFVocabularies::DCTERMS.creator, :class_name => LD4L::FoafRDF::Person
|
27
27
|
|
28
28
|
# properties from ORE.Aggregation
|
29
|
-
property :aggregates, :predicate => RDFVocabularies::ORE.aggregates
|
29
|
+
property :aggregates, :predicate => RDFVocabularies::ORE.aggregates, :cast => false # multiple values
|
30
30
|
property :first_proxy, :predicate => RDFVocabularies::IANA.first, :class_name => LD4L::OreRDF::ProxyResource
|
31
31
|
property :last_proxy, :predicate => RDFVocabularies::IANA.last, :class_name => LD4L::OreRDF::ProxyResource
|
32
32
|
|
@@ -8,7 +8,7 @@ module LD4L
|
|
8
8
|
# configure :base_uri => LD4L::OreRDF.configuration.base_uri, repository => :default
|
9
9
|
configure :type => RDFVocabularies::ORE.Proxy, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
|
10
10
|
|
11
|
-
property :proxy_for, :predicate => RDFVocabularies::ORE.proxyFor
|
11
|
+
property :proxy_for, :predicate => RDFVocabularies::ORE.proxyFor, :cast => false
|
12
12
|
property :proxy_in, :predicate => RDFVocabularies::ORE.proxyIn, :class_name => LD4L::OreRDF::AggregationResource
|
13
13
|
property :next_proxy, :predicate => RDFVocabularies::IANA.next, :class_name => LD4L::OreRDF::ProxyResource
|
14
14
|
property :prev_proxy, :predicate => RDFVocabularies::IANA.prev, :class_name => LD4L::OreRDF::ProxyResource
|
@@ -13,7 +13,7 @@ module LD4L
|
|
13
13
|
# appends to the end if position is not specified. Creates a proxy object for the resource.
|
14
14
|
#
|
15
15
|
# @param [LD4L::OreRDF::Aggregation] :aggregation to which to add resource
|
16
|
-
# @param [
|
16
|
+
# @param [String] :resource - URI for the resources to be aggregated
|
17
17
|
# @param [insert_position] :position from beginning of the list of proxies when positive; position from the
|
18
18
|
# end of the list of proxies when negative
|
19
19
|
#
|
@@ -22,7 +22,8 @@ module LD4L
|
|
22
22
|
raise ArgumentError, "resource must be either a string representation of an URI or an instance of RDF::URI" unless
|
23
23
|
resource.kind_of?(String) || resource.kind_of?(RDF::URI)
|
24
24
|
|
25
|
-
resource
|
25
|
+
# make sure resource is a String - HANGING ERROR will occur if set as RDF::URI
|
26
|
+
resource = resource.to_s if resource.kind_of?(RDF::URI)
|
26
27
|
|
27
28
|
# validate aggregation is of correct type
|
28
29
|
raise ArgumentError, "aggregation is not LD4L::OreRDF::Aggregation" unless
|
@@ -8,7 +8,7 @@ module LD4L
|
|
8
8
|
# resource.
|
9
9
|
#
|
10
10
|
# @param [LD4L::OreRDF::Aggregation] :aggregation to which to add resource
|
11
|
-
# @param [Array<
|
11
|
+
# @param [Array<String>] resources - array of URIs for the resources to be aggregated
|
12
12
|
# @param [insert_position] :position from beginning of the list of proxies when positive; position from the
|
13
13
|
# end of the list of proxies when negative
|
14
14
|
#
|
@@ -6,7 +6,7 @@ module LD4L
|
|
6
6
|
# Create an ore proxy in one step passing in the required information.
|
7
7
|
#
|
8
8
|
# @param [Hash] options the options to use while generating the proxy
|
9
|
-
# @option options [LD4L::OreRDF::
|
9
|
+
# @option options [LD4L::OreRDF::Aggregation] :aggregation - abstract aggregation to which the resource is being added (required)
|
10
10
|
# @option options [String, RDF::URI] :resource - resource uri for the resource being added to the aggregation (required)
|
11
11
|
# @option options [String, RDF::URI] :id - uri or localname to use for the rdf_subject of the new proxy (optional)(default - mint)
|
12
12
|
# - full URI - [String, RDF::URI] used as passed in
|
@@ -29,8 +29,8 @@ module LD4L
|
|
29
29
|
raise ArgumentError, "resource must be either a string representation of an URI or an instance of RDF::URI" unless
|
30
30
|
resource.kind_of?(String) || resource.kind_of?(RDF::URI)
|
31
31
|
|
32
|
-
# make sure resource is
|
33
|
-
resource =
|
32
|
+
# make sure resource is a String - HANGING ERROR will occur if set as RDF::URI
|
33
|
+
resource = resource.to_s if resource.kind_of?(RDF::URI)
|
34
34
|
|
35
35
|
# mint an id if needed
|
36
36
|
id = options[:id] ||
|
data/lib/ld4l/ore_rdf/version.rb
CHANGED
@@ -122,44 +122,44 @@ describe 'LD4L::OreRDF::AggregationResource' do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
it "should be set to a URI producing an ActiveTriple::Resource" do
|
125
|
-
subject.aggregates =
|
126
|
-
expect(subject.aggregates.first).to be_a
|
125
|
+
subject.aggregates = "http://example.org/individual/b1"
|
126
|
+
expect(subject.aggregates.first).to be_a String
|
127
|
+
expect(subject.aggregates.first).to eq "http://example.org/individual/b1"
|
127
128
|
end
|
128
129
|
|
129
130
|
it "should be settable" do
|
130
|
-
subject.aggregates =
|
131
|
-
expect(subject.aggregates.first
|
132
|
-
['id']
|
131
|
+
subject.aggregates = "http://example.org/individual/b1"
|
132
|
+
expect(subject.aggregates.first).to eq "http://example.org/individual/b1"
|
133
133
|
end
|
134
134
|
|
135
135
|
it "should be settable to multiple values" do
|
136
|
-
bib1 =
|
137
|
-
bib2 =
|
138
|
-
bib3 =
|
136
|
+
bib1 = "http://example.org/individual/b1"
|
137
|
+
bib2 = "http://example.org/individual/b2"
|
138
|
+
bib3 = "http://example.org/individual/b3"
|
139
139
|
subject.aggregates = bib1
|
140
140
|
subject.aggregates << bib2
|
141
141
|
subject.aggregates << bib3
|
142
|
-
expect(subject.aggregates[0]
|
143
|
-
expect(subject.aggregates[1]
|
144
|
-
expect(subject.aggregates[2]
|
142
|
+
expect(subject.aggregates[0]).to eq bib1
|
143
|
+
expect(subject.aggregates[1]).to eq bib2
|
144
|
+
expect(subject.aggregates[2]).to eq bib3
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should be changeable" do
|
148
|
-
orig_bib =
|
149
|
-
new_bib =
|
148
|
+
orig_bib = "http://example.org/individual/b1"
|
149
|
+
new_bib = "http://example.org/individual/b1_NEW"
|
150
150
|
subject.aggregates = orig_bib
|
151
151
|
subject.aggregates = new_bib
|
152
|
-
expect(subject.aggregates.first
|
152
|
+
expect(subject.aggregates.first).to eq new_bib
|
153
153
|
end
|
154
154
|
|
155
155
|
it "should be changeable for multiple values" do
|
156
|
-
orig_bib1 =
|
157
|
-
orig_bib2 =
|
158
|
-
orig_bib3 =
|
156
|
+
orig_bib1 = "http://example.org/individual/b1"
|
157
|
+
orig_bib2 = "http://example.org/individual/b2"
|
158
|
+
orig_bib3 = "http://example.org/individual/b3"
|
159
159
|
|
160
|
-
new_bib1 =
|
161
|
-
new_bib2 =
|
162
|
-
new_bib3 =
|
160
|
+
new_bib1 = "http://example.org/individual/b1_NEW"
|
161
|
+
new_bib2 = "http://example.org/individual/b2_NEW"
|
162
|
+
new_bib3 = "http://example.org/individual/b3_NEW"
|
163
163
|
|
164
164
|
subject.aggregates = orig_bib1
|
165
165
|
subject.aggregates << orig_bib2
|
@@ -171,20 +171,20 @@ describe 'LD4L::OreRDF::AggregationResource' do
|
|
171
171
|
aggregates[2] = new_bib3
|
172
172
|
subject.aggregates = aggregates
|
173
173
|
|
174
|
-
expect(subject.aggregates[0]
|
175
|
-
# expect(subject.aggregates[1]
|
176
|
-
expect(subject.aggregates[1]
|
177
|
-
expect(subject.aggregates[2]
|
174
|
+
expect(subject.aggregates[0]).to eq new_bib1
|
175
|
+
# expect(subject.aggregates[1]).to eq new_bib2
|
176
|
+
expect(subject.aggregates[1]).to eq orig_bib2
|
177
|
+
expect(subject.aggregates[2]).to eq new_bib3
|
178
178
|
end
|
179
179
|
|
180
180
|
it "should be directly changeable for multiple values" do
|
181
|
-
orig_bib1 =
|
182
|
-
orig_bib2 =
|
183
|
-
orig_bib3 =
|
181
|
+
orig_bib1 = "http://example.org/individual/b1"
|
182
|
+
orig_bib2 = "http://example.org/individual/b2"
|
183
|
+
orig_bib3 = "http://example.org/individual/b3"
|
184
184
|
|
185
|
-
new_bib1 =
|
186
|
-
new_bib2 =
|
187
|
-
new_bib3 =
|
185
|
+
new_bib1 = "http://example.org/individual/b1_NEW"
|
186
|
+
new_bib2 = "http://example.org/individual/b2_NEW"
|
187
|
+
new_bib3 = "http://example.org/individual/b3_NEW"
|
188
188
|
|
189
189
|
subject.aggregates = orig_bib1
|
190
190
|
subject.aggregates << orig_bib2
|
@@ -194,10 +194,10 @@ describe 'LD4L::OreRDF::AggregationResource' do
|
|
194
194
|
# subject.aggregates[1] = new_bib2
|
195
195
|
subject.aggregates[2] = new_bib3
|
196
196
|
|
197
|
-
expect(subject.aggregates[0]
|
198
|
-
# expect(subject.aggregates[1]
|
199
|
-
expect(subject.aggregates[1]
|
200
|
-
expect(subject.aggregates[2]
|
197
|
+
expect(subject.aggregates[0]).to eq new_bib1
|
198
|
+
# expect(subject.aggregates[1]).to eq new_bib2
|
199
|
+
expect(subject.aggregates[1]).to eq orig_bib2
|
200
|
+
expect(subject.aggregates[2]).to eq new_bib3
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
@@ -381,9 +381,9 @@ describe 'LD4L::OreRDF::AggregationResource' do
|
|
381
381
|
end
|
382
382
|
results = []
|
383
383
|
vci_array.each { |vci| results << vci.proxy_for.first }
|
384
|
-
expect(results).to include
|
385
|
-
expect(results).to include
|
386
|
-
expect(results).to include
|
384
|
+
expect(results).to include "http://example.org/individual/b1"
|
385
|
+
expect(results).to include "http://example.org/individual/b2"
|
386
|
+
expect(results).to include "http://example.org/individual/b3"
|
387
387
|
expect(vci_array.size).to eq(3)
|
388
388
|
end
|
389
389
|
|
@@ -68,16 +68,16 @@ describe 'LD4L::OreRDF::ProxyResource' do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should be settable" do
|
71
|
-
subject.proxy_for =
|
72
|
-
expect(subject.proxy_for.first
|
71
|
+
subject.proxy_for = "http://example.org/b1"
|
72
|
+
expect(subject.proxy_for.first).to eq "http://example.org/b1"
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should be changeable" do
|
76
|
-
orig_proxy_for =
|
77
|
-
new_proxy_for =
|
76
|
+
orig_proxy_for = "http://example.org/b1"
|
77
|
+
new_proxy_for = "http://example.org/b1_NEW"
|
78
78
|
subject.proxy_for = orig_proxy_for
|
79
79
|
subject.proxy_for = new_proxy_for
|
80
|
-
expect(subject.proxy_for.first
|
80
|
+
expect(subject.proxy_for.first).to eq new_proxy_for
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -289,9 +289,9 @@ describe 'LD4L::OreRDF::ProxyResource' do
|
|
289
289
|
end
|
290
290
|
results = []
|
291
291
|
vci_array.each { |vci| results << vci.proxy_for.first }
|
292
|
-
expect(results).to include
|
293
|
-
expect(results).to include
|
294
|
-
expect(results).to include
|
292
|
+
expect(results).to include "http://example.org/individual/b1"
|
293
|
+
expect(results).to include "http://example.org/individual/b2"
|
294
|
+
expect(results).to include "http://example.org/individual/b3"
|
295
295
|
expect(vci_array.size).to eq(3)
|
296
296
|
end
|
297
297
|
|
@@ -390,7 +390,7 @@ describe 'LD4L::OreRDF::ProxyResource' do
|
|
390
390
|
subject.contributor = "John Smith"
|
391
391
|
an_aggregation = LD4L::OreRDF::AggregationResource.new('1')
|
392
392
|
subject.proxy_in = an_aggregation
|
393
|
-
subject.proxy_for =
|
393
|
+
subject.proxy_for = "http://example.org/b1"
|
394
394
|
subject.persist!
|
395
395
|
end
|
396
396
|
|
@@ -16,19 +16,19 @@ describe 'LD4L::OreRDF::AggregationResource::AddAggregatedResource' do
|
|
16
16
|
it "should add a single resource to an empty set" do
|
17
17
|
subject.aggregates = []
|
18
18
|
LD4L::OreRDF::AddAggregatedResource.call( subject, RDF::URI("http://example.org/individual/b1") )
|
19
|
-
expect(subject.aggregates.first
|
19
|
+
expect(subject.aggregates.first).to eq "http://example.org/individual/b1"
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should add a single resource to an existing set" do
|
23
|
-
subject.aggregates =
|
23
|
+
subject.aggregates = "http://example.org/individual/b1"
|
24
24
|
LD4L::OreRDF::AddAggregatedResource.call( subject, RDF::URI("http://example.org/individual/b2") )
|
25
|
-
expect(subject.aggregates[0]
|
26
|
-
expect(subject.aggregates[1]
|
25
|
+
expect(subject.aggregates[0]).to eq "http://example.org/individual/b1"
|
26
|
+
expect(subject.aggregates[1]).to eq "http://example.org/individual/b2"
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should generate the resource instance for a single resource" do
|
30
30
|
proxy = LD4L::OreRDF::AddAggregatedResource.call( subject, RDF::URI("http://example.org/individual/b1" ))
|
31
|
-
expect(proxy.proxy_for.first
|
31
|
+
expect(proxy.proxy_for.first).to eq "http://example.org/individual/b1"
|
32
32
|
expect(proxy.proxy_in.first).to eq subject.aggregation_resource
|
33
33
|
end
|
34
34
|
end
|
@@ -36,9 +36,9 @@ describe 'LD4L::OreRDF::AddAggregatedResources' do
|
|
36
36
|
RDF::URI("http://example.org/individual/b2"),
|
37
37
|
RDF::URI("http://example.org/individual/b3")])
|
38
38
|
aggregates = subject.aggregates
|
39
|
-
expect(aggregates).to include
|
40
|
-
expect(aggregates).to include
|
41
|
-
expect(aggregates).to include
|
39
|
+
expect(aggregates).to include "http://example.org/individual/b1"
|
40
|
+
expect(aggregates).to include "http://example.org/individual/b2"
|
41
|
+
expect(aggregates).to include "http://example.org/individual/b3"
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should add multiple resources to an existing set" do
|
@@ -49,10 +49,10 @@ describe 'LD4L::OreRDF::AddAggregatedResources' do
|
|
49
49
|
RDF::URI("http://example.org/individual/b3"),
|
50
50
|
RDF::URI("http://example.org/individual/b4")])
|
51
51
|
aggregates = subject.aggregates
|
52
|
-
expect(aggregates).to include
|
53
|
-
expect(aggregates).to include
|
54
|
-
expect(aggregates).to include
|
55
|
-
expect(aggregates).to include
|
52
|
+
expect(aggregates).to include "http://example.org/individual/b1"
|
53
|
+
expect(aggregates).to include "http://example.org/individual/b2"
|
54
|
+
expect(aggregates).to include "http://example.org/individual/b3"
|
55
|
+
expect(aggregates).to include "http://example.org/individual/b4"
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should return an array of resource instances for each of the multiple resources" do
|
@@ -69,9 +69,9 @@ describe 'LD4L::OreRDF::AddAggregatedResources' do
|
|
69
69
|
proxy_array.each do |proxy|
|
70
70
|
results << proxy.proxy_for.first
|
71
71
|
end
|
72
|
-
expect(results).to include
|
73
|
-
expect(results).to include
|
74
|
-
expect(results).to include
|
72
|
+
expect(results).to include "http://example.org/individual/b1"
|
73
|
+
expect(results).to include "http://example.org/individual/b2"
|
74
|
+
expect(results).to include "http://example.org/individual/b3"
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -109,7 +109,7 @@ describe 'LD4L::OreRDF::FindAggregations' do
|
|
109
109
|
|
110
110
|
it "should find aggregation by rdf uri criteria (aka aggregates)" do
|
111
111
|
aggregations = LD4L::OreRDF::FindAggregations.call(
|
112
|
-
:criteria => { RDFVocabularies::ORE.aggregates =>
|
112
|
+
:criteria => { RDFVocabularies::ORE.aggregates => "http://example.org/individual/b32"})
|
113
113
|
expect(aggregations).not_to include "http::/example.org/ag1"
|
114
114
|
expect(aggregations).not_to include "http::/example.org/ag2"
|
115
115
|
expect(aggregations).to include "http::/example.org/ag3"
|
@@ -30,7 +30,7 @@ describe 'LD4L::OreRDF::CreateProxy' do
|
|
30
30
|
proxy = LD4L::OreRDF::CreateProxy.call(
|
31
31
|
resource: RDF::URI("http://example.org/individual/b1"),
|
32
32
|
aggregation: aggregation)
|
33
|
-
expect(proxy.proxy_for.first
|
33
|
+
expect(proxy.proxy_for.first).to eq "http://example.org/individual/b1"
|
34
34
|
expect(proxy.proxy_in.first).to eq aggregation.aggregation_resource
|
35
35
|
expect(proxy.next_proxy).to eq []
|
36
36
|
expect(proxy.prev_proxy).to eq []
|
@@ -58,7 +58,7 @@ describe 'LD4L::OreRDF::CreateProxy' do
|
|
58
58
|
id: "123",
|
59
59
|
resource: RDF::URI("http://example.org/individual/b1"),
|
60
60
|
aggregation: aggregation)
|
61
|
-
expect(proxy.proxy_for.first
|
61
|
+
expect(proxy.proxy_for.first).to eq "http://example.org/individual/b1"
|
62
62
|
expect(proxy.proxy_in.first).to eq aggregation.aggregation_resource
|
63
63
|
expect(proxy.next_proxy).to eq []
|
64
64
|
expect(proxy.prev_proxy).to eq []
|
@@ -86,7 +86,7 @@ describe 'LD4L::OreRDF::CreateProxy' do
|
|
86
86
|
id: "http://example.org/individual/ag123",
|
87
87
|
resource: RDF::URI("http://example.org/individual/b1"),
|
88
88
|
aggregation: aggregation)
|
89
|
-
expect(proxy.proxy_for.first
|
89
|
+
expect(proxy.proxy_for.first).to eq "http://example.org/individual/b1"
|
90
90
|
expect(proxy.proxy_in.first).to eq aggregation.aggregation_resource
|
91
91
|
expect(proxy.next_proxy).to eq []
|
92
92
|
expect(proxy.prev_proxy).to eq []
|
@@ -40,8 +40,8 @@ describe 'LD4L::OreRDF::FindProxies' do
|
|
40
40
|
expect(proxies.size).to eq 1
|
41
41
|
expect(proxies.first).to be_a_kind_of RDF::URI
|
42
42
|
pr = LD4L::OreRDF::ProxyResource.new(proxies.first)
|
43
|
-
expect(pr.proxy_in.first.rdf_subject).to eq
|
44
|
-
expect(pr.proxy_for.first
|
43
|
+
expect(pr.proxy_in.first.rdf_subject.to_s).to eq "http::/example.org/ag1"
|
44
|
+
expect(pr.proxy_for.first).to eq "http://example.org/individual/b11"
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -108,11 +108,11 @@ describe 'LD4L::OreRDF::FindProxies' do
|
|
108
108
|
it "should find proxies by criteria (aka proxy_for)" do
|
109
109
|
proxies = LD4L::OreRDF::FindProxies.call(
|
110
110
|
:aggregation => 'http::/example.org/ag2',
|
111
|
-
:criteria => { RDFVocabularies::ORE.proxyFor =>
|
111
|
+
:criteria => { RDFVocabularies::ORE.proxyFor => "http://example.org/individual/b22" } )
|
112
112
|
expect(proxies.size).to eq 1
|
113
113
|
expect(proxies.first).to be_a_kind_of RDF::URI
|
114
114
|
pr = LD4L::OreRDF::ProxyResource.new(proxies.first)
|
115
|
-
expect(pr.proxy_for.first
|
115
|
+
expect(pr.proxy_for.first).to eq "http://example.org/individual/b22"
|
116
116
|
expect(pr.proxy_in.first.rdf_subject).to eq RDF::URI("http::/example.org/ag2")
|
117
117
|
end
|
118
118
|
|
@@ -124,12 +124,12 @@ describe 'LD4L::OreRDF::FindProxies' do
|
|
124
124
|
proxies.each do |p|
|
125
125
|
expect(p).to be_a_kind_of RDF::URI
|
126
126
|
pr = LD4L::OreRDF::ProxyResource.new(p)
|
127
|
-
proxy_for << pr.proxy_for.first
|
127
|
+
proxy_for << pr.proxy_for.first
|
128
128
|
expect(pr.proxy_in.first.rdf_subject).to eq RDF::URI("http::/example.org/ag3")
|
129
129
|
end
|
130
|
-
expect(proxy_for).to include
|
131
|
-
expect(proxy_for).to include
|
132
|
-
expect(proxy_for).to include
|
130
|
+
expect(proxy_for).to include "http://example.org/individual/b31"
|
131
|
+
expect(proxy_for).to include "http://example.org/individual/b32"
|
132
|
+
expect(proxy_for).to include "http://example.org/individual/b33"
|
133
133
|
end
|
134
134
|
|
135
135
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ld4l-ore_rdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- E. Lynette Rayle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
@@ -237,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
237
|
version: '0'
|
238
238
|
requirements: []
|
239
239
|
rubyforge_project:
|
240
|
-
rubygems_version: 2.
|
240
|
+
rubygems_version: 2.2.2
|
241
241
|
signing_key:
|
242
242
|
specification_version: 4
|
243
243
|
summary: ORE RDF models.
|