pacer 0.9.1.1-java → 1.0.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. data/.autotest +4 -1
  2. data/.gitignore +4 -0
  3. data/.rspec +1 -1
  4. data/Gemfile-dev +33 -0
  5. data/Gemfile-release +4 -0
  6. data/README.md +27 -9
  7. data/Rakefile +26 -8
  8. data/bin/autotest +1 -1
  9. data/lib/pacer/blueprints/multi_graph.rb +7 -19
  10. data/lib/pacer/blueprints/ruby_graph.rb +77 -52
  11. data/lib/pacer/blueprints/tg.rb +6 -93
  12. data/lib/pacer/blueprints.rb +0 -1
  13. data/lib/pacer/core/graph/edges_route.rb +10 -12
  14. data/lib/pacer/core/graph/element_route.rb +14 -21
  15. data/lib/pacer/core/graph/graph_index_route.rb +12 -8
  16. data/lib/pacer/core/graph/graph_route.rb +2 -5
  17. data/lib/pacer/core/graph/mixed_route.rb +3 -5
  18. data/lib/pacer/core/graph/vertices_route.rb +26 -27
  19. data/lib/pacer/core/route.rb +35 -66
  20. data/lib/pacer/exceptions.rb +13 -6
  21. data/lib/pacer/extensions/block_filter_element.rb +0 -5
  22. data/lib/pacer/filter/collection_filter.rb +9 -2
  23. data/lib/pacer/filter/empty_filter.rb +12 -3
  24. data/lib/pacer/filter/future_filter.rb +5 -5
  25. data/lib/pacer/filter/loop_filter.rb +7 -13
  26. data/lib/pacer/filter/object_filter.rb +10 -16
  27. data/lib/pacer/filter/property_filter/filters.rb +134 -93
  28. data/lib/pacer/filter/property_filter.rb +22 -19
  29. data/lib/pacer/filter/where_filter/node_visitor.rb +47 -26
  30. data/lib/pacer/filter/where_filter.rb +24 -3
  31. data/lib/pacer/function_resolver.rb +7 -2
  32. data/lib/pacer/graph/graph_ml.rb +39 -0
  33. data/lib/pacer/graph/graph_transactions_mixin.rb +107 -175
  34. data/lib/pacer/graph/pacer_graph.rb +438 -0
  35. data/lib/pacer/graph/simple_encoder.rb +20 -0
  36. data/lib/pacer/graph/yaml_encoder.rb +81 -0
  37. data/lib/pacer/graph.rb +8 -10
  38. data/lib/pacer/pipe/blackbox_pipeline.rb +11 -4
  39. data/lib/pacer/pipe/block_filter_pipe.rb +5 -22
  40. data/lib/pacer/pipe/cross_product_transform_pipe.rb +5 -7
  41. data/lib/pacer/pipe/edges_pipe.rb +22 -0
  42. data/lib/pacer/pipe/enumerable_pipe.rb +3 -9
  43. data/lib/pacer/pipe/expandable_pipe.rb +2 -14
  44. data/lib/pacer/pipe/id_collection_filter_pipe.rb +2 -8
  45. data/lib/pacer/pipe/is_empty_pipe.rb +5 -12
  46. data/lib/pacer/pipe/is_unique_pipe.rb +3 -13
  47. data/lib/pacer/pipe/label_collection_filter_pipe.rb +1 -7
  48. data/lib/pacer/pipe/label_prefix_pipe.rb +0 -6
  49. data/lib/pacer/pipe/loop_pipe.rb +27 -25
  50. data/lib/pacer/pipe/never_pipe.rb +1 -1
  51. data/lib/pacer/pipe/path_wrapping_pipe.rb +40 -0
  52. data/lib/pacer/pipe/process_pipe.rb +2 -20
  53. data/lib/pacer/pipe/property_comparison_pipe.rb +0 -6
  54. data/lib/pacer/pipe/ruby_pipe.rb +10 -3
  55. data/lib/pacer/pipe/simple_visitor_pipe.rb +12 -11
  56. data/lib/pacer/pipe/stream_sort_pipe.rb +1 -7
  57. data/lib/pacer/pipe/stream_uniq_pipe.rb +0 -6
  58. data/lib/pacer/pipe/type_filter_pipe.rb +1 -7
  59. data/lib/pacer/pipe/unary_transform_pipe.rb +6 -8
  60. data/lib/pacer/pipe/unwrapping_pipe.rb +13 -0
  61. data/lib/pacer/pipe/vertices_pipe.rb +22 -0
  62. data/lib/pacer/pipe/visitor_pipe.rb +3 -7
  63. data/lib/pacer/pipe/wrapping_pipe.rb +37 -0
  64. data/lib/pacer/pipes.rb +17 -12
  65. data/lib/pacer/route/mixin/bulk_operations.rb +8 -9
  66. data/lib/pacer/route/mixin/route_operations.rb +17 -11
  67. data/lib/pacer/route/mixins.rb +0 -1
  68. data/lib/pacer/route.rb +198 -121
  69. data/lib/pacer/side_effect/aggregate.rb +22 -2
  70. data/lib/pacer/side_effect/as.rb +73 -0
  71. data/lib/pacer/side_effect/group_count.rb +0 -3
  72. data/lib/pacer/side_effect/is_unique.rb +7 -6
  73. data/lib/pacer/side_effect.rb +1 -1
  74. data/lib/pacer/support/enumerable.rb +14 -12
  75. data/lib/pacer/support/nil_class.rb +5 -0
  76. data/lib/pacer/support/proc.rb +2 -2
  77. data/lib/pacer/support.rb +1 -1
  78. data/lib/pacer/transform/cap.rb +1 -1
  79. data/lib/pacer/transform/has_count_cap.rb +1 -1
  80. data/lib/pacer/transform/join.rb +20 -16
  81. data/lib/pacer/transform/map.rb +6 -2
  82. data/lib/pacer/transform/path.rb +44 -20
  83. data/lib/pacer/transform/sort_section.rb +58 -51
  84. data/lib/pacer/utils/tsort.rb +7 -2
  85. data/lib/pacer/utils.rb +0 -1
  86. data/lib/pacer/version.rb +4 -3
  87. data/lib/pacer/visitors/section.rb +42 -0
  88. data/lib/pacer/visitors/visits_section.rb +32 -0
  89. data/lib/pacer/visitors.rb +7 -0
  90. data/lib/pacer/wrappers/edge_wrapper.rb +164 -11
  91. data/lib/pacer/wrappers/element_wrapper.rb +133 -8
  92. data/lib/pacer/wrappers/index_wrapper.rb +47 -0
  93. data/lib/pacer/wrappers/vertex_wrapper.rb +175 -12
  94. data/lib/pacer/wrappers/wrapper_selector.rb +40 -0
  95. data/lib/pacer/wrappers/wrapping_pipe_function.rb +90 -0
  96. data/lib/pacer/wrappers.rb +3 -1
  97. data/lib/pacer-1.0.0-standalone.jar +0 -0
  98. data/lib/pacer.rb +13 -47
  99. data/pacer.gemspec +0 -8
  100. data/pom.xml +10 -3
  101. data/spec/pacer/blueprints/dex_spec.rb +12 -26
  102. data/spec/pacer/blueprints/neo4j_spec.rb +14 -28
  103. data/spec/pacer/blueprints/tg_spec.rb +6 -54
  104. data/spec/pacer/core/graph/edges_route_spec.rb +1 -1
  105. data/spec/pacer/core/graph/element_route_spec.rb +2 -2
  106. data/spec/pacer/core/graph/graph_route_spec.rb +2 -2
  107. data/spec/pacer/core/graph/vertices_route_spec.rb +10 -3
  108. data/spec/pacer/core/route_spec.rb +35 -58
  109. data/spec/pacer/filter/empty_filter_spec.rb +5 -6
  110. data/spec/pacer/filter/future_filter_spec.rb +8 -8
  111. data/spec/pacer/filter/loop_filter_spec.rb +120 -6
  112. data/spec/pacer/filter/object_filter_spec.rb +15 -0
  113. data/spec/pacer/filter/property_filter/filters_spec.rb +169 -0
  114. data/spec/pacer/filter/property_filter_spec.rb +15 -12
  115. data/spec/pacer/filter/uniq_filter_spec.rb +1 -1
  116. data/spec/pacer/filter/where_filter_spec.rb +55 -7
  117. data/spec/pacer/graph/{graph_mixin_spec.rb → pacer_graph_spec.rb} +114 -185
  118. data/spec/pacer/route/mixin/base_spec.rb +36 -35
  119. data/spec/pacer/route/mixin/route_operations_spec.rb +4 -46
  120. data/spec/pacer/side_effect/as_spec.rb +34 -0
  121. data/spec/pacer/support/enumerable_spec.rb +6 -6
  122. data/spec/pacer/transform/join_spec.rb +7 -5
  123. data/spec/pacer/transform/map_spec.rb +55 -0
  124. data/spec/pacer/transform/path_spec.rb +30 -15
  125. data/spec/pacer/transform/process_spec.rb +42 -0
  126. data/spec/pacer/transform/sort_section_spec.rb +82 -0
  127. data/spec/pacer/wrapper/edge_wrapper_spec.rb +122 -2
  128. data/spec/pacer/wrapper/element_wrapper_spec.rb +289 -3
  129. data/spec/pacer/wrapper/vertex_wrapper_spec.rb +289 -2
  130. data/spec/spec_helper.rb +16 -7
  131. data/spec/support/graph_runner.rb +80 -29
  132. data/tags +1165 -0
  133. metadata +46 -107
  134. data/.rvmrc +0 -0
  135. data/lib/pacer/blueprints/extensions.rb +0 -77
  136. data/lib/pacer/graph/edge_mixin.rb +0 -127
  137. data/lib/pacer/graph/element_mixin.rb +0 -202
  138. data/lib/pacer/graph/graph_indices_mixin.rb +0 -93
  139. data/lib/pacer/graph/graph_mixin.rb +0 -361
  140. data/lib/pacer/graph/index_mixin.rb +0 -30
  141. data/lib/pacer/graph/vertex_mixin.rb +0 -119
  142. data/lib/pacer/pipe/map_pipe.rb +0 -36
  143. data/lib/pacer/pipe/variable_store_iterator_wrapper.rb +0 -26
  144. data/lib/pacer/route/mixin/variable_route_module.rb +0 -26
  145. data/lib/pacer/side_effect/section.rb +0 -25
  146. data/lib/pacer/support/iterator_mixins.rb +0 -110
  147. data/lib/pacer/wrappers/new_element.rb +0 -106
  148. data/lib/pacer-0.9.1.1-standalone.jar +0 -0
  149. data/spec/pacer/graph/edge_mixin_spec.rb +0 -116
  150. data/spec/pacer/graph/element_mixin_spec.rb +0 -297
  151. data/spec/pacer/graph/index_mixin_spec.rb +0 -0
  152. data/spec/pacer/graph/vertex_mixin_spec.rb +0 -192
