dbd 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Guardfile +0 -1
  3. data/HISTORY.txt +9 -0
  4. data/README.md +47 -39
  5. data/bin/test_1.rb +4 -4
  6. data/bin/test_5.rb +4 -4
  7. data/docs/test.rb +11 -11
  8. data/lib/dbd.rb +2 -2
  9. data/lib/dbd/context.rb +65 -0
  10. data/lib/dbd/context_fact.rb +76 -0
  11. data/lib/dbd/errors.rb +1 -1
  12. data/lib/dbd/fact.rb +37 -37
  13. data/lib/dbd/fact/collection.rb +5 -5
  14. data/lib/dbd/fact/factory.rb +6 -6
  15. data/lib/dbd/graph.rb +2 -2
  16. data/lib/dbd/resource.rb +25 -24
  17. data/lib/dbd/version.rb +1 -1
  18. data/spec/lib/dbd/context/context_spec.rb +74 -0
  19. data/spec/lib/dbd/context_fact/methods_spec.rb +79 -0
  20. data/spec/lib/dbd/context_fact/new_spec.rb +51 -0
  21. data/spec/lib/dbd/context_fact/test_factories_spec.rb +24 -0
  22. data/spec/lib/dbd/errors/errors_spec.rb +30 -0
  23. data/spec/lib/dbd/fact/collection/collection_spec.rb +58 -58
  24. data/spec/lib/dbd/fact/factory/factory_spec.rb +3 -3
  25. data/spec/lib/dbd/fact/methods_spec.rb +12 -12
  26. data/spec/lib/dbd/fact/new_spec.rb +9 -9
  27. data/spec/lib/dbd/fact/subject/test_factories_spec.rb +4 -4
  28. data/spec/lib/dbd/fact/test_factories_spec.rb +18 -18
  29. data/spec/lib/dbd/graph/add_to_graph_spec.rb +22 -22
  30. data/spec/lib/dbd/graph/from_csv_spec.rb +16 -16
  31. data/spec/lib/dbd/graph/test_factories_spec.rb +11 -11
  32. data/spec/lib/dbd/graph/to_csv_spec.rb +18 -18
  33. data/spec/lib/dbd/performance_spec.rb +4 -4
  34. data/spec/lib/dbd/resource/collection_spec.rb +28 -30
  35. data/spec/lib/dbd/resource/new_spec.rb +10 -11
  36. data/spec/lib/dbd/resource/test_factories_spec.rb +8 -7
  37. data/spec/lib/dbd/version/version_spec.rb +9 -0
  38. data/spec/test_factories/context.rb +16 -0
  39. data/spec/test_factories/{provenance_fact.rb → context_fact.rb} +6 -6
  40. data/spec/test_factories/fact.rb +23 -23
  41. data/spec/test_factories/fact/subject.rb +1 -1
  42. data/spec/test_factories/graph.rb +7 -7
  43. data/spec/test_factories/resource.rb +15 -10
  44. metadata +20 -16
  45. data/lib/dbd/provenance_fact.rb +0 -77
  46. data/lib/dbd/provenance_resource.rb +0 -63
  47. data/spec/lib/dbd/provenance_fact/methods_spec.rb +0 -78
  48. data/spec/lib/dbd/provenance_fact/new_spec.rb +0 -51
  49. data/spec/lib/dbd/provenance_fact/test_factories_spec.rb +0 -24
  50. data/spec/lib/dbd/provenance_resource/provenance_resource_spec.rb +0 -75
  51. data/spec/test_factories/provenance_resource.rb +0 -16
@@ -4,19 +4,19 @@ module Dbd
4
4
  class Fact
5
5
  describe Collection do
6
6
 
7
- let(:provenance_subject_1) { Fact.factory.new_subject }
8
- let(:provenance_subject_2) { Fact.factory.new_subject }
7
+ let(:context_subject_1) { Fact.factory.new_subject }
8
+ let(:context_subject_2) { Fact.factory.new_subject }
9
9
 
