pacer-neo4j 2.1.0-java → 2.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/lib/{pacer-neo4j-2.1.0-standalone.jar → pacer-neo4j-2.1.1-standalone.jar} +0 -0
- data/lib/pacer-neo4j.rb +14 -7
- data/lib/pacer-neo4j/algo.rb +2 -2
- data/lib/pacer-neo4j/algo/cypher_transform.rb +129 -0
- data/lib/pacer-neo4j/algo/path_wrapper.rb +2 -20
- data/lib/pacer-neo4j/algo/wrapping.rb +34 -0
- data/lib/pacer-neo4j/blueprints_graph.rb +28 -0
- data/lib/pacer-neo4j/graph.rb +88 -14
- data/lib/pacer-neo4j/transaction_event_handler.rb +40 -0
- data/lib/pacer-neo4j/tx_data_wrapper.rb +100 -0
- data/lib/pacer-neo4j/version.rb +4 -4
- data/pom.xml +3 -3
- metadata +10 -5
Binary file
|
data/lib/pacer-neo4j.rb
CHANGED
@@ -8,15 +8,20 @@ require 'pacer-neo4j/version'
|
|
8
8
|
require Pacer::Neo4j::JAR
|
9
9
|
|
10
10
|
require 'pacer-neo4j/graph'
|
11
|
+
require 'pacer-neo4j/algo/wrapping'
|
11
12
|
require 'pacer-neo4j/algo/path_pipe'
|
12
13
|
require 'pacer-neo4j/algo/block_cost_evaluator'
|
13
14
|
require 'pacer-neo4j/algo/block_estimate_evaluator'
|
14
15
|
require 'pacer-neo4j/algo/block_path_expander'
|
15
16
|
require 'pacer-neo4j/algo/path_wrapper'
|
16
17
|
require 'pacer-neo4j/algo/traversal_branch_wrapper'
|
18
|
+
require 'pacer-neo4j/algo/cypher_transform'
|
17
19
|
require 'pacer-neo4j/algo'
|
18
20
|
require 'pacer-neo4j/raw_vertex_wrapping_pipe'
|
19
21
|
require 'pacer-neo4j/lucene_filter'
|
22
|
+
require 'pacer-neo4j/transaction_event_handler'
|
23
|
+
require 'pacer-neo4j/tx_data_wrapper'
|
24
|
+
require 'pacer-neo4j/blueprints_graph'
|
20
25
|
|
21
26
|
Pacer::FunctionResolver.clear_cache
|
22
27
|
|
@@ -37,18 +42,20 @@ module Pacer
|
|
37
42
|
# `graph.setCheckElementsInTransaction(false)` to disable the
|
38
43
|
# feature.
|
39
44
|
def neo4j(path_or_graph, args = nil)
|
40
|
-
bp_neo_class = com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph
|
41
45
|
if path_or_graph.is_a? String
|
42
46
|
path = File.expand_path(path_or_graph)
|
43
47
|
open = proc do
|
44
|
-
|
45
|
-
|
48
|
+
raw_graph = Pacer.open_graphs[path]
|
49
|
+
if raw_graph
|
50
|
+
graph = Pacer::Neo4j::BlueprintsGraph.new(raw_graph)
|
51
|
+
else
|
46
52
|
if args
|
47
|
-
graph =
|
53
|
+
graph = Pacer::Neo4j::BlueprintsGraph.new(path, args.to_hash_map)
|
48
54
|
else
|
49
|
-
graph =
|
55
|
+
graph = Pacer::Neo4j::BlueprintsGraph.new(path)
|
50
56
|
end
|
51
|
-
|
57
|
+
graph.allow_auto_tx = true
|
58
|
+
Pacer.open_graphs[path] = graph.raw_graph
|
52
59
|
graph.setCheckElementsInTransaction true
|
53
60
|
end
|
54
61
|
graph
|
@@ -60,7 +67,7 @@ module Pacer
|
|
60
67
|
Neo4j::Graph.new(Pacer::YamlEncoder, open, shutdown)
|
61
68
|
else
|
62
69
|
# Don't register the new graph so that it won't be automatically closed.
|
63
|
-
Neo4j::Graph.new Pacer::YamlEncoder, proc {
|
70
|
+
Neo4j::Graph.new Pacer::YamlEncoder, proc { Pacer::Neo4j::BlueprintsGraph.new(path_or_graph) }
|
64
71
|
end
|
65
72
|
end
|
66
73
|
|
data/lib/pacer-neo4j/algo.rb
CHANGED
@@ -291,7 +291,7 @@ end
|
|
291
291
|
protected
|
292
292
|
|
293
293
|
def attach_pipe(end_pipe)
|
294
|
-
if back.element_type == :path
|
294
|
+
if back and back.element_type == :path
|
295
295
|
p = PathFromPathPipe.new build_algo, graph, max_hits
|
296
296
|
else
|
297
297
|
p = PathPipe.new build_algo, graph, target, max_hits
|
@@ -308,7 +308,7 @@ end
|
|
308
308
|
end
|
309
309
|
|
310
310
|
def inspect_string
|
311
|
-
if back.element_type == :path
|
311
|
+
if back and back.element_type == :path
|
312
312
|
"expand[#{method}](max_depth: #{ max_depth })"
|
313
313
|
else
|
314
314
|
"paths_to[#{method}](#{ target.inspect }, max_depth: #{ max_depth })"
|
@@ -0,0 +1,129 @@
|
|
1
|
+
module Pacer
|
2
|
+
module Core
|
3
|
+
module StringRoute
|
4
|
+
def raw_cypher(opts = {})
|
5
|
+
chain_route({element_type: :cypher, transform: Pacer::Transform::Cypher}.merge opts)
|
6
|
+
end
|
7
|
+
|
8
|
+
def cypher(opts = {})
|
9
|
+
raw_cypher(opts).paths
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
module Graph
|
14
|
+
module VerticesRoute
|
15
|
+
def raw_cypher(query, elements_per_query = nil)
|
16
|
+
reducer(element_type: :array).
|
17
|
+
enter { Set[] }.
|
18
|
+
leave { |x, a| x.nil? or (elements_per_query and a.length % elements_per_query == 0) }.
|
19
|
+
reduce { |v, ids| ids << v.element_id }.
|
20
|
+
map(element_type: :string) { |a| "start v=node(#{a.to_a.join(',')}) #{ query }"}.
|
21
|
+
raw_cypher
|
22
|
+
end
|
23
|
+
|
24
|
+
def cypher(query, elements_per_query = nil)
|
25
|
+
raw_cypher(query, elements_per_query).paths
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
module CypherRoute
|
31
|
+
def paths(*columns)
|
32
|
+
chain_route element_type: :path, transform: Pacer::Transform::CypherResults, columns: columns
|
33
|
+
end
|
34
|
+
|
35
|
+
def v(column = nil)
|
36
|
+
chain_route element_type: :vertex, transform: Pacer::Transform::CypherResults, columns: [column].compact, single: true
|
37
|
+
end
|
38
|
+
|
39
|
+
def e(column = nil)
|
40
|
+
chain_route element_type: :edge, transform: Pacer::Transform::CypherResults, columns: [column].compact, single: true
|
41
|
+
end
|
42
|
+
|
43
|
+
def results(*columns)
|
44
|
+
chain_route element_type: :array, transform: Pacer::Transform::CypherResults, columns: columns
|
45
|
+
end
|
46
|
+
end
|
47
|
+
Pacer::RouteBuilder.current.element_types[:cypher] = [CypherRoute]
|
48
|
+
end
|
49
|
+
|
50
|
+
module Transform
|
51
|
+
module Cypher
|
52
|
+
protected
|
53
|
+
|
54
|
+
def attach_pipe(end_pipe)
|
55
|
+
pipe = CypherPipe.new(self)
|
56
|
+
pipe.setStarts end_pipe if end_pipe
|
57
|
+
pipe
|
58
|
+
end
|
59
|
+
|
60
|
+
class CypherPipe < Pacer::Pipes::RubyPipe
|
61
|
+
import org.neo4j.cypher.javacompat.ExecutionEngine
|
62
|
+
|
63
|
+
attr_reader :engine
|
64
|
+
|
65
|
+
def initialize(route)
|
66
|
+
super()
|
67
|
+
graph = route.graph.neo_graph
|
68
|
+
@engine = ExecutionEngine.new graph
|
69
|
+
end
|
70
|
+
|
71
|
+
protected
|
72
|
+
|
73
|
+
def processNextStart
|
74
|
+
engine.execute starts.next
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
module CypherResults
|
80
|
+
attr_accessor :columns, :single
|
81
|
+
|
82
|
+
protected
|
83
|
+
|
84
|
+
def attach_pipe(end_pipe)
|
85
|
+
pipe = ResultsPipe.new(self, columns, single)
|
86
|
+
pipe.setStarts end_pipe if end_pipe
|
87
|
+
pipe
|
88
|
+
end
|
89
|
+
|
90
|
+
class ResultsPipe < Pacer::Pipes::RubyPipe
|
91
|
+
import org.neo4j.cypher.javacompat.ExecutionEngine
|
92
|
+
|
93
|
+
include Pacer::Neo4j::Algo::Wrapping
|
94
|
+
|
95
|
+
attr_reader :columns, :graph, :single
|
96
|
+
attr_accessor :current
|
97
|
+
|
98
|
+
def initialize(route, columns, single)
|
99
|
+
super()
|
100
|
+
@single = single
|
101
|
+
@graph = route.graph
|
102
|
+
@columns = columns if columns and columns.any?
|
103
|
+
end
|
104
|
+
|
105
|
+
protected
|
106
|
+
|
107
|
+
def processNextStart
|
108
|
+
while true
|
109
|
+
if current
|
110
|
+
if current.first.hasNext
|
111
|
+
if single
|
112
|
+
return wrap_path(current.map(&:next)).first
|
113
|
+
else
|
114
|
+
return wrap_path current.map(&:next)
|
115
|
+
end
|
116
|
+
else
|
117
|
+
self.current = nil
|
118
|
+
end
|
119
|
+
else
|
120
|
+
results = starts.next
|
121
|
+
cols = columns || results.columns.to_a
|
122
|
+
self.current = cols.map { |col| results.columnAs col }
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -6,9 +6,7 @@ module Pacer
|
|
6
6
|
#
|
7
7
|
# Note that I have removed methods that I didn't understand, assuming they are internal.
|
8
8
|
class PathWrapper
|
9
|
-
|
10
|
-
import com.tinkerpop.blueprints.impls.neo4j.Neo4jVertex
|
11
|
-
import com.tinkerpop.blueprints.impls.neo4j.Neo4jEdge
|
9
|
+
include Wrapping
|
12
10
|
|
13
11
|
attr_reader :graph, :raw_path
|
14
12
|
|
@@ -26,13 +24,7 @@ module Pacer
|
|
26
24
|
|
27
25
|
# Iterates through both the vertices and edges of this path in order.
|
28
26
|
def path
|
29
|
-
raw_path.iterator
|
30
|
-
if e.is_a? Node
|
31
|
-
wrap_vertex e
|
32
|
-
else
|
33
|
-
wrap_edge e
|
34
|
-
end
|
35
|
-
end
|
27
|
+
wrap_path raw_path.iterator
|
36
28
|
end
|
37
29
|
|
38
30
|
def to_a
|
@@ -136,16 +128,6 @@ module Pacer
|
|
136
128
|
def both(*args)
|
137
129
|
end_v.both(*args)
|
138
130
|
end
|
139
|
-
|
140
|
-
private
|
141
|
-
|
142
|
-
def wrap_vertex(v)
|
143
|
-
Pacer::Wrappers::VertexWrapper.new graph, Neo4jVertex.new(v, graph.blueprints_graph)
|
144
|
-
end
|
145
|
-
|
146
|
-
def wrap_edge(e)
|
147
|
-
Pacer::Wrappers::EdgeWrapper.new graph, Neo4jEdge.new(e, graph.blueprints_graph)
|
148
|
-
end
|
149
131
|
end
|
150
132
|
end
|
151
133
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Pacer
|
2
|
+
module Neo4j
|
3
|
+
module Algo
|
4
|
+
module Wrapping
|
5
|
+
import org.neo4j.graphdb.Node
|
6
|
+
import org.neo4j.graphdb.Relationship
|
7
|
+
import com.tinkerpop.blueprints.impls.neo4j.Neo4jVertex
|
8
|
+
import com.tinkerpop.blueprints.impls.neo4j.Neo4jEdge
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def wrap_path(p)
|
13
|
+
p.collect do |e|
|
14
|
+
if e.is_a? Node
|
15
|
+
wrap_vertex e
|
16
|
+
elsif e.is_a? Relationship
|
17
|
+
wrap_edge e
|
18
|
+
else
|
19
|
+
e
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def wrap_vertex(v)
|
25
|
+
Pacer::Wrappers::VertexWrapper.new graph, Neo4jVertex.new(v, graph.blueprints_graph)
|
26
|
+
end
|
27
|
+
|
28
|
+
def wrap_edge(e)
|
29
|
+
Pacer::Wrappers::EdgeWrapper.new graph, Neo4jEdge.new(e, graph.blueprints_graph)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Pacer
|
2
|
+
module Neo4j
|
3
|
+
class BlueprintsGraph < com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph
|
4
|
+
attr_accessor :allow_auto_tx
|
5
|
+
attr_reader :tx_depth
|
6
|
+
|
7
|
+
def initialize(*args)
|
8
|
+
super
|
9
|
+
@tx_depth = 0
|
10
|
+
end
|
11
|
+
|
12
|
+
def transaction
|
13
|
+
@tx_depth += 1
|
14
|
+
yield
|
15
|
+
ensure
|
16
|
+
@tx_depth -= 1
|
17
|
+
end
|
18
|
+
|
19
|
+
def autoStartTransaction
|
20
|
+
if tx_depth != 0 or allow_auto_tx
|
21
|
+
super
|
22
|
+
else
|
23
|
+
raise Pacer::TransactionError, "Can't mutate the graph outside a transaction block"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/pacer-neo4j/graph.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
module Pacer
|
2
2
|
module Neo4j
|
3
3
|
class Graph < PacerGraph
|
4
|
+
JDate = java.util.Date
|
5
|
+
import java.text.SimpleDateFormat
|
6
|
+
|
4
7
|
# I'm not sure exactly what this impacts but if it is false, many Pacer tests fail.
|
5
8
|
#
|
6
9
|
# Presumably Neo4j is faster with it set to false.
|
@@ -12,14 +15,71 @@ module Pacer
|
|
12
15
|
blueprints_graph.getCheckElementsInTransaction
|
13
16
|
end
|
14
17
|
|
18
|
+
def allow_auto_tx=(b)
|
19
|
+
blueprints_graph.allow_auto_tx = b
|
20
|
+
end
|
21
|
+
|
22
|
+
def allow_auto_tx
|
23
|
+
blueprints_graph.allow_auto_tx
|
24
|
+
end
|
25
|
+
|
26
|
+
def transaction(*args, &block)
|
27
|
+
blueprints_graph.transaction do
|
28
|
+
super
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def cypher(query)
|
33
|
+
[query].to_route(element_type: :string, graph: self).cypher
|
34
|
+
end
|
35
|
+
|
15
36
|
def key_index_cache(type, name, size = :undefined)
|
37
|
+
indexer = lucene_auto_index(type)
|
16
38
|
if size == :undefined
|
17
|
-
|
39
|
+
indexer.getCacheCapacity name
|
18
40
|
else
|
19
|
-
|
41
|
+
indexer.setCacheCapacity name, size
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def neo_graph
|
46
|
+
blueprints_graph.raw_graph
|
47
|
+
end
|
48
|
+
|
49
|
+
def on_commit(&block)
|
50
|
+
return unless block
|
51
|
+
TransactionEventHandler.new(self).tap do |h|
|
52
|
+
h.on_commit = block
|
53
|
+
neo_graph.registerTransactionEventHandler h
|
20
54
|
end
|
21
55
|
end
|
22
56
|
|
57
|
+
# This is actually only called if the commit fails and then it internally tries to
|
58
|
+
# rollback. It seems that it's actually possible for it to fail to rollback here, too...
|
59
|
+
#
|
60
|
+
# An exception in before_commit can definitely trigger this.
|
61
|
+
#
|
62
|
+
# Regular rollbacks do not get seen by the transaction system and no callback happens.
|
63
|
+
def on_commit_failed(&block)
|
64
|
+
return unless block
|
65
|
+
TransactionEventHandler.new(self).tap do |h|
|
66
|
+
h.on_commit_failed = block
|
67
|
+
neo_graph.registerTransactionEventHandler h
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def before_commit(&block)
|
72
|
+
return unless block
|
73
|
+
TransactionEventHandler.new(self).tap do |h|
|
74
|
+
h.before_commit = block
|
75
|
+
neo_graph.registerTransactionEventHandler h
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def drop_handler(h)
|
80
|
+
neo_graph.unregisterTransactionEventHandler h
|
81
|
+
end
|
82
|
+
|
23
83
|
private
|
24
84
|
|
25
85
|
def index_properties(type, filters)
|
@@ -30,15 +90,16 @@ module Pacer
|
|
30
90
|
indexed = index_properties type, filters
|
31
91
|
if indexed.any?
|
32
92
|
indexed.map do |k, v|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
%{#{k}:"#{s}"}
|
93
|
+
k = k.to_s.gsub '/', '\\/'
|
94
|
+
if v.is_a? Range
|
95
|
+
encoded = encode_property(v.min)
|
96
|
+
if encoded.is_a? JDate
|
97
|
+
"#{k}:[#{lucene_value v.min} TO #{lucene_value v.max}]"
|
39
98
|
else
|
40
|
-
"#{k}
|
99
|
+
"#{k}:{#{lucene_value v.min} TO #{lucene_value v.max}}"
|
41
100
|
end
|
101
|
+
else
|
102
|
+
"#{k}:#{lucene_value v}"
|
42
103
|
end
|
43
104
|
end.join " AND "
|
44
105
|
else
|
@@ -46,16 +107,29 @@ module Pacer
|
|
46
107
|
end
|
47
108
|
end
|
48
109
|
|
49
|
-
def
|
50
|
-
|
110
|
+
def lucene_value(v)
|
111
|
+
s = encode_property(v)
|
112
|
+
if s.is_a? JDate
|
113
|
+
f = SimpleDateFormat.new 'yyyyMMddHHmmssSSS'
|
114
|
+
f.format s
|
115
|
+
elsif s
|
116
|
+
if s.is_a? String and s =~ /[\t :"']/
|
117
|
+
s.inspect
|
118
|
+
else s
|
119
|
+
s
|
120
|
+
end
|
121
|
+
else
|
122
|
+
'NULL'
|
123
|
+
end
|
51
124
|
end
|
52
125
|
|
53
126
|
def lucene_auto_index(type)
|
54
127
|
if type == :vertex
|
55
|
-
neo_graph.index.getNodeAutoIndexer
|
128
|
+
indexer = neo_graph.index.getNodeAutoIndexer
|
56
129
|
elsif type == :edge
|
57
|
-
neo_graph.index.getRelationshipAutoIndexer
|
130
|
+
indexer = neo_graph.index.getRelationshipAutoIndexer
|
58
131
|
end
|
132
|
+
indexer.getAutoIndex
|
59
133
|
end
|
60
134
|
|
61
135
|
def indexed_route(element_type, filters, block)
|
@@ -64,7 +138,7 @@ module Pacer
|
|
64
138
|
else
|
65
139
|
query = build_query(element_type, filters)
|
66
140
|
if query
|
67
|
-
route = lucene query, element_type: element_type
|
141
|
+
route = lucene query, element_type: element_type, extensions: filters.extensions, wrapper: filters.wrapper
|
68
142
|
filters.remove_property_keys key_indices(element_type)
|
69
143
|
if filters.any?
|
70
144
|
Pacer::Route.property_filter(route, filters, block)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Pacer
|
2
|
+
module Neo4j
|
3
|
+
class TransactionEventHandler
|
4
|
+
include org.neo4j.graphdb.event.TransactionEventHandler
|
5
|
+
|
6
|
+
attr_reader :graph
|
7
|
+
attr_accessor :on_commit, :on_commit_failed, :before_commit
|
8
|
+
|
9
|
+
def initialize(graph)
|
10
|
+
@graph = graph
|
11
|
+
end
|
12
|
+
|
13
|
+
def unregister!
|
14
|
+
graph.drop_handler self
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
# Return value is passed to afterCommit or afterRollback, but some values can cause crashes.
|
20
|
+
def beforeCommit(data)
|
21
|
+
before_commit.call TxDataWrapper.new data, graph if before_commit
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def afterCommit(data, ignore)
|
26
|
+
on_commit.call TxDataWrapper.new data, graph if on_commit
|
27
|
+
end
|
28
|
+
|
29
|
+
# This is actually only called if the commit fails and then it internally tries to
|
30
|
+
# rollback. It seems that it's actually possible for it to fail to rollback here, too...
|
31
|
+
#
|
32
|
+
# An exception in beforeCommit can definitely trigger this.
|
33
|
+
#
|
34
|
+
# Regular rollbacks do not get seen by the transaction system and no callback happens.
|
35
|
+
def afterRollback(data, ignore)
|
36
|
+
on_commit_failed.call TxDataWrapper.new data, graph if on_commit_failed
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module Pacer
|
2
|
+
module Neo4j
|
3
|
+
# Uses the interface defined here:
|
4
|
+
# http://api.neo4j.org/1.8/org/neo4j/graphdb/Path.html
|
5
|
+
#
|
6
|
+
# Note that I have removed methods that I didn't understand, assuming they are internal.
|
7
|
+
class TxDataWrapper
|
8
|
+
include Algo::Wrapping
|
9
|
+
|
10
|
+
attr_reader :graph, :tx
|
11
|
+
|
12
|
+
def initialize(tx, graph)
|
13
|
+
@tx = tx
|
14
|
+
@graph = graph
|
15
|
+
end
|
16
|
+
|
17
|
+
def created_v
|
18
|
+
tx.createdNodes.map { |n| wrap_vertex n }
|
19
|
+
end
|
20
|
+
|
21
|
+
def deleted_v
|
22
|
+
tx.deletedNodes.map { |n| wrap_vertex n }
|
23
|
+
end
|
24
|
+
|
25
|
+
def created_e
|
26
|
+
tx.createdRelationships.map { |n| wrap_edge n }
|
27
|
+
end
|
28
|
+
|
29
|
+
def deleted_e
|
30
|
+
tx.deletedRelationships.map { |n| wrap_edge n }
|
31
|
+
end
|
32
|
+
|
33
|
+
def created_v_ids
|
34
|
+
tx.createdNodes.map { |n| n.getId }
|
35
|
+
end
|
36
|
+
|
37
|
+
def deleted_v_ids
|
38
|
+
tx.deletedNodes.map { |n| n.getId }
|
39
|
+
end
|
40
|
+
|
41
|
+
def created_e_ids
|
42
|
+
tx.createdRelationships.map { |n| n.getId }
|
43
|
+
end
|
44
|
+
|
45
|
+
def deleted_e_ids
|
46
|
+
tx.deletedRelationships.map { |n| n.getId }
|
47
|
+
end
|
48
|
+
|
49
|
+
def deleted?(e)
|
50
|
+
tx.is_deleted e.element.rawElement
|
51
|
+
end
|
52
|
+
|
53
|
+
def changed_v
|
54
|
+
tx.assignedNodeProperties.map do |p|
|
55
|
+
{ element_type: :vertex,
|
56
|
+
id: p.entity.getId,
|
57
|
+
key: p.key,
|
58
|
+
was: graph.decode_property(p.previouslyCommitedValue),
|
59
|
+
is: graph.decode_property(p.value) }
|
60
|
+
end +
|
61
|
+
tx.removedNodeProperties.map do |p|
|
62
|
+
{ element_type: :vertex,
|
63
|
+
id: p.entity.getId,
|
64
|
+
key: p.key,
|
65
|
+
was: graph.decode_property(p.previouslyCommitedValue),
|
66
|
+
is: nil }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def changed_e
|
71
|
+
tx.assignedRelationshipProperties.map do |p|
|
72
|
+
{ element_type: :edge,
|
73
|
+
id: p.entity.getId,
|
74
|
+
key: p.key,
|
75
|
+
was: graph.decode_property(p.previouslyCommitedValue),
|
76
|
+
is: graph.decode_property(p.value) }
|
77
|
+
end +
|
78
|
+
tx.removedRelationshipProperties.map do |p|
|
79
|
+
{ element_type: :edge,
|
80
|
+
id: p.entity.getId,
|
81
|
+
key: p.key,
|
82
|
+
was: graph.decode_property(p.previouslyCommitedValue),
|
83
|
+
is: nil }
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def changes
|
88
|
+
changed_v + changed_e
|
89
|
+
end
|
90
|
+
|
91
|
+
def summary
|
92
|
+
{ created_v: created_v_ids,
|
93
|
+
deleted_v: deleted_v_ids,
|
94
|
+
created_e: created_e_ids,
|
95
|
+
deleted_e: deleted_e_ids,
|
96
|
+
changes: changes }
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/lib/pacer-neo4j/version.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Pacer
|
2
2
|
module Neo4j
|
3
|
-
VERSION = "2.1.
|
3
|
+
VERSION = "2.1.1"
|
4
4
|
JAR = "pacer-neo4j-#{ VERSION }-standalone.jar"
|
5
5
|
JAR_PATH = "lib/#{ JAR }"
|
6
|
-
BLUEPRINTS_VERSION = "2.
|
7
|
-
PIPES_VERSION = "2.
|
8
|
-
PACER_REQ = ">= 1.
|
6
|
+
BLUEPRINTS_VERSION = "2.2.0"
|
7
|
+
PIPES_VERSION = "2.2.0"
|
8
|
+
PACER_REQ = ">= 1.1.2"
|
9
9
|
end
|
10
10
|
end
|
data/pom.xml
CHANGED
@@ -7,9 +7,9 @@
|
|
7
7
|
<artifactId>pacer-neo4j</artifactId>
|
8
8
|
<!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
|
9
9
|
<properties>
|
10
|
-
<
|
11
|
-
<
|
12
|
-
<pipes.version>2.
|
10
|
+
<blueprints.version>2.2.0</blueprints.version>
|
11
|
+
<gem.version>2.1.1</gem.version>
|
12
|
+
<pipes.version>2.2.0</pipes.version>
|
13
13
|
</properties>
|
14
14
|
<!-- NOTE: the following properties are automatically updated based on the values in lib/pacer-neo4j/version.rb -->
|
15
15
|
<version>${gem.version}</version>
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: pacer-neo4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.1.
|
5
|
+
version: 2.1.1
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Darrick Wiebe
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pacer
|
@@ -17,13 +17,13 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ! '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 1.
|
20
|
+
version: 1.1.2
|
21
21
|
none: false
|
22
22
|
requirement: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.1.2
|
27
27
|
none: false
|
28
28
|
prerelease: false
|
29
29
|
type: :runtime
|
@@ -43,18 +43,23 @@ files:
|
|
43
43
|
- lib/pacer-neo4j/algo/block_cost_evaluator.rb
|
44
44
|
- lib/pacer-neo4j/algo/block_estimate_evaluator.rb
|
45
45
|
- lib/pacer-neo4j/algo/block_path_expander.rb
|
46
|
+
- lib/pacer-neo4j/algo/cypher_transform.rb
|
46
47
|
- lib/pacer-neo4j/algo/path_pipe.rb
|
47
48
|
- lib/pacer-neo4j/algo/path_wrapper.rb
|
48
49
|
- lib/pacer-neo4j/algo/traversal_branch_wrapper.rb
|
50
|
+
- lib/pacer-neo4j/algo/wrapping.rb
|
51
|
+
- lib/pacer-neo4j/blueprints_graph.rb
|
49
52
|
- lib/pacer-neo4j/graph.rb
|
50
53
|
- lib/pacer-neo4j/lucene_filter.rb
|
51
54
|
- lib/pacer-neo4j/raw_vertex_wrapping_pipe.rb
|
52
55
|
- lib/pacer-neo4j/rspec.rb
|
56
|
+
- lib/pacer-neo4j/transaction_event_handler.rb
|
57
|
+
- lib/pacer-neo4j/tx_data_wrapper.rb
|
53
58
|
- lib/pacer-neo4j/version.rb
|
54
59
|
- pacer-neo4j.gemspec
|
55
60
|
- pom.xml
|
56
61
|
- pom/standalone.xml
|
57
|
-
- lib/pacer-neo4j-2.1.
|
62
|
+
- lib/pacer-neo4j-2.1.1-standalone.jar
|
58
63
|
homepage: http://neo4j.org
|
59
64
|
licenses: []
|
60
65
|
post_install_message:
|