@@ -0,0 +1,90 @@
1
+ module Pacer
2
+ module Wrappers
3
+ class WrappingPipeFunction
4
+ include com.tinkerpop.pipes.PipeFunction
5
+
6
+ attr_reader :block, :graph, :wrapper, :extensions, :back
7
+
8
+ def initialize(back, block)
9
+ @back = back
10
+ @block = block
11
+ if back
12
+ @graph = back.graph
13
+ @extensions = back.extensions + [Pacer::Extensions::BlockFilterElement]
14
+ element_type = back.element_type
15
+ end
16
+ @wrapper = WrapperSelector.build element_type, extensions
17
+ end
18
+
19
+ def arity
20
+ block.arity
21
+ end
22
+
23
+ def compute(element)
24
+ e = wrapper.new element
25
+ e.graph = graph if e.respond_to? :graph=
26
+ e.back = back if e.respond_to? :back=
27
+ block.call e
28
+ end
29
+
30
+ alias call compute
31
+
32
+ def call_with_args(element, *args)
33
+ e = wrapper.new element
34
+ e.graph = graph if e.respond_to? :graph=
35
+ e.back = back if e.respond_to? :back=
36
+ block.call e, *args
37
+ end
38
+
39
+ def wrap_path(path)
40
+ path.collect do |item|
41
+ if item.is_a? Pacer::Vertex
42
+ wrapped = Pacer::Wrappers::VertexWrapper.new item
43
+ wrapped.graph = graph
44
+ wrapped
45
+ elsif item.is_a? Pacer::Edge
46
+ wrapped = Pacer::Wrappers::EdgeWrapper.new item
47
+ wrapped.graph = graph
48
+ wrapped
49
+ else
50
+ item
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ class UnwrappingPipeFunction
57
+ include com.tinkerpop.pipes.PipeFunction
58
+
59
+ attr_reader :block
60
+
61
+ def initialize(block)
62
+ @block = block
63
+ end
64
+
65
+ def arity
66
+ block.arity
67
+ end
68
+
69
+ def compute(element)
70
+ e = block.call element
71
+ if e.is_a? ElementWrapper
72
+ e.element
73
+ else
74
+ e
75
+ end
76
+ end
77
+
78
+ alias call compute
79
+
80
+ def call_with_args(element, *args)
81
+ e = block.call element, *args
82
+ if e.is_a? ElementWrapper
83
+ e.element
84
+ else
85
+ e
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -13,7 +13,9 @@ module Pacer
13
13
  end
