dbd 0.0.4 → 0.0.5

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: 52008013920900a7e6910513c2dd0cde838b386b
4
- data.tar.gz: 0eae581b08f64c6dc3a7f459d6c39d58dff670c5
3
+ metadata.gz: 9ad1bee3c2518a24358318cfda3b6931321911a2
4
+ data.tar.gz: 2b7ffc84e350ce65c526e8cfc2246713e02cd7a6
5
5
  SHA512:
6
- metadata.gz: c61721ceb5d4161f317d8e2fa1f2a15cfef35ffac18d0a9c5e536a2929bdb1e744be061619f599bb26045067ccb2bd93bd1e1d0023f394005e628b6261497d71
7
- data.tar.gz: 16ce5f0c1be7867338e9c0e37a808d260ed9beef25a7d299f6ea575bcf542fb87b79352987e9c90166102167cd1fce353c9ac8057f6f82b5637613697a288a04
6
+ metadata.gz: a2b09154cd4c1482f08d7233964343c9b02ac70293358e9928b6b46fe30f04650b1a118506ab0fe98d6ce8a46143563ac5f09a0e3233f5c3196ab95b26e97b81
7
+ data.tar.gz: a25149c6e0288ce1cd9ae0f7f769fbcd067b5db6dfc52b8128cd4f6d53cfd31c1e607e62e2ef020735cef027447de56711f754bcfcf8cef55005d241ae7e2ca6
data/Gemfile CHANGED
@@ -6,3 +6,6 @@ gemspec
6
6
  #gem 'rdf', '1.1.0',
7
7
  # :git => 'https://github.com/ruby-rdf/rdf',
8
8
  # :branch => '1.1'
9
+
10
+ #gem 'ruby_peter_v',
11
+ # :path => '/Users/peter_v/p/ruby_peter_v'
@@ -22,3 +22,8 @@
22
22
  =====
23
23
 
24
24
  * Graph#<< takes recursive collections of Facts
25
+
26
+ 0.0.5 (03 June 2013)
27
+ =====
28
+
29
+ * use ruby_peter_v 0.0.8 which does not have max_with_nil
data/README.md CHANGED
@@ -3,7 +3,9 @@
3
3
  This is facts based data store, inspired by [RDF] concepts, but adding a log based structure and fine-grained provenance.
4
4
 
5
5
  * [Why?][Rationale]
6
- * <http://github.com/petervandenabeele/dbd>
6
+ * <https://github.com/petervandenabeele/dbd>
7
+ * <http://rubydoc.info/github/petervandenabeele/dbd/frames/>
8
+ * <https://rubygems.org/gems/dbd>
7
9
 
