pacer 1.3.4-java → 1.3.5-java

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: d0437b2986f40401080f7411e1a9544d0f755ba6
4
- data.tar.gz: dccae462788df22508168a2020967d8ff6b68ee4
3
+ metadata.gz: 8c1a23e3e54a2756db3922e88510185ad2ccf8bc
4
+ data.tar.gz: 7f2fd6f0f42832e55b91c8dbaf230bb0c3050549
5
5
  SHA512:
6
- metadata.gz: d57a870de4286fc56cf7c0dd0def46110fd95bd0179c8de3bb255547351dfb9e3d400bc1d91989adef29a5b53e1cffbd66fe888d1986fe6a8a7e3320e12ce4e6
7
- data.tar.gz: def7ed535a7df4fa3337722aa553f7bc4235fa15c6667372edb442d452d035c107e53a8e3b44c1d221bc0a42860e0defec0b9e0698e0ba81736dc4bf5b28559f
6
+ metadata.gz: a1b4a54c3a52d987414be288ededf52c8a18d3c4243bb3ec9fb0166e0b0df5fd8efe524a118c53b1469a2fb841eda2e1568e45bf87cd86ba7dac52706db6e1fc
7
+ data.tar.gz: 898247e0abb0e20b9f1b5eab079cc366bb046d356239ccb0fc3ab4c31e9bcdff83bf5b0d75fa01d44ac3709f50e94ca5cd533a8ff20f58084d8e57f5368a9647
@@ -36,6 +36,7 @@ module Pacer::Core::Graph
36
36
 
37
37
  def indexed_route(element_type, filters, block)
38
38
  filters.graph = self
39
+ filters.use_lookup!
39
40
  filters.indices = graph.indices
40
41
  filters.choose_best_index = choose_best_index != false
41
42
  filters.search_manual_indices = search_manual_indices
@@ -215,10 +215,10 @@ HELP
215
215
  expando.setStarts empty.iterator
216
216
  if route
217
217
  control_pipe = Pacer::Route.pipeline route
218
+ control_pipe.setStarts expando
218
219
  else
219
- control_pipe = Pacer::Pipes::IdentityPipe.new
220
+ control_pipe = expando
220
221
  end
221
- control_pipe.setStarts expando
222
222
  [expando, control_pipe]
223
223
  end
224
224
 
@@ -3,17 +3,17 @@ module Pacer
3
3
  module RouteOperations
4
4
  def is(value)
5
5
  if value.is_a? Symbol
6
- chain_route :filter => :property, :block => proc { |v| v.vars[value] == v }
6
+ chain_route filter: Pacer::Filter::SectionFilter, section: value
7
7
  else
8
- chain_route({ :filter => :object, :value => value })
8
+ chain_route filter: Pacer::Filter::ObjectFilter, value: value
9
9
  end
10
10
  end
11
11
 
12
12
  def is_not(value)
13
13
  if value.is_a? Symbol
14
- chain_route :filter => :property, :block => proc { |v| v.vars[value] != v }
14
+ chain_route filter: Pacer::Filter::SectionFilter, section: value, negate: true
15
15
  else
16
- chain_route({ :filter => :object, :value => value, :negate => true })
16
+ chain_route filter: Pacer::Filter::ObjectFilter, value: value, negate: true
17
17
  end
18
18
  end
19
19
 
@@ -46,5 +46,55 @@ module Pacer
46
46
  end
47
47
  end
48
48
  end
49
+
50
+ module SectionFilter
51
+ # VisitsSection module provides:
52
+ # section=
53
+ # section_visitor
54
+ include Pacer::Visitors::VisitsSection
55
+
56
+ attr_accessor :negate
57
+
58
+ def attach_pipe(end_pipe)
59
+ pipe = FilterSectionPipe.new(section_visitor, negate)
60
+ pipe.setStarts end_pipe if end_pipe
61
+ pipe
62
+ end
63
+
64
+ class FilterSectionPipe < Pacer::Pipes::RubyPipe
65
+ attr_reader :section, :negate
66
+ attr_accessor :other
67
+
68
+ def initialize(section, negate)
69
+ super()
70
+ @section = section
71
+ @negate = negate
72
+ section.visitor = self if section
73
+ end
74
+
75
+ def processNextStart
76
+ value = starts.next
77
+ if negate
78
+ while value == other
79
+ value = starts.next
80
+ end
81
+ else
82
+ while value != other
83
+ value = starts.next
84
+ end
85
+ end
86
+ value
87
+ end
88
+
89
+ def on_raw_element(x)
90
+ self.other = x
91
+ end
92
+
93
+ def reset
94
+ self.other = nil
95
+ super
96
+ end
97
+ end
98
+ end
49
99
  end