14
14
  end
15
15
 
16
- require 'pacer/wrappers/new_element'
17
16
  require 'pacer/wrappers/element_wrapper'
18
17
  require 'pacer/wrappers/vertex_wrapper'
19
18
  require 'pacer/wrappers/edge_wrapper'
19
+ require 'pacer/wrappers/index_wrapper'
20
+ require 'pacer/wrappers/wrapper_selector'
21
+ require 'pacer/wrappers/wrapping_pipe_function'
Binary file
data/lib/pacer.rb CHANGED
@@ -1,11 +1,11 @@
1
- if not defined?(JRUBY_VERSION) or JRUBY_VERSION =~ /^(0|1\.[0-5]|1\.6\.[0-3])/
1
+ if not defined?(JRUBY_VERSION) or JRUBY_VERSION =~ /^(0|1\.[0-6])/
2
2
  # NOTE: This is because JRuby 1.6.4 fixes a bug that made it impossible to
3
3
  # instantiate Java classes with a varargs constructor signature with 0
4
4
  # arguments. Marko would not accept a patch to create a 0 args constructor to
5
5
  # work around the problem, therefore this version of Pacer will not work
6
6
  # under any older versions of JRuby. The oldest Pacer version that will work
7
7
  # is 0.8.1.
8
- raise Exception, 'Pacer >= 0.8.2 requires JRuby version 1.6.4 or higher. It is strongly recommended that you use the latest JRuby release.'
8
+ raise Exception, 'Pacer >= 1.0.0 requires JRuby version 1.7.0 preview or higher. It is strongly recommended that you use the latest JRuby release.'
9
9
  end
