pacer-neo4j 2.1.2-java → 2.1.4-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/pacer-neo4j/blueprints_graph.rb +6 -12
- data/lib/pacer-neo4j/graph.rb +68 -14
- data/lib/pacer-neo4j/tx_data_wrapper.rb +2 -1
- data/lib/pacer-neo4j/version.rb +3 -3
- data/lib/{pacer-neo4j-2.1.2-standalone.jar → pacer-neo4j-2.1.4-standalone.jar} +0 -0
- data/pom.xml +5 -3
- metadata +12 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7190dda6385c119ecea1c959a2778eebf00da79c
|
4
|
+
data.tar.gz: 93c2c9f4ebe74afa68cfaa98ed3e00ed5a7ea123
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a0849277cbe979a44d5a8e17ca7c00b0e928042059b1a21a116e2232de98749b3d96727be379b2cf56355ed0d94a26ca5f8328074a4a6dff867169b78a33ed90
|
7
|
+
data.tar.gz: 07db1630318fa5320ec0e241d40f84b83d69f1680134a253d572868eebc01a7a14563973e4f561f8be7f562340ec8bc743b7885634c86f9bcb53c7b1b717c675
|
@@ -2,22 +2,16 @@ module Pacer
|
|
2
2
|
module Neo4j
|
3
3
|
class BlueprintsGraph < com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph
|
4
4
|
attr_accessor :allow_auto_tx
|
5
|
-
attr_reader :tx_depth
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def transaction
|
13
|
-
@tx_depth += 1
|
14
|
-
yield
|
15
|
-
ensure
|
16
|
-
@tx_depth -= 1
|
6
|
+
# Threadlocal tx_depth is set in Pacer's graph_transaction_mixin.rb
|
7
|
+
def tx_depth
|
8
|
+
graphs = Thread.current[:graphs] ||= {}
|
9
|
+
tgi = graphs[object_id] ||= {}
|
10
|
+
tgi[:tx_depth] || 0
|
17
11
|
end
|
18
12
|
|
19
13
|
def autoStartTransaction
|
20
|
-
if tx_depth != 0
|
14
|
+
if allow_auto_tx or tx_depth != 0
|
21
15
|
super
|
22
16
|
else
|
23
17
|
raise Pacer::TransactionError, "Can't mutate the graph outside a transaction block"
|
data/lib/pacer-neo4j/graph.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
1
3
|
module Pacer
|
2
4
|
module Neo4j
|
3
5
|
class Graph < PacerGraph
|
@@ -23,12 +25,6 @@ module Pacer
|
|
23
25
|
blueprints_graph.allow_auto_tx
|
24
26
|
end
|
25
27
|
|
26
|
-
def transaction(*args, &block)
|
27
|
-
blueprints_graph.transaction do
|
28
|
-
super
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
28
|
def cypher(query)
|
33
29
|
[query].to_route(element_type: :string, graph: self).cypher
|
34
30
|
end
|
@@ -42,6 +38,48 @@ module Pacer
|
|
42
38
|
end
|
43
39
|
end
|
44
40
|
|
41
|
+
# When a Neo4J graph is restarted, the ids of any elements that were deleted
|
42
|
+
# will be reused. Running this code immediately after starting the graph
|
43
|
+
# prevents Neo4J from reusing those IDs.
|
44
|
+
def prevent_id_reuse!
|
45
|
+
{
|
46
|
+
edges: prevent_edge_id_reuse!,
|
47
|
+
vertices: prevent_vertex_id_reuse!
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# This works by simply creating IDs until the ID of a new element is greater than
|
52
|
+
# either the max existing ID, or the min_new_id argument.
|
53
|
+
def prevent_vertex_id_reuse!(min_new_id = nil)
|
54
|
+
min_new_id ||= v.element_ids.max
|
55
|
+
g = blueprints_graph
|
56
|
+
n = 0
|
57
|
+
transaction do |_, rollback|
|
58
|
+
begin
|
59
|
+
n += 1
|
60
|
+
v = g.addVertex(nil)
|
61
|
+
end while v.getId < min_new_id
|
62
|
+
rollback.call
|
63
|
+
end
|
64
|
+
n
|
65
|
+
end
|
66
|
+
|
67
|
+
def prevent_edge_id_reuse!(min_new_id = nil)
|
68
|
+
min_new_id ||= e.element_ids.max
|
69
|
+
g = blueprints_graph
|
70
|
+
n = 0
|
71
|
+
transaction do |_, rollback|
|
72
|
+
v1 = g.addVertex nil
|
73
|
+
v2 = g.addVertex nil
|
74
|
+
begin
|
75
|
+
n += 1
|
76
|
+
e = g.addEdge(nil, v1, v2, "temp")
|
77
|
+
end while e.getId < min_new_id
|
78
|
+
rollback.call
|
79
|
+
end
|
80
|
+
n
|
81
|
+
end
|
82
|
+
|
45
83
|
def neo_graph
|
46
84
|
blueprints_graph.raw_graph
|
47
85
|
end
|
@@ -86,22 +124,38 @@ module Pacer
|
|
86
124
|
filters.properties.select { |k, v| key_indices(type).include?(k) and not v.nil? }
|
87
125
|
end
|
88
126
|
|
127
|
+
def lucene_set(k, v)
|
128
|
+
statements = v.map { |x| "#{k}:#{lucene_value(x)}" }
|
129
|
+
"(#{ statements.join(' OR ') })"
|
130
|
+
end
|
131
|
+
|
132
|
+
def lucene_range(k, v)
|
133
|
+
if v.min and v.max
|
134
|
+
encoded = encode_property(v.min)
|
135
|
+
if encoded.is_a? JDate
|
136
|
+
"#{k}:[#{lucene_value v.min} TO #{lucene_value v.max}]"
|
137
|
+
else
|
138
|
+
"#{k}:[#{lucene_value v.min} TO #{lucene_value v.max}]"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
89
143
|
def build_query(type, filters)
|
90
144
|
indexed = index_properties type, filters
|
91
145
|
if indexed.any?
|
92
146
|
indexed.map do |k, v|
|
93
147
|
k = k.to_s.gsub '/', '\\/'
|
94
148
|
if v.is_a? Range
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
149
|
+
lucene_range(k, v)
|
150
|
+
elsif v.class.name == 'RangeSet'
|
151
|
+
s = v.ranges.map { |r| lucene_range(k, r) }.join " OR "
|
152
|
+
"(#{s})"
|
153
|
+
elsif v.is_a? Set
|
154
|
+
lucene_set(k, v)
|
101
155
|
else
|
102
156
|
"#{k}:#{lucene_value v}"
|
103
157
|
end
|
104
|
-
end.join " AND "
|
158
|
+
end.compact.join " AND "
|
105
159
|
else
|
106
160
|
nil
|
107
161
|
end
|
@@ -113,7 +167,7 @@ module Pacer
|
|
113
167
|
f = SimpleDateFormat.new 'yyyyMMddHHmmssSSS'
|
114
168
|
f.format s
|
115
169
|
elsif s
|
116
|
-
if s.is_a? String
|
170
|
+
if s.is_a? String
|
117
171
|
s.inspect
|
118
172
|
else s
|
119
173
|
s
|
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.4"
|
4
4
|
JAR = "pacer-neo4j-#{ VERSION }-standalone.jar"
|
5
5
|
JAR_PATH = "lib/#{ JAR }"
|
6
|
-
BLUEPRINTS_VERSION = "2.
|
7
|
-
PIPES_VERSION = "2.
|
6
|
+
BLUEPRINTS_VERSION = "2.3.0"
|
7
|
+
PIPES_VERSION = "2.3.0"
|
8
8
|
PACER_REQ = ">= 1.1.2"
|
9
9
|
end
|
10
10
|
end
|
Binary file
|
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
|
-
<blueprints.version>2.
|
11
|
-
<gem.version>2.1.
|
12
|
-
<pipes.version>2.
|
10
|
+
<blueprints.version>2.3.0</blueprints.version>
|
11
|
+
<gem.version>2.1.4</gem.version>
|
12
|
+
<pipes.version>2.3.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>
|
@@ -32,11 +32,13 @@
|
|
32
32
|
<artifactId>blueprints-neo4j-graph</artifactId>
|
33
33
|
<version>${blueprints.version}</version>
|
34
34
|
</dependency>
|
35
|
+
<!--
|
35
36
|
<dependency>
|
36
37
|
<groupId>com.tinkerpop.blueprints</groupId>
|
37
38
|
<artifactId>blueprints-neo4jbatch-graph</artifactId>
|
38
39
|
<version>${blueprints.version}</version>
|
39
40
|
</dependency>
|
41
|
+
-->
|
40
42
|
</dependencies>
|
41
43
|
|
42
44
|
<repositories>
|
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pacer-neo4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 2.1.2
|
4
|
+
version: 2.1.4
|
6
5
|
platform: java
|
7
6
|
authors:
|
8
7
|
- Darrick Wiebe
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-07-04 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: pacer
|
16
15
|
version_requirements: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
|
-
- -
|
17
|
+
- - '>='
|
19
18
|
- !ruby/object:Gem::Version
|
20
19
|
version: 1.1.2
|
21
|
-
none: false
|
22
20
|
requirement: !ruby/object:Gem::Requirement
|
23
21
|
requirements:
|
24
|
-
- -
|
22
|
+
- - '>='
|
25
23
|
- !ruby/object:Gem::Version
|
26
24
|
version: 1.1.2
|
27
|
-
none: false
|
28
25
|
prerelease: false
|
29
26
|
type: :runtime
|
30
27
|
description: Neo4J jars and related code for Pacer
|
@@ -59,32 +56,29 @@ files:
|
|
59
56
|
- pacer-neo4j.gemspec
|
60
57
|
- pom.xml
|
61
58
|
- pom/standalone.xml
|
62
|
-
- lib/pacer-neo4j-2.1.
|
59
|
+
- lib/pacer-neo4j-2.1.4-standalone.jar
|
63
60
|
homepage: http://neo4j.org
|
64
61
|
licenses: []
|
62
|
+
metadata: {}
|
65
63
|
post_install_message:
|
66
64
|
rdoc_options: []
|
67
65
|
require_paths:
|
68
66
|
- lib
|
69
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
68
|
requirements:
|
71
|
-
- -
|
69
|
+
- - '>='
|
72
70
|
- !ruby/object:Gem::Version
|
73
|
-
version:
|
74
|
-
MA==
|
75
|
-
none: false
|
71
|
+
version: '0'
|
76
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
73
|
requirements:
|
78
|
-
- -
|
74
|
+
- - '>='
|
79
75
|
- !ruby/object:Gem::Version
|
80
|
-
version:
|
81
|
-
MA==
|
82
|
-
none: false
|
76
|
+
version: '0'
|
83
77
|
requirements: []
|
84
78
|
rubyforge_project: pacer-neo4j
|
85
|
-
rubygems_version:
|
79
|
+
rubygems_version: 2.0.3
|
86
80
|
signing_key:
|
87
|
-
specification_version:
|
81
|
+
specification_version: 4
|
88
82
|
summary: Neo4J jars and related code for Pacer
|
89
83
|
test_files: []
|
90
84
|
has_rdoc:
|