50
100
  end
@@ -172,6 +172,22 @@ module Pacer
172
172
  result
173
173
  end
174
174
 
175
+ # Check #lookup in extensions, in preerence to #route_conditions
176
+ # for filters to apply.
177
+ #
178
+ # Designed to allow filters to be defined in extensions that
179
+ # will not be used on every appearance of the extension (too
180
+ # many property filters in a traversal can impose a serious
181
+ # performance penalty. It is expected that lookup filters will
182
+ # only be used for index lookups.
183
+ def use_lookup!
184
+ extensions.each do |ext|
185
+ if ext.respond_to? :lookup
186
+ add_filters ext.lookup, ext
187
+ end
188
+ end
189
+ end
190
+
175
191
  protected
176
192
 
177
193
  attr_accessor :non_ext_props
@@ -191,9 +207,7 @@ module Pacer
191
207
  else
192
208
  self.extensions << filter
193
209
  end
194
- if filter.respond_to? :route_conditions
195
- add_filters filter.route_conditions, filter
196
- end
210
+ extract_conditions(filter)
197
211
  if filter.respond_to? :route
198
212
  self.route_modules << filter
199
213
  end
@@ -203,20 +217,22 @@ module Pacer
203
217
  else
204
218
  if filter.respond_to? :wrapper
205
219
  self.wrapper = filter.wrapper
206
- if filter.respond_to? :route_conditions
207
- add_filters filter.route_conditions, filter
208
- end
220
+ extract_conditions(filter)
209
221
  elsif filter.respond_to? :parts
210
222
  self.extensions.concat filter.parts.to_a
211
- if filter.respond_to? :route_conditions
212
- add_filters filter.route_conditions, filter
213
- end
223
+ extract_conditions(filter)
214
224
  else
215
225
  raise "Unknown filter: #{ filter.class }: #{ filter.inspect }"
216
226
  end
217
227
  end
218
228
  end
219
229
 
230
+ def extract_conditions(filter)
231
+ if filter.respond_to? :route_conditions
232
+ add_filters filter.route_conditions, filter
233
+ end
234
+ end
235
+
220
236
  def add_filters(filters, extension)
221
237
  if filters.is_a? Array
222
238
  filters.each do |filter|
@@ -102,7 +102,7 @@ require 'pacer/transform/payload'
102
102
  require 'pacer/transform/lookup_ids'
103
103
 
104
104
  require 'pacer/side_effect/aggregate'
105
- require 'pacer/side_effect/as'
105
+ require 'pacer/side_effect/as_var'
106
106
  require 'pacer/side_effect/group_count'
107
107
  require 'pacer/side_effect/is_unique'
108
108
  require 'pacer/side_effect/counted'
@@ -3,7 +3,7 @@ module Pacer
3
3
  class SimpleVisitorPipe < Pacer::Pipes::RubyPipe
4
4
  attr_reader :visitor, :in_section, :wrapper, :graph
5
5
 
6
- attr_accessor :use_on_element, :use_after_element, :use_reset
6
+ attr_accessor :use_on_raw_element, :use_on_element, :use_after_element, :use_visitor_reset
7
7
 
8
8
  def initialize(wrapper, graph)
9
9
  super()
@@ -14,15 +14,17 @@ module Pacer
14
14
 
15
15
  def visitor=(visitor)
16
16
  @visitor = visitor
17
+ @use_on_raw_element = visitor.respond_to? :on_raw_element
17
18
  @use_on_element = visitor.respond_to? :on_element
18
19
  @use_after_element = visitor.respond_to? :after_element
19
- @use_reset = visitor.respond_to? :reset
20
+ @use_visitor_reset = visitor.respond_to? :visitor_reset
20
21
  end
21
22
 
22
23
  def processNextStart
23
24
  visitor.after_element if use_after_element and in_section
24
25
  current = starts.next
25
26
  @in_section = true unless in_section
