pacer 0.9.1.1-java → 1.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +4 -1
- data/.gitignore +4 -0
- data/.rspec +1 -1
- data/Gemfile-dev +33 -0
- data/Gemfile-release +4 -0
- data/README.md +27 -9
- data/Rakefile +26 -8
- data/bin/autotest +1 -1
- data/lib/pacer/blueprints/multi_graph.rb +7 -19
- data/lib/pacer/blueprints/ruby_graph.rb +77 -52
- data/lib/pacer/blueprints/tg.rb +6 -93
- data/lib/pacer/blueprints.rb +0 -1
- data/lib/pacer/core/graph/edges_route.rb +10 -12
- data/lib/pacer/core/graph/element_route.rb +14 -21
- data/lib/pacer/core/graph/graph_index_route.rb +12 -8
- data/lib/pacer/core/graph/graph_route.rb +2 -5
- data/lib/pacer/core/graph/mixed_route.rb +3 -5
- data/lib/pacer/core/graph/vertices_route.rb +26 -27
- data/lib/pacer/core/route.rb +35 -66
- data/lib/pacer/exceptions.rb +13 -6
- data/lib/pacer/extensions/block_filter_element.rb +0 -5
- data/lib/pacer/filter/collection_filter.rb +9 -2
- data/lib/pacer/filter/empty_filter.rb +12 -3
- data/lib/pacer/filter/future_filter.rb +5 -5
- data/lib/pacer/filter/loop_filter.rb +7 -13
- data/lib/pacer/filter/object_filter.rb +10 -16
- data/lib/pacer/filter/property_filter/filters.rb +134 -93
- data/lib/pacer/filter/property_filter.rb +22 -19
- data/lib/pacer/filter/where_filter/node_visitor.rb +47 -26
- data/lib/pacer/filter/where_filter.rb +24 -3
- data/lib/pacer/function_resolver.rb +7 -2
- data/lib/pacer/graph/graph_ml.rb +39 -0
- data/lib/pacer/graph/graph_transactions_mixin.rb +107 -175
- data/lib/pacer/graph/pacer_graph.rb +438 -0
- data/lib/pacer/graph/simple_encoder.rb +20 -0
- data/lib/pacer/graph/yaml_encoder.rb +81 -0
- data/lib/pacer/graph.rb +8 -10
- data/lib/pacer/pipe/blackbox_pipeline.rb +11 -4
- data/lib/pacer/pipe/block_filter_pipe.rb +5 -22
- data/lib/pacer/pipe/cross_product_transform_pipe.rb +5 -7
- data/lib/pacer/pipe/edges_pipe.rb +22 -0
- data/lib/pacer/pipe/enumerable_pipe.rb +3 -9
- data/lib/pacer/pipe/expandable_pipe.rb +2 -14
- data/lib/pacer/pipe/id_collection_filter_pipe.rb +2 -8
- data/lib/pacer/pipe/is_empty_pipe.rb +5 -12
- data/lib/pacer/pipe/is_unique_pipe.rb +3 -13
- data/lib/pacer/pipe/label_collection_filter_pipe.rb +1 -7
- data/lib/pacer/pipe/label_prefix_pipe.rb +0 -6
- data/lib/pacer/pipe/loop_pipe.rb +27 -25
- data/lib/pacer/pipe/never_pipe.rb +1 -1
- data/lib/pacer/pipe/path_wrapping_pipe.rb +40 -0
- data/lib/pacer/pipe/process_pipe.rb +2 -20
- data/lib/pacer/pipe/property_comparison_pipe.rb +0 -6
- data/lib/pacer/pipe/ruby_pipe.rb +10 -3
- data/lib/pacer/pipe/simple_visitor_pipe.rb +12 -11
- data/lib/pacer/pipe/stream_sort_pipe.rb +1 -7
- data/lib/pacer/pipe/stream_uniq_pipe.rb +0 -6
- data/lib/pacer/pipe/type_filter_pipe.rb +1 -7
- data/lib/pacer/pipe/unary_transform_pipe.rb +6 -8
- data/lib/pacer/pipe/unwrapping_pipe.rb +13 -0
- data/lib/pacer/pipe/vertices_pipe.rb +22 -0
- data/lib/pacer/pipe/visitor_pipe.rb +3 -7
- data/lib/pacer/pipe/wrapping_pipe.rb +37 -0
- data/lib/pacer/pipes.rb +17 -12
- data/lib/pacer/route/mixin/bulk_operations.rb +8 -9
- data/lib/pacer/route/mixin/route_operations.rb +17 -11
- data/lib/pacer/route/mixins.rb +0 -1
- data/lib/pacer/route.rb +198 -121
- data/lib/pacer/side_effect/aggregate.rb +22 -2
- data/lib/pacer/side_effect/as.rb +73 -0
- data/lib/pacer/side_effect/group_count.rb +0 -3
- data/lib/pacer/side_effect/is_unique.rb +7 -6
- data/lib/pacer/side_effect.rb +1 -1
- data/lib/pacer/support/enumerable.rb +14 -12
- data/lib/pacer/support/nil_class.rb +5 -0
- data/lib/pacer/support/proc.rb +2 -2
- data/lib/pacer/support.rb +1 -1
- data/lib/pacer/transform/cap.rb +1 -1
- data/lib/pacer/transform/has_count_cap.rb +1 -1
- data/lib/pacer/transform/join.rb +20 -16
- data/lib/pacer/transform/map.rb +6 -2
- data/lib/pacer/transform/path.rb +44 -20
- data/lib/pacer/transform/sort_section.rb +58 -51
- data/lib/pacer/utils/tsort.rb +7 -2
- data/lib/pacer/utils.rb +0 -1
- data/lib/pacer/version.rb +4 -3
- data/lib/pacer/visitors/section.rb +42 -0
- data/lib/pacer/visitors/visits_section.rb +32 -0
- data/lib/pacer/visitors.rb +7 -0
- data/lib/pacer/wrappers/edge_wrapper.rb +164 -11
- data/lib/pacer/wrappers/element_wrapper.rb +133 -8
- data/lib/pacer/wrappers/index_wrapper.rb +47 -0
- data/lib/pacer/wrappers/vertex_wrapper.rb +175 -12
- data/lib/pacer/wrappers/wrapper_selector.rb +40 -0
- data/lib/pacer/wrappers/wrapping_pipe_function.rb +90 -0
- data/lib/pacer/wrappers.rb +3 -1
- data/lib/pacer-1.0.0-standalone.jar +0 -0
- data/lib/pacer.rb +13 -47
- data/pacer.gemspec +0 -8
- data/pom.xml +10 -3
- data/spec/pacer/blueprints/dex_spec.rb +12 -26
- data/spec/pacer/blueprints/neo4j_spec.rb +14 -28
- data/spec/pacer/blueprints/tg_spec.rb +6 -54
- data/spec/pacer/core/graph/edges_route_spec.rb +1 -1
- data/spec/pacer/core/graph/element_route_spec.rb +2 -2
- data/spec/pacer/core/graph/graph_route_spec.rb +2 -2
- data/spec/pacer/core/graph/vertices_route_spec.rb +10 -3
- data/spec/pacer/core/route_spec.rb +35 -58
- data/spec/pacer/filter/empty_filter_spec.rb +5 -6
- data/spec/pacer/filter/future_filter_spec.rb +8 -8
- data/spec/pacer/filter/loop_filter_spec.rb +120 -6
- data/spec/pacer/filter/object_filter_spec.rb +15 -0
- data/spec/pacer/filter/property_filter/filters_spec.rb +169 -0
- data/spec/pacer/filter/property_filter_spec.rb +15 -12
- data/spec/pacer/filter/uniq_filter_spec.rb +1 -1
- data/spec/pacer/filter/where_filter_spec.rb +55 -7
- data/spec/pacer/graph/{graph_mixin_spec.rb → pacer_graph_spec.rb} +114 -185
- data/spec/pacer/route/mixin/base_spec.rb +36 -35
- data/spec/pacer/route/mixin/route_operations_spec.rb +4 -46
- data/spec/pacer/side_effect/as_spec.rb +34 -0
- data/spec/pacer/support/enumerable_spec.rb +6 -6
- data/spec/pacer/transform/join_spec.rb +7 -5
- data/spec/pacer/transform/map_spec.rb +55 -0
- data/spec/pacer/transform/path_spec.rb +30 -15
- data/spec/pacer/transform/process_spec.rb +42 -0
- data/spec/pacer/transform/sort_section_spec.rb +82 -0
- data/spec/pacer/wrapper/edge_wrapper_spec.rb +122 -2
- data/spec/pacer/wrapper/element_wrapper_spec.rb +289 -3
- data/spec/pacer/wrapper/vertex_wrapper_spec.rb +289 -2
- data/spec/spec_helper.rb +16 -7
- data/spec/support/graph_runner.rb +80 -29
- data/tags +1165 -0
- metadata +46 -107
- data/.rvmrc +0 -0
- data/lib/pacer/blueprints/extensions.rb +0 -77
- data/lib/pacer/graph/edge_mixin.rb +0 -127
- data/lib/pacer/graph/element_mixin.rb +0 -202
- data/lib/pacer/graph/graph_indices_mixin.rb +0 -93
- data/lib/pacer/graph/graph_mixin.rb +0 -361
- data/lib/pacer/graph/index_mixin.rb +0 -30
- data/lib/pacer/graph/vertex_mixin.rb +0 -119
- data/lib/pacer/pipe/map_pipe.rb +0 -36
- data/lib/pacer/pipe/variable_store_iterator_wrapper.rb +0 -26
- data/lib/pacer/route/mixin/variable_route_module.rb +0 -26
- data/lib/pacer/side_effect/section.rb +0 -25
- data/lib/pacer/support/iterator_mixins.rb +0 -110
- data/lib/pacer/wrappers/new_element.rb +0 -106
- data/lib/pacer-0.9.1.1-standalone.jar +0 -0
- data/spec/pacer/graph/edge_mixin_spec.rb +0 -116
- data/spec/pacer/graph/element_mixin_spec.rb +0 -297
- data/spec/pacer/graph/index_mixin_spec.rb +0 -0
- data/spec/pacer/graph/vertex_mixin_spec.rb +0 -192
@@ -1,297 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
unless defined? ElementMixinSpec
|
4
|
-
ElementMixinSpec = true
|
5
|
-
|
6
|
-
shared_examples_for Pacer::ElementMixin do
|
7
|
-
context 'vertex' do
|
8
|
-
subject { v0 }
|
9
|
-
it { should be_a(Pacer::Core::Graph::VerticesRoute) }
|
10
|
-
it { should be_a(Pacer::ElementMixin) }
|
11
|
-
it { should be_a(Pacer::VertexMixin) }
|
12
|
-
it { should_not be_a(Pacer::EdgeMixin) }
|
13
|
-
|
14
|
-
describe '#v' do
|
15
|
-
context '()' do
|
16
|
-
subject { v0.v }
|
17
|
-
its(:to_a) { should == [v0] }
|
18
|
-
it { should be_a_vertices_route }
|
19
|
-
end
|
20
|
-
|
21
|
-
context '(:name => "eliza")' do
|
22
|
-
subject { v0.v(:name => 'eliza') }
|
23
|
-
its(:to_a) { should == [v0] }
|
24
|
-
it { should be_a_vertices_route }
|
25
|
-
end
|
26
|
-
|
27
|
-
context '(:name => "other")' do
|
28
|
-
subject { v0.v(:name => 'other') }
|
29
|
-
its(:to_a) { should == [] }
|
30
|
-
it { should be_a_vertices_route }
|
31
|
-
end
|
32
|
-
|
33
|
-
context '(SimpleMixin)' do
|
34
|
-
subject { v0.v(Tackle::SimpleMixin) }
|
35
|
-
its(:to_a) { should == [v0] }
|
36
|
-
it { should be_a_vertices_route }
|
37
|
-
its(:extensions) { should == Set[Tackle::SimpleMixin] }
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '#e' do
|
42
|
-
it 'is unsupported' do
|
43
|
-
expect { v0.e }.to raise_error(Pacer::UnsupportedOperation)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe '#eql?' do
|
48
|
-
subject { Hash.new(0) }
|
49
|
-
before do
|
50
|
-
subject[v0] += 1
|
51
|
-
subject[graph.v.first] += 1
|
52
|
-
end
|
53
|
-
|
54
|
-
its(:keys) { should == [v0] }
|
55
|
-
its(:values) { should == [2] }
|
56
|
-
|
57
|
-
it 'should put wrapped vertices in the same key' do
|
58
|
-
subject[v0.v(Tackle::SimpleMixin).first] += 1
|
59
|
-
subject.values.should == [3]
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'should put other vertices in a different key' do
|
63
|
-
subject[v1].should == 0
|
64
|
-
subject[v0].should == 2
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'edge' do
|
70
|
-
subject { e0 }
|
71
|
-
it { should be_a(Pacer::Core::Graph::EdgesRoute) }
|
72
|
-
it { should be_a(Pacer::ElementMixin) }
|
73
|
-
it { should be_a(Pacer::EdgeMixin) }
|
74
|
-
it { should_not be_a(Pacer::VertexMixin) }
|
75
|
-
|
76
|
-
describe '#e', :transactions => false do
|
77
|
-
context '()' do
|
78
|
-
subject { e0.e }
|
79
|
-
its(:to_a) { should == [e0] }
|
80
|
-
it(:a => :b) { should be_an_edges_route }
|
81
|
-
end
|
82
|
-
|
83
|
-
context '(:links)' do
|
84
|
-
subject { e0.e(:links) }
|
85
|
-
its(:to_a) { should == [e0] }
|
86
|
-
it { should be_an_edges_route }
|
87
|
-
end
|
88
|
-
|
89
|
-
context '(:other)' do
|
90
|
-
subject { e0.e(:other) }
|
91
|
-
its(:to_a) { should == [] }
|
92
|
-
it { should be_an_edges_route }
|
93
|
-
end
|
94
|
-
|
95
|
-
context '(SimpleMixin)' do
|
96
|
-
subject { e0.e(Tackle::SimpleMixin) }
|
97
|
-
its(:to_a) { should == [e0] }
|
98
|
-
it { should be_an_edges_route }
|
99
|
-
its(:extensions) { should == Set[Tackle::SimpleMixin] }
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
describe '#v' do
|
104
|
-
it 'is unsupported' do
|
105
|
-
expect { e0.v }.to raise_error(Pacer::UnsupportedOperation)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe '#eql?', :transactions => false do
|
110
|
-
subject { Hash.new(0) }
|
111
|
-
before do
|
112
|
-
subject[e0] += 1
|
113
|
-
subject[graph.e.first] += 1
|
114
|
-
end
|
115
|
-
|
116
|
-
its(:keys) { should == [e0] }
|
117
|
-
its(:values) { should == [2] }
|
118
|
-
|
119
|
-
it 'should put wrapped edges in the same key' do
|
120
|
-
subject[e0.e(Tackle::SimpleMixin).first] += 1
|
121
|
-
subject.values.should == [3]
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'should put other edges in a different key' do
|
125
|
-
subject[e1].should == 0
|
126
|
-
subject[e0].should == 2
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
describe '#graph' do
|
132
|
-
it { v0.graph.should == graph }
|
133
|
-
it { e0.graph.should == graph }
|
134
|
-
end
|
135
|
-
|
136
|
-
contexts(
|
137
|
-
'vertex' => proc{
|
138
|
-
let(:element) { v0 }
|
139
|
-
},
|
140
|
-
'edge' => proc{
|
141
|
-
let(:element) { e0 }
|
142
|
-
}) do
|
143
|
-
describe '#[]' do
|
144
|
-
context 'value types' do
|
145
|
-
it '(String)' do
|
146
|
-
element[:string] = 'words'
|
147
|
-
element[:string].should == 'words'
|
148
|
-
end
|
149
|
-
|
150
|
-
it '(Array)' do
|
151
|
-
a = [10, 'elements']
|
152
|
-
element[:array] = a
|
153
|
-
element[:array].should == a
|
154
|
-
end
|
155
|
-
|
156
|
-
it '(Hash)' do
|
157
|
-
h = { :elements => 10 }
|
158
|
-
element[:hash] = h
|
159
|
-
element[:hash].should == h
|
160
|
-
end
|
161
|
-
|
162
|
-
it '(Time)' do
|
163
|
-
time = Time.utc 2011, 1, 2, 3, 4, 5
|
164
|
-
element[:time] = time
|
165
|
-
element[:time].should == time
|
166
|
-
end
|
167
|
-
|
168
|
-
it '(Fixnum)' do
|
169
|
-
element[:number] = 123
|
170
|
-
element[:number].should == 123
|
171
|
-
end
|
172
|
-
|
173
|
-
it '(Float)' do
|
174
|
-
element[:float] = 12.345
|
175
|
-
element[:float].should == 12.345
|
176
|
-
end
|
177
|
-
|
178
|
-
it '(Bignum)' do
|
179
|
-
element[:big] = 123321123321123321123321123321123321
|
180
|
-
element[:big].should == 123321123321123321123321123321123321
|
181
|
-
end
|
182
|
-
|
183
|
-
it "('')" do
|
184
|
-
element[:name] = ''
|
185
|
-
element[:name].should be_nil
|
186
|
-
element.property_keys.should_not include('name')
|
187
|
-
end
|
188
|
-
|
189
|
-
it '(nil)' do
|
190
|
-
element[:name] = nil
|
191
|
-
element[:name].should be_nil
|
192
|
-
element.property_keys.should_not include('name')
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
context 'key types' do
|
197
|
-
it 'String' do
|
198
|
-
element['name'].should == element[:name]
|
199
|
-
end
|
200
|
-
|
201
|
-
it 'Fixnum' do
|
202
|
-
element[123] = 'value'
|
203
|
-
element[123].should == 'value'
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
describe '#result', :transactions => false do
|
209
|
-
subject { element.result }
|
210
|
-
it { should equal(element) }
|
211
|
-
end
|
212
|
-
|
213
|
-
describe '#from_graph?' do
|
214
|
-
context 'same graph' do
|
215
|
-
subject { element.from_graph? graph }
|
216
|
-
it { should be_true }
|
217
|
-
end
|
218
|
-
context 'different graph' do
|
219
|
-
subject { element.from_graph? graph2 }
|
220
|
-
it { should be_false }
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
describe '#properties' do
|
225
|
-
before do
|
226
|
-
element.properties = { :a => 'valuea', :b => 'valueb' }
|
227
|
-
end
|
228
|
-
subject { element.properties }
|
229
|
-
it { should be_a(Hash) }
|
230
|
-
its(:count) { should == 2 }
|
231
|
-
it 'should have the correct vales' do
|
232
|
-
element.properties['a'].should == 'valuea'
|
233
|
-
element.properties['b'].should == 'valueb'
|
234
|
-
element[:a].should == 'valuea'
|
235
|
-
element[:b].should == 'valueb'
|
236
|
-
end
|
237
|
-
it 'should not affect the element if returned values are changed' do
|
238
|
-
element.properties['a'].gsub!(/value/, 'oops')
|
239
|
-
element.properties['a'].should == 'valuea'
|
240
|
-
element[:a].should == 'valuea'
|
241
|
-
end
|
242
|
-
it 'should not affect the element if returned keys are changed' do
|
243
|
-
element.properties.delete('a')
|
244
|
-
element.properties['a'].should == 'valuea'
|
245
|
-
element[:a].should == 'valuea'
|
246
|
-
end
|
247
|
-
it 'should not affect the element if something is added' do
|
248
|
-
element.properties['c'] = 'something'
|
249
|
-
element[:c].should be_nil
|
250
|
-
end
|
251
|
-
context 'existing properties' do
|
252
|
-
before do
|
253
|
-
element.properties = { :a => 'new value', :c => 'value c' }
|
254
|
-
end
|
255
|
-
its(:count) { should == 2 }
|
256
|
-
it 'should have the correct values' do
|
257
|
-
element[:a].should == 'new value'
|
258
|
-
element[:b].should be_nil
|
259
|
-
element[:c].should == 'value c'
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
subject { element }
|
265
|
-
its(:element_id) { should_not be_nil }
|
266
|
-
context '', :transactions => false do
|
267
|
-
# FIXME: Neo4j edges are flaky sometimes when inside a
|
268
|
-
# transaction. If you look them up by id, they are not found.
|
269
|
-
its(:to_a) { should == [element] }
|
270
|
-
its(:element) { should == element }
|
271
|
-
end
|
272
|
-
end
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
Run.all do
|
277
|
-
it_uses Pacer::ElementMixin do
|
278
|
-
let(:v0) { graph.create_vertex :name => 'eliza' }
|
279
|
-
let(:v1) { graph.create_vertex :name => 'darrick' }
|
280
|
-
let(:e0) { graph.create_edge nil, v0, v1, :links }
|
281
|
-
let(:e1) { graph.create_edge nil, v0, v1, :relinks }
|
282
|
-
end
|
283
|
-
|
284
|
-
context 'vertex' do
|
285
|
-
let(:v0) { graph.create_vertex :name => 'eliza' }
|
286
|
-
subject { v0 }
|
287
|
-
it { should_not be_a(Pacer::Wrappers::ElementWrapper) }
|
288
|
-
end
|
289
|
-
|
290
|
-
context 'edge' do
|
291
|
-
let(:v0) { graph.create_vertex :name => 'eliza' }
|
292
|
-
let(:v1) { graph.create_vertex :name => 'darrick' }
|
293
|
-
let(:e0) { graph.create_edge nil, v0, v1, :links }
|
294
|
-
subject { e0 }
|
295
|
-
it { should_not be_a(Pacer::Wrappers::ElementWrapper) }
|
296
|
-
end
|
297
|
-
end
|
File without changes
|
@@ -1,192 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
shared_examples_for Pacer::VertexMixin do
|
4
|
-
use_simple_graph_data
|
5
|
-
|
6
|
-
describe '#v' do
|
7
|
-
subject { v0.v }
|
8
|
-
it { should be_a_vertices_route }
|
9
|
-
it { should_not be_a(graph.element_type(:vertex)) }
|
10
|
-
it { should_not be_an_instance_of(graph.element_type(:vertex)) }
|
11
|
-
end
|
12
|
-
|
13
|
-
describe '#add_extensions' do
|
14
|
-
context 'no extensions' do
|
15
|
-
subject { v0.add_extensions([]) }
|
16
|
-
its('extensions.to_a') { should == [] }
|
17
|
-
it { should_not be_a(Pacer::Wrappers::ElementWrapper) }
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'with extensions' do
|
21
|
-
subject { v0.add_extensions([Tackle::SimpleMixin]) }
|
22
|
-
its('extensions.to_a') { should == [Tackle::SimpleMixin] }
|
23
|
-
it { should be_a(Pacer::Wrappers::ElementWrapper) }
|
24
|
-
it { should be_a(Pacer::Wrappers::VertexWrapper) }
|
25
|
-
it { should_not be_a(Pacer::Wrappers::EdgeWrapper) }
|
26
|
-
|
27
|
-
describe '#v' do
|
28
|
-
subject { v0.add_extensions([Tackle::SimpleMixin]).v }
|
29
|
-
its('extensions.to_a') { should == [Tackle::SimpleMixin] }
|
30
|
-
it { should be_a_vertices_route }
|
31
|
-
it { should be_a(Tackle::SimpleMixin::Route) }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe '#delete!' do
|
37
|
-
before do
|
38
|
-
@vertex_id = v0.element_id
|
39
|
-
v0.delete!
|
40
|
-
graph.checkpoint # deleted edges in neo may otherwise still be looked up during the transaction
|
41
|
-
end
|
42
|
-
it 'should be removed' do
|
43
|
-
graph.vertex(@vertex_id).should be_nil
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
contexts(
|
48
|
-
'into new tg' => proc {
|
49
|
-
let(:dest) { Pacer.tg }
|
50
|
-
},
|
51
|
-
'into graph2' => proc {
|
52
|
-
before { pending 'support temporary hash indices for clone/copy' unless graph.supports_manual_indices? }
|
53
|
-
let(:dest) { graph2 }
|
54
|
-
}) do
|
55
|
-
describe '#clone_into', :transactions => false do
|
56
|
-
subject { v0.clone_into(dest) }
|
57
|
-
its(:properties) { should == { 'name' => 'eliza' } }
|
58
|
-
its(:graph) { should equal(dest) }
|
59
|
-
its('element_id.to_s') { should == v0.element_id.to_s if graph.supports_custom_element_ids? }
|
60
|
-
end
|
61
|
-
|
62
|
-
describe '#copy_into', :transaction => false do
|
63
|
-
subject { v1.copy_into(dest) }
|
64
|
-
its(:properties) { should == { 'name' => 'darrick' } }
|
65
|
-
its(:graph) { should equal(dest) }
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
subject { v0 }
|
70
|
-
its(:graph) { should equal(graph) }
|
71
|
-
its(:display_name) { should be_nil }
|
72
|
-
its(:inspect) { should =~ /#<[VM]\[#{v0.element_id}\]>/ }
|
73
|
-
context 'with label proc' do
|
74
|
-
before do
|
75
|
-
graph.vertex_name = proc { |e| "some name" }
|
76
|
-
end
|
77
|
-
its(:display_name) { should == "some name" }
|
78
|
-
its(:inspect) { should =~ /#<[VM]\[#{ v0.element_id }\] some name>/ }
|
79
|
-
end
|
80
|
-
it { should_not == v1 }
|
81
|
-
it { should == v0 }
|
82
|
-
context 'edge with same element id', :transactions => false do
|
83
|
-
it { should_not == e0 }
|
84
|
-
end
|
85
|
-
|
86
|
-
context 'with more data' do
|
87
|
-
let(:from_v) { graph.create_vertex }
|
88
|
-
let(:to_v) { graph.create_vertex }
|
89
|
-
|
90
|
-
before do
|
91
|
-
%w[ a a a b b c ].each do |label|
|
92
|
-
v = graph.create_vertex
|
93
|
-
graph.create_edge nil, from_v, v, label
|
94
|
-
graph.create_edge nil, v, to_v, label
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe '#in_edges' do
|
99
|
-
specify 'to_v should have 6 in edges' do
|
100
|
-
to_v.in_edges.count.should == 6
|
101
|
-
end
|
102
|
-
|
103
|
-
specify 'to_v should have 3 in edges with label a' do
|
104
|
-
to_v.in_edges('a').count.should == 3
|
105
|
-
end
|
106
|
-
|
107
|
-
specify 'to_v should have 4 in edges with label a or c' do
|
108
|
-
to_v.in_edges('a', 'c').count.should == 4
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'should add an extension' do
|
112
|
-
edge = to_v.in_edges(Tackle::SimpleMixin).first
|
113
|
-
edge.should be_a(Pacer::EdgeMixin)
|
114
|
-
edge.extensions.should include(Tackle::SimpleMixin)
|
115
|
-
end
|
116
|
-
|
117
|
-
it 'should be able to mix labels and mixins as arguments' do
|
118
|
-
edge = to_v.in_edges('a', Tackle::SimpleMixin, 'b').first
|
119
|
-
edge.should be_a(Pacer::EdgeMixin)
|
120
|
-
edge.extensions.should include(Tackle::SimpleMixin)
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'should filter correctly with a mix of labels and mixins as arguments' do
|
124
|
-
to_v.in_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe '#out_edges' do
|
129
|
-
specify 'from_v should have 6 out edges' do
|
130
|
-
from_v.out_edges.count.should == 6
|
131
|
-
end
|
132
|
-
|
133
|
-
specify 'from_v should have 3 out edges with label a' do
|
134
|
-
from_v.out_edges('a').count.should == 3
|
135
|
-
end
|
136
|
-
|
137
|
-
specify 'from_v should have 4 out edges with label a or c' do
|
138
|
-
from_v.out_edges('a', 'c').count.should == 4
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'should add an extension' do
|
142
|
-
edge = from_v.out_edges(Tackle::SimpleMixin).first
|
143
|
-
edge.should be_a(Pacer::EdgeMixin)
|
144
|
-
edge.extensions.should include(Tackle::SimpleMixin)
|
145
|
-
end
|
146
|
-
|
147
|
-
it 'should be able to mix labels and mixins as arguments' do
|
148
|
-
edge = from_v.out_edges('a', Tackle::SimpleMixin, 'b').first
|
149
|
-
edge.should be_a(Pacer::EdgeMixin)
|
150
|
-
edge.extensions.should include(Tackle::SimpleMixin)
|
151
|
-
end
|
152
|
-
|
153
|
-
it 'should filter correctly with a mix of labels and mixins as arguments' do
|
154
|
-
from_v.out_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
describe '#both_edges' do
|
159
|
-
specify 'from_v should have 6 edges' do
|
160
|
-
from_v.both_edges.count.should == 6
|
161
|
-
end
|
162
|
-
|
163
|
-
specify 'from_v should have 3 edges with label a' do
|
164
|
-
from_v.both_edges('a').count.should == 3
|
165
|
-
end
|
166
|
-
|
167
|
-
specify 'from_v should have 4 edges with label a or c' do
|
168
|
-
from_v.both_edges('a', 'c').count.should == 4
|
169
|
-
end
|
170
|
-
|
171
|
-
it 'should add an extension' do
|
172
|
-
edge = from_v.both_edges(Tackle::SimpleMixin).first
|
173
|
-
edge.should be_a(Pacer::EdgeMixin)
|
174
|
-
edge.extensions.should include(Tackle::SimpleMixin)
|
175
|
-
end
|
176
|
-
|
177
|
-
it 'should be able to mix labels and mixins as arguments' do
|
178
|
-
edge = from_v.both_edges('a', Tackle::SimpleMixin, 'b').first
|
179
|
-
edge.should be_a(Pacer::EdgeMixin)
|
180
|
-
edge.extensions.should include(Tackle::SimpleMixin)
|
181
|
-
end
|
182
|
-
|
183
|
-
it 'should filter correctly with a mix of labels and mixins as arguments' do
|
184
|
-
from_v.both_edges('a', Tackle::SimpleMixin, 'b').count.should == 5
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
Run.all do
|
191
|
-
it_uses Pacer::VertexMixin
|
192
|
-
end
|