10
10
 
11
11
  if RUBY_VERSION == '1.8.7'
@@ -15,6 +15,7 @@ WARNING: Pacer is developed using JRuby in 1.9 mode. I recommend you
15
15
  defaulting to 1.9 mode by setting the environment variable
16
16
  JRUBY_OPTS=--1.9
17
17
  WARNING
18
+ raise Exception, "Pacer must be run in JRuby 1.9 mode"
18
19
  end
19
20
 
20
21
  require 'java'
@@ -39,9 +40,9 @@ module Pacer
39
40
  require JAR
40
41
 
41
42
  require 'pacer/exceptions'
42
- require 'pacer/graph'
43
43
  require 'pacer/pipes'
44
44
  require 'pacer/core'
45
+ require 'pacer/graph'
45
46
  require 'pacer/routes'
46
47
  require 'pacer/wrappers'
47
48
  require 'pacer/route'
@@ -49,6 +50,7 @@ module Pacer
49
50
  require 'pacer/blueprints'
50
51
  require 'pacer/support'
51
52
  require 'pacer/utils'
53
+ require 'pacer/visitors'
52
54
  require 'pacer/filter'
53
55
  require 'pacer/transform'
54
56
  require 'pacer/side_effect'
@@ -181,16 +183,12 @@ module Pacer
181
183
 
182
184
  # Is the object a vertex?
183
185
  def vertex?(element)
184
- element.is_a? Pacer::Vertex or
185
- (element.respond_to? :element and
186
- element.element.is_a? Pacer::Vertex)
186
+ element.is_a? Pacer::Wrappers::VertexWrapper
187
187
  end
188
188
 
189
189
  # Is the object an edge?
190
190
  def edge?(element)
191
- element.is_a? Pacer::Edge
192
- (element.respond_to? :element and
193
- element.element.is_a? Pacer::Edge)
191
+ element.is_a? Pacer::Wrappers::EdgeWrapper
194
192
  end
195
193
 
196
194
  def vertex_route?(obj)
@@ -203,18 +201,6 @@ module Pacer
203
201
  end
204
202
  alias edges_route? edge_route?
205
203
 
206
- # Blueprints constant for manual index.
207
- # @return [com.tinkerpop.blueprints.pgm.Index::Type::MANUAL]
208
- def manual_index
209
- com.tinkerpop.blueprints.pgm.Index::Type::MANUAL
210
- end
211
-
212
- # Blueprints constant for automatic index.
213
- # @return [com.tinkerpop.blueprints.pgm.Index::Type::AUTOMATIC]
214
- def automatic_index
215
- com.tinkerpop.blueprints.pgm.Index::Type::AUTOMATIC
216
- end
217
-
218
204
  # If a pipe is giving you trouble, you can get all of the
219
205
  # intermediate pipes by using this method.
220
206
  #
@@ -245,28 +231,10 @@ module Pacer
245
231
  # or a url or address.
246
232
  # @return [Hash] address => graph
247
233
  def open_graphs