27
+ visitor.on_raw_element current if use_on_raw_element
26
28
  if use_on_element
27
29
  wrapped = wrapper.new graph, current
28
30
  visitor.on_element(wrapped)
@@ -34,7 +36,7 @@ module Pacer
34
36
  end
35
37
 
36
38
  def reset
37
- visitor.reset if use_reset
39
+ visitor.visitor_reset if use_visitor_reset
38
40
  @in_section = false
39
41
  super
40
42
  end
@@ -3,14 +3,16 @@ module Pacer
3
3
  # Store the current intermediate element in the route's vars hash by the
4
4
  # given name so that it is accessible subsequently in the processing of the
5
5
  # route.
6
- def as(name)
7
- as = ::Pacer::SideEffect::As
6
+ #
7
+ # Deprecated.
8
+ def as_var(name)
9
+ as = ::Pacer::SideEffect::AsVar
8
10
  section(name, as::SingleElementSet).chain_route :side_effect => as, :variable_name => name
9
11
  end
10
12
  end
11
13
 
12
14
  module SideEffect
13
- module As
15
+ module AsVar
14
16
  class AsPipe < Pacer::Pipes::RubyPipe
15
17
  attr_accessor :vars
16
18
 
@@ -1,6 +1,6 @@
1
1
  module Pacer
2
2
  unless const_defined? :VERSION
3
- VERSION = "1.3.4"
3
+ VERSION = "1.3.5"
4
4
 
5
5
  JAR = "pacer-#{ VERSION }-standalone.jar"
6
6
  JAR_PATH = "lib/#{ JAR }"
@@ -4,6 +4,11 @@ module Pacer
4
4
  def section(section_name = nil, visitor_target = nil)
5
5
  chain_route visitor: :section, section_name: section_name, visitor_target: visitor_target
6
6
  end
7
+
8
+ # see #as_var for the old as implementation
9
+ def as(section_name = nil)
10
+ section section_name
11
+ end
7
12
  end
8
13
  end
9
14
 
@@ -47,6 +47,18 @@ module Pacer::Wrappers
47
47
  @route_conditions
48
48
  end
49
49
 
50
+ def lookup
51
+ return @lookup if defined? @lookup
52
+ @lookup = extensions.inject({}) do |h, ext|
53
+ if ext.respond_to? :lookup
54
+ h.merge! ext.lookup
55
+ else
56
+ h
57
+ end
58
+ end
59
+ @lookup
60
+ end
61
+
50
62
  protected
51
63
 
52
64
  def build_extension_wrapper(exts, mod_names, superclass)
data/pom.xml CHANGED
@@ -8,7 +8,7 @@
8
8
  <!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
9
9
  <properties>
10
10
  <blueprints.version>2.3.0</blueprints.version>
11
- <gem.version>1.3.4</gem.version>
11
+ <gem.version>1.3.5</gem.version>
12
12
  <pipes.version>2.3.0</pipes.version>
13
13
  <gremlin.version>2.3.0</gremlin.version>
14
14
  </properties>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pacer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: java
6
6
  authors:
7
7
  - Darrick Wiebe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-28 00:00:00.000000000 Z
11
+ date: 2013-08-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Pacer defines routes through a graph and then traverses them very quickly.
14
14
  email: darrick@innatesoftware.com
@@ -112,7 +112,7 @@ files:
112
112
  - lib/pacer/route/mixin/route_operations.rb
113
113
  - lib/pacer/route_builder.rb
114
114
  - lib/pacer/side_effect/aggregate.rb
115
- - lib/pacer/side_effect/as.rb
115
+ - lib/pacer/side_effect/as_var.rb
116
116
  - lib/pacer/side_effect/counted.rb
117
117
  - lib/pacer/side_effect/group_count.rb
118
118
  - lib/pacer/side_effect/is_unique.rb
@@ -220,7 +220,7 @@ files:
220
220
  - spec/support/use_transactions.rb
221
221
  - spec/tackle/simple_mixin.rb
222
222
  - spec/tackle/tinkerpop_graph_mixins.rb
223
- - lib/pacer-1.3.4-standalone.jar
223
+ - lib/pacer-1.3.5-standalone.jar
224
224
  homepage: http://github.com/pangloss/pacer
225
225
  licenses:
226
226
  - MIT