10
- let(:provenance_fact_context) { TestFactories::ProvenanceFact.context(provenance_subject_1) }
11
- let(:provenance_fact_created_by) { TestFactories::ProvenanceFact.created_by(provenance_subject_1) }
12
- let(:provenance_fact_original_source) { TestFactories::ProvenanceFact.original_source(provenance_subject_2) }
10
+ let(:context_fact_visibility) { TestFactories::ContextFact.visibility(context_subject_1) }
11
+ let(:context_fact_created_by) { TestFactories::ContextFact.created_by(context_subject_1) }
12
+ let(:context_fact_original_source) { TestFactories::ContextFact.original_source(context_subject_2) }
13
13
 
14
- let(:fact_1) { TestFactories::Fact.fact_1(provenance_subject_1) }
15
- let(:fact_2_with_subject) { TestFactories::Fact.fact_2_with_subject(provenance_subject_1) }
16
- let(:fact_3_with_subject) { TestFactories::Fact.fact_3_with_subject(provenance_subject_1) }
14
+ let(:fact_1) { TestFactories::Fact.fact_1(context_subject_1) }
15
+ let(:fact_2_with_subject) { TestFactories::Fact.fact_2_with_subject(context_subject_1) }
16
+ let(:fact_3_with_subject) { TestFactories::Fact.fact_3_with_subject(context_subject_1) }
17
17
 
18
- let(:fact_2_3) { TestFactories::Fact::Collection.fact_2_3(provenance_subject_1) }
19
- let(:provenance_facts) { TestFactories::Fact::Collection.provenance_facts(provenance_subject_1) }
18
+ let(:fact_2_3) { TestFactories::Fact::Collection.fact_2_3(context_subject_1) }
19
+ let(:context_facts) { TestFactories::Fact::Collection.context_facts(context_subject_1) }
20
20
 
21
21
  let(:subject) do
22
22
  Object.new.tap do |object_with_Fact_Collection|
@@ -43,13 +43,13 @@ module Dbd
43
43
  subject.size.should == 1
44
44
  end
45
45
 
46
- it 'adding a provenance_fact works' do
47
- subject << provenance_fact_context
46
+ it 'adding a context_fact works' do
47
+ subject << context_fact_visibility
48
48
  subject.size.should == 1
49
49
  end
50
50
 
51
51
  it 'returns self to allow chaining' do
52
- (subject << provenance_fact_context).should == subject
52
+ (subject << context_fact_visibility).should == subject
53
53
  end
54
54
  end
55
55
 
@@ -68,14 +68,14 @@ module Dbd
68
68
  end
69
69
  end
70
70
 
71
- describe 'adding a fact with a ref to a provenance_fact' do
71
+ describe 'adding a fact with a ref to a context_fact' do
72
72
 
73
- it 'fact_2_with_subject has a provenance_subject that refers to context and created_by' do
74
- subject << provenance_fact_context
75
- subject << provenance_fact_created_by
73
+ it 'fact_2_with_subject has a context_subject that refers to context_fact_visibility and context_fact_created_by' do
74
+ subject << context_fact_visibility
75
+ subject << context_fact_created_by
76
76
  subject << fact_2_with_subject
77
- ps = fact_1.provenance_subject
78
- subject.by_subject(ps).should == [provenance_fact_context, provenance_fact_created_by]
77
+ context_subject = fact_1.context_subject
78
+ subject.by_subject(context_subject).should == [context_fact_visibility, context_fact_created_by]
79
79
  end
80
80
  end
81
81
 
@@ -136,37 +136,37 @@ module Dbd
136
136
  end
137
137
  end
138
138
 
139
- describe 'provenance_facts must all come before first use by a fact' do
140
- it 'adding a provenance_fact, depending fact, another provenance_fact with same subject fail' do
141
- subject << provenance_fact_context
139
+ describe 'context_facts must all come before first use by a fact' do
140
+ it 'adding a context_fact, depending fact, another context_fact with same subject fail' do
141
+ subject << context_fact_visibility
142
142
  subject << fact_2_with_subject
143
- lambda { subject << provenance_fact_created_by } . should raise_error OutOfOrderError
143
+ lambda{ subject << context_fact_created_by }.should raise_error OutOfOrderError
144
144
  end
145
145
 
146
146
  # testing private functionality (kept temporarily as documentation)
