dbd 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/Guardfile +2 -2
  3. data/HISTORY.txt +11 -0
  4. data/README.md +24 -5
  5. data/bin/test_4.rb +2 -2
  6. data/bin/test_6.rb +2 -2
  7. data/docs/test.rb +1 -1
  8. data/lib/dbd/fact.rb +35 -67
  9. data/lib/dbd/fact/factory.rb +90 -0
  10. data/lib/dbd/fact/id.rb +2 -2
  11. data/lib/dbd/fact/subject.rb +2 -2
  12. data/lib/dbd/graph.rb +4 -6
  13. data/lib/dbd/helpers/uuid.rb +2 -2
  14. data/lib/dbd/resource.rb +1 -1
  15. data/lib/dbd/time_stamp.rb +16 -7
  16. data/lib/dbd/version.rb +1 -1
  17. data/spec/lib/dbd/fact/collection/collection_spec.rb +59 -59
  18. data/spec/lib/dbd/fact/factory/factory_spec.rb +109 -0
  19. data/spec/lib/dbd/fact/id/id_spec.rb +4 -4
  20. data/spec/lib/dbd/fact/id/test_factories_spec.rb +14 -0
  21. data/spec/lib/dbd/fact/methods_spec.rb +53 -57
  22. data/spec/lib/dbd/fact/new_spec.rb +32 -55
  23. data/spec/lib/dbd/fact/subject/subject_spec.rb +3 -3
  24. data/spec/lib/dbd/fact/subject/test_factories_spec.rb +23 -0
  25. data/spec/lib/dbd/fact/test_factories_spec.rb +82 -0
  26. data/spec/lib/dbd/graph/add_to_graph_spec.rb +31 -31
  27. data/spec/lib/dbd/graph/from_csv_spec.rb +47 -20
  28. data/spec/lib/dbd/graph/test_factories_spec.rb +58 -0
  29. data/spec/lib/dbd/graph/to_csv_spec.rb +46 -45
  30. data/spec/lib/dbd/helpers/ordered_set_collection/ordered_set_collection_spec.rb +17 -17
  31. data/spec/lib/dbd/helpers/uuid/uuid_spec.rb +11 -5
  32. data/spec/lib/dbd/performance_spec.rb +6 -6
  33. data/spec/lib/dbd/provenance_fact/methods_spec.rb +19 -19
  34. data/spec/lib/dbd/provenance_fact/new_spec.rb +17 -17
  35. data/spec/lib/dbd/provenance_fact/test_factories_spec.rb +24 -0
  36. data/spec/lib/dbd/provenance_resource/provenance_resource_spec.rb +24 -24
  37. data/spec/lib/dbd/rdf_base/rdf_base_spec.rb +7 -7
  38. data/spec/lib/dbd/resource/collection_spec.rb +34 -34
  39. data/spec/lib/dbd/resource/new_spec.rb +12 -12
  40. data/spec/lib/dbd/resource/test_factories_spec.rb +25 -0
  41. data/spec/lib/dbd/time_stamp/comparisons_spec.rb +31 -30
  42. data/spec/lib/dbd/time_stamp/methods_spec.rb +17 -13
  43. data/spec/lib/dbd/time_stamp/new_spec.rb +40 -14
  44. data/spec/lib/dbd/time_stamp/test_factories_spec.rb +18 -0
  45. data/spec/spec_helper.rb +2 -6
  46. data/spec/{factories → test_factories}/fact.rb +32 -25
  47. data/spec/{factories → test_factories}/fact/id.rb +2 -2
  48. data/spec/{factories → test_factories}/fact/subject.rb +3 -3
  49. data/spec/test_factories/graph.rb +25 -0
  50. data/spec/{factories → test_factories}/provenance_fact.rb +8 -10
  51. data/spec/{factories → test_factories}/provenance_resource.rb +3 -3
  52. data/spec/{factories → test_factories}/resource.rb +10 -4
  53. data/spec/{factories → test_factories}/time_stamp.rb +2 -2
  54. metadata +35 -32
  55. data/spec/factories/graph.rb +0 -23
  56. data/spec/lib/dbd/fact/factory_spec.rb +0 -82
  57. data/spec/lib/dbd/fact/id/factory_spec.rb +0 -16
  58. data/spec/lib/dbd/fact/subject/factory_spec.rb +0 -25
  59. data/spec/lib/dbd/graph/factory_spec.rb +0 -33
  60. data/spec/lib/dbd/provenance_fact/factory_spec.rb +0 -24
  61. data/spec/lib/dbd/resource/factory_spec.rb +0 -18
  62. data/spec/lib/dbd/time_stamp/factory_spec.rb +0 -18
