pacer 2.0.10.pre-java → 2.0.12-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.autotest +0 -4
- data/.gitignore +1 -0
- data/.travis.yml +2 -2
- data/Rakefile +25 -0
- data/blog/detach_benchmarks.txt +56 -0
- data/ext/.classpath +26 -0
- data/ext/.gitignore +44 -0
- data/ext/.project +23 -0
- data/ext/pom.xml +76 -0
- data/ext/src/main/java/com/xnlogic/pacer/pipes/BlackboxPipeline.java +56 -0
- data/ext/src/main/java/com/xnlogic/pacer/pipes/CollectionFilterPipe.java +18 -0
- data/ext/src/main/java/com/xnlogic/pacer/pipes/EdgesPipe.java +26 -0
- data/ext/src/main/java/com/xnlogic/pacer/pipes/ExpandablePipe.java +93 -0
- data/ext/src/main/java/com/xnlogic/pacer/pipes/IdCollectionFilterPipe.java +50 -0
- data/ext/src/main/java/com/xnlogic/pacer/pipes/IsEmptyPipe.java +35 -0
- data/ext/src/main/java/com/xnlogic/pacer/pipes/IsUniquePipe.java +58 -0
- data/ext/src/main/java/com/xnlogic/pacer/pipes/LabelCollectionFilterPipe.java +32 -0
- data/ext/src/main/java/com/xnlogic/pacer/pipes/LabelPrefixPipe.java +23 -0
- data/ext/src/main/java/com/xnlogic/pacer/pipes/NeverPipe.java +10 -0
- data/ext/src/main/java/com/xnlogic/pacer/pipes/VerticesPipe.java +26 -0
- data/ext/src/test/java/com/xnlogic/pacer/pipes/BlackboxPipelineTest.java +33 -0
- data/ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java +50 -0
- data/ext/src/test/java/com/xnlogic/pacer/pipes/EdgesPipeTest.java +103 -0
- data/ext/src/test/java/com/xnlogic/pacer/pipes/ExpandablePipeTest.java +66 -0
- data/ext/src/test/java/com/xnlogic/pacer/pipes/IdCollectionFilterPipeTest.java +85 -0
- data/ext/src/test/java/com/xnlogic/pacer/pipes/IsUniquePipeTest.java +62 -0
- data/ext/src/test/java/com/xnlogic/pacer/pipes/LabelCollectionFilterPipeTest.java +97 -0
- data/ext/src/test/java/com/xnlogic/pacer/pipes/LabelPrefixPipeTest.java +69 -0
- data/ext/src/test/java/com/xnlogic/pacer/pipes/NeverPipeTest.java +17 -0
- data/ext/src/test/java/com/xnlogic/pacer/pipes/VerticesPipeTest.java +97 -0
- data/lib/pacer/core/graph/element_route.rb +2 -2
- data/lib/pacer/core/graph/path_route.rb +2 -2
- data/lib/pacer/core/route.rb +77 -1
- data/lib/pacer/filter/property_filter/edge_filters.rb +5 -1
- data/lib/pacer/filter/property_filter/filters.rb +23 -7
- data/lib/pacer/pipe/path_wrapping_pipe.rb +14 -3
- data/lib/pacer/pipe/wrapping_pipe.rb +15 -4
- data/lib/pacer/pipes.rb +15 -13
- data/lib/pacer/route.rb +1 -0
- data/lib/pacer/side_effect/as_var.rb +1 -1
- data/lib/pacer/side_effect/is_unique.rb +2 -2
- data/lib/pacer/transform/branch.rb +1 -1
- data/lib/pacer/transform/lookup_ids.rb +1 -1
- data/lib/pacer/transform/path_tree.rb +1 -1
- data/lib/pacer/transform/reduce.rb +1 -1
- data/lib/pacer/transform/sort_section.rb +17 -9
- data/lib/pacer/transform/stream_sort.rb +1 -0
- data/lib/pacer/transform/stream_uniq.rb +1 -0
- data/lib/pacer/transform/wrapped_path.rb +1 -1
- data/lib/pacer/version.rb +1 -1
- data/lib/pacer/visitors/section.rb +10 -3
- data/lib/pacer/visitors/visits_section.rb +4 -4
- data/lib/pacer-ext.jar +0 -0
- data/lib/pacer.rb +1 -0
- data/pacer.gemspec +2 -1
- data/spec/pacer/filter/property_filter_spec.rb +17 -0
- data/spec/pacer/transform/path_spec.rb +10 -0
- data/spec/pacer/transform/sort_section_spec.rb +8 -1
- metadata +59 -30
- data/lib/pacer/pipe/blackbox_pipeline.rb +0 -55
- data/lib/pacer/pipe/collection_filter_pipe.rb +0 -12
- data/lib/pacer/pipe/edges_pipe.rb +0 -22
- data/lib/pacer/pipe/expandable_pipe.rb +0 -51
- data/lib/pacer/pipe/id_collection_filter_pipe.rb +0 -37
- data/lib/pacer/pipe/is_empty_pipe.rb +0 -23
- data/lib/pacer/pipe/is_unique_pipe.rb +0 -51
- data/lib/pacer/pipe/label_collection_filter_pipe.rb +0 -15
- data/lib/pacer/pipe/label_prefix_pipe.rb +0 -15
- data/lib/pacer/pipe/never_pipe.rb +0 -9
- data/lib/pacer/pipe/vertices_pipe.rb +0 -22
@@ -79,11 +79,20 @@ Run.tg(:read_only) do
|
|
79
79
|
subject { graph.v(Tackle::SimpleMixin, :name => 'pangloss') }
|
80
80
|
its(:count) { should == 1 }
|
81
81
|
its(:extensions) { should == [Tackle::SimpleMixin] }
|
82
|
+
it 'should produce an equivalent predecate' do
|
83
|
+
p = subject.filters.to_predicate
|
84
|
+
graph.v.to_a.select(&p).should == subject.to_a
|
85
|
+
end
|
82
86
|
end
|
83
87
|
|
84
88
|
context 'reversed params' do
|
85
89
|
subject { graph.v.v(TP::Pangloss, Tackle::SimpleMixin) }
|
86
90
|
its(:count) { should == 1 }
|
91
|
+
it 'should produce an equivalent predecate' do
|
92
|
+
pending 'does not work for self.route style.'
|
93
|
+
#p = subject.filters.to_predicate
|
94
|
+
#graph.v.to_a.select(&p).should == subject.to_a
|
95
|
+
end
|
87
96
|
end
|
88
97
|
|
89
98
|
context 'reversed params' do
|
@@ -109,6 +118,10 @@ Run.tg(:read_only) do
|
|
109
118
|
it { should_not be_empty }
|
110
119
|
its('first.class') { should_not == wrapper_class }
|
111
120
|
its('first.class.extensions') { should == exts + [Pacer::Utils::TSort] }
|
121
|
+
it 'should produce an equivalent predecate' do
|
122
|
+
p = subject.filters.to_predicate
|
123
|
+
graph.v.to_a.select(&p).should == subject.to_a
|
124
|
+
end
|
112
125
|
end
|
113
126
|
|
114
127
|
describe 'v(wrapper_class, :name => "pacer")' do
|
@@ -119,6 +132,10 @@ Run.tg(:read_only) do
|
|
119
132
|
its(:first) { should be_a wrapper_class }
|
120
133
|
its(:filters) { should_not be_nil }
|
121
134
|
its('filters.wrapper') { should == wrapper_class }
|
135
|
+
it 'should produce an equivalent predecate' do
|
136
|
+
p = subject.filters.to_predicate
|
137
|
+
graph.v.to_a.select(&p).should == subject.to_a
|
138
|
+
end
|
122
139
|
end
|
123
140
|
end
|
124
141
|
end
|
@@ -15,6 +15,16 @@ describe Pacer::Transform::Path do
|
|
15
15
|
[@g.vertex(5), @g.edge(12), @g.vertex(3)]]
|
16
16
|
end
|
17
17
|
|
18
|
+
it 'should be the same as above with a detached route' do
|
19
|
+
p = @g.v.detach { |v| v.filter(:type => 'person').out_e.in_v(:type => 'project').paths }
|
20
|
+
p = p.build(@g, true)
|
21
|
+
Set[*@g.v.to_a.flat_map { |x| p.read x }.map(&:to_a)].should ==
|
22
|
+
Set[[@g.vertex(0), @g.edge(0), @g.vertex(1)],
|
23
|
+
[@g.vertex(5), @g.edge(1), @g.vertex(4)],
|
24
|
+
[@g.vertex(5), @g.edge(13), @g.vertex(2)],
|
25
|
+
[@g.vertex(5), @g.edge(12), @g.vertex(3)]]
|
26
|
+
end
|
27
|
+
|
18
28
|
it 'should include all elements traversed' do
|
19
29
|
@g.v.out_e.in_v.paths.each do |path|
|
20
30
|
path[0].should be_a(Pacer::Wrappers::VertexWrapper)
|
@@ -10,6 +10,13 @@ Run.tg :read_only do
|
|
10
10
|
graph.v.section(:x).out.out.sort_section(:x) { |a, b| a[:name] <=> b[:name] }
|
11
11
|
end
|
12
12
|
|
13
|
+
it 'should be sorted' do
|
14
|
+
sorted = graph.v.flat_map do |v|
|
15
|
+
v.out.out[:name].to_a.sort
|
16
|
+
end.to_a
|
17
|
+
by_custom[:name].to_a.should == sorted
|
18
|
+
end
|
19
|
+
|
13
20
|
it 'should have the same elements' do
|
14
21
|
by_custom.group_count.should == unsorted.group_count
|
15
22
|
end
|
@@ -22,7 +29,7 @@ Run.tg :read_only do
|
|
22
29
|
|
23
30
|
it 'should put groups into the correct order' do
|
24
31
|
# depends on the order of graph.v(type: 'project') ...
|
25
|
-
route = graph.v(type: 'project').section(:proj).out[:name].
|
32
|
+
route = graph.v(type: 'project').section(:proj).out[:name].sort_section(:proj) { |a, b| a <=> b }
|
26
33
|
route.to_a.should == %w[
|
27
34
|
blueprints
|
28
35
|
blueprints
|
metadata
CHANGED
@@ -1,45 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pacer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.12
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Darrick Wiebe
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lock_jar
|
15
|
-
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.10.2
|
20
|
-
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
23
21
|
requirements:
|
24
22
|
- - ~>
|
25
23
|
- !ruby/object:Gem::Version
|
26
24
|
version: 0.10.2
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: xn_gem_release_tasks
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
30
35
|
requirements:
|
31
|
-
- -
|
36
|
+
- - '>='
|
32
37
|
- !ruby/object:Gem::Version
|
33
38
|
version: '0'
|
34
|
-
type: :development
|
35
39
|
prerelease: false
|
40
|
+
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake-compiler
|
36
43
|
version_requirements: !ruby/object:Gem::Requirement
|
37
44
|
requirements:
|
38
|
-
- -
|
45
|
+
- - ~>
|
39
46
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
41
|
-
|
42
|
-
|
47
|
+
version: 0.9.2
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ~>
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.9.2
|
53
|
+
prerelease: false
|
54
|
+
type: :development
|
55
|
+
description: Pacer defines composeable routes through a graph and then traverses them very quickly.
|
43
56
|
email: dw@xnlogic.com
|
44
57
|
executables: []
|
45
58
|
extensions: []
|
@@ -66,7 +79,34 @@ files:
|
|
66
79
|
- bin/yard
|
67
80
|
- bin/yardoc
|
68
81
|
- blog/2012-09-18-pacer-1.0.md
|
82
|
+
- blog/detach_benchmarks.txt
|
83
|
+
- ext/.classpath
|
84
|
+
- ext/.gitignore
|
85
|
+
- ext/.project
|
86
|
+
- ext/pom.xml
|
87
|
+
- ext/src/main/java/com/xnlogic/pacer/pipes/BlackboxPipeline.java
|
88
|
+
- ext/src/main/java/com/xnlogic/pacer/pipes/CollectionFilterPipe.java
|
89
|
+
- ext/src/main/java/com/xnlogic/pacer/pipes/EdgesPipe.java
|
90
|
+
- ext/src/main/java/com/xnlogic/pacer/pipes/ExpandablePipe.java
|
91
|
+
- ext/src/main/java/com/xnlogic/pacer/pipes/IdCollectionFilterPipe.java
|
92
|
+
- ext/src/main/java/com/xnlogic/pacer/pipes/IsEmptyPipe.java
|
93
|
+
- ext/src/main/java/com/xnlogic/pacer/pipes/IsUniquePipe.java
|
94
|
+
- ext/src/main/java/com/xnlogic/pacer/pipes/LabelCollectionFilterPipe.java
|
95
|
+
- ext/src/main/java/com/xnlogic/pacer/pipes/LabelPrefixPipe.java
|
96
|
+
- ext/src/main/java/com/xnlogic/pacer/pipes/NeverPipe.java
|
97
|
+
- ext/src/main/java/com/xnlogic/pacer/pipes/VerticesPipe.java
|
98
|
+
- ext/src/test/java/com/xnlogic/pacer/pipes/BlackboxPipelineTest.java
|
99
|
+
- ext/src/test/java/com/xnlogic/pacer/pipes/CollectionFilterPipeTest.java
|
100
|
+
- ext/src/test/java/com/xnlogic/pacer/pipes/EdgesPipeTest.java
|
101
|
+
- ext/src/test/java/com/xnlogic/pacer/pipes/ExpandablePipeTest.java
|
102
|
+
- ext/src/test/java/com/xnlogic/pacer/pipes/IdCollectionFilterPipeTest.java
|
103
|
+
- ext/src/test/java/com/xnlogic/pacer/pipes/IsUniquePipeTest.java
|
104
|
+
- ext/src/test/java/com/xnlogic/pacer/pipes/LabelCollectionFilterPipeTest.java
|
105
|
+
- ext/src/test/java/com/xnlogic/pacer/pipes/LabelPrefixPipeTest.java
|
106
|
+
- ext/src/test/java/com/xnlogic/pacer/pipes/NeverPipeTest.java
|
107
|
+
- ext/src/test/java/com/xnlogic/pacer/pipes/VerticesPipeTest.java
|
69
108
|
- ideas.rb
|
109
|
+
- lib/pacer-ext.jar
|
70
110
|
- lib/pacer.rb
|
71
111
|
- lib/pacer/blueprints/group_vertex.rb
|
72
112
|
- lib/pacer/blueprints/payload_elements.rb
|
@@ -111,22 +151,12 @@ files:
|
|
111
151
|
- lib/pacer/graph/simple_encoder.rb
|
112
152
|
- lib/pacer/graph/yaml_encoder.rb
|
113
153
|
- lib/pacer/loader.rb
|
114
|
-
- lib/pacer/pipe/blackbox_pipeline.rb
|
115
154
|
- lib/pacer/pipe/block_filter_pipe.rb
|
116
|
-
- lib/pacer/pipe/collection_filter_pipe.rb
|
117
155
|
- lib/pacer/pipe/cross_product_transform_pipe.rb
|
118
|
-
- lib/pacer/pipe/edges_pipe.rb
|
119
156
|
- lib/pacer/pipe/enumerable_pipe.rb
|
120
|
-
- lib/pacer/pipe/expandable_pipe.rb
|
121
|
-
- lib/pacer/pipe/id_collection_filter_pipe.rb
|
122
|
-
- lib/pacer/pipe/is_empty_pipe.rb
|
123
|
-
- lib/pacer/pipe/is_unique_pipe.rb
|
124
|
-
- lib/pacer/pipe/label_collection_filter_pipe.rb
|
125
|
-
- lib/pacer/pipe/label_prefix_pipe.rb
|
126
157
|
- lib/pacer/pipe/loop_pipe.rb
|
127
158
|
- lib/pacer/pipe/multi_pipe.rb
|
128
159
|
- lib/pacer/pipe/naked_pipe.rb
|
129
|
-
- lib/pacer/pipe/never_pipe.rb
|
130
160
|
- lib/pacer/pipe/path_wrapping_pipe.rb
|
131
161
|
- lib/pacer/pipe/process_pipe.rb
|
132
162
|
- lib/pacer/pipe/property_comparison_pipe.rb
|
@@ -137,7 +167,6 @@ files:
|
|
137
167
|
- lib/pacer/pipe/type_filter_pipe.rb
|
138
168
|
- lib/pacer/pipe/unary_transform_pipe.rb
|
139
169
|
- lib/pacer/pipe/unwrapping_pipe.rb
|
140
|
-
- lib/pacer/pipe/vertices_pipe.rb
|
141
170
|
- lib/pacer/pipe/visitor_pipe.rb
|
142
171
|
- lib/pacer/pipe/wrapping_pipe.rb
|
143
172
|
- lib/pacer/pipes.rb
|
@@ -256,24 +285,24 @@ homepage: http://github.com/pangloss/pacer
|
|
256
285
|
licenses:
|
257
286
|
- MIT
|
258
287
|
metadata: {}
|
259
|
-
post_install_message:
|
288
|
+
post_install_message:
|
260
289
|
rdoc_options: []
|
261
290
|
require_paths:
|
262
291
|
- lib
|
263
292
|
required_ruby_version: !ruby/object:Gem::Requirement
|
264
293
|
requirements:
|
265
|
-
- -
|
294
|
+
- - '>='
|
266
295
|
- !ruby/object:Gem::Version
|
267
296
|
version: '0'
|
268
297
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
269
298
|
requirements:
|
270
|
-
- -
|
299
|
+
- - '>='
|
271
300
|
- !ruby/object:Gem::Version
|
272
|
-
version:
|
301
|
+
version: '0'
|
273
302
|
requirements: []
|
274
|
-
rubyforge_project:
|
303
|
+
rubyforge_project:
|
275
304
|
rubygems_version: 2.4.5
|
276
|
-
signing_key:
|
305
|
+
signing_key:
|
277
306
|
specification_version: 4
|
278
307
|
summary: A very efficient and easy to use graph traversal engine.
|
279
308
|
test_files:
|
@@ -1,55 +0,0 @@
|
|
1
|
-
module Pacer::Pipes
|
2
|
-
# Same concept as the regular pipeline, but this one
|
3
|
-
# does not touch the intermediate pipes. They must be
|
4
|
-
# wired together before being passed in to this object.
|
5
|
-
# This allows me to build a pipeline in Pacer and then
|
6
|
-
# pass it on to a pipe like FutureFilterPipe that only
|
7
|
-
# knows how to act on a single pipe.
|
8
|
-
class BlackboxPipeline
|
9
|
-
include com.tinkerpop.pipes.Pipe
|
10
|
-
|
11
|
-
attr_reader :pathEnabled
|
12
|
-
|
13
|
-
def initialize(start_pipe, end_pipe)
|
14
|
-
@start_pipe = start_pipe
|
15
|
-
@end_pipe = end_pipe
|
16
|
-
end
|
17
|
-
|
18
|
-
def setStarts(pipe)
|
19
|
-
if pipe.respond_to? :iterator
|
20
|
-
@start_pipe.setStarts pipe.iterator
|
21
|
-
else
|
22
|
-
@start_pipe.setStarts pipe
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def next
|
27
|
-
@end_pipe.next
|
28
|
-
end
|
29
|
-
|
30
|
-
def hasNext
|
31
|
-
@end_pipe.hasNext
|
32
|
-
end
|
33
|
-
|
34
|
-
def reset
|
35
|
-
@end_pipe.reset
|
36
|
-
end
|
37
|
-
|
38
|
-
def enablePath(b)
|
39
|
-
@pathEnabled = b
|
40
|
-
@end_pipe.enablePath b
|
41
|
-
end
|
42
|
-
|
43
|
-
def getCurrentPath
|
44
|
-
@end_pipe.getCurrentPath
|
45
|
-
end
|
46
|
-
|
47
|
-
def iterator
|
48
|
-
@end_pipe.iterator
|
49
|
-
end
|
50
|
-
|
51
|
-
def to_s
|
52
|
-
"[#{ @start_pipe }...#{ @end_pipe }]"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module Pacer
|
2
|
-
module Pipes
|
3
|
-
module Renamed
|
4
|
-
AbstractCollectionFilterPipe = com.tinkerpop.pipes.filter.CollectionFilterPipe
|
5
|
-
end
|
6
|
-
|
7
|
-
# This seemingly-useless class only exists because the class in Pipes
|
8
|
-
# is marked abstract despite being complete.
|
9
|
-
class CollectionFilterPipe < Renamed::AbstractCollectionFilterPipe
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Pacer::Pipes
|
2
|
-
class EdgesPipe < AbstractPipe
|
3
|
-
attr_reader :starts
|
4
|
-
|
5
|
-
def setStarts(starts)
|
6
|
-
@starts = starts.first
|
7
|
-
self.iter = @starts.getEdges.iterator
|
8
|
-
end
|
9
|
-
|
10
|
-
def processNextStart
|
11
|
-
iter.next
|
12
|
-
end
|
13
|
-
|
14
|
-
def reset
|
15
|
-
self.iter = @starts.getEdges.iterator
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
attr_accessor :iter
|
21
|
-
end
|
22
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module Pacer::Pipes
|
2
|
-
class ExpandablePipe < RubyPipe
|
3
|
-
def initialize
|
4
|
-
super()
|
5
|
-
@queue = java.util.LinkedList.new
|
6
|
-
end
|
7
|
-
|
8
|
-
def add(element, metadata = nil, path = nil)
|
9
|
-
@queue.add [element, metadata, path]
|
10
|
-
end
|
11
|
-
|
12
|
-
def metadata
|
13
|
-
@metadata
|
14
|
-
end
|
15
|
-
|
16
|
-
def next
|
17
|
-
super
|
18
|
-
ensure
|
19
|
-
@path = @next_path
|
20
|
-
@metadata = @next_metadata
|
21
|
-
end
|
22
|
-
|
23
|
-
protected
|
24
|
-
|
25
|
-
def processNextStart
|
26
|
-
if @queue.isEmpty
|
27
|
-
@next_metadata = nil
|
28
|
-
r = @starts.next
|
29
|
-
if pathEnabled and @starts.respond_to? :getCurrentPath
|
30
|
-
@next_path = @starts.getCurrentPath
|
31
|
-
else
|
32
|
-
@next_path = java.util.ArrayList.new
|
33
|
-
end
|
34
|
-
r
|
35
|
-
else
|
36
|
-
element, @next_metadata, @next_path = @queue.remove
|
37
|
-
element
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def getPathToHere
|
42
|
-
path = java.util.ArrayList.new
|
43
|
-
if @path
|
44
|
-
@path.each do |e|
|
45
|
-
path.add e
|
46
|
-
end
|
47
|
-
end
|
48
|
-
path
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Pacer::Pipes
|
2
|
-
class IdCollectionFilterPipe < RubyPipe
|
3
|
-
import com.tinkerpop.blueprints.Contains
|
4
|
-
attr_reader :contains_in
|
5
|
-
|
6
|
-
def initialize(ids, comparison)
|
7
|
-
super()
|
8
|
-
@ids = Set[*ids]
|
9
|
-
if comparison == Contains::IN
|
10
|
-
@contains_in = true
|
11
|
-
elsif
|
12
|
-
comparison == Contains::NOT_IN
|
13
|
-
@contains_in = false
|
14
|
-
else
|
15
|
-
fail InternalError, "Unknown comparison type for ID collection filter"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def processNextStart
|
20
|
-
if contains_in
|
21
|
-
while true
|
22
|
-
element = @starts.next
|
23
|
-
if element and @ids.include? element.getId
|
24
|
-
return element
|
25
|
-
end
|
26
|
-
end
|
27
|
-
else
|
28
|
-
while true
|
29
|
-
element = @starts.next
|
30
|
-
if element and not @ids.include? element.getId
|
31
|
-
return element
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Pacer::Pipes
|
2
|
-
class IsEmptyPipe < RubyPipe
|
3
|
-
def initialize
|
4
|
-
super
|
5
|
-
@raise = false
|
6
|
-
end
|
7
|
-
|
8
|
-
def processNextStart
|
9
|
-
raise EmptyPipe.instance if @raise
|
10
|
-
starts.next
|
11
|
-
@raise = true
|
12
|
-
rescue EmptyPipe, java.util.NoSuchElementException
|
13
|
-
true
|
14
|
-
else
|
15
|
-
raise EmptyPipe.instance
|
16
|
-
end
|
17
|
-
|
18
|
-
def reset
|
19
|
-
@raise = false
|
20
|
-
super()
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module Pacer::Pipes
|
2
|
-
class IsUniquePipe < RubyPipe
|
3
|
-
import java.util.ArrayList
|
4
|
-
import com.tinkerpop.pipes.sideeffect.SideEffectPipe
|
5
|
-
import com.tinkerpop.pipes.util.iterators.ExpandableIterator
|
6
|
-
import com.tinkerpop.pipes.filter.DuplicateFilterPipe
|
7
|
-
|
8
|
-
include SideEffectPipe
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
super()
|
12
|
-
prepare_state
|
13
|
-
end
|
14
|
-
|
15
|
-
def processNextStart
|
16
|
-
value = starts.next
|
17
|
-
check_uniqueness value if @unique
|
18
|
-
value
|
19
|
-
end
|
20
|
-
|
21
|
-
def reset
|
22
|
-
super()
|
23
|
-
prepare_state
|
24
|
-
end
|
25
|
-
|
26
|
-
def unique?
|
27
|
-
@unique
|
28
|
-
end
|
29
|
-
|
30
|
-
def getSideEffect
|
31
|
-
@unique
|
32
|
-
end
|
33
|
-
|
34
|
-
protected
|
35
|
-
|
36
|
-
def check_uniqueness(value)
|
37
|
-
@expando.add value
|
38
|
-
@unique_pipe.next
|
39
|
-
rescue EmptyPipe, java.util.NoSuchElementException
|
40
|
-
@unique = false
|
41
|
-
end
|
42
|
-
|
43
|
-
def prepare_state
|
44
|
-
@unique = true
|
45
|
-
@expando = ExpandableIterator.new ArrayList.new.iterator
|
46
|
-
@unique_pipe = DuplicateFilterPipe.new
|
47
|
-
@unique_pipe.setStarts @expando
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Pacer::Pipes
|
2
|
-
class LabelCollectionFilterPipe < RubyPipe
|
3
|
-
def initialize(labels)
|
4
|
-
super()
|
5
|
-
@labels = Set[*labels.map(&:to_s)]
|
6
|
-
end
|
7
|
-
|
8
|
-
def processNextStart
|
9
|
-
while true
|
10
|
-
edge = @starts.next
|
11
|
-
return edge if edge and @labels.include? edge.getLabel
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Pacer::Pipes
|
2
|
-
class VerticesPipe < AbstractPipe
|
3
|
-
attr_reader :starts
|
4
|
-
|
5
|
-
def setStarts(starts)
|
6
|
-
@starts = starts.first
|
7
|
-
self.iter = @starts.getVertices.iterator
|
8
|
-
end
|
9
|
-
|
10
|
-
def processNextStart
|
11
|
-
iter.next
|
12
|
-
end
|
13
|
-
|
14
|
-
def reset
|
15
|
-
self.iter = @starts.getVertices.iterator
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
attr_accessor :iter
|
21
|
-
end
|
22
|
-
end
|