147
- # A hash with all the provenance_subjects that are used by at least one fact.
148
- # Needed for the validation that no provenance_fact may be added that is
147
+ # A hash with all the context_subjects that are used by at least one fact.
148
+ # Needed for the validation that no context_fact may be added that is
149
149
  # referred from a fact that is already in the fact stream.
150
- describe 'used_provenance_subjects' do
150
+ describe 'used_context_subjects' do
151
151
  # testing an internal variable ...
152
152
 
153
- let(:used_provenance_subjects) do
154
- subject.instance_variable_get(:@used_provenance_subjects)
153
+ let(:used_context_subjects) do
154
+ subject.instance_variable_get(:@used_context_subjects)
155
155
  end
156
156
 
157
157
  it 'is empty initially' do
158
- used_provenance_subjects.should be_empty
158
+ used_context_subjects.should be_empty
159
159
  end
160
160
 
161
- it 'adding a provenance_fact alone does not create an entry' do
162
- subject << provenance_fact_context
163
- used_provenance_subjects.should be_empty
161
+ it 'adding a context_fact alone does not create an entry' do
162
+ subject << context_fact_visibility
163
+ used_context_subjects.should be_empty
164
164
  end
165
165
 
166
- it 'adding a provenance_fact and a depending fact create an entry' do
167
- subject << provenance_fact_context
166
+ it 'adding a context_fact and a depending fact create an entry' do
167
+ subject << context_fact_visibility
168
168
  subject << fact_2_with_subject
169
- used_provenance_subjects[provenance_subject_1].should == true
169
+ used_context_subjects[context_subject_1].should == true
170
170
  end
171
171
  end
172
172
  end
@@ -177,8 +177,8 @@ module Dbd
177
177
  end
178
178
 
179
179
  it 'raises FactError with message when fact.errors has errors' do