8
10
  [![Gem Version](https://badge.fury.io/rb/dbd.png)](http://badge.fury.io/rb/dbd)
9
11
  [![Build Status](https://travis-ci.org/petervandenabeele/dbd.png?branch=master)](http://travis-ci.org/petervandenabeele/dbd)
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'yard'
27
27
  spec.add_runtime_dependency 'neography'
28
28
  spec.add_runtime_dependency 'rdf', '~> 1.0.6'
29
- spec.add_runtime_dependency 'ruby_peter_v', '>= 0.0.4'
29
+ spec.add_runtime_dependency 'ruby_peter_v', '>= 0.0.8'
30
30
  end
@@ -4,6 +4,7 @@ As a client
4
4
  I can read the predicates for a provenance_fact from provenance ontology
5
5
 
6
6
  * make an ontology in a separate gem (dbd_onto)
7
+ * clean up using common methods
7
8
  * import that gem
8
9
  * use this ontology to build a validated Provenance Resource
9
10
  * use this validate Provenance Resource instance to better build
@@ -14,7 +14,7 @@ module Dbd
14
14
  #
15
15
  # This will add a time_stamp to the Facts.
16
16
  def <<(recursive_fact_collection)
17
- loop_recursively(recursive_fact_collection) do |fact|
17
+ recursive_fact_collection.each_recursively do |fact|
18
18
  enforce_strictly_monotonic_time(fact)
19
19
  super(fact)
20
20
  end
@@ -42,19 +42,5 @@ module Dbd
42
42
  fact.time_stamp = TimeStamp.new(larger_than: newest_time_stamp) unless fact.time_stamp
43
43
  end
44
44
 
45
- def loop_recursively(recursive_collection, &block)
46
- Array(recursive_collection).each do |fact_or_collection|
47
- further_recursion_or_stop(fact_or_collection, &block)
48
- end
49
- end
50
-
51
- def further_recursion_or_stop(fact_or_collection, &block)
52
- if fact_or_collection.respond_to?(:each)
53
- loop_recursively(fact_or_collection, &block)
54
- else
55
- yield(fact_or_collection)
56
- end
57
- end
58
-
59
45
  end
60
46
  end
@@ -35,6 +35,7 @@ module Dbd
35
35
  # in a fact stream.
36
36
  class TimeStamp
37
37
 
38
+ include DefineEquality(:time)
38
39
  attr_reader :time
39
40
 
40
41
  ##
@@ -58,7 +59,7 @@ module Dbd
58
59
  private
59
60
 
60
61
  def new_time(larger_than)
61
- max_with_nil(Time.now.utc, (larger_than && larger_than.time)) + random_offset
62
+ [Time.now.utc, (larger_than && larger_than.time)].compact.max + random_offset
62
63
  end
63
64
 
64
65
  def random_offset
@@ -73,14 +74,6 @@ module Dbd
73
74
  @time.strftime('%F %T.%N %Z')
74
75
  end
75
76
 
76
- def ==(other)
77
- @time == other.time
78
- end
79
-
80
- def hash
81
- @time.hash
82
- end
83
-
84
77
  def >(other)
85
78
  @time > other.time
86
79
  end
@@ -89,12 +82,16 @@ module Dbd
89
82
  @time < other.time
90
83
  end
91
84
 
85
+ def >=(other)
86
+ @time >= other.time
87
+ end
88
+
92
89
  def <=(other)
93
90
  @time <= other.time
94
91
  end
95
92
 
96
93
  def +(seconds)
97
- TimeStamp.new(time: (@time + seconds))
94
+ self.class.new(time: (@time + seconds))
98
95
  end
99
96
 
100
97
  def -(other)
@@ -1,3 +1,3 @@
1
1
  module Dbd
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -47,7 +47,7 @@ module Dbd
47
47
  described_class.new(
48
48
  predicate: nil,
49
49
  object: string_object_1)
50
- end . should raise_error PredicateError
50
+ end.should raise_error(PredicateError)
51
51
  end
52
52
 
53
53
  it "a nil object raises ObjectError" do
@@ -55,13 +55,13 @@ module Dbd
55
55
  described_class.new(
56
56
  predicate: data_predicate,
57
57
  object: nil)
58
- end . should raise_error ObjectError
58
+ end.should raise_error(ObjectError)
59
59
  end
60
60
  end
61
61
 
62
62
  describe "time_stamp=" do
63
63
  it "checks the type (too easy to try to give a Time arg" do
64
- lambda { fact_1.time_stamp = Time.now } . should raise_error(ArgumentError)
64
+ lambda{ fact_1.time_stamp = Time.now }.should raise_error(ArgumentError)
65
65
  end
66
66
 
67
67
  describe "set_once" do
@@ -76,7 +76,7 @@ module Dbd
76
76
  describe "setting it two times" do
77
77
  it "with a different value raises a SetOnceError" do
78
78
  fact_1.time_stamp = time_stamp_now
79
- lambda { fact_1.time_stamp = (time_stamp_now+1) } . should raise_error SetOnceError
79
+ lambda{ fact_1.time_stamp = (time_stamp_now+1) }.should raise_error(RubyPeterV::SetOnceError)
80
80
  end
81
81
  end
82
82
  end
@@ -21,15 +21,15 @@ module Dbd
21
21
 
22
22
  describe "with a provenance_subject argument" do
23
23
  it "raises an ProvenanceError" do
24
- lambda { described_class.new(provenance_subject: provenance_resource_subject) } .
25
- should raise_error ProvenanceError
24
+ lambda{ described_class.new(provenance_subject: provenance_resource_subject) }.
25
+ should raise_error(ProvenanceError)
26
26
  end
27
27
  end
28
28
  end
29
29
 
30
30
  describe "provenance_subject" do
31
31
  it "raises NoMethodError when called" do
32
- lambda { provenance_resource.provenance_subject } . should raise_error NoMethodError
32
+ lambda{ provenance_resource.provenance_subject }.should raise_error(NoMethodError)
33
33
  end
34
34
  end
35
35
 
@@ -53,8 +53,8 @@ module Dbd
53
53
  end
54
54
 
55
55
  it "with incorrect subject it raises SubjectError" do
56
- lambda { provenance_resource << provenance_fact_context_with_incorrect_subject } .
57
- should raise_error SetOnceError,
56
+ lambda{ provenance_resource << provenance_fact_context_with_incorrect_subject }.
57
+ should raise_error(RubyPeterV::SetOnceError),
58
58
  "Value of subject was #{provenance_fact_context_with_incorrect_subject.subject}, " \
59
59
  "trying to set it to #{provenance_resource.subject}"
60
60
  end
@@ -70,7 +70,7 @@ module Dbd
70
70
  end
71
71
 
72
72
  it "with incorrect provenance_subject it raises ProvenanceError" do
73
- lambda { provenance_resource << fact_1 } .
73
+ lambda{ provenance_resource << fact_1 }.
74
74
  should raise_error ProvenanceError
75
75
  end
76
76
  end
@@ -79,8 +79,8 @@ module Dbd
79
79
 
80
80
  describe "when the subject of the fact is not equal to the resource_subject" do
81
81
  it "raises a SetOnceError" do
82
- lambda {resource << fact_2_with_subject } . should raise_error(
83
- SetOnceError,
82
+ lambda{ resource << fact_2_with_subject }.should raise_error(
83
+ RubyPeterV::SetOnceError,
84
84
  "Value of subject was #{fact_2_with_subject.subject}, " \
85
85
  "trying to set it to #{resource.subject}")
86
86
  end
@@ -123,9 +123,9 @@ module Dbd
123
123
  end
124
124
 
125
125
  describe "when the provenance_subject of the fact is not equal to the resource" do
126
- it "raises a ProvenanceError" do
127
- lambda { resource << fact_with_incorrect_provenance } . should raise_error(
128
- SetOnceError,
126
+ it "raises a SetOnceError" do
127
+ lambda{ resource << fact_with_incorrect_provenance }.should raise_error(
128
+ RubyPeterV::SetOnceError,
129
129
  "Value of provenance_subject was #{fact_with_incorrect_provenance.provenance_subject}, " \
130
130
  "trying to set it to #{resource.provenance_subject}")
131
131
  end
@@ -80,8 +80,13 @@ module Dbd
80
80
  end
81
81
  end
82
82
 
83
- describe "<=" do
83
+ describe ">=" do
84
+ it "is true if time_stamp_2 is really larger" do
85
+ time_stamp_2.should >= time_stamp_1
86
+ end
87
+ end
84
88
 
89
+ describe "<=" do
85
90
  it "is true if time_stamp_1 is really smaller" do
86
91
  time_stamp_1.should <= time_stamp_2
87
92
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Vandenabeele
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-29 00:00:00.000000000 Z
11
+ date: 2013-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - '>='
130
130
  - !ruby/object:Gem::Version
131
- version: 0.0.4
131
+ version: 0.0.8
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '>='
137
137
  - !ruby/object:Gem::Version
138
- version: 0.0.4
138
+ version: 0.0.8
139
139
  description: A data store that (almost) never forgets
140
140
  email:
141
141
  - peter@vandenabeele.com