@@ -1,23 +0,0 @@
1
- module Factories
2
- module Graph
3
-
4
- def self.factory_for
5
- ::Dbd::Graph
6
- end
7
-
8
- def self.new_subject
9
- ::Dbd::ProvenanceFact.new_subject
10
- end
11
-
12
- def self.only_provenance
13
- factory_for.new << Factories::Fact::Collection.provenance_facts(new_subject)
14
- end
15
-
16
- def self.full
17
- provenance_resource = Factories::ProvenanceResource.provenance_resource
18
- resource = Factories::Resource.facts_resource(provenance_resource.subject)
19
- factory_for.new << provenance_resource << resource
20
- end
21
-
22
- end
23
- end
@@ -1,82 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Dbd
4
- describe Fact do
5
- let(:provenance_subject) { ProvenanceFact.new_subject }
6
- let(:subject) { described_class.new_subject }
7
- let(:data_predicate) { "http://example.org/test/name" }
8
- let(:string_object_1) { "Gandhi" }
9
- let(:fact_2_with_subject) { Factories::Fact.fact_2_with_subject(provenance_subject) }
10
- let(:full_fact) { Factories::Fact.full_fact }
11
-
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)
15
- fact_2_with_subject.subject.should be_a(subject.class)
16
- fact_2_with_subject.predicate.should be_a(data_predicate.class)
17
- fact_2_with_subject.object.should be_a(string_object_1.class)
18
- end
19
-
20
- it "without explicit provenance_subject" do
21
- Factories::Fact.fact_1.provenance_subject.should be_nil
22
- end
23
-
24
- it "fact_2_with_subject should not raise_error" do
25
- Factories::Fact.fact_2_with_subject
26
- end
27
-
28
- it "fact_3_with_subject should not raise_error" do
29
- Factories::Fact.fact_3_with_subject
30
- end
31
-
32
- describe "data_fact" do
33
- describe "without arguments" do
34
- it "has empty provenance_subject" do
35
- Factories::Fact.data_fact.provenance_subject.should be_nil
36
- end
37
-
38
- it "has empty subject" do
39
- Factories::Fact.data_fact.subject.should be_nil
40
- end
41
- end
42
-
43
- describe "with provenance_subject" do
44
- it "has provenance_subject" do
45
- Factories::Fact.data_fact(provenance_subject).
46
- provenance_subject.should == provenance_subject
47
- end
48
-
49
- it "has empty subject" do
50
- Factories::Fact.data_fact(provenance_subject).subject.should be_nil
51
- end
52
- end
53
-
54
- describe "with provenance_subject and subject" do
55
- it "has provenance_subject" do
56
- Factories::Fact.data_fact(provenance_subject, subject).
57
- provenance_subject.should == provenance_subject
58
- end
59
-
60
- it "has subject" do
61
- Factories::Fact.data_fact(provenance_subject, subject).
62
- subject.should == subject
63
- end
64
- end
65
- end
66
-
67
- describe "full_fact" do
68
- it "does not fail" do
69
- full_fact
70
- end
71
-
72
- it "has values for all attributes" do
73
- full_fact.values.all?.should be_true
74
- end
75
-
76
- it "is valid (no errors)" do
77
- full_fact.errors.should be_empty
78
- end
79
- end
80
- end
81
- end
82
- end
@@ -1,16 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Dbd
4
- class Fact
5
- describe ID do
6
- describe "Factory" do
7
-
8
- let(:fixed_id) { Factories::Fact::ID.fixed_id }
9
-
10
- it "fixed_id is exactly this fixed id" do
11
- fixed_id.should == "825e44d5-af33-4858-8047-549bd813daa8"
12
- end
13
- end
14
- end
15
- end
16
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Dbd
4
- class Fact
5
- describe Subject do
6
- describe "Factory" do
7
-
8
- let(:fixed_subject) { Factories::Fact::Subject.fixed_subject }
9
- let(:fixed_provenance_subject) { Factories::Fact::Subject.fixed_provenance_subject }
10
-
11
- describe "fixed_subject" do
12
- it "fixed_subject is exactly this fixed subject" do
13
- fixed_subject.should == "2e9fbc87-2e94-47e9-a8fd-121cc4bc3e8f"
14
- end
15
- end
16
-
17
- describe "fixed_provenance_subject" do
18
- it "fixed_provenance_subject is exactly this fixed subject" do
19
- fixed_provenance_subject.should == "40fab407-9b04-4a51-9a52-d978abfcbb1f"
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,33 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Dbd
4
- describe Graph do
5
- describe "factory" do
6
- describe "with only provenance facts" do
7
-
8
- let(:only_provenance) { Factories::Graph.only_provenance }
9
-
10
- it "is a Graph" do
11
- only_provenance.should be_a(Graph)
12
- end
13
-
14
- it "has some facts" do
15
- only_provenance.size.should >= 2
16
- end
17
- end
18
-
19
- describe "full" do
20
-
21
- let(:full) { Factories::Graph.full }
22
-
23
- it "is a Graph" do
24
- full.should be_a(Graph)
25
- end
26
-
27
- it "full has many facts" do
28
- full.size.should >= 4
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,24 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Dbd
4
- describe ProvenanceFact do
5
-
6
- describe "Factories do not fail" do
7
- it "Factories::ProvenanceFact.context is OK" do
8
- Factories::ProvenanceFact.context.should_not be_nil
9
- end
10
-
11
- it "Factories::ProvenanceFact.created_by is OK" do
12
- Factories::ProvenanceFact.created_by.should_not be_nil
13
- end
14
-
15
- it "Factories::ProvenanceFact.original_source is OK" do
16
- Factories::ProvenanceFact.original_source.should_not be_nil
17
- end
18
-
19
- it "Factories::ProvenanceFact.new_subject is OK" do
20
- Factories::ProvenanceFact.new_subject.should be_a(ProvenanceFact.new_subject.class)
21
- end
22
- end
23
- end
24
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Dbd
4
- describe Resource do
5
-
6
- let(:provenance_subject) { Factories::ProvenanceResource.provenance_resource.subject }
7
-
8
- describe "Factories::Resource" do
9
- it ".empty works" do
10
- Factories::Resource.facts_resource(provenance_subject)
11
- end
12
-
13
- it ".facts_resource works" do
14
- Factories::Resource.facts_resource(provenance_subject)
15
- end
16
- end
17
- end
18
- end
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Dbd
4
- describe TimeStamp do
5
-
6
- let(:fixed_time_stamp) { Factories::TimeStamp.fixed_time_stamp }
7
-
8
- describe "factory works" do
9
- it "is a TimeStamp" do
10
- fixed_time_stamp.should be_a(TimeStamp)
11
- end
12
-
13
- it "has an exact time" do
14
- fixed_time_stamp.to_s.should == "2013-06-17 21:55:09.967653013 UTC"
15
- end
16
- end
17
- end
18
- end