180
- provenance_fact_context.stub(:errors).and_return(['Error 1', 'Error 2'])
181
- lambda { subject << provenance_fact_context } . should raise_error(
180
+ context_fact_visibility.stub(:errors).and_return(['Error 1', 'Error 2'])
181
+ lambda { subject << context_fact_visibility } . should raise_error(
182
182
  FactError,
183
183
  'Error 1, Error 2.')
184
184
  end
@@ -186,49 +186,49 @@ module Dbd
186
186
 
187
187
  describe 'by_subject : ' do
188
188
  it 'finds entries for a given subject' do
189
- subject << provenance_fact_context
190
- subject << provenance_fact_created_by
191
- subject << provenance_fact_original_source
192
- provenance_fact_context.subject.should == provenance_subject_1 # assert test set-up
193
- provenance_fact_created_by.subject.should == provenance_subject_1 # assert test set-up
194
- provenance_fact_original_source.subject.should == provenance_subject_2 # assert test set-up
195
- subject.by_subject(provenance_subject_1).first.should == provenance_fact_context
196
- subject.by_subject(provenance_subject_1).last.should == provenance_fact_created_by
197
- subject.by_subject(provenance_subject_2).single.should == provenance_fact_original_source
189
+ subject << context_fact_visibility
190
+ subject << context_fact_created_by
191
+ subject << context_fact_original_source
192
+ context_fact_visibility.subject.should == context_subject_1 # assert test set-up
193
+ context_fact_created_by.subject.should == context_subject_1 # assert test set-up
194
+ context_fact_original_source.subject.should == context_subject_2 # assert test set-up
195
+ subject.by_subject(context_subject_1).first.should == context_fact_visibility
196
+ subject.by_subject(context_subject_1).last.should == context_fact_created_by
197
+ subject.by_subject(context_subject_2).single.should == context_fact_original_source
198
198
  end
199
199
  end
200
200
 
201
201
  describe 'TestFactories::Fact::Collection' do
202
202
  describe '.fact_2_3' do
203
- it 'has the given provenance_subject with explicit subject arg' do
203
+ it 'has the given context_subject with explicit subject arg' do
204
204
  fact_2_3.each do |fact|
205
- fact.provenance_subject.should == provenance_subject_1
205
+ fact.context_subject.should == context_subject_1
206
206
  end
207
207
  end
208
208
  end
209
209
 
210
- describe '.provenance_facts' do
211
- it 'has a context' do
212
- provenance_facts.select do |provenance_fact|
213
- provenance_fact.predicate == 'https://data.vandenabeele.com/ontologies/provenance#context'
210
+ describe '.context_facts' do
211
+ it 'has a visibility' do
212
+ context_facts.select do |context_fact|
213
+ context_fact.predicate == 'context:visibility'
214
214
  end.size.should == 1
215
215
  end
216
216
 
217
217
  it 'has a created_by' do
218
- provenance_facts.select do |provenance_fact|
219
- provenance_fact.predicate == 'https://data.vandenabeele.com/ontologies/provenance#created_by'
218
+ context_facts.select do |context_fact|
219
+ context_fact.predicate == 'dcterms:creator'
220
220
  end.size.should == 1
221
221
  end
222
222
 
223
223
  it 'has an original_source' do
224
- provenance_facts.select do |provenance_fact|
225
- provenance_fact.predicate == 'https://data.vandenabeele.com/ontologies/provenance#original_source'
224
+ context_facts.select do |context_fact|
225
+ context_fact.predicate == 'prov:source'
226
226
  end.size.should == 1
227
227
  end
228
228
 
229
229
  it 'has the given subjects with explicit subject arg' do
230
- provenance_facts.each do |provenance_fact|
231
- provenance_fact.subject.should == provenance_subject_1
230
+ context_facts.each do |context_fact|
231
+ context_fact.subject.should == context_subject_1
232
232
  end
233
233
  end
234
234
  end
@@ -61,12 +61,12 @@ module Dbd
61
61
  with_validation(string_values)
62
62
  end
63
63
 
64
- it 'for a nil provenance_subject (for provenance_facts)' do
64
+ it 'for a nil context_subject (for context_facts)' do
65
65
  string_values[2] = nil
66
66
  with_validation(string_values)
67
67
  end
68
68
 
69
- it 'for an empty provenance_subject (for provenance_facts)' do
69
+ it 'for an empty context_subject (for context_facts)' do
70
70
  string_values[2] = ''
71
71
  with_validation(string_values)
72
72
  end
@@ -83,7 +83,7 @@ module Dbd
83
83
  lambda{ with_validation(string_values) }.should raise_error(FactError)
84
84
  end
85
85
 
86
- it 'for invalid provenance_subject' do
86
+ it 'for invalid context_subject' do
87
87
  string_values[2] = 'foo'
88
88
  lambda{ with_validation(string_values) }.should raise_error(FactError)
89
89
  end
@@ -4,12 +4,12 @@ module Dbd
4
4
  describe Fact do
5
5
 
6
6
  let(:factory) { described_class.factory }
7
- let(:provenance_subject) { factory.new_subject }
7
+ let(:context_subject) { factory.new_subject }
8
8
  let(:subject) { factory.new_subject }
9
- let(:fact_1) { TestFactories::Fact.fact_1(provenance_subject) }
10
- let(:fact_2_with_subject) { TestFactories::Fact.fact_2_with_subject(provenance_subject) }
11
- let(:fact_with_newline) { TestFactories::Fact.fact_with_newline(provenance_subject) }
12
- let(:fact_with_special_chars) { TestFactories::Fact.fact_with_special_chars(provenance_subject) }
9
+ let(:fact_1) { TestFactories::Fact.fact_1(context_subject) }
10
+ let(:fact_2_with_subject) { TestFactories::Fact.fact_2_with_subject(context_subject) }
11
+ let(:fact_with_newline) { TestFactories::Fact.fact_with_newline(context_subject) }
12
+ let(:fact_with_special_chars) { TestFactories::Fact.fact_with_special_chars(context_subject) }
13
13
  let(:full_fact) { TestFactories::Fact.full_fact }
14
14
 
15
15
  describe '.factory' do
@@ -47,7 +47,7 @@ module Dbd
47
47
  end
48
48
 
49
49
  describe 'short' do
50
- it 'for a base fact shows provenance, subject, predicate, object' do
50
+ it 'for a base fact shows context, subject, predicate, object' do
51
51
  fact_1.subject = subject
52
52
  fact_1.time_stamp = TimeStamp.new
53
53
  fact_1.short.should match(/^[0-9a-f]{8} : [0-9a-f]{8} : http:\/\/example\.org\/test\/ : Gandhi$/)
@@ -86,14 +86,14 @@ module Dbd
86
86
  fact_2_with_subject.errors.should be_empty
87
87
  end
88
88
 
89
- describe 'without provenance_subject' do
89
+ describe 'without context_subject' do
90
90
 
91
91
  before(:each) do
92
- fact_2_with_subject.stub(:provenance_subject).and_return(nil)
92
+ fact_2_with_subject.stub(:context_subject).and_return(nil)
93
93
  end
94
94
 
95
95
  it 'errors returns an array with 1 error message' do
96
- fact_2_with_subject.errors.single.should match(/Provenance subject is missing/)
96
+ fact_2_with_subject.errors.single.should match(/ContextFact subject is missing/)
97
97
  end
98
98
  end
99
99
 
@@ -139,9 +139,9 @@ module Dbd
139
139
  end
140
140
  end
141
141
 
142
- describe 'provenance_fact?' do
143
- it 'is false for a base fact or derived from it that is not a ProvenanceFact ' do
144
- fact_1.provenance_fact?.should be_false
142
+ describe 'context_fact?' do
143
+ it 'is false for a base fact or derived from it that is not a ContextFact ' do
144
+ fact_1.context_fact?.should be_false
145
145
  end
146
146
  end
147
147
 
@@ -3,10 +3,10 @@ require 'spec_helper'
3
3
  module Dbd
4
4
  describe Fact do
5
5
  let(:factory) { described_class.factory}
6
- let(:provenance_subject) { factory.new_subject }
6
+ let(:context_subject) { factory.new_subject }
7
7
  let(:subject) { factory.new_subject }
8
- let(:fact_1) { TestFactories::Fact.fact_1(provenance_subject) }
9
- let(:fact_2_with_subject) { TestFactories::Fact.fact_2_with_subject(provenance_subject) }
8
+ let(:fact_1) { TestFactories::Fact.fact_1(context_subject) }
9
+ let(:fact_2_with_subject) { TestFactories::Fact.fact_2_with_subject(context_subject) }
10
10
  let(:data_predicate) { 'http://example.org/test/name' }
11
11
  let(:string_object_1) { 'Gandhi' }
12
12
  let(:id_valid_regexp) { described_class::ID.valid_regexp }
@@ -38,8 +38,8 @@ module Dbd
38
38
  lambda{ fact_with_incorrect_time_stamp }.should raise_error(ArgumentError)
39
39
  end
40
40
 
41
- it 'new sets the provenance_subject' do
42
- fact_1.provenance_subject.should == provenance_subject
41
+ it 'new sets the context_subject' do
42
+ fact_1.context_subject.should == context_subject
43
43
  end
44
44
 
45
45
  it 'new sets the subject' do
@@ -75,11 +75,11 @@ module Dbd
75
75
  end
76
76
  end
77
77
 
78
- describe 'update_used_provenance_subjects' do
79
- it 'sets the value for provenance_subject to true for a fact' do
78
+ describe 'update_used_context_subjects' do
79
+ it 'sets the value for context_subject to true for a fact' do
80
80
  h = {}
81
- fact_1.update_used_provenance_subjects(h)
82
- h[fact_1.provenance_subject].should == true
81
+ fact_1.update_used_context_subjects(h)
82
+ h[fact_1.context_subject].should == true
83
83
  end
84
84
  end
85
85
  end
@@ -5,7 +5,7 @@ module TestFactories
5
5
  describe Subject do
6
6
 
7
7
  let(:fixed_subject) { described_class.fixed_subject }
8
- let(:fixed_provenance_subject) { described_class.fixed_provenance_subject }
8
+ let(:fixed_context_subject) { described_class.fixed_context_subject }
9
9
 
10
10
  describe 'fixed_subject' do
11
11
  it 'fixed_subject is exactly this fixed subject' do
@@ -13,9 +13,9 @@ module TestFactories
13
13
  end
14
14
  end
15
15
 
16
- describe 'fixed_provenance_subject' do
17
- it 'fixed_provenance_subject is exactly this fixed subject' do
18
- fixed_provenance_subject.should == '40fab407-9b04-4a51-9a52-d978abfcbb1f'
16
+ describe 'fixed_context_subject' do
17
+ it 'fixed_context_subject is exactly this fixed subject' do
18
+ fixed_context_subject.should == '40fab407-9b04-4a51-9a52-d978abfcbb1f'
19
19
  end
20
20
  end
21
21
  end
@@ -2,23 +2,23 @@ require 'spec_helper'
2
2
 
3
3
  module TestFactories
4
4
  describe Fact do
5
- let(:provenance_subject) { ProvenanceFact.new_subject }
5
+ let(:context_subject) { ContextFact.new_subject }
6
6
  let(:subject) { described_class.new_subject }
7
7
  let(:data_predicate) { 'http://example.org/test/name' }
8
8
  let(:string_object_1) { 'Gandhi' }
9
- let(:fact_2_with_subject) { described_class.fact_2_with_subject(provenance_subject) }
9
+ let(:fact_2_with_subject) { described_class.fact_2_with_subject(context_subject) }
10
10
  let(:full_fact) { described_class.full_fact }
11
11
 
12
12
  describe 'factory works' do
13
- it 'with explicit provenance_subject' do
14
- fact_2_with_subject.provenance_subject.should be_a(provenance_subject.class)
13
+ it 'with explicit context_subject' do
14
+ fact_2_with_subject.context_subject.should be_a(context_subject.class)
15
15
  fact_2_with_subject.subject.should be_a(subject.class)
16
16
  fact_2_with_subject.predicate.should be_a(data_predicate.class)
17
17
  fact_2_with_subject.object.should be_a(string_object_1.class)
18
18
  end
19
19
 
20
- it 'without explicit provenance_subject' do
21
- described_class.fact_1.provenance_subject.should be_nil
20
+ it 'without explicit context_subject' do
21
+ described_class.fact_1.context_subject.should be_nil
22
22
  end
23
23
 
24
24
  it 'fact_2_with_subject should not raise_error' do
@@ -31,8 +31,8 @@ module TestFactories
31
31
 
32
32
  describe 'data_fact' do
33
33
  describe 'without arguments' do
34
- it 'has empty provenance_subject' do
35
- described_class.data_fact.provenance_subject.should be_nil
34
+ it 'has empty context_subject' do
35
+ described_class.data_fact.context_subject.should be_nil
36
36
  end
37
37
 
38
38
  it 'has empty subject' do
@@ -40,25 +40,25 @@ module TestFactories
40
40
  end
41
41
  end
42
42
 
43
- describe 'with provenance_subject' do
44
- it 'has provenance_subject' do
45
- described_class.data_fact(provenance_subject).
46
- provenance_subject.should == provenance_subject
43
+ describe 'with context_subject' do
44
+ it 'has context_subject' do
45
+ described_class.data_fact(context_subject).
46
+ context_subject.should == context_subject
47
47
  end
48
48
 
49
49
  it 'has empty subject' do
50
- described_class.data_fact(provenance_subject).subject.should be_nil
50
+ described_class.data_fact(context_subject).subject.should be_nil
51
51
  end
52
52
  end
53
53
 
54
- describe 'with provenance_subject and subject' do
55
- it 'has provenance_subject' do
56
- described_class.data_fact(provenance_subject, subject).
57
- provenance_subject.should == provenance_subject
54
+ describe 'with context_subject and subject' do
55
+ it 'has context_subject' do
56
+ described_class.data_fact(context_subject, subject).
57
+ context_subject.should == context_subject
58
58
  end
59
59
 
60
60
  it 'has subject' do
61
- described_class.data_fact(provenance_subject, subject).
61
+ described_class.data_fact(context_subject, subject).
62
62
  subject.should == subject
63
63
  end
64
64
  end
@@ -9,16 +9,16 @@ module Dbd
9
9
 
10
10
  let(:data_fact) { TestFactories::Fact.data_fact(new_subject, new_subject) }
11
11
  let(:fact_no_subject) { TestFactories::Fact.data_fact(new_subject, nil) }
12
- let(:fact_no_provenance) { TestFactories::Fact.data_fact(nil, new_subject) }
12
+ let(:fact_no_context) { TestFactories::Fact.data_fact(nil, new_subject) }
13
13
 
14
- let(:provenance_facts) { TestFactories::Fact::Collection.provenance_facts(new_subject) }
15
- let(:provenance_fact_1) { provenance_facts.first }
14
+ let(:context_facts) { TestFactories::Fact::Collection.context_facts(new_subject) }
15
+ let(:context_fact_1) { context_facts.first }
16
16
 
17
17
  let(:subject_regexp) { Fact::Subject.regexp }
18
18
 
19
- let(:provenance_resource) { TestFactories::ProvenanceResource.provenance_resource }
20
- let(:resource) { TestFactories::Resource.facts_resource(provenance_resource.subject) }
21
- let(:resource_array) { [provenance_resource, resource]}
19
+ let(:context) { TestFactories::Context.context }
20
+ let(:resource) { TestFactories::Resource.facts_resource(context.subject) }
21
+ let(:resource_array) { [context, resource]}
22
22
 
23
23
  describe 'create a graph' do
24
24
  it 'does not fail' do
@@ -32,12 +32,12 @@ module Dbd
32
32
  subject << data_fact
33
33
  end
34
34
 
35
- it 'a provenance_fact does not fail' do
36
- subject << provenance_fact_1
35
+ it 'a context_fact does not fail' do
36
+ subject << context_fact_1
37
37
  end
38
38
 
39
39
  it 'two facts does not fail' do
40
- subject << provenance_fact_1
40
+ subject << context_fact_1
41
41
  subject << data_fact
42
42
  end
43
43
 
@@ -45,8 +45,8 @@ module Dbd
45
45
  lambda { subject << fact_no_subject } . should raise_error FactError
46
46
  end
47
47
 
48
- it 'fact with missing provenance raises FactError' do
49
- lambda { subject << fact_no_provenance } . should raise_error FactError
48
+ it 'fact with missing context raises FactError' do
49
+ lambda { subject << fact_no_context } . should raise_error FactError
50
50
  end
51
51
  end
52
52
 
@@ -88,22 +88,22 @@ module Dbd
88
88
  end
89
89
  end
90
90
 
91
- describe 'a ProvenanceResource and a Resource' do
91
+ describe 'a Context and a Resource' do
92
92
 
93
93
  it 'does not fail' do
94
- subject << provenance_resource
94
+ subject << context
95
95
  end
96
96
 
97
- it 'Adds the facts from the provenance_resource to the graph' do
98
- subject << provenance_resource
97
+ it 'Adds the facts from the context to the graph' do
98
+ subject << context
99
99
  subject.size.should == 2
100
100
  end
101
101
 
102
- it 'Adds the facts from the provenance_resource and the resource to the graph' do
103
- subject << provenance_resource
102
+ it 'Adds the facts from the context and the resource to the graph' do
103
+ subject << context
104
104
  subject << resource
105
105
  subject.size.should == 4
106
- subject.first.should be_a(ProvenanceFact)
106
+ subject.first.should be_a(ContextFact)
107
107
  subject.last.class.should == Fact
108
108
  end
109
109
  end
@@ -113,9 +113,9 @@ module Dbd
113
113
  subject << resource_array
114
114
  end
115
115
 
116
- it 'Adds the facts from the provenance_resource and the resource to the graph' do
116
+ it 'Adds the facts from the context and the resource to the graph' do
117
117
  subject << resource_array
118
- subject.first.class.should == ProvenanceFact
118
+ subject.first.class.should == ContextFact
119
119
  subject.last.class.should == Fact
120
120
  subject.size.should == 4
121
121
  end
@@ -126,13 +126,13 @@ module Dbd
126
126
  end
127
127
 
128
128
  it 'works with different levels deep in 1 collection' do
129
- subject << [provenance_resource, [[resource]]]
129
+ subject << [context, [[resource]]]
130
130
  subject.size.should == 4
131
131
  end
132
132
  end
133
133
 
134
134
  it 'returns self' do
135
- (subject << TestFactories::Fact::Collection.provenance_facts(new_subject)).should be_a(described_class)
135
+ (subject << TestFactories::Fact::Collection.context_facts(new_subject)).should be_a(described_class)
136
136
  end
137
137
  end
138
138
  end