dbd 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.txt +6 -0
- data/README.md +33 -31
- data/docs/stories/014_escape_newlines_in_CSV.txt +10 -4
- data/docs/test.rb +28 -29
- data/lib/dbd/fact.rb +11 -11
- data/lib/dbd/version.rb +1 -1
- data/spec/lib/dbd/fact/methods_spec.rb +14 -10
- data/spec/lib/dbd/graph/to_csv_spec.rb +8 -8
- data/spec/test_factories/fact.rb +2 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4df1f0e326b407d9c2f0391a7ae7b0980a2deae
|
4
|
+
data.tar.gz: a9724f1c990e1fdeaa3c3159ae059b26de4ddc4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 391388832659492f0c00259140f97c1626820a0473373d5491ef9fb7e1fca6f1dd0badc3be4fca3bbbb2c567b52bdfa37bfef14bc1efe60f40beaa22813bc0ca
|
7
|
+
data.tar.gz: ca0facecd89bca3dfffb24865b8cf14e4676582d8254fed22e26ca268738c61ffc35f4f3fc7b755c8b4e728779e14579a8ae99a91be6f17f306f3c10f2cf490e
|
data/HISTORY.txt
CHANGED
@@ -85,3 +85,9 @@
|
|
85
85
|
* backslash => '\\\\' (double backslash)
|
86
86
|
=> now 1 fact is 1 "line" in the CSV file
|
87
87
|
(allowing file operations that are line oriented)
|
88
|
+
|
89
|
+
0.0.14 (9 Aug 2013)
|
90
|
+
======
|
91
|
+
|
92
|
+
* in to_CSV the time_stamp now comes first (swapped with id)
|
93
|
+
* this will allow file level 'sort' on the ISO dates
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ This is facts based data store, inspired by [RDF] concepts, but adding a log bas
|
|
29
29
|
provenance is possible per fact (e.g. different properties about the same
|
30
30
|
resource can come from different sources, different visibility etc.)
|
31
31
|
* can keep the original_source reference, creator, date, …
|
32
|
-
* can have a context that allows filtering data (e.g. private, professional, …)
|
32
|
+
* can have a context that allows filtering data (e.g. public, private, professional, …)
|
33
33
|
* separate encryption schemes per context are possible
|
34
34
|
* Context is flexible, since built itself from Facts
|
35
35
|
* Schemaless
|
@@ -39,7 +39,6 @@ This is facts based data store, inspired by [RDF] concepts, but adding a log bas
|
|
39
39
|
* the object of each Fact can be another Resource
|
40
40
|
* aimed at exporting to a graph database (e.g. Neo4j) for analysis
|
41
41
|
|
42
|
-
|
43
42
|
## License
|
44
43
|
|
45
44
|
Open Source [MIT]
|
@@ -63,7 +62,7 @@ require 'dbd'
|
|
63
62
|
|
64
63
|
context = Dbd::Context.new
|
65
64
|
|
66
|
-
context << Dbd::ContextFact.new(predicate: "prov:
|
65
|
+
context << Dbd::ContextFact.new(predicate: "prov:visibility", object: "public")
|
67
66
|
context << Dbd::ContextFact.new(predicate: "prov:source", object: "http://github.com/petervandenabeele/dbd")
|
68
67
|
context << Dbd::ContextFact.new(predicate: "dcterms:creator", object: "@peter_v")
|
69
68
|
context << Dbd::ContextFact.new(predicate: "dcterms:created", object: Time.now.utc)
|
@@ -84,15 +83,15 @@ puts "facts in short representation:"
|
|
84
83
|
puts graph.map(&:short)
|
85
84
|
|
86
85
|
# facts in short representation:
|
87
|
-
# [ cont ] :
|
88
|
-
# [ cont ] :
|
89
|
-
# [ cont ] :
|
90
|
-
# [ cont ] :
|
91
|
-
# [ cont ] :
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
86
|
+
# [ cont ] : d5ad0ca1 : prov:visibility : public
|
87
|
+
# [ cont ] : d5ad0ca1 : prov:source : http://github.com/petervandenabeele/dbd
|
88
|
+
# [ cont ] : d5ad0ca1 : dcterms:creator : @peter_v
|
89
|
+
# [ cont ] : d5ad0ca1 : dcterms:created : 2013-08-09 20:15:24 UTC
|
90
|
+
# [ cont ] : d5ad0ca1 : prov:license : MIT
|
91
|
+
# d5ad0ca1 : dede3cf8 : todo:nobelPeacePriceWinn : 2012
|
92
|
+
# d5ad0ca1 : dede3cf8 : rdfs:label : EU
|
93
|
+
# d5ad0ca1 : dede3cf8 : rdfs:comment : European Union
|
94
|
+
# d5ad0ca1 : dede3cf8 : todo:story : A long period of peace,_ that is a "bliss".
|
96
95
|
|
97
96
|
csv = graph.to_CSV
|
98
97
|
|
@@ -100,30 +99,29 @@ puts "facts in full detail in CSV:"
|
|
100
99
|
puts csv
|
101
100
|
|
102
101
|
# facts in full detail in CSV:
|
103
|
-
#
|
104
|
-
# "
|
105
|
-
# "
|
106
|
-
# "
|
107
|
-
# "
|
108
|
-
# "
|
109
|
-
# "
|
110
|
-
# "
|
111
|
-
# "
|
112
|
-
# that is a ""bliss""."
|
102
|
+
# "2013-08-09 20:15:24.022368550 UTC","9cc48236-cb12-40e8-8641-08407b9a03fb","","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","prov:visibility","public"
|
103
|
+
# "2013-08-09 20:15:24.022416066 UTC","86afeade-0802-4fe7-b0d7-9a09d5441dbf","","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","prov:source","http://github.com/petervandenabeele/dbd"
|
104
|
+
# "2013-08-09 20:15:24.022435168 UTC","97d7fd9f-77e1-45e9-bdaa-9a283345c8ec","","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dcterms:creator","@peter_v"
|
105
|
+
# "2013-08-09 20:15:24.022449630 UTC","aa0897ce-d5ea-497a-8c4b-3a9339f6cc52","","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dcterms:created","2013-08-09 20:15:24 UTC"
|
106
|
+
# "2013-08-09 20:15:24.022463761 UTC","154d2b46-99df-4eaf-8a75-9e3b7d5df2a7","","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","prov:license","MIT"
|
107
|
+
# "2013-08-09 20:15:24.022480963 UTC","0590f53a-346a-4ece-b510-fc1179e76e05","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dede3cf8-2d3f-4170-8ce5-3fe7c0db5529","todo:nobelPeacePriceWinner","2012"
|
108
|
+
# "2013-08-09 20:15:24.022497483 UTC","b28dc6fb-1779-47d3-9109-882075b28d08","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dede3cf8-2d3f-4170-8ce5-3fe7c0db5529","rdfs:label","EU"
|
109
|
+
# "2013-08-09 20:15:24.022512505 UTC","5474dbc0-ee47-4e7a-aa0a-cd60f8467d84","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dede3cf8-2d3f-4170-8ce5-3fe7c0db5529","rdfs:comment","European Union"
|
110
|
+
# "2013-08-09 20:15:24.022526505 UTC","a8c0a137-8c45-49bf-9a87-5915a24725b9","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dede3cf8-2d3f-4170-8ce5-3fe7c0db5529","todo:story","A long period of peace,\n that is a ""bliss""."
|
113
111
|
|
114
112
|
imported_graph = Dbd::Graph.new.from_CSV(csv)
|
115
113
|
|
116
114
|
puts imported_graph.map(&:short)
|
117
115
|
|
118
|
-
# [ cont ] :
|
119
|
-
# [ cont ] :
|
120
|
-
# [ cont ] :
|
121
|
-
# [ cont ] :
|
122
|
-
# [ cont ] :
|
123
|
-
#
|
124
|
-
#
|
125
|
-
#
|
126
|
-
#
|
116
|
+
# [ cont ] : d5ad0ca1 : prov:visibility : public
|
117
|
+
# [ cont ] : d5ad0ca1 : prov:source : http://github.com/petervandenabeele/dbd
|
118
|
+
# [ cont ] : d5ad0ca1 : dcterms:creator : @peter_v
|
119
|
+
# [ cont ] : d5ad0ca1 : dcterms:created : 2013-08-09 20:15:24 UTC
|
120
|
+
# [ cont ] : d5ad0ca1 : prov:license : MIT
|
121
|
+
# d5ad0ca1 : dede3cf8 : todo:nobelPeacePriceWinn : 2012
|
122
|
+
# d5ad0ca1 : dede3cf8 : rdfs:label : EU
|
123
|
+
# d5ad0ca1 : dede3cf8 : rdfs:comment : European Union
|
124
|
+
# d5ad0ca1 : dede3cf8 : todo:story : A long period of peace,_ that is a "bliss".
|
127
125
|
```
|
128
126
|
|
129
127
|
## Performance tests on 10 M facts
|
@@ -164,6 +162,10 @@ The significantly larger times to read from_CSV versus writing to_CSV are _not_
|
|
164
162
|
significantly caused by input validation (a test in JRuby without validation on
|
165
163
|
reading 1M facts was only 6% faster with the input validation turned off).
|
166
164
|
|
165
|
+
Version 0.0.13 introduced newline escaping for to_CSV and from_CSV and this
|
166
|
+
has added a performance penalty of approx. 30% (all strings are sent through
|
167
|
+
gsub with a regexp).
|
168
|
+
|
167
169
|
[RDF]: http://www.w3.org/RDF/
|
168
170
|
[Rationale]: http://github.com/petervandenabeele/dbd/blob/master/docs/rationale.md
|
169
171
|
[MIT]: https://github.com/petervandenabeele/dbd/blob/master/LICENSE.txt
|
@@ -10,10 +10,16 @@ So, the newlines in the String object need to be escaped
|
|
10
10
|
* escape on writing, suggest:
|
11
11
|
* "\n" => "\\n" (a back slash and a letter n)
|
12
12
|
"C:\nuby" => "C:\\nuby"
|
13
|
-
* do we need to escape a "real"
|
13
|
+
* do we need to escape a "real" backslash ??
|
14
|
+
=> yes, escape single backslash to double backslash
|
14
15
|
|
15
|
-
*
|
16
|
-
* "\\n" => "\n" (a newline)
|
17
|
-
*
|
16
|
+
* unescape on reading, suggest:
|
17
|
+
* "\\n" (backslash n) => "\n" (a newline)
|
18
|
+
* "\\\\" (double backslash) => "\\" (single backslash)
|
19
|
+
|
20
|
+
* the magic upon unescaping is that a uneven amount of backslashes,
|
21
|
+
followed by a 'n' can only be an escaped newline. A real
|
22
|
+
"backslash n" will always trigger an even amount of backslashes
|
23
|
+
in the escaped version.
|
18
24
|
|
19
25
|
* validate that write + read performance is not degraded too much
|
data/docs/test.rb
CHANGED
@@ -2,7 +2,7 @@ require 'dbd'
|
|
2
2
|
|
3
3
|
context = Dbd::Context.new
|
4
4
|
|
5
|
-
context << Dbd::ContextFact.new(predicate: "prov:
|
5
|
+
context << Dbd::ContextFact.new(predicate: "prov:visibility", object: "public")
|
6
6
|
context << Dbd::ContextFact.new(predicate: "prov:source", object: "http://github.com/petervandenabeele/dbd")
|
7
7
|
context << Dbd::ContextFact.new(predicate: "dcterms:creator", object: "@peter_v")
|
8
8
|
context << Dbd::ContextFact.new(predicate: "dcterms:created", object: Time.now.utc)
|
@@ -23,15 +23,15 @@ puts "facts in short representation:"
|
|
23
23
|
puts graph.map(&:short)
|
24
24
|
|
25
25
|
# facts in short representation:
|
26
|
-
# [
|
27
|
-
# [
|
28
|
-
# [
|
29
|
-
# [
|
30
|
-
# [
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
26
|
+
# [ cont ] : d5ad0ca1 : prov:visibility : public
|
27
|
+
# [ cont ] : d5ad0ca1 : prov:source : http://github.com/petervandenabeele/dbd
|
28
|
+
# [ cont ] : d5ad0ca1 : dcterms:creator : @peter_v
|
29
|
+
# [ cont ] : d5ad0ca1 : dcterms:created : 2013-08-09 20:15:24 UTC
|
30
|
+
# [ cont ] : d5ad0ca1 : prov:license : MIT
|
31
|
+
# d5ad0ca1 : dede3cf8 : todo:nobelPeacePriceWinn : 2012
|
32
|
+
# d5ad0ca1 : dede3cf8 : rdfs:label : EU
|
33
|
+
# d5ad0ca1 : dede3cf8 : rdfs:comment : European Union
|
34
|
+
# d5ad0ca1 : dede3cf8 : todo:story : A long period of peace,_ that is a "bliss".
|
35
35
|
|
36
36
|
csv = graph.to_CSV
|
37
37
|
|
@@ -39,27 +39,26 @@ puts "facts in full detail in CSV:"
|
|
39
39
|
puts csv
|
40
40
|
|
41
41
|
# facts in full detail in CSV:
|
42
|
-
#
|
43
|
-
# "
|
44
|
-
# "
|
45
|
-
# "
|
46
|
-
# "
|
47
|
-
# "
|
48
|
-
# "
|
49
|
-
# "
|
50
|
-
# "
|
51
|
-
# that is a ""bliss""."
|
42
|
+
# "2013-08-09 20:15:24.022368550 UTC","9cc48236-cb12-40e8-8641-08407b9a03fb","","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","prov:visibility","public"
|
43
|
+
# "2013-08-09 20:15:24.022416066 UTC","86afeade-0802-4fe7-b0d7-9a09d5441dbf","","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","prov:source","http://github.com/petervandenabeele/dbd"
|
44
|
+
# "2013-08-09 20:15:24.022435168 UTC","97d7fd9f-77e1-45e9-bdaa-9a283345c8ec","","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dcterms:creator","@peter_v"
|
45
|
+
# "2013-08-09 20:15:24.022449630 UTC","aa0897ce-d5ea-497a-8c4b-3a9339f6cc52","","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dcterms:created","2013-08-09 20:15:24 UTC"
|
46
|
+
# "2013-08-09 20:15:24.022463761 UTC","154d2b46-99df-4eaf-8a75-9e3b7d5df2a7","","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","prov:license","MIT"
|
47
|
+
# "2013-08-09 20:15:24.022480963 UTC","0590f53a-346a-4ece-b510-fc1179e76e05","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dede3cf8-2d3f-4170-8ce5-3fe7c0db5529","todo:nobelPeacePriceWinner","2012"
|
48
|
+
# "2013-08-09 20:15:24.022497483 UTC","b28dc6fb-1779-47d3-9109-882075b28d08","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dede3cf8-2d3f-4170-8ce5-3fe7c0db5529","rdfs:label","EU"
|
49
|
+
# "2013-08-09 20:15:24.022512505 UTC","5474dbc0-ee47-4e7a-aa0a-cd60f8467d84","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dede3cf8-2d3f-4170-8ce5-3fe7c0db5529","rdfs:comment","European Union"
|
50
|
+
# "2013-08-09 20:15:24.022526505 UTC","a8c0a137-8c45-49bf-9a87-5915a24725b9","d5ad0ca1-645f-41a8-8384-7f411a1f94e2","dede3cf8-2d3f-4170-8ce5-3fe7c0db5529","todo:story","A long period of peace,\n that is a ""bliss""."
|
52
51
|
|
53
52
|
imported_graph = Dbd::Graph.new.from_CSV(csv)
|
54
53
|
|
55
54
|
puts imported_graph.map(&:short)
|
56
55
|
|
57
|
-
# [
|
58
|
-
# [
|
59
|
-
# [
|
60
|
-
# [
|
61
|
-
# [
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
56
|
+
# [ cont ] : d5ad0ca1 : prov:visibility : public
|
57
|
+
# [ cont ] : d5ad0ca1 : prov:source : http://github.com/petervandenabeele/dbd
|
58
|
+
# [ cont ] : d5ad0ca1 : dcterms:creator : @peter_v
|
59
|
+
# [ cont ] : d5ad0ca1 : dcterms:created : 2013-08-09 20:15:24 UTC
|
60
|
+
# [ cont ] : d5ad0ca1 : prov:license : MIT
|
61
|
+
# d5ad0ca1 : dede3cf8 : todo:nobelPeacePriceWinn : 2012
|
62
|
+
# d5ad0ca1 : dede3cf8 : rdfs:label : EU
|
63
|
+
# d5ad0ca1 : dede3cf8 : rdfs:comment : European Union
|
64
|
+
# d5ad0ca1 : dede3cf8 : todo:story : A long period of peace,_ that is a "bliss".
|
data/lib/dbd/fact.rb
CHANGED
@@ -14,10 +14,6 @@ module Dbd
|
|
14
14
|
# Framework) concept, but with different and extended functionality.
|
15
15
|
#
|
16
16
|
# Each basic fact has:
|
17
|
-
# * a unique and invariant *id* (a uuid)
|
18
|
-
#
|
19
|
-
# To allow referencing back to it (e.g. to invalidate it later in a fact stream).
|
20
|
-
#
|
21
17
|
# * a *time_stamp* (time with nanosecond granularity)
|
22
18
|
#
|
23
19
|
# To allow verifying that the order in a fact stream is correct.
|
@@ -26,6 +22,10 @@ module Dbd
|
|
26
22
|
# creation of the fact, but it has to increase in strictly monotic
|
27
23
|
# order in a fact stream.
|
28
24
|
#
|
25
|
+
# * a unique and invariant *id* (a uuid)
|
26
|
+
#
|
27
|
+
# To allow referencing back to it (e.g. to invalidate it later in a fact stream).
|
28
|
+
#
|
29
29
|
# * a *context_subject* (a uuid)
|
30
30
|
#
|
31
31
|
# The subject of the Context (a set of Contexts with
|
@@ -67,8 +67,8 @@ module Dbd
|
|
67
67
|
##
|
68
68
|
# @return [Array] The 6 attributes of a Fact.
|
69
69
|
def self.attributes
|
70
|
-
[:
|
71
|
-
:
|
70
|
+
[:time_stamp,
|
71
|
+
:id,
|
72
72
|
:context_subject,
|
73
73
|
:subject,
|
74
74
|
:predicate,
|
@@ -114,15 +114,15 @@ module Dbd
|
|
114
114
|
# Builds a new Fact.
|
115
115
|
#
|
116
116
|
# @param [Hash{Symbol => Object}] options
|
117
|
-
# @option options [#to_s] :predicate Required : the predicate for this Fact
|
118
117
|
# @option options [#to_s] :object Required : the object for this Fact (required)
|
119
|
-
# @option options [
|
120
|
-
# @option options [String (uuid)] :subject
|
121
|
-
# @option options [
|
118
|
+
# @option options [#to_s] :predicate Required : the predicate for this Fact
|
119
|
+
# @option options [String (uuid)] :subject Optional : the subject for this Fact
|
120
|
+
# @option options [String (uuid)] :context_subject Optional : the subject of the Context
|
122
121
|
# @option options [String (uuid)] :id Optional : set the id
|
122
|
+
# @option options [TimeStamp] :time_stamp Optional : the time_stamp for this Fact
|
123
123
|
def initialize(options)
|
124
|
-
@id = options[:id] || self.class.factory.new_id
|
125
124
|
@time_stamp = options[:time_stamp]
|
125
|
+
@id = options[:id] || self.class.factory.new_id
|
126
126
|
@context_subject = options[:context_subject]
|
127
127
|
@subject = options[:subject]
|
128
128
|
@predicate = options[:predicate]
|
data/lib/dbd/version.rb
CHANGED
@@ -8,7 +8,7 @@ module Dbd
|
|
8
8
|
let(:subject) { factory.new_subject }
|
9
9
|
let(:fact_1) { TestFactories::Fact.fact_1(context_subject) }
|
10
10
|
let(:fact_2_with_subject) { TestFactories::Fact.fact_2_with_subject(context_subject) }
|
11
|
-
let(:fact_with_newline) { TestFactories::Fact.
|
11
|
+
let(:fact_with_newline) { TestFactories::Fact.data_fact_EU(context_subject) }
|
12
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
|
|
@@ -77,7 +77,7 @@ module Dbd
|
|
77
77
|
|
78
78
|
it 'for a fact with a newline replaces it with a underscore' do
|
79
79
|
fact_with_newline.subject = subject
|
80
|
-
fact_with_newline.short.should match(/^[0-9a-f]{8} : [0-9a-f]{8} : http:\/\/example\.org\/test\/ :
|
80
|
+
fact_with_newline.short.should match(/^[0-9a-f]{8} : [0-9a-f]{8} : http:\/\/example\.org\/test\/ : \\n_\\n_\\_\\\\_\\\\\\_European_Union\\n$/)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -114,8 +114,12 @@ module Dbd
|
|
114
114
|
described_class.attributes.size.should == 6
|
115
115
|
end
|
116
116
|
|
117
|
-
it 'first attribute is :
|
118
|
-
described_class.attributes.first.should == :
|
117
|
+
it 'first attribute is :time_stamp' do
|
118
|
+
described_class.attributes.first.should == :time_stamp
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'second attribute is :id' do
|
122
|
+
described_class.attributes[1].should == :id
|
119
123
|
end
|
120
124
|
end
|
121
125
|
|
@@ -124,8 +128,8 @@ module Dbd
|
|
124
128
|
full_fact.values.size.should == 6
|
125
129
|
end
|
126
130
|
|
127
|
-
it 'the
|
128
|
-
full_fact.values
|
131
|
+
it 'the first element (time_stamp) is a TimeStamp' do
|
132
|
+
full_fact.values.first.should be_a(TimeStamp)
|
129
133
|
end
|
130
134
|
end
|
131
135
|
|
@@ -134,12 +138,12 @@ module Dbd
|
|
134
138
|
full_fact.string_values.size.should == 6
|
135
139
|
end
|
136
140
|
|
137
|
-
it 'the
|
138
|
-
full_fact.string_values
|
141
|
+
it 'the first element (time_stamp) is a String' do
|
142
|
+
full_fact.string_values.first.should be_a(String)
|
139
143
|
end
|
140
144
|
|
141
145
|
it 'escapes a newline into \n and \n into \\\\n (two backslashes and a n)' do
|
142
|
-
full_fact.string_values
|
146
|
+
full_fact.string_values.last.should == "Gandhi\\nKing\\\\n" # backslash newline
|
143
147
|
end
|
144
148
|
end
|
145
149
|
|
@@ -175,7 +179,7 @@ module Dbd
|
|
175
179
|
|
176
180
|
it 'is true when the time_stamp is 500 ns larger' do
|
177
181
|
string_values_time_modified = string_values.dup.tap { |_string_values|
|
178
|
-
_string_values[
|
182
|
+
_string_values[0] = '2013-06-17 21:55:09.967653513 UTC'
|
179
183
|
}
|
180
184
|
other = factory.from_string_values(string_values_time_modified)
|
181
185
|
other.should be_equivalent(ref)
|
@@ -52,12 +52,12 @@ module Dbd
|
|
52
52
|
subject.to_CSV.lines.to_a.first.chomp
|
53
53
|
end
|
54
54
|
|
55
|
-
it 'has
|
56
|
-
first_line.split(',')[0].
|
55
|
+
it 'has time_stamp as first value' do
|
56
|
+
first_line.split(',')[0][1..-2].should match(time_stamp_valid_regexp)
|
57
57
|
end
|
58
58
|
|
59
|
-
it 'has
|
60
|
-
first_line.split(',')[1]
|
59
|
+
it 'has id (a Fact::ID) as second value' do
|
60
|
+
first_line.split(',')[1].gsub(/"/, '').should match(id_valid_regexp)
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'has an empty third value (signature of a context_fact)' do
|
@@ -119,12 +119,12 @@ module Dbd
|
|
119
119
|
subject.to_CSV.lines.to_a.first.chomp
|
120
120
|
end
|
121
121
|
|
122
|
-
it 'has
|
123
|
-
first_line.split(',')[0].
|
122
|
+
it 'has time_stamp as first value' do
|
123
|
+
first_line.split(',')[0][1..-2].should match(time_stamp_valid_regexp)
|
124
124
|
end
|
125
125
|
|
126
|
-
it 'has
|
127
|
-
first_line.split(',')[1]
|
126
|
+
it 'has id (a Fact::ID) as second value' do
|
127
|
+
first_line.split(',')[1].gsub(/"/, '').should match(id_valid_regexp)
|
128
128
|
end
|
129
129
|
|
130
130
|
it 'has context_fact_1.subject as third value' do
|
data/spec/test_factories/fact.rb
CHANGED
@@ -10,8 +10,8 @@ module TestFactories
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.string_values
|
13
|
-
['
|
14
|
-
'
|
13
|
+
['2013-06-17 21:55:09.967653013 UTC',
|
14
|
+
'825e44d5-af33-4858-8047-549bd813daa8',
|
15
15
|
'40fab407-9b04-4a51-9a52-d978abfcbb1f',
|
16
16
|
'2e9fbc87-2e94-47e9-a8fd-121cc4bc3e8f',
|
17
17
|
'http://example.org/test/name',
|
@@ -79,14 +79,6 @@ module TestFactories
|
|
79
79
|
object: "\\n\n\\n\n\\\n\\\\\n\\\\\\\nEuropean\nUnion\\n")
|
80
80
|
end
|
81
81
|
|
82
|
-
def self.fact_with_newline(context_subject = nil, subject = nil)
|
83
|
-
factory_for.new(
|
84
|
-
context_subject: context_subject,
|
85
|
-
subject: subject,
|
86
|
-
predicate: 'http://example.org/test/comment',
|
87
|
-
object: "A long story\nreally.")
|
88
|
-
end
|
89
|
-
|
90
82
|
def self.full_fact
|
91
83
|
fixed_id = TestFactories::Fact::ID.fixed_id
|
92
84
|
fact_with_forced_id(fixed_id).tap do |fact|
|
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
|
+
version: 0.0.14
|
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-08-
|
11
|
+
date: 2013-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|