pacer 1.3.5-java → 1.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/lib/pacer/core/graph/element_route.rb +3 -1
  4. data/lib/pacer/core/graph/graph_index_route.rb +13 -5
  5. data/lib/pacer/core/graph/graph_route.rb +2 -2
  6. data/lib/pacer/core/graph/vertices_route.rb +5 -3
  7. data/lib/pacer/core/route.rb +1 -0
  8. data/lib/pacer/filter/object_filter.rb +9 -0
  9. data/lib/pacer/filter/property_filter/edge_filters.rb +1 -1
  10. data/lib/pacer/filter/property_filter/filters.rb +11 -3
  11. data/lib/pacer/filter/property_filter.rb +8 -8
  12. data/lib/pacer/utils/graph_analysis.rb +3 -3
  13. data/lib/pacer/utils/trie.rb +1 -1
  14. data/lib/pacer/utils/y_files.rb +14 -5
  15. data/lib/pacer/version.rb +1 -1
  16. data/lib/pacer/visitors/section.rb +4 -0
  17. data/lib/pacer/wrappers/element_wrapper.rb +4 -4
  18. data/lib/pacer/wrappers/vertex_wrapper.rb +1 -1
  19. data/lib/{pacer-1.3.5-standalone.jar → pacer-1.4.0-standalone.jar} +0 -0
  20. data/lib/pacer.rb +4 -0
  21. data/pom.xml +1 -1
  22. data/samples/grateful_dead.rb +2 -2
  23. data/spec/pacer/blueprints/neo4j_spec.rb +4 -3
  24. data/spec/pacer/core/graph/vertices_route_spec.rb +3 -1
  25. data/spec/pacer/filter/property_filter/edge_filters_spec.rb +6 -6
  26. data/spec/pacer/filter/property_filter/filters_spec.rb +7 -7
  27. data/spec/pacer/route/mixin/base_spec.rb +6 -6
  28. data/spec/pacer/side_effect/{as_spec.rb → as_var_spec.rb} +5 -5
  29. data/spec/pacer/wrapper/edge_wrapper_spec.rb +2 -1
  30. data/spec/pacer/wrapper/vertex_wrapper_spec.rb +3 -3
  31. data/spec/support/graph_runner.rb +2 -0
  32. data/spec/tackle/tinkerpop_graph_mixins.rb +3 -3
  33. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c1a23e3e54a2756db3922e88510185ad2ccf8bc
4
- data.tar.gz: 7f2fd6f0f42832e55b91c8dbaf230bb0c3050549
3
+ metadata.gz: b1719e006a5a547e01b900999a76df5df6ada73c
4
+ data.tar.gz: 9ef6e2292108bd5b4f817bca04fb8747a9e64581
5
5
  SHA512:
6
- metadata.gz: a1b4a54c3a52d987414be288ededf52c8a18d3c4243bb3ec9fb0166e0b0df5fd8efe524a118c53b1469a2fb841eda2e1568e45bf87cd86ba7dac52706db6e1fc
7
- data.tar.gz: 898247e0abb0e20b9f1b5eab079cc366bb046d356239ccb0fc3ab4c31e9bcdff83bf5b0d75fa01d44ac3709f50e94ca5cd533a8ff20f58084d8e57f5368a9647
6
+ metadata.gz: 3084c5a67393a3a6ed28d1ba4239ea030bce9ae540a975721cf88d2dddccab927328e4f34ee44c9f9919e7080ebc96eff77d9d1157954564b33646e8a1880d39
7
+ data.tar.gz: e2388b84181c61a15d09af7d02b802ab59842ffdc208a538d0358a5320e5b1d2ca3cb8d105b18f3527ef330d579a9d9fc5a7acbcf62ebcaa53c99bff592c9d79
data/.gitignore CHANGED
@@ -30,4 +30,5 @@ bin
30
30
  .jitcache
