pacer 0.9.1.1-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.
- data/.autotest +8 -0
- data/.document +5 -0
- data/.gitignore +26 -0
- data/.rspec +1 -0
- data/.rvmrc +0 -0
- data/CONTRIBUTORS +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +24 -0
- data/README.md +187 -0
- data/Rakefile +49 -0
- data/autotest/discover.rb +1 -0
- data/bin/autospec +16 -0
- data/bin/autotest +16 -0
- data/bin/rake +16 -0
- data/bin/rcov +16 -0
- data/bin/rspec +16 -0
- data/bin/yard +16 -0
- data/bin/yardoc +16 -0
- data/lib/pacer/blueprints/extensions.rb +77 -0
- data/lib/pacer/blueprints/multi_graph.rb +121 -0
- data/lib/pacer/blueprints/ruby_graph.rb +199 -0
- data/lib/pacer/blueprints/tg.rb +100 -0
- data/lib/pacer/blueprints.rb +4 -0
- data/lib/pacer/core/graph/edges_route.rb +92 -0
- data/lib/pacer/core/graph/element_route.rb +171 -0
- data/lib/pacer/core/graph/graph_index_route.rb +48 -0
- data/lib/pacer/core/graph/graph_route.rb +55 -0
- data/lib/pacer/core/graph/mixed_route.rb +96 -0
- data/lib/pacer/core/graph/vertices_route.rb +220 -0
- data/lib/pacer/core/graph.rb +13 -0
- data/lib/pacer/core/route.rb +502 -0
- data/lib/pacer/core/side_effect.rb +11 -0
- data/lib/pacer/core.rb +8 -0
- data/lib/pacer/exceptions.rb +11 -0
- data/lib/pacer/extensions/block_filter_element.rb +22 -0
- data/lib/pacer/extensions.rb +6 -0
- data/lib/pacer/filter/block_filter.rb +31 -0
- data/lib/pacer/filter/collection_filter.rb +109 -0
- data/lib/pacer/filter/empty_filter.rb +70 -0
- data/lib/pacer/filter/future_filter.rb +68 -0
- data/lib/pacer/filter/index_filter.rb +30 -0
- data/lib/pacer/filter/loop_filter.rb +95 -0
- data/lib/pacer/filter/object_filter.rb +55 -0
- data/lib/pacer/filter/property_filter/edge_filters.rb +93 -0
- data/lib/pacer/filter/property_filter/filters.rb +269 -0
- data/lib/pacer/filter/property_filter.rb +111 -0
- data/lib/pacer/filter/random_filter.rb +13 -0
- data/lib/pacer/filter/range_filter.rb +104 -0
- data/lib/pacer/filter/uniq_filter.rb +12 -0
- data/lib/pacer/filter/where_filter/node_visitor.rb +280 -0
- data/lib/pacer/filter/where_filter.rb +47 -0
- data/lib/pacer/filter.rb +17 -0
- data/lib/pacer/function_resolver.rb +43 -0
- data/lib/pacer/graph/edge_mixin.rb +127 -0
- data/lib/pacer/graph/element_mixin.rb +202 -0
- data/lib/pacer/graph/graph_indices_mixin.rb +93 -0
- data/lib/pacer/graph/graph_mixin.rb +361 -0
- data/lib/pacer/graph/graph_transactions_mixin.rb +207 -0
- data/lib/pacer/graph/index_mixin.rb +30 -0
- data/lib/pacer/graph/vertex_mixin.rb +119 -0
- data/lib/pacer/graph.rb +14 -0
- data/lib/pacer/pipe/blackbox_pipeline.rb +48 -0
- data/lib/pacer/pipe/block_filter_pipe.rb +38 -0
- data/lib/pacer/pipe/collection_filter_pipe.rb +10 -0
- data/lib/pacer/pipe/cross_product_transform_pipe.rb +48 -0
- data/lib/pacer/pipe/enumerable_pipe.rb +30 -0
- data/lib/pacer/pipe/expandable_pipe.rb +63 -0
- data/lib/pacer/pipe/id_collection_filter_pipe.rb +33 -0
- data/lib/pacer/pipe/is_empty_pipe.rb +30 -0
- data/lib/pacer/pipe/is_unique_pipe.rb +61 -0
- data/lib/pacer/pipe/label_collection_filter_pipe.rb +21 -0
- data/lib/pacer/pipe/label_prefix_pipe.rb +21 -0
- data/lib/pacer/pipe/loop_pipe.rb +86 -0
- data/lib/pacer/pipe/map_pipe.rb +36 -0
- data/lib/pacer/pipe/never_pipe.rb +9 -0
- data/lib/pacer/pipe/process_pipe.rb +37 -0
- data/lib/pacer/pipe/property_comparison_pipe.rb +40 -0
- data/lib/pacer/pipe/ruby_pipe.rb +25 -0
- data/lib/pacer/pipe/simple_visitor_pipe.rb +43 -0
- data/lib/pacer/pipe/stream_sort_pipe.rb +84 -0
- data/lib/pacer/pipe/stream_uniq_pipe.rb +33 -0
- data/lib/pacer/pipe/type_filter_pipe.rb +22 -0
- data/lib/pacer/pipe/unary_transform_pipe.rb +59 -0
- data/lib/pacer/pipe/variable_store_iterator_wrapper.rb +26 -0
- data/lib/pacer/pipe/visitor_pipe.rb +67 -0
- data/lib/pacer/pipes.rb +61 -0
- data/lib/pacer/route/mixin/bulk_operations.rb +52 -0
- data/lib/pacer/route/mixin/route_operations.rb +107 -0
- data/lib/pacer/route/mixin/variable_route_module.rb +26 -0
- data/lib/pacer/route/mixins.rb +3 -0
- data/lib/pacer/route.rb +228 -0
- data/lib/pacer/routes.rb +6 -0
- data/lib/pacer/side_effect/aggregate.rb +31 -0
- data/lib/pacer/side_effect/counted.rb +30 -0
- data/lib/pacer/side_effect/group_count.rb +44 -0
- data/lib/pacer/side_effect/is_unique.rb +32 -0
- data/lib/pacer/side_effect/section.rb +25 -0
- data/lib/pacer/side_effect/visitor.rb +37 -0
- data/lib/pacer/side_effect.rb +11 -0
- data/lib/pacer/support/array_list.rb +28 -0
- data/lib/pacer/support/enumerable.rb +100 -0
- data/lib/pacer/support/hash.rb +9 -0
- data/lib/pacer/support/iterator_mixins.rb +110 -0
- data/lib/pacer/support/native_exception.rb +22 -0
- data/lib/pacer/support/proc.rb +16 -0
- data/lib/pacer/support.rb +10 -0
- data/lib/pacer/transform/cap.rb +50 -0
- data/lib/pacer/transform/gather.rb +9 -0
- data/lib/pacer/transform/has_count_cap.rb +41 -0
- data/lib/pacer/transform/join.rb +181 -0
- data/lib/pacer/transform/map.rb +23 -0
- data/lib/pacer/transform/path.rb +50 -0
- data/lib/pacer/transform/process.rb +23 -0
- data/lib/pacer/transform/scatter.rb +23 -0
- data/lib/pacer/transform/sort_section.rb +103 -0
- data/lib/pacer/transform/stream_sort.rb +21 -0
- data/lib/pacer/transform/stream_uniq.rb +21 -0
- data/lib/pacer/transform.rb +16 -0
- data/lib/pacer/utils/graph_analysis.rb +112 -0
- data/lib/pacer/utils/trie.rb +93 -0
- data/lib/pacer/utils/tsort.rb +65 -0
- data/lib/pacer/utils/y_files.rb +127 -0
- data/lib/pacer/utils.rb +10 -0
- data/lib/pacer/version.rb +13 -0
- data/lib/pacer/wrappers/edge_wrapper.rb +51 -0
- data/lib/pacer/wrappers/element_wrapper.rb +78 -0
- data/lib/pacer/wrappers/new_element.rb +106 -0
- data/lib/pacer/wrappers/vertex_wrapper.rb +51 -0
- data/lib/pacer/wrappers.rb +19 -0
- data/lib/pacer-0.9.1.1-standalone.jar +0 -0
- data/lib/pacer.rb +290 -0
- data/pacer.gemspec +30 -0
- data/pom/standalone.xml +22 -0
- data/pom.xml +124 -0
- data/samples/grateful-dead.xml +26380 -0
- data/samples/grateful_dead.rb +63 -0
- data/samples/profile.rb +15 -0
- data/spec/data/grateful-dead.xml +26380 -0
- data/spec/data/pacer.graphml +319 -0
- data/spec/pacer/blueprints/dex_spec.rb +172 -0
- data/spec/pacer/blueprints/neo4j_spec.rb +177 -0
- data/spec/pacer/blueprints/tg_spec.rb +128 -0
- data/spec/pacer/core/graph/edges_route_spec.rb +52 -0
- data/spec/pacer/core/graph/element_route_spec.rb +46 -0
- data/spec/pacer/core/graph/graph_route_spec.rb +94 -0
- data/spec/pacer/core/graph/vertices_route_spec.rb +169 -0
- data/spec/pacer/core/route_spec.rb +197 -0
- data/spec/pacer/filter/collection_filter_spec.rb +19 -0
- data/spec/pacer/filter/empty_filter_spec.rb +29 -0
- data/spec/pacer/filter/future_filter_spec.rb +97 -0
- data/spec/pacer/filter/loop_filter_spec.rb +31 -0
- data/spec/pacer/filter/property_filter_spec.rb +111 -0
- data/spec/pacer/filter/random_filter_spec.rb +17 -0
- data/spec/pacer/filter/uniq_filter_spec.rb +18 -0
- data/spec/pacer/filter/where_filter_spec.rb +93 -0
- data/spec/pacer/graph/edge_mixin_spec.rb +116 -0
- data/spec/pacer/graph/element_mixin_spec.rb +297 -0
- data/spec/pacer/graph/graph_mixin_spec.rb +538 -0
- data/spec/pacer/graph/index_mixin_spec.rb +0 -0
- data/spec/pacer/graph/vertex_mixin_spec.rb +192 -0
- data/spec/pacer/pipe/block_filter_pipe_spec.rb +0 -0
- data/spec/pacer/pipe/labels_filter_pipe_spec.rb +0 -0
- data/spec/pacer/pipe/ruby_pipe_spec.rb +0 -0
- data/spec/pacer/pipe/type_filter_pipe_spec.rb +0 -0
- data/spec/pacer/route/mixin/base_spec.rb +419 -0
- data/spec/pacer/route/mixin/bulk_operations_spec.rb +30 -0
- data/spec/pacer/route/mixin/route_operations_spec.rb +127 -0
- data/spec/pacer/support/array_list_spec.rb +0 -0
- data/spec/pacer/support/enumerable_spec.rb +115 -0
- data/spec/pacer/transform/join_spec.rb +138 -0
- data/spec/pacer/transform/path_spec.rb +54 -0
- data/spec/pacer/utils/tsort_spec.rb +89 -0
- data/spec/pacer/wrapper/edge_wrapper_spec.rb +33 -0
- data/spec/pacer/wrapper/element_wrapper_spec.rb +169 -0
- data/spec/pacer/wrapper/vertex_wrapper_spec.rb +33 -0
- data/spec/pacer_spec.rb +0 -0
- data/spec/spec_helper.rb +91 -0
- data/spec/support/contexts.rb +14 -0
- data/spec/support/graph_runner.rb +142 -0
- data/spec/support/matchers.rb +19 -0
- data/spec/support/use_transactions.rb +31 -0
- data/spec/tackle/simple_mixin.rb +21 -0
- data/spec/tackle/tinkerpop_graph_mixins.rb +60 -0
- metadata +364 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Pacer::Wrappers
|
|
2
|
+
class VertexWrapper < ElementWrapper
|
|
3
|
+
include Pacer::Vertex
|
|
4
|
+
include Pacer::Core::Graph::VerticesRoute
|
|
5
|
+
include Pacer::ElementMixin
|
|
6
|
+
include Pacer::VertexMixin
|
|
7
|
+
|
|
8
|
+
def_delegators :@element,
|
|
9
|
+
:getId, :getPropertyKeys, :getProperty, :setProperty, :removeProperty,
|
|
10
|
+
:getOutEdges, :getInEdges,
|
|
11
|
+
:getRawVertex,
|
|
12
|
+
:graph, :graph=, :<=>, :==
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
def wrapper_for(exts)
|
|
16
|
+
@wrappers = {} unless defined? @wrappers
|
|
17
|
+
@wrappers[exts.to_set] ||= build_vertex_wrapper(exts)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def clear_cache
|
|
21
|
+
@wrappers = {}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
protected
|
|
25
|
+
|
|
26
|
+
def build_vertex_wrapper(exts)
|
|
27
|
+
build_extension_wrapper(exts, [:Route, :Vertex], VertexWrapper)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# This method must be defined here rather than in the superclass in order
|
|
32
|
+
# to correctly override the method in an included module
|
|
33
|
+
def extensions
|
|
34
|
+
self.class.extensions
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# This method must be defined here rather than in the superclass in order
|
|
38
|
+
# to correctly override the method in an included module
|
|
39
|
+
def element
|
|
40
|
+
@element
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def add_extensions(exts)
|
|
44
|
+
if exts.any?
|
|
45
|
+
self.class.wrap(element, extensions + exts.to_a)
|
|
46
|
+
else
|
|
47
|
+
self
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'forwardable'
|
|
2
|
+
|
|
3
|
+
module Pacer
|
|
4
|
+
def self.vertex_wrapper(*exts)
|
|
5
|
+
Wrappers::VertexWrapper.wrapper_for(exts)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.edge_wrapper(*exts)
|
|
9
|
+
Wrappers::EdgeWrapper.wrapper_for(exts)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module Wrappers
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
require 'pacer/wrappers/new_element'
|
|
17
|
+
require 'pacer/wrappers/element_wrapper'
|
|
18
|
+
require 'pacer/wrappers/vertex_wrapper'
|
|
19
|
+
require 'pacer/wrappers/edge_wrapper'
|
|
Binary file
|
data/lib/pacer.rb
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
if not defined?(JRUBY_VERSION) or JRUBY_VERSION =~ /^(0|1\.[0-5]|1\.6\.[0-3])/
|
|
2
|
+
# NOTE: This is because JRuby 1.6.4 fixes a bug that made it impossible to
|
|
3
|
+
# instantiate Java classes with a varargs constructor signature with 0
|
|
4
|
+
# arguments. Marko would not accept a patch to create a 0 args constructor to
|
|
5
|
+
# work around the problem, therefore this version of Pacer will not work
|
|
6
|
+
# under any older versions of JRuby. The oldest Pacer version that will work
|
|
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.'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
if RUBY_VERSION == '1.8.7'
|
|
12
|
+
STDERR.puts <<WARNING
|
|
13
|
+
WARNING: Pacer is developed using JRuby in 1.9 mode. I recommend you
|
|
14
|
+
restart JRuby in 1.9 mode, either with the --1.9 flag, or by
|
|
15
|
+
defaulting to 1.9 mode by setting the environment variable
|
|
16
|
+
JRUBY_OPTS=--1.9
|
|
17
|
+
WARNING
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
require 'java'
|
|
21
|
+
require 'pp'
|
|
22
|
+
require 'rubygems'
|
|
23
|
+
|
|
24
|
+
module Pacer
|
|
25
|
+
unless const_defined? :PATH
|
|
26
|
+
PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
|
27
|
+
lib_path = File.join(PATH, 'lib')
|
|
28
|
+
$:.unshift lib_path unless $:.any? { |path| path == lib_path }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
require 'pacer/version'
|
|
32
|
+
|
|
33
|
+
if RUBY_VERSION =~ /^1.9/
|
|
34
|
+
Enumerator = ::Enumerator
|
|
35
|
+
else
|
|
36
|
+
Enumerator = Enumerable::Enumerator
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
require JAR
|
|
40
|
+
|
|
41
|
+
require 'pacer/exceptions'
|
|
42
|
+
require 'pacer/graph'
|
|
43
|
+
require 'pacer/pipes'
|
|
44
|
+
require 'pacer/core'
|
|
45
|
+
require 'pacer/routes'
|
|
46
|
+
require 'pacer/wrappers'
|
|
47
|
+
require 'pacer/route'
|
|
48
|
+
require 'pacer/extensions'
|
|
49
|
+
require 'pacer/blueprints'
|
|
50
|
+
require 'pacer/support'
|
|
51
|
+
require 'pacer/utils'
|
|
52
|
+
require 'pacer/filter'
|
|
53
|
+
require 'pacer/transform'
|
|
54
|
+
require 'pacer/side_effect'
|
|
55
|
+
require 'pacer/function_resolver'
|
|
56
|
+
|
|
57
|
+
class << self
|
|
58
|
+
# A global place for pacer to put debug info if it's tucked deep in
|
|
59
|
+
# its internals. Should typically not be used unless a mysterious
|
|
60
|
+
# bug needs to be analyzed but that never really happens ;)
|
|
61
|
+
attr_accessor :debug_info
|
|
62
|
+
|
|
63
|
+
# Returns the time pacer was last reloaded (or when it was started).
|
|
64
|
+
def reload_time
|
|
65
|
+
if defined? @reload_time
|
|
66
|
+
@reload_time
|
|
67
|
+
else
|
|
68
|
+
START_TIME
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Reload all Ruby modified files in the Pacer library. Useful for debugging
|
|
73
|
+
# in the console. Does not do any of the fancy stuff that Rails reloading
|
|
74
|
+
# does. Certain types of changes will still require restarting the
|
|
75
|
+
# session.
|
|
76
|
+
def reload!
|
|
77
|
+
require 'pathname'
|
|
78
|
+
Pathname.new(File.expand_path(__FILE__)).parent.find do |path|
|
|
79
|
+
if path.extname == '.rb' and path.mtime > reload_time
|
|
80
|
+
puts path.to_s
|
|
81
|
+
load path.to_s
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
clear_plugin_cache
|
|
85
|
+
@reload_time = Time.now
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Set to true to prevent inspecting any route from printing
|
|
89
|
+
# the matching elements to the screen.
|
|
90
|
+
def hide_route_elements=(bool)
|
|
91
|
+
@hide_route_elements = bool
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Returns whether elements should be displayed. Also yields,
|
|
95
|
+
# temporarily setting the value to true to prevent a route
|
|
96
|
+
# containing routes from printing the contained routes' elements or
|
|
97
|
+
# going recursive if the route were to somehow contain itself.
|
|
98
|
+
#
|
|
99
|
+
# @todo don't use negative method names.
|
|
100
|
+
#
|
|
101
|
+
# @yield print elements while inside this block
|
|
102
|
+
# @return [true, false] should you not print elemets?
|
|
103
|
+
def hide_route_elements
|
|
104
|
+
@hide_route_elements = nil unless defined? @hide_route_elements
|
|
105
|
+
if block_given?
|
|
106
|
+
if @hide_route_elements
|
|
107
|
+
yield
|
|
108
|
+
else
|
|
109
|
+
begin
|
|
110
|
+
@hide_route_elements = true
|
|
111
|
+
yield
|
|
112
|
+
ensure
|
|
113
|
+
@hide_route_elements = false
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
else
|
|
117
|
+
@hide_route_elements
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Returns how many terminal columns we have.
|
|
122
|
+
# @return [Fixnum] number of terminal columns
|
|
123
|
+
def columns
|
|
124
|
+
if defined? @columns
|
|
125
|
+
@columns
|
|
126
|
+
else
|
|
127
|
+
150
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Tell Pacer how many terminal columns we have so it can print
|
|
132
|
+
# elements out in nice columns.
|
|
133
|
+
# @param [Fixnum] n number of terminal columns
|
|
134
|
+
def columns=(n)
|
|
135
|
+
@columns = n
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Returns how many matching items should be displayed by #inspect before we
|
|
139
|
+
# give up and display nothing but the route definition.
|
|
140
|
+
# @return [Fixnum] maximum number of elements to display
|
|
141
|
+
def inspect_limit
|
|
142
|
+
if defined? @inspect_limit
|
|
143
|
+
@inspect_limit
|
|
144
|
+
else
|
|
145
|
+
500
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Set the maximum number of elements to print on the screen when
|
|
150
|
+
# inspecting a route.
|
|
151
|
+
# @param [Fixnum] n maximum number of elements to display
|
|
152
|
+
def inspect_limit=(n)
|
|
153
|
+
@inspect_limit = n
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Set Pacer's general verbosity.
|
|
157
|
+
# @param [:very, true, false] default is true, :very is more
|
|
158
|
+
# verbose, false is quiet
|
|
159
|
+
def verbose=(v)
|
|
160
|
+
@verbose = v
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Current verbosity setting
|
|
164
|
+
# @return [:very, true, false]
|
|
165
|
+
def verbose?
|
|
166
|
+
@verbose = nil unless defined? @verbose
|
|
167
|
+
@verbose = true if @verbose.nil?
|
|
168
|
+
@verbose
|
|
169
|
+
end
|
|
170
|
+
alias verbose verbose?
|
|
171
|
+
|
|
172
|
+
# Clear all cached data that may become invalid when {#reload!} is
|
|
173
|
+
# called.
|
|
174
|
+
#
|
|
175
|
+
# @todo reimpliment as callbacks to keep the code all in one place.
|
|
176
|
+
def clear_plugin_cache
|
|
177
|
+
Wrappers::VertexWrapper.clear_cache
|
|
178
|
+
Wrappers::EdgeWrapper.clear_cache
|
|
179
|
+
FunctionResolver.clear_cache
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Is the object a vertex?
|
|
183
|
+
def vertex?(element)
|
|
184
|
+
element.is_a? Pacer::Vertex or
|
|
185
|
+
(element.respond_to? :element and
|
|
186
|
+
element.element.is_a? Pacer::Vertex)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Is the object an edge?
|
|
190
|
+
def edge?(element)
|
|
191
|
+
element.is_a? Pacer::Edge
|
|
192
|
+
(element.respond_to? :element and
|
|
193
|
+
element.element.is_a? Pacer::Edge)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def vertex_route?(obj)
|
|
197
|
+
obj.is_a? Pacer::Core::Graph::VerticesRoute
|
|
198
|
+
end
|
|
199
|
+
alias vertices_route? vertex_route?
|
|
200
|
+
|
|
201
|
+
def edge_route?(obj)
|
|
202
|
+
obj.is_a? Pacer::Core::Graph::EdgesRoute
|
|
203
|
+
end
|
|
204
|
+
alias edges_route? edge_route?
|
|
205
|
+
|
|
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
|
+
# If a pipe is giving you trouble, you can get all of the
|
|
219
|
+
# intermediate pipes by using this method.
|
|
220
|
+
#
|
|
221
|
+
# @example how to use it:
|
|
222
|
+
# Pacer.debug_pipe(graph.v.out_e)
|
|
223
|
+
#
|
|
224
|
+
# Each returned pipe can be iterated with it's #next method to see
|
|
225
|
+
# what it would have returned if it were the end pipe.
|
|
226
|
+
#
|
|
227
|
+
# @return [[java.util.Iterator, Array<Hash>, com.tinkerpop.pipes.Pipe]]
|
|
228
|
+
# the iterator is the data source. Each Hash in the array is
|
|
229
|
+
# information about one pipe in the pipeline that was created.
|
|
230
|
+
# These are in order of creation, not necessarily of attachment.
|
|
231
|
+
# However the hash will contain what pipe was used as the source
|
|
232
|
+
# for the given pipe along with all arguments used to create the
|
|
233
|
+
# pipe as well as other information if it seemed useful.
|
|
234
|
+
def debug_pipe(pipe)
|
|
235
|
+
@debug_pipes = []
|
|
236
|
+
result = pipe.send :iterator
|
|
237
|
+
[debug_source, debug_pipes, result]
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
def debug_pipe!
|
|
241
|
+
@debug_pipes = []
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# All of the currently open graphs that are tied to the filesystem
|
|
245
|
+
# or a url or address.
|
|
246
|
+
# @return [Hash] address => graph
|
|
247
|
+
def open_graphs
|
|
248
|
+
@open_graphs = Hash.new { |h, k| h[k] = {} } unless defined? @open_graphs
|
|
249
|
+
@open_graphs
|
|
250
|
+
end
|
|
251
|
+
|
|
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
|
+
# Used internally to collect debug information while using
|
|
271
|
+
# {#debug_pipe}
|
|
272
|
+
attr_accessor :debug_source
|
|
273
|
+
# Used internally to collect debug information while using
|
|
274
|
+
# {#debug_pipe}
|
|
275
|
+
attr_reader :debug_pipes
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
at_exit do
|
|
280
|
+
# 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
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
end
|
data/pacer.gemspec
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "pacer/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |s|
|
|
6
|
+
s.name = "pacer"
|
|
7
|
+
s.version = Pacer::VERSION
|
|
8
|
+
s.platform = 'java'
|
|
9
|
+
s.authors = ["Darrick Wiebe"]
|
|
10
|
+
s.email = "darrick@innatesoftware.com"
|
|
11
|
+
s.homepage = "http://github.com/pangloss/pacer"
|
|
12
|
+
s.license = "MIT"
|
|
13
|
+
s.summary = %Q{A very efficient and easy to use graph traversal engine.}
|
|
14
|
+
s.description = %Q{Pacer defines routes through a graph and then traverses them very quickly.}
|
|
15
|
+
|
|
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
|
+
|
|
26
|
+
s.files = `git ls-files`.split("\n") + [Pacer::JAR_PATH]
|
|
27
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
|
28
|
+
s.require_paths = ['lib']
|
|
29
|
+
end
|
|
30
|
+
|
data/pom/standalone.xml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<assembly>
|
|
2
|
+
<id>standalone</id>
|
|
3
|
+
<formats>
|
|
4
|
+
<format>jar</format>
|
|
5
|
+
</formats>
|
|
6
|
+
<includeBaseDirectory>false</includeBaseDirectory>
|
|
7
|
+
|
|
8
|
+
<fileSets>
|
|
9
|
+
<fileSet>
|
|
10
|
+
<directory>target/classes</directory>
|
|
11
|
+
<outputDirectory>/</outputDirectory>
|
|
12
|
+
</fileSet>
|
|
13
|
+
</fileSets>
|
|
14
|
+
|
|
15
|
+
<dependencySets>
|
|
16
|
+
<dependencySet>
|
|
17
|
+
<outputDirectory>/</outputDirectory>
|
|
18
|
+
<unpack>true</unpack>
|
|
19
|
+
<scope>runtime</scope>
|
|
20
|
+
</dependencySet>
|
|
21
|
+
</dependencySets>
|
|
22
|
+
</assembly>
|
data/pom.xml
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
3
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
4
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
5
|
+
<modelVersion>4.0.0</modelVersion>
|
|
6
|
+
<groupId>com.tinkerpop.pacer</groupId>
|
|
7
|
+
<artifactId>pacer</artifactId>
|
|
8
|
+
<!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
|
|
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>
|
|
13
|
+
</properties>
|
|
14
|
+
<!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
|
|
15
|
+
<version>${gem.version}</version>
|
|
16
|
+
<packaging>pom</packaging>
|
|
17
|
+
<url>https://github.com/pangloss/pacer</url>
|
|
18
|
+
<name>Pacer Tinkerpop core dependencies including Blueprints Core
|
|
19
|
+
and Pipes.</name>
|
|
20
|
+
<description>
|
|
21
|
+
</description>
|
|
22
|
+
<inceptionYear>2011</inceptionYear>
|
|
23
|
+
<developers>
|
|
24
|
+
<developer>
|
|
25
|
+
<name>Darrick Wiebe</name>
|
|
26
|
+
<email>darrick@innatesoftware.com</email>
|
|
27
|
+
<url>http://github.com/pangloss</url>
|
|
28
|
+
</developer>
|
|
29
|
+
</developers>
|
|
30
|
+
<dependencies>
|
|
31
|
+
<!-- PROPERTY GRAPH MODEL SUPPORT -->
|
|
32
|
+
<dependency>
|
|
33
|
+
<groupId>com.tinkerpop.blueprints</groupId>
|
|
34
|
+
<artifactId>blueprints-core</artifactId>
|
|
35
|
+
<version>${blueprints.version}</version>
|
|
36
|
+
</dependency>
|
|
37
|
+
<!-- GRAPH TRAVERSAL SUPPORT -->
|
|
38
|
+
<dependency>
|
|
39
|
+
<groupId>com.tinkerpop</groupId>
|
|
40
|
+
<artifactId>pipes</artifactId>
|
|
41
|
+
<version>${pipes.version}</version>
|
|
42
|
+
</dependency>
|
|
43
|
+
</dependencies>
|
|
44
|
+
|
|
45
|
+
<repositories>
|
|
46
|
+
<repository>
|
|
47
|
+
<id>tinkerpop-repository</id>
|
|
48
|
+
<name>TinkerPop Maven2 Repository</name>
|
|
49
|
+
<url>http://tinkerpop.com/maven2</url>
|
|
50
|
+
<snapshots>
|
|
51
|
+
<enabled>true</enabled>
|
|
52
|
+
<updatePolicy>always</updatePolicy>
|
|
53
|
+
</snapshots>
|
|
54
|
+
</repository>
|
|
55
|
+
</repositories>
|
|
56
|
+
|
|
57
|
+
<distributionManagement>
|
|
58
|
+
<repository>
|
|
59
|
+
<id>tinkerpop-repository</id>
|
|
60
|
+
<name>TinkerPop Maven2 Repository</name>
|
|
61
|
+
<url>ftp://ftp.tinkerpop.com:21/public/maven2/</url>
|
|
62
|
+
</repository>
|
|
63
|
+
</distributionManagement>
|
|
64
|
+
|
|
65
|
+
<build>
|
|
66
|
+
<directory>${basedir}/target</directory>
|
|
67
|
+
<finalName>${project.artifactId}-${project.version}</finalName>
|
|
68
|
+
<resources>
|
|
69
|
+
<resource>
|
|
70
|
+
<directory>${basedir}/src/main/resources
|
|
71
|
+
</directory>
|
|
72
|
+
</resource>
|
|
73
|
+
</resources>
|
|
74
|
+
<testResources>
|
|
75
|
+
<testResource>
|
|
76
|
+
<directory>${basedir}/src/test/resources
|
|
77
|
+
</directory>
|
|
78
|
+
</testResource>
|
|
79
|
+
</testResources>
|
|
80
|
+
<plugins>
|
|
81
|
+
<plugin>
|
|
82
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
|
83
|
+
<configuration>
|
|
84
|
+
<source>1.6</source>
|
|
85
|
+
<target>1.6</target>
|
|
86
|
+
</configuration>
|
|
87
|
+
</plugin>
|
|
88
|
+
<plugin>
|
|
89
|
+
<artifactId>maven-assembly-plugin</artifactId>
|
|
90
|
+
<version>2.2-beta-4</version>
|
|
91
|
+
<executions>
|
|
92
|
+
<execution>
|
|
93
|
+
<phase>package</phase>
|
|
94
|
+
<goals>
|
|
95
|
+
<goal>attached</goal>
|
|
96
|
+
</goals>
|
|
97
|
+
</execution>
|
|
98
|
+
</executions>
|
|
99
|
+
<configuration>
|
|
100
|
+
<descriptors>
|
|
101
|
+
<descriptor>pom/standalone.xml</descriptor>
|
|
102
|
+
</descriptors>
|
|
103
|
+
<finalName>${project.artifactId}-${project.version}</finalName>
|
|
104
|
+
<outputDirectory>lib</outputDirectory>
|
|
105
|
+
<workDirectory>target/assembly/work</workDirectory>
|
|
106
|
+
<tarLongFileMode>warn</tarLongFileMode>
|
|
107
|
+
</configuration>
|
|
108
|
+
</plugin>
|
|
109
|
+
<plugin>
|
|
110
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
111
|
+
<artifactId>maven-javadoc-plugin</artifactId>
|
|
112
|
+
<version>2.6.1</version>
|
|
113
|
+
</plugin>
|
|
114
|
+
</plugins>
|
|
115
|
+
<extensions>
|
|
116
|
+
<extension>
|
|
117
|
+
<groupId>org.apache.maven.wagon</groupId>
|
|
118
|
+
<artifactId>wagon-ftp</artifactId>
|
|
119
|
+
<version>1.0-alpha-6</version>
|
|
120
|
+
</extension>
|
|
121
|
+
</extensions>
|
|
122
|
+
</build>
|
|
123
|
+
|
|
124
|
+
</project>
|