248
- @open_graphs = Hash.new { |h, k| h[k] = {} } unless defined? @open_graphs
234
+ @open_graphs = {} unless defined? @open_graphs
249
235
  @open_graphs
250
236
  end
251
237
 
252
- def next_graph_id
253
- @next_graph_id = 0 unless defined? @next_graph_id
254
- @next_graph_id += 1
255
- end
256
-
257
- # Tell pacer to record that we're starting a graph.
258
- #
259
- # @param [Class] type type of graph
260
- # @param [String] key address of the graph
261
- # @yield the block should return the instantiated graph.
262
- # @return [GraphMixin] the instantiated graph
263
- def starting_graph(type, key)
264
- graph = open_graphs[type][key]
265
- return graph if graph
266
- graph = yield
267
- open_graphs[type][key] = graph
268
- end
269
-
270
238
  # Used internally to collect debug information while using
271
239
  # {#debug_pipe}
272
240
  attr_accessor :debug_source
@@ -278,13 +246,11 @@ end
278
246
 
279
247
  at_exit do
280
248
  # Close all open graphs
281
- Pacer.open_graphs.each do |type, graphs|
282
- graphs.each do |path, graph|
283
- begin
284
- graph.shutdown
285
- rescue Exception, StandardError => e
286
- pp e
287
- end
249
+ Pacer.open_graphs.each do |path, graph|
250
+ begin
251
+ graph.shutdown
252
+ rescue Exception, StandardError => e
253
+ puts "Exception on graph shutdown: #{ e.class } #{ e.message }\n\n#{e.backtrace.join "\n" }"
288
254
  end
289
255
  end
290
256
  end
data/pacer.gemspec CHANGED
@@ -14,14 +14,6 @@ Gem::Specification.new do |s|
14
14
  s.description = %Q{Pacer defines routes through a graph and then traverses them very quickly.}
15
15
 
16
16
  s.add_dependency 'fastercsv', '>= 1.5.4'
17
- s.add_development_dependency 'rspec', '~> 2.7.0'
18
- s.add_development_dependency 'rr', '~> 1.0'
19
- s.add_development_dependency 'rcov'
20
- s.add_development_dependency 'yard'
21
- s.add_development_dependency 'rake'
22
-
23
- s.add_development_dependency 'pacer-neo4j', '1.0.7.1'
24
- s.add_development_dependency 'autotest'
25
17
 
26
18
  s.files = `git ls-files`.split("\n") + [Pacer::JAR_PATH]
27
19
  s.test_files = `git ls-files -- spec/*`.split("\n")
data/pom.xml CHANGED
@@ -7,9 +7,10 @@
7
7
  <artifactId>pacer</artifactId>
8
8
  <!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
9
9
  <properties>
10
- <gem.version>0.9.1.1</gem.version>
11
- <blueprints.version>1.0</blueprints.version>
12
- <pipes.version>0.8</pipes.version>
10
+ <gem.version>1.0.0</gem.version>
11
+ <blueprints.version>2.1.0</blueprints.version>
12
+ <pipes.version>2.1.0</pipes.version>
13
+ <gremlin.version>2.1.0</gremlin.version>
13
14
  </properties>
14
15
  <!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
15
16
  <version>${gem.version}</version>
@@ -40,6 +41,12 @@
40
41
  <artifactId>pipes</artifactId>
41
42
  <version>${pipes.version}</version>
42
43
  </dependency>
44
+ <!-- MOAR GRAPH TRAVERSAL SUPPORT -->
45
+ <dependency>
46
+ <groupId>com.tinkerpop.gremlin</groupId>
47
+ <artifactId>gremlin-java</artifactId>
48
+ <version>${gremlin.version}</version>
49
+ </dependency>
43
50
  </dependencies>
44
51
 
45
52
  <repositories>
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  Run.dex do
4
- describe Pacer::DexGraph do
4
+ describe Pacer::Dex do
5
5
  let(:v0) { graph.create_vertex }
6
6
  let(:v1) { graph.create_vertex }
7
7
  let(:e0) { graph.create_edge '0', v0, v1, :default }
@@ -13,60 +13,60 @@ Run.dex do
13
13
 
14
14
  context ':vertex' do
15
15
  subject { graph.element_type(:vertex) }
16
- it { should == com.tinkerpop.blueprints.pgm.impls.dex.DexVertex }
16
+ it { should == :vertex }
17
17
  end
18
18
 
19
19
  context 'a vertex' do
20
20
  subject { graph.element_type(v0) }
21
- it { should == com.tinkerpop.blueprints.pgm.impls.dex.DexVertex }
21
+ it { should == :vertex }
22
22
  end
23
23
 