31
31
  coverage/*
32
32
  dex.log
33
- vendor/
33
+ vendor/
34
+ private/
@@ -43,7 +43,9 @@ module Pacer::Core::Graph
43
43
 
44
44
  # Delete all matching elements.
45
45
  def delete!
46
- uniq.bulk_job { |e| e.delete! }
46
+ count = 0
47
+ uniq.bulk_job { |e| count += 1; e.delete! }
48
+ count
47
49
  end
48
50
 
49
51
  # Stores the result of the current route in a new route so it will not need
@@ -3,14 +3,23 @@ module Pacer::Core::Graph
3
3
  # This module adds indexed route methods to the basic graph classes returned from the
4
4
  # blueprints library.
5
5
  module GraphIndexRoute
6
+ # If never_scan is true, raise an exception if a graph route does not
7
+ # start with an indexed property. Large databases could spend hours
8
+ # scanning!
9
+ attr_accessor :never_scan
10
+ attr_accessor :choose_best_index
11
+ attr_accessor :search_manual_indices
12
+
6
13
  # Returns a new route to all graph vertices. Standard filter options.
7
14
  def v(*args, &block)
8
- filters = Pacer::Route.filters(args)
15
+ filters = Pacer::Route.filters(self, args)
9
16
  if features.supportsKeyIndices or (search_manual_indices and features.supportsIndices)
10
17
  route = indexed_route(:vertex, filters, block)
11
18
  end
12
19
  if route
13
20
  route
21
+ elsif never_scan
22
+ fail Pacer::ClientError, "No indexed properties found among: #{ filters.property_keys.join ', ' }"
14
23
  else
15
24
  super(filters, &block)
16
25
  end
@@ -18,20 +27,19 @@ module Pacer::Core::Graph
18
27
 
19
28
  # Returns a new route to all graph edges. Standard filter options.
20
29
  def e(*args, &block)
21
- filters = Pacer::Route.edge_filters(args)
30
+ filters = Pacer::Route.edge_filters(self, args)
22
31
  if features.supportsKeyIndices or (search_manual_indices and features.supportsIndices)
23
32
  route = indexed_route(:edge, filters, block)
24
33
  end
25
34
  if route
26
35
  route
36
+ elsif never_scan
37
+ fail Pacer::ClientError, "No indexed properties found among: #{ filters.property_keys.join ', ' }"
27
38
  else
28
39
  super(filters, &block)
29
40
  end
30
41
  end
31
42
 
32
- attr_accessor :choose_best_index
33
- attr_accessor :search_manual_indices
34
-
35
43
  private
36
44
 
37
45
  def indexed_route(element_type, filters, block)
@@ -5,7 +5,7 @@ module Pacer::Core::Graph
5
5
  module GraphRoute
6
6
  # Returns a new route to all graph vertices. Standard filter options.
7
7
  def v(*filters, &block)
8
- filters = Pacer::Route.filters(filters)
8
+ filters = Pacer::Route.filters(self, filters)
9
9
  route = chain_route :element_type => :vertex,
10
10
  :pipe_class => Pacer::Pipes::VerticesPipe,
11
11
  :route_name => 'GraphV'
@@ -14,7 +14,7 @@ module Pacer::Core::Graph
14
14
 
15
15
  # Returns a new route to all graph edges. Standard filter options.
16
16
  def e(*filters, &block)
17
- filters = Pacer::Route.edge_filters(filters)
17
+ filters = Pacer::Route.edge_filters(self, filters)
18
18
  route = chain_route :element_type => :edge,
19
19
  :pipe_class => Pacer::Pipes::EdgesPipe,
20
20
  :route_name => 'GraphE'
@@ -140,8 +140,10 @@ module Pacer::Core::Graph
140
140
  # Delete all matching vertices and all edges which link to this
141
141
  # vertex.
142
142
  def delete!
143
- uniq.both_e.uniq.bulk_job { |e| e.delete! }
144
- uniq.bulk_job { |e| e.delete! }
143
+ count = 0
144
+ uniq.both_e.uniq.bulk_job { |e| count += 1; e.delete! }
145
+ uniq.bulk_job { |e| count += 1; e.delete! }
146
+ count
145
147
  end
146
148
 
147
149
  # Create associations with the given label from all vertices
@@ -209,7 +211,7 @@ module Pacer::Core::Graph
209
211
  end
210
212
 
211
213
  def extract_labels(filters)
212
- filters = Pacer::Route.edge_filters(filters)
214
+ filters = Pacer::Route.edge_filters(self, filters)
213
215
  @route_labels = filters.labels
214
216
  filters.labels = []
215
217
  filters
@@ -485,6 +485,7 @@ HELP
485
485
  # Return an iterator for this route loading data from all previous routes
486
486
  # in the chain.
487
487
  def iterator
488
+ Pacer.executing_route self
488
489
  start, end_pipe = build_pipeline
489
490
  if start
490
491
  src = source_iterator
@@ -61,6 +61,15 @@ module Pacer
61
61
  pipe
62
62
  end
63
63
 
64
+ def inspect_class_name
65
+ if negate
66
+ "is_not(#{section.inspect})"
67
+ else
68
+ "is(#{section.inspect})"
69
+ end
70
+ end
71
+
72
+
64
73
  class FilterSectionPipe < Pacer::Pipes::RubyPipe
65
74
  attr_reader :section, :negate
66
75
  attr_accessor :other
@@ -10,7 +10,7 @@ module Pacer
10
10
 
11
11
  public
12
12
 
13
- def initialize(filters)
13
+ def initialize(graph, filters)
14
14
  @best_index = nil
15
15
  self.labels = []
16
16
  self.non_ext_labels = []
@@ -59,7 +59,8 @@ module Pacer
59
59
  # @attr [Boolean] search_manual_indices
60
60
  attr_accessor :search_manual_indices
61
61
 
62
- def initialize(filters)
62
+ def initialize(graph, filters)
63
+ @graph = graph
63
64
  @properties = []
64
65
  @blocks = []
65
66
  @extensions = []
@@ -90,6 +91,10 @@ module Pacer
90
91
  non_ext_props.delete_if { |a| keys.include? a.first }
91
92
  end
92
93
 
94
+ def property_keys
95
+ properties.map(&:first).uniq
96
+ end
97
+
93
98
  # Set which indices are available to be used to determine the
94
99
  # best_index.
95
100
  #
@@ -183,9 +188,12 @@ module Pacer
183
188
  def use_lookup!
184
189
  extensions.each do |ext|
185
190
  if ext.respond_to? :lookup
186
- add_filters ext.lookup, ext
191
+ add_filters ext.lookup(graph), ext
187
192
  end
188
193
  end
194
+ if wrapper and wrapper.respond_to? :lookup
195
+ add_filters wrapper.lookup(graph), nil
196
+ end
189
197
  end
190
198
 
191
199
  protected
@@ -229,7 +237,7 @@ module Pacer
229
237
 
230
238
  def extract_conditions(filter)
231
239
  if filter.respond_to? :route_conditions
232
- add_filters filter.route_conditions, filter
240
+ add_filters filter.route_conditions(graph), filter
233
241
  end
234
242
  end
235
243
 
@@ -4,23 +4,23 @@ require 'pacer/filter/property_filter/edge_filters'
4
4
  module Pacer
5
5
  class Route
6
6
  class << self
7
- def filters(filters)
7
+ def filters(graph, filters)
8
8
  if filters? filters
9
9
  filters
10
10
  elsif filters? filters.first
11
11
  filters.first
12
12
  else
13
- Pacer::Filter::PropertyFilter::Filters.new(filters)
13
+ Pacer::Filter::PropertyFilter::Filters.new(graph, filters)
14
14
  end
15
15
  end
16
16
 
17
- def edge_filters(filters)
17
+ def edge_filters(graph, filters)
18
18
  if filters? filters
19
19
  filters
20
20
  elsif filters? filters.first
21
21
  filters.first
22
22
  else
23
- Pacer::Filter::PropertyFilter::EdgeFilters.new(filters)
23
+ Pacer::Filter::PropertyFilter::EdgeFilters.new(graph, filters)
24
24
  end
25
25
  end
26
26
 
@@ -29,7 +29,7 @@ module Pacer
29
29
  end
30
30
 
31
31
  def property_filter_before(base, args, block)
32
- filters = Pacer::Route.edge_filters(args)
32
+ filters = Pacer::Route.edge_filters(base.graph, args)
33
33
  filters.blocks = [block] if block
34
34
  args = chain_args(filters)
35
35
  if filters.extensions_only? and base.is_a? Route
@@ -42,7 +42,7 @@ module Pacer
42
42
  end
43
43
 
44
44
  def property_filter(base, args, block)
45
- filters = Pacer::Route.edge_filters(args)
45
+ filters = Pacer::Route.edge_filters(base.graph, args)
46
46
  filters.blocks = [block] if block
47
47
  args = chain_args(filters)
48
48
  if filters.extensions_only? and base.is_a? Route
@@ -75,13 +75,13 @@ module Pacer
75
75
  if f.is_a? Filters
76
76
  @filters = f
77
77
  else
78
- @filters = EdgeFilters.new(f)
78
+ @filters = EdgeFilters.new(graph, f)
79
79
  end
80
80
  end
81
81
 
82
82
  # Return an array of filter options for the current route.
83
83
  def filters
84
- @filters ||= EdgeFilters.new(nil)
84
+ @filters ||= EdgeFilters.new(graph, nil)
85
85
  end
86
86
 
87
87
  def block=(block)
@@ -79,7 +79,7 @@ module Pacer
79
79
  end
80
80
 
81
81
  module Vertices
82
- def self.route_conditions
82
+ def self.route_conditions(graph)
83
83
  { :element_type => 'vertex' }
84
84
  end
85
85
 
@@ -105,7 +105,7 @@ module Pacer
105
105
  end
106
106
 
107
107
  module Edges
108
- def self.route_conditions
108
+ def self.route_conditions(graph)
109
109
  { :element_type => 'edge' }
110
110
  end
111
111
 
@@ -117,7 +117,7 @@ module Pacer
117
117
  end
118
118
 
119
119
  module Properties
120
- def self.route_conditions
120
+ def self.route_conditions(graph)
121
121
  { :element_type => 'property keys' }
122
122
  end
123
123
  end
@@ -10,7 +10,7 @@ module Pacer::Utils
10
10
  end
11
11
  end
12
12
 
13
- def route_conditions
13
+ def route_conditions(graph)
14
14
  { :type => 'Trie' }
15
15
  end
16
16
  end
@@ -30,17 +30,19 @@ module Pacer
30
30
  end
31
31
 
32
32
  # Export the given graph to the given path in an extended .graphml format.
33
- def export(graph, path)
34
- x = xml(graph)
33
+ def export(route, path)
34
+ x = xml(route)
35
+ puts "\n\nWriting XML"
35
36
  File.open(File.expand_path(path), 'w') do |f|
36
37
  f.puts x.to_xml
37
38
  end
38
39
  end
39
40
 
40
41
  # Returns the xml builder used to construct the xml for the given graph.
41
- def xml(graph)
42
+ def xml(route)
42
43
  node_keys = Set[]
43
44
  edge_keys = Set[]
45
+ n = 0
44
46
  builder = Nokogiri::XML::Builder.new do |xml|
45
47
  xml.graphml('xmlns' => "http://graphml.graphdrawing.org/xmlns",
46
48
  'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
@@ -49,7 +51,11 @@ module Pacer
49
51
  xml.key 'for' => "node", 'id' => "y.nodegraphics", 'yfiles.type' => "nodegraphics"
50
52
  xml.key 'attr.name' => "description", 'attr.type' => "string", 'for' => "node", 'id' => "d2"
51
53
  xml.key 'for' => "edge", 'id' => "y.edgegraphics", 'yfiles.type' => "edgegraphics"
52
- graph.v.each do |v|
54
+ puts "Building XML data structure"
55
+ puts "Vertices"
56
+ route.paths.vertices.scatter(element_type: :vertex).uniq.each do |v|
57
+ n += 1
58
+ print '.' if n % 100 == 0
53
59
  xml.node :id => v.element_id do
54
60
  xml.data :key => 'y.nodegraphics' do
55
61
  xml['y'].ShapeNode do
@@ -81,7 +87,10 @@ module Pacer
81
87
  end
82
88
  end
83
89
  end
84
- graph.e.each do |e|
90
+ puts "\n\nEdges"
91
+ route.paths.edges.scatter(element_type: :edge).uniq.each do |e|
92
+ n += 1
93
+ print '.' if n % 100 == 0
85
94
  xml.edge :id => e.element_id, :source => e.out_vertex.element_id, :target => e.in_vertex.element_id, :label => e.label do
86
95
  xml.data :key => 'y.edgegraphics' do
87
96
  xml['y'].PolyLineEdge do
data/lib/pacer/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Pacer
2
2
  unless const_defined? :VERSION
3
- VERSION = "1.3.5"
3
+ VERSION = "1.4.0"
4
4
 
5
5
  JAR = "pacer-#{ VERSION }-standalone.jar"
6
6
  JAR_PATH = "lib/#{ JAR }"
@@ -42,6 +42,10 @@ module Pacer
42
42
  end
43
43
  pipe
44
44
  end
45
+
46
+ def inspect_class_name
47
+ "#{super}(#{section_name.inspect})"
48
+ end
45
49
  end
46
50
  end
47
51
  end
@@ -35,11 +35,11 @@ module Pacer::Wrappers
35
35
  caches.each { |c| c.clear_cache } if caches
36
36
  end
37
37
 
38
- def route_conditions
38
+ def route_conditions(graph)
39
39
  return @route_conditions if defined? @route_conditions
40
40
  @route_conditions = extensions.inject({}) do |h, ext|
41
41
  if ext.respond_to? :route_conditions
42
- h.merge! ext.route_conditions
42
+ h.merge! ext.route_conditions(graph)
43
43
  else
44
44
  h
45
45
  end
@@ -47,11 +47,11 @@ module Pacer::Wrappers
47
47
  @route_conditions
48
48
  end
49
49
 
50
- def lookup
50
+ def lookup(graph)
51
51
  return @lookup if defined? @lookup
52
52
  @lookup = extensions.inject({}) do |h, ext|
53
53
  if ext.respond_to? :lookup
54
- h.merge! ext.lookup
54
+ h.merge! ext.lookup(graph)
55
55
  else
56
56
  h
57
57
  end
@@ -100,7 +100,7 @@ module Pacer::Wrappers
100
100
  def as?(*exts)
101
101
  has_exts = extensions_missing(exts).all? do |ext|
102
102
  if ext.respond_to? :route_conditions
103
- ext.route_conditions.all? do |k, v|
103
+ ext.route_conditions(graph).all? do |k, v|
104
104
  self[k] == v
105
105
  end
106
106
  else
data/lib/pacer.rb CHANGED
@@ -160,6 +160,10 @@ module Pacer
160
160
  end
161
161
  alias verbose verbose?
162
162
 
163
+ def executing_route(route)
164
+ # override this if you want to know when a pipeline is about to be built.
165
+ end
166
+
163
167
  # Clear all cached data that may become invalid when {#reload!} is
164
168
  # called.
165
169
  #
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.5</gem.version>
11
+ <gem.version>1.4.0</gem.version>
12
12
  <pipes.version>2.3.0</pipes.version>
13
13
  <gremlin.version>2.3.0</gremlin.version>
14
14
  </properties>
@@ -1,6 +1,6 @@
1
1
  module GD
2
2
  module Artist
3
- def self.route_conditions
3
+ def self.route_conditions(graph)
4
4
  { type: 'artist' }
5
5
  end
6
6
 
@@ -24,7 +24,7 @@ module GD
24
24
  end
25
25
 
26
26
  module Song
27
- def self.route_conditions
27
+ def self.route_conditions(graph)
28
28
  { type: 'song' }
29
29
  end
30
30
 
@@ -2,13 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  module NeoSpec
4
4
  class Person < Pacer::Wrappers::VertexWrapper
5
- def self.route_conditions
5
+ def self.route_conditions(graph)
6
6
  { type: 'person' }
7
7
  end
8
8
  end
9
9
 
10
10
  class Frog < Pacer::Wrappers::VertexWrapper
11
- def self.route_conditions
11
+ def self.route_conditions(graph)
12
12
  { frog: 'yes' }
13
13
  end
14
14
  end
@@ -40,7 +40,8 @@ module NeoSpec
40
40
  # sanity checks
41
41
  it { should be_a Pacer::Filter::LuceneFilter }
42
42
  its(:query) { should == 'type:"person"' }
43
- its(:count) { should == 2 }
43
+ # This doesn't work because neo indices are out of sync before the transaction finalizes
44
+ #its(:count) { should == 2 }
44
45
 
45
46
  its(:wrapper) { should == Person }
46
47
  end
@@ -22,7 +22,9 @@ Run.all(:read_write) do
22
22
  graph.v.property?(:name).count.should == 7
23
23
  graph.v.property?(:zero).count.should == 1
24
24
 
25
- graph.v.property?(:falsy).count.should == 1
25
+ unless graph_name == 'mcfly'
26
+ graph.v.property?(:falsy).count.should == 1
27
+ end
26
28
  end
27
29
  end
28
30
  end
@@ -7,7 +7,7 @@ module Pacer::Filter::PropertyFilter
7
7
  subject { filters }
8
8
 
9
9
  context 'symbol label' do
10
- let(:filters) { Pacer::Route.edge_filters [:label] }
10
+ let(:filters) { Pacer::Route.edge_filters graph, [:label] }
11
11
 
12
12
  its(:any?) { should be_true }
13
13
  its(:labels) { should == ['label'] }
@@ -20,21 +20,21 @@ module Pacer::Filter::PropertyFilter
20
20
  end
21
21
 
22
22
  context 'symbol labels' do
23
- let(:filters) { Pacer::Route.edge_filters [:label, :label2] }
23
+ let(:filters) { Pacer::Route.edge_filters graph, [:label, :label2] }
24
24
 
25
25
  its(:any?) { should be_true }
26
26
  its(:labels) { should == ['label', 'label2'] }
27
27
  end
28
28
 
29
29
  context 'labels arrays' do
30
- let(:filters) { Pacer::Route.edge_filters ["label", [:label2]] }
30
+ let(:filters) { Pacer::Route.edge_filters graph, ["label", [:label2]] }
31
31
 
32
32
  its(:any?) { should be_true }
33
33
  its(:labels) { should == ['label', 'label2'] }
34
34
  end
35
35
 
36
36
  context 'labels and properties' do
37
- let(:filters) { Pacer::Route.edge_filters [:label, { prop: 'value' }] }
37
+ let(:filters) { Pacer::Route.edge_filters graph, [:label, { prop: 'value' }] }
38
38
 
39
39
  its(:any?) { should be_true }
40
40
  its(:labels) { should == ['label'] }
@@ -42,7 +42,7 @@ module Pacer::Filter::PropertyFilter
42
42
  end
43
43
 
44
44
  context 'labels and extension' do
45
- let(:filters) { Pacer::Route.edge_filters [:label, TP::Person] }
45
+ let(:filters) { Pacer::Route.edge_filters graph, [:label, TP::Person] }
46
46
 
47
47
  its(:any?) { should be_true }
48
48
  its(:labels) { should == ['label'] }
@@ -51,7 +51,7 @@ module Pacer::Filter::PropertyFilter
51
51
  end
52
52
 
53
53
  context 'labels and simple extension' do
54
- let(:filters) { Pacer::Route.edge_filters [:label, Tackle::SimpleMixin] }
54
+ let(:filters) { Pacer::Route.edge_filters graph, [:label, Tackle::SimpleMixin] }
55
55
 
56
56
  its(:any?) { should be_true }
57
57
  its(:labels) { should == ['label'] }
@@ -7,13 +7,13 @@ module Pacer::Filter::PropertyFilter
7
7
  subject { filters }
8
8
 
9
9
  context 'no properties' do
10
- let(:filters) { Pacer::Route.send filter_method, [] }
10
+ let(:filters) { Pacer::Route.send filter_method, graph, [] }
11
11
 
12
12
  its(:any?) { should be_false }
13
13
  end
14
14
 
15
15
  context 'no properties' do
16
- let(:filters) { Pacer::Route.send filter_method, [Tackle::SimpleMixin] }
16
+ let(:filters) { Pacer::Route.send filter_method, graph, [Tackle::SimpleMixin] }
17
17
 
18
18
  its(:any?) { should be_true }
19
19
  its(:extensions_only?) { should be_true }
@@ -25,7 +25,7 @@ module Pacer::Filter::PropertyFilter
25
25
  end
26
26
 
27
27
  context 'simple properties' do
28
- let(:filters) { Pacer::Route.send filter_method, [name: 'Darrick', nickname: 'pangloss'] }
28
+ let(:filters) { Pacer::Route.send filter_method, graph, [name: 'Darrick', nickname: 'pangloss'] }
29
29
 
30
30
  its(:any?) { should be_true }
31
31
  its(:extensions_only?) { should be_false }
@@ -37,7 +37,7 @@ module Pacer::Filter::PropertyFilter
37
37
  end
38
38
 
39
39
  context 'With a Set of properties' do
40
- let(:filters) { Pacer::Route.send filter_method, [nickname: Set['pangloss', 'someone']] }
40
+ let(:filters) { Pacer::Route.send filter_method, graph, [nickname: Set['pangloss', 'someone']] }
41
41
 
42
42
  before { subject.graph = graph }
43
43
 
@@ -58,7 +58,7 @@ module Pacer::Filter::PropertyFilter
58
58
  end
59
59
 
60
60
  context 'with extensions' do
61
- let(:filters) { Pacer::Route.send filter_method, [TP::Person, name: 'Darrick', nickname: 'pangloss'] }
61
+ let(:filters) { Pacer::Route.send filter_method, graph, [TP::Person, name: 'Darrick', nickname: 'pangloss'] }
62
62
 
63
63
  its(:any?) { should be_true }
64
64
  its(:extensions) { should == [TP::Person] }
@@ -134,7 +134,7 @@ module Pacer::Filter::PropertyFilter
134
134
 
135
135
  context 'with route module' do
136
136
  # TODO: should this feature be removed?
137
- let(:filters) { Pacer::Route.send filter_method, [TP::Pangloss] }
137
+ let(:filters) { Pacer::Route.send filter_method, graph, [TP::Pangloss] }
138
138
 
139
139
  its(:any?) { should be_true }
140
140
  its(:extensions_only?) { should be_false }
@@ -146,7 +146,7 @@ module Pacer::Filter::PropertyFilter
146
146
  end
147
147
 
148
148
  context 'with manual index' do
149
- let(:filters) { Pacer::Route.send filter_method, [tokens: { short: '555555' }, name: 'Darrick'] }
149
+ let(:filters) { Pacer::Route.send filter_method, graph, [tokens: { short: '555555' }, name: 'Darrick'] }
150
150
 
151
151
  its(:any?) { should be_true }
152
152
  its(:extensions) { should be_empty }
@@ -29,9 +29,9 @@ Run.all do
29
29
  subject { route }
30
30
 
31
31
  its(:inspect) do
32
- should be_one_of "#<V-Index(name: \"gremlin\") -> V-Section -> :grem -> inE(:wrote)>",
33
- /#<V-Lucene\(name:"gremlin"\) ~ \d+ -> V-Section -> :grem -> inE\(:wrote\)>/,
34
- "#<GraphV -> V-Property(name==\"gremlin\") -> V-Section -> :grem -> inE(:wrote)>"
32
+ should be_one_of "#<V-Index(name: \"gremlin\") -> V-Section(:grem) -> inE(:wrote)>",
33
+ /#<V-Lucene\(name:"gremlin"\) ~ \d+ -> V-Section\(:grem\) -> inE\(:wrote\)>/,
34
+ "#<GraphV -> V-Property(name==\"gremlin\") -> V-Section(:grem) -> inE(:wrote)>"
35
35
  end
36
36
  its(:out_v) { should_not be_nil }
37
37
  end
@@ -106,9 +106,9 @@ Run.all(:read_only) do
106
106
  r = r.out_e(:wrote) { |e| true }
107
107
  r = r.in_v
108
108
  r = r.is_not(:grem)
109
- r.inspect.should be_one_of "#<V-Index(name: \"gremlin\") -> V-Section -> :grem -> inE(:wrote) -> outV -> outE(:wrote) -> E-Property(&block) -> inV -> V-Property(&block)>",
110
- /#<V-Lucene\(name:"gremlin"\) ~ \d+ -> V-Section -> :grem -> inE\(:wrote\) -> outV -> outE\(:wrote\) -> E-Property\(&block\) -> inV -> V-Property\(&block\)>/,
111
- "#<GraphV -> V-Property(name==\"gremlin\") -> V-Section -> :grem -> inE(:wrote) -> outV -> outE(:wrote) -> E-Property(&block) -> inV -> V-Property(&block)>"
109
+ r.inspect.should be_one_of "#<V-Index(name: \"gremlin\") -> V-Section(:grem) -> inE(:wrote) -> outV -> outE(:wrote) -> E-Property(&block) -> inV -> is_not(:grem)>",
110
+ /#<V-Lucene\(name:"gremlin"\) ~ \d+ -> V-Section\(:grem\) -> inE\(:wrote\) -> outV -> outE\(:wrote\) -> E-Property\(&block\) -> inV -> is_not\(:grem\)>/,
111
+ "#<GraphV -> V-Property(name==\"gremlin\") -> V-Section(:grem) -> inE(:wrote) -> outV -> outE(:wrote) -> E-Property(&block) -> inV -> is_not(:grem)>"
112
112
  end
113
113
  end
114
114
 
@@ -3,17 +3,17 @@ require 'spec_helper'
3
3
  Run.all(:read_only) do
4
4
  use_pacer_graphml_data(:read_only)
5
5
 
6
- describe '#as' do
6
+ describe '#as_var' do
7
7
  it 'should set the variable to the correct node' do
8
8
  vars = Set[]
9
- route = graph.v.as(:a_vertex)
9
+ route = graph.v.as_var(:a_vertex)
10
10
  route.in_e(:wrote) { |edge| vars << route.vars[:a_vertex] }.count
11
11
  vars.should == Set[*graph.e.e(:wrote).in_v]
12
12
  end
13
13
 
14
14
  it 'should not break path generation (simple)' do
15
15
  who = nil
16
- r1 = graph.v.as(:who)
16
+ r1 = graph.v.as_var(:who)
17
17
  r = r1.in_e(:wrote).out_v.v { |v|
18
18
  who = r1.vars[:who]
19
19
  }.paths
@@ -25,8 +25,8 @@ Run.all(:read_only) do
25
25
 
26
26
  it 'should not break path generation' do
27
27
  who_wrote_what = nil
28
- r1 = graph.v.as(:who)
29
- r = r1.in_e(:wrote).as(:wrote).out_v.as(:what).v { |v|
28
+ r1 = graph.v.as_var(:who)
29
+ r = r1.in_e(:wrote).as_var(:wrote).out_v.as_var(:what).v { |v|
30
30
  who_wrote_what = [r1.vars[:who], r1.vars[:wrote], r1.vars[:what]]
31
31
  }.paths
32
32
  r.each do |path|
@@ -10,7 +10,7 @@ Run.all :read_only do
10
10
  subject { e_wrapper_class }
11
11
 
12
12
  it { should_not be_nil }
13
- its(:route_conditions) { should == { label: 'wrote' } }
13
+ it { subject.route_conditions(graph).should == { label: 'wrote' } }
14
14
  its(:extensions) { should == e_exts }
15
15
 
16
16
  describe 'instance' do
@@ -135,6 +135,7 @@ describe Pacer::Wrappers::EdgeWrapper do
135
135
  end
136
136
 
137
137
  it 'should reuse the element id' do
138
+ return if graph_name == 'mcfly'
138
139
  unless graph.features.ignoresSuppliedIds
139
140
  e0
140
141
  c = example.metadata[:graph_commit]
@@ -11,7 +11,7 @@ Run.all :read_only do
11
11
  subject { v_wrapper_class }
12
12
 
13
13
  it { should_not be_nil }
14
- its(:route_conditions) { should == { type: 'project' } }
14
+ it { subject.route_conditions(graph).should == { type: 'project' } }
15
15
  its(:extensions) { should == v_exts }
16
16
 
17
17
  describe 'instance' do
@@ -36,7 +36,7 @@ end
36
36
 
37
37
  module VertexWrapperSpec
38
38
  module Project
39
- def self.route_conditions
39
+ def self.route_conditions(graph)
40
40
  { :type => 'project' }
41
41
  end
42
42
 
@@ -45,7 +45,7 @@ module VertexWrapperSpec
45
45
  end
46
46
 
47
47
  module IsRuby
48
- def self.route_conditions
48
+ def self.route_conditions(graph)
49
49
  { :language => 'ruby' }
50
50
  end
51
51
 
@@ -38,6 +38,7 @@ class RSpec::GraphRunner
38
38
  def tg(usage_style = :read_write, indices = true, &block)
39
39
  return unless use_graph? 'tg'
40
40
  describe 'tg' do
41
+ let(:graph_name) { 'tg' }
41
42
  let(:graph) { Pacer.tg }
42
43
  let(:graph2) { Pacer.tg }
43
44
  instance_eval(&block)
@@ -78,6 +79,7 @@ protected
78
79
  return unless use_graph? name
79
80
  clear_graph ||= proc { |g| clear g }
80
81
  describe name do
82
+ let(:graph_name) { name }
81
83
  let(:graph) do
82
84
  if indices
83
85
  source_graph_1
@@ -1,6 +1,6 @@
1
1
  module TP
2
2
  module Person
3
- def self.route_conditions
3
+ def self.route_conditions(graph)
4
4
  { :type => 'person' }
5
5
  end
6
6
 
@@ -13,7 +13,7 @@ module TP
13
13
 
14
14
 
15
15
  class Project
16
- def self.route_conditions
16
+ def self.route_conditions(graph)
17
17
  { :type => 'project' }
18
18
  end
19
19
 
@@ -47,7 +47,7 @@ module TP
47
47
  end
48
48
 
49
49
  module Wrote
50
- def self.route_conditions
50
+ def self.route_conditions(graph)
51
51
  { label: 'wrote' }
52
52
  end
53
53
 
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.5
4
+ version: 1.4.0
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-30 00:00:00.000000000 Z
11
+ date: 2013-09-09 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
@@ -199,7 +199,7 @@ files:
199
199
  - spec/pacer/route/mixin/base_spec.rb
200
200
  - spec/pacer/route/mixin/bulk_operations_spec.rb
201
201
  - spec/pacer/route/mixin/route_operations_spec.rb
202
- - spec/pacer/side_effect/as_spec.rb
202
+ - spec/pacer/side_effect/as_var_spec.rb
203
203
  - spec/pacer/side_effect/is_unique_spec.rb
204
204
  - spec/pacer/support/array_list_spec.rb
205
205
  - spec/pacer/support/enumerable_spec.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.5-standalone.jar
223
+ - lib/pacer-1.4.0-standalone.jar
224
224
  homepage: http://github.com/pangloss/pacer
225
225
  licenses:
226
226
  - MIT
@@ -278,7 +278,7 @@ test_files:
278
278
  - spec/pacer/route/mixin/base_spec.rb
279
279
  - spec/pacer/route/mixin/bulk_operations_spec.rb
280
280
  - spec/pacer/route/mixin/route_operations_spec.rb
281
- - spec/pacer/side_effect/as_spec.rb
281
+ - spec/pacer/side_effect/as_var_spec.rb
282
282
  - spec/pacer/side_effect/is_unique_spec.rb
283
283
  - spec/pacer/support/array_list_spec.rb
284
284
  - spec/pacer/support/enumerable_spec.rb