24
24
  context ':edge' do
25
25
  subject { graph.element_type(:edge) }
26
- it { should == com.tinkerpop.blueprints.pgm.impls.dex.DexEdge }
26
+ it { should == :edge }
27
27
  end
28
28
 
29
29
  context 'an edge' do
30
30
  subject { graph.element_type(e0) }
31
- it { should == com.tinkerpop.blueprints.pgm.impls.dex.DexEdge }
31
+ it { should == :edge }
32
32
  end
33
33
 
34
34
  context ':mixed' do
35
35
  subject { graph.element_type(:mixed) }
36
- it { should == com.tinkerpop.blueprints.pgm.impls.dex.DexElement }
36
+ it { should == :mixed }
37
37
  end
38
38
 
39
39
  context ':object' do
40
40
  subject { graph.element_type(:object) }
41
- it { should == Object }
41
+ it { should == :object }
42
42
  end
43
43
 
44
44
  context 'from element_type' do
45
45
  context ':vertex' do
46
46
  subject { graph.element_type(graph.element_type :vertex) }
47
- it { should == com.tinkerpop.blueprints.pgm.impls.dex.DexVertex }
47
+ it { should == :vertex }
48
48
  end
49
49
 
50
50
  context ':edge' do
51
51
  subject { graph.element_type(graph.element_type :edge) }
52
- it { should == com.tinkerpop.blueprints.pgm.impls.dex.DexEdge }
52
+ it { should == :edge }
53
53
  end
54
54
 
55
55
  context ':mixed' do
56
56
  subject { graph.element_type(graph.element_type :mixed) }
57
- it { should == com.tinkerpop.blueprints.pgm.impls.dex.DexElement }
57
+ it { should == :mixed }
58
58
  end
59
59
 
60
60
  context ':object' do
61
61
  subject { graph.element_type(graph.element_type :object) }
62
- it { should == Object }
62
+ it { should == :object }
63
63
  end
64
64
  end
65
65
 
66
66
  context 'from index_class' do
67
67
  context ':vertex' do
68
68
  subject { graph.element_type(graph.index_class :vertex) }
69
- it { should == com.tinkerpop.blueprints.pgm.impls.dex.DexVertex }
69
+ it { should == :vertex }
70
70
  end
71
71
  end
72
72
  end
@@ -154,19 +154,5 @@ Run.dex do
154
154
  v.extensions.should include(Tackle::SimpleMixin)
155
155
  end
156
156
  end
157
-
158
- describe '#get_vertices' do
159
- before { e0 }
160
- subject { graph.get_vertices }
161
- it { should be_a(Pacer::Core::Route) }
162
- its(:count) { should == 2 }
163
- end
164
-
165
- describe '#get_edges' do
166
- before { e0 }
167
- subject { graph.get_edges }
168
- it { should be_a(Pacer::Core::Route) }
169
- its(:count) { should == 1 }
170
- end
171
157
  end
172
158
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  Run.neo4j do
4
- describe Pacer::Neo4jGraph do
4
+ describe 'neo4j graph' do
5
5
  let(:v0) { graph.create_vertex }
6
6
  let(:v1) { graph.create_vertex }
7
7
  let(:e0) { graph.create_edge '0', v0, v1, :default }
@@ -13,72 +13,72 @@ Run.neo4j do
13
13
 
14
14
  context ':vertex' do
15
15
  subject { graph.element_type(:vertex) }
16
- it { should == com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex }
16
+ it { should == :vertex }
17
17
  end
18
18
 
19
19
  context 'a vertex' do
20
20
  subject { graph.element_type(v0) }
21
- it { should == com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex }
21
+ it { should == :vertex }
22
22
  end
23
23
 
24
24
  context ':edge' do
25
25
  subject { graph.element_type(:edge) }
26
- it { should == com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jEdge }
26
+ it { should == :edge }
27
27
  end
28
28
 
29
29
  context 'an edge' do
30
30
  subject { graph.element_type(e0) }
31
- it { should == com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jEdge }
31
+ it { should == :edge }
32
32
  end
33
33
 
34
34
  context ':mixed' do
35
35
  subject { graph.element_type(:mixed) }
36
- it { should == com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jElement }
36
+ it { should == :mixed }
37
37
  end
38
38
 
39
39
  context ':object' do
40
40
  subject { graph.element_type(:object) }
41
- it { should == Object }
41
+ it { should == :object }
42
42
  end
43
43
 
44
44
  context 'from element_type' do
45
45
  context ':vertex' do
46
46
  subject { graph.element_type(graph.element_type :vertex) }
47
- it { should == com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex }
47
+ it { should == :vertex }
48
48
  end
49
49
 
50
50
  context ':edge' do
51
51
  subject { graph.element_type(graph.element_type :edge) }
52
- it { should == com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jEdge }
52
+ it { should == :edge }
53
53
  end
54
54
 
55
55
  context ':mixed' do
56
56
  subject { graph.element_type(graph.element_type :mixed) }
57
- it { should == com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jElement }
57
+ it { should == :mixed }
58
58
  end
59
59
 
60
60
  context ':object' do
61
61
  subject { graph.element_type(graph.element_type :object) }
62
- it { should == Object }
62
+ it { should == :object }
63
63
  end
64
64
  end
65
65
 
66
66
  context 'from index_class' do
67
67
  context ':vertex' do
68
68
  subject { graph.element_type(graph.index_class :vertex) }
69
- it { should == com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex }
69
+ it { should == :vertex }
70
70
  end
71
71
 
72
72
  context ':edge' do
73
73
  subject { graph.element_type(graph.index_class :edge) }
74
- it { should == com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jEdge }
74
+ it { should == :edge }
75
75
  end
76
76
  end
77
77
  end
78
78
 
79
79
  describe '#indices' do
80
80
  subject { graph.indices.to_a }
81
- its(:count) { should == 2 }
81
+ its(:count) { should == 0 }
82
82
  end
83
83
 
84
84
  describe '#sanitize_properties' do
@@ -159,19 +159,5 @@ Run.neo4j do
159
159
  v.extensions.should include(Tackle::SimpleMixin)
160
160
  end
161
161
  end
162
-
163
- describe '#get_vertices' do
164
- before { e0 }
165
- subject { graph.get_vertices }
166
- it { should be_a(Pacer::Core::Route) }
167
- its(:count) { should == 2 }
168
- end
169
-
170
- describe '#get_edges' do
171
- before { e0 }
172
- subject { graph.get_edges }
173
- it { should be_a(Pacer::Core::Route) }
174
- its(:count) { should == 1 }
175
- end
176
162
  end
177
163
  end
@@ -13,66 +13,32 @@ Run.tg do
13
13
 
14
14
  context ':vertex' do
15
15
  subject { Pacer.tg.element_type(:vertex) }
16
- it { should == com.tinkerpop.blueprints.pgm.impls.tg.TinkerVertex }
16
+ it { should == :vertex }
17
17
  end
18
18
 
19
19
  context 'a vertex' do
20
20
  subject { graph.element_type(v0) }
21
- it { should == com.tinkerpop.blueprints.pgm.impls.tg.TinkerVertex }
21
+ it { should == :vertex }
22
22
  end
23
23
 
24
24
  context ':edge' do
25
25
  subject { graph.element_type(:edge) }
26
- it { should == com.tinkerpop.blueprints.pgm.impls.tg.TinkerEdge }
26
+ it { should == :edge }
27
27
  end
28
28
 
29
29
  context 'an edge' do
30
30
  subject { graph.element_type(e0) }
31
- it { should == com.tinkerpop.blueprints.pgm.impls.tg.TinkerEdge }
31
+ it { should == :edge }
32
32
  end
33
33
 
34
34
  context ':mixed' do
35
35
  subject { graph.element_type(:mixed) }
36
- it { should == com.tinkerpop.blueprints.pgm.impls.tg.TinkerElement }
36
+ it { should == :mixed }
37
37
  end
38
38
 
39
39
  context ':object' do
40
40
  subject { graph.element_type(:object) }
41
- it { should == Object }
42
- end
43
-
44
- context 'from result' do
45
- context ':vertex' do
46
- subject { Pacer.tg.element_type(Pacer.tg.element_type :vertex) }
47
- it { should == com.tinkerpop.blueprints.pgm.impls.tg.TinkerVertex }
48
- end
49
-
50
- context ':edge' do
51
- subject { graph.element_type(Pacer.tg.element_type :edge) }
52
- it { should == com.tinkerpop.blueprints.pgm.impls.tg.TinkerEdge }
53
- end
54
-
55
- context ':mixed' do
56
- subject { graph.element_type(Pacer.tg.element_type :mixed) }
57
- it { should == com.tinkerpop.blueprints.pgm.impls.tg.TinkerElement }
58
- end
59
-
60
- context ':object' do
61
- subject { graph.element_type(Pacer.tg.element_type :object) }
62
- it { should == Object }
63
- end
64
- end
65
-
66
- context 'from index_class' do
67
- context ':vertex' do
68
- subject { graph.element_type(graph.index_class :vertex) }
69
- it { should == com.tinkerpop.blueprints.pgm.impls.tg.TinkerVertex }
70
- end
71
-
72
- context ':edge' do
73
- subject { graph.element_type(graph.index_class :edge) }
74
- it { should == com.tinkerpop.blueprints.pgm.impls.tg.TinkerEdge }
75
- end
41
+ it { should == :object }
76
42
  end
77
43
  end
78
44
 
@@ -110,19 +76,5 @@ Run.tg do
110
76
  v.extensions.should include(Tackle::SimpleMixin)
111
77
  end
112
78
  end
113
-
114
- describe '#get_vertices' do
115
- before { e0 }
116
- subject { graph.get_vertices }
117
- it { should be_a(Pacer::Core::Route) }
118
- its(:count) { should == 2 }
119
- end
120
-
121
- describe '#get_edges' do
122
- before { e0 }
123
- subject { graph.get_edges }
124
- it { should be_a(Pacer::Core::Route) }
125
- its(:count) { should == 1 }
126
- end
127
79
  end
128
80
  end
@@ -35,7 +35,7 @@ Run.all(:read_only) do
35
35
  describe '#labels' do
36
36
  subject { graph.e.labels }
37
37
  it { should be_a Pacer::Core::Route }
38
- its(:element_type) { should == Object }
38
+ its(:element_type) { should == :object }
39
39
  its(:count) { should == 14 }
40
40
  end
41
41
 
@@ -4,7 +4,7 @@ shared_examples_for Pacer::Core::Graph::ElementRoute do
4
4
  describe '#properties' do
5
5
  subject { r.properties }
6
6
  its(:count) { should == r.count }
7
- its(:element_type) { should == Object }
7
+ its(:element_type) { should == :object }
8
8
  specify 'should all be hashes' do
9
9
  props = subject.each
10
10
  elements = r.each
@@ -15,7 +15,7 @@ shared_examples_for Pacer::Core::Graph::ElementRoute do
15
15
  end
16
16
 
17
17
  context 'with extensions' do
18
- let(:route) { r.add_extension(Tackle::SimpleMixin) }
18
+ let(:route) { r.add_extensions([Tackle::SimpleMixin]) }
19
19
  describe '#each without a block' do
20
20
  subject { route.each }
21
21
  specify 'elements should be wrapped' do
@@ -70,13 +70,13 @@ Run.all(:read_only, false) do
70
70
 
71
71
  context 'extension search 2' do
72
72
  subject { graph.v(TP::Pangloss) }
73
- it { should be_a(Pacer::Filter::IndexFilter) }
73
+ its(:back) { should be_a(Pacer::Filter::IndexFilter) }
74
74
  its(:to_a) { should_not be_empty }
75
75
  its(:count) { should == 1 }
76
76
  end
77
77
  end
78
78
 
79
- context 'with vertex auto index' do
79
+ pending 'with vertex auto index' do
80
80
  before :all do
81
81
  graph.build_automatic_index :v_auto, :vertex, [:type] if graph
82
82
  end
@@ -75,7 +75,9 @@ Run.tg(:read_only) do
75
75
  it { graph.v.out_e(:label) { |x| true }.should be_a(Pacer::Route) }
76
76
  it { graph.v.out_e { |x| true }.should be_a(Pacer::Route) }
77
77
 
78
- it { Set[*graph.v.out_e].should == Set[*graph.edges] }
78
+ it('should have all edges') do
79
+ Set[*graph.v.out_e].should == Set[*graph.e]
80
+ end
79
81
 
80
82
  it { graph.v.out_e.count.should >= 1 }
81
83
 
@@ -129,9 +131,9 @@ Run.tg do
129
131
  subject { people.add_edges_to(:uses, projects) }
130
132
 
131
133
  it { should be_a(Pacer::Core::Route) }
132
- its(:element_type) { should == graph.element_type(:edge) }
134
+ its(:element_type) { should == :edge }
133
135
  its(:count) { should == 8 }
134
- its('back.back.element_type') { should == Object }
136
+ its('back.back.element_type') { should == :object }
135
137
  its('back.count') { should == 8 }
136
138
 
137
139
  specify 'all edges in rasge should exist' do
@@ -163,6 +165,11 @@ Run.tg do
163
165
  result = pangloss.add_edges_to(:likes, nil)
164
166
  result.should be_nil
165
167
  end
168
+
169
+ it 'should work if the source is a simple vertex' do
170
+ result = pangloss.first.add_edges_to(:likes, pacer)
171
+ result.should_not be_empty
172
+ end
166
173
  end
167
174
  end
168
175
  end