pacer-neo4j 1.1.1-java → 2.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.
- data/Rakefile +7 -1
- data/lib/pacer-neo4j/graph.rb +25 -123
- data/lib/pacer-neo4j/rspec.rb +0 -4
- data/lib/pacer-neo4j/version.rb +4 -3
- data/lib/{pacer-neo4j-1.1.1-standalone.jar → pacer-neo4j-2.0.0-standalone.jar} +0 -0
- data/lib/pacer-neo4j.rb +0 -4
- data/pacer-neo4j.gemspec +1 -1
- data/pom.xml +3 -3
- metadata +16 -13
- data/lib/pacer-neo4j/edge.rb +0 -36
- data/lib/pacer-neo4j/index.rb +0 -45
- data/lib/pacer-neo4j/vertex.rb +0 -11
data/Rakefile
CHANGED
@@ -22,8 +22,14 @@ file Pacer::Neo4j::JAR_PATH => 'pom.xml' do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
task :note do
|
25
|
-
puts "NOTE: touch lib/pacer-neo4j/version.rb to force everything to rebuild"
|
25
|
+
puts "NOTE: touch lib/pacer-neo4j/version.rb (or rake touch) to force everything to rebuild"
|
26
26
|
end
|
27
27
|
|
28
28
|
task :build => [:note, Pacer::Neo4j::JAR_PATH]
|
29
29
|
task :install => [:note, Pacer::Neo4j::JAR_PATH]
|
30
|
+
|
31
|
+
desc 'Touch version.rb so that the jar rebuilds'
|
32
|
+
task :touch do
|
33
|
+
system 'touch', 'lib/pacer-neo4j/version.rb'
|
34
|
+
end
|
35
|
+
|
data/lib/pacer-neo4j/graph.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
3
|
module Pacer
|
4
|
-
Neo4jGraph = com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jGraph
|
5
|
-
Neo4jElement = com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jElement
|
6
4
|
|
7
5
|
# Add 'static methods' to the Pacer namespace.
|
8
6
|
class << self
|
@@ -12,137 +10,41 @@ module Pacer
|
|
12
10
|
# If the graph is opened from a path, it will be registered to be closed by
|
13
11
|
# Ruby's at_exit callback, but if an already open graph is given, it will
|
14
12
|
# not.
|
13
|
+
#
|
14
|
+
# Please note that Pacer turns on Neo4j's checkElementsInTransaction
|
15
|
+
# feature by default. For some sort of performance improvement at
|
16
|
+
# the expense of an odd consistency model within transactions that
|
17
|
+
# require considerable more complexity in client code, you can use
|
18
|
+
# `graph.setCheckElementsInTransaction(false)` to disable the
|
19
|
+
# feature.
|
15
20
|
def neo4j(path_or_graph, args = nil)
|
21
|
+
neo = com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph
|
16
22
|
if path_or_graph.is_a? String
|
17
23
|
path = File.expand_path(path_or_graph)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
else
|
26
|
-
# Don't register the new graph so that it won't be automatically closed.
|
27
|
-
Neo4jGraph.new(path_or_graph)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
# Extend the java class imported from blueprints.
|
34
|
-
class Neo4jGraph
|
35
|
-
include GraphMixin
|
36
|
-
include GraphIndicesMixin
|
37
|
-
include GraphTransactionsMixin
|
38
|
-
include ManagedTransactionsMixin
|
39
|
-
include Pacer::Core::Route
|
40
|
-
include Pacer::Core::Graph::GraphRoute
|
41
|
-
include Pacer::Core::Graph::GraphIndexRoute
|
42
|
-
|
43
|
-
# Override to return an enumeration-friendly array of vertices.
|
44
|
-
def get_vertices
|
45
|
-
getVertices.to_route(:graph => self, :element_type => :vertex)
|
46
|
-
end
|
47
|
-
|
48
|
-
# Override to return an enumeration-friendly array of edges.
|
49
|
-
def get_edges
|
50
|
-
getEdges.to_route(:graph => self, :element_type => :edge)
|
51
|
-
end
|
52
|
-
|
53
|
-
def element_class
|
54
|
-
Neo4jElement
|
55
|
-
end
|
56
|
-
|
57
|
-
def vertex_class
|
58
|
-
Neo4jVertex
|
59
|
-
end
|
60
|
-
|
61
|
-
def edge_class
|
62
|
-
Neo4jEdge
|
63
|
-
end
|
64
|
-
|
65
|
-
def sanitize_properties(props)
|
66
|
-
pairs = props.map do |name, value|
|
67
|
-
[name, encode_property(value)]
|
68
|
-
end
|
69
|
-
Hash[pairs]
|
70
|
-
end
|
71
|
-
|
72
|
-
def encode_property(value)
|
73
|
-
case value
|
74
|
-
when nil
|
75
|
-
nil
|
76
|
-
when String
|
77
|
-
value = value.strip
|
78
|
-
value = nil if value == ''
|
79
|
-
value
|
80
|
-
when Numeric
|
81
|
-
if value.is_a? Bignum
|
82
|
-
value.to_yaml
|
83
|
-
else
|
84
|
-
value
|
85
|
-
end
|
86
|
-
when true, false
|
87
|
-
value
|
88
|
-
when Array
|
89
|
-
if value.length == 0
|
90
|
-
value_type = Fixnum
|
91
|
-
else
|
92
|
-
value_type = value.first.class
|
93
|
-
value_type = TrueClass if value_type == FalseClass
|
94
|
-
value.each do |v|
|
95
|
-
if value_type != v.class or (value == true or value == false and value_type == TrueClass)
|
96
|
-
value_type = nil
|
97
|
-
break
|
24
|
+
open = proc do
|
25
|
+
graph = Pacer.open_graphs[path]
|
26
|
+
unless graph
|
27
|
+
if args
|
28
|
+
graph = neo.new(path, args.to_hash_map)
|
29
|
+
else
|
30
|
+
graph = neo.new(path)
|
98
31
|
end
|
32
|
+
Pacer.open_graphs[path] = graph
|
33
|
+
graph.setCheckElementsInTransaction true
|
99
34
|
end
|
35
|
+
graph
|
100
36
|
end
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
when Float
|
105
|
-
value.to_java :double
|
106
|
-
when TrueClass
|
107
|
-
value.to_java :boolean
|
108
|
-
when String
|
109
|
-
value.to_java :string
|
110
|
-
else
|
111
|
-
value.to_yaml
|
37
|
+
shutdown = proc do |g|
|
38
|
+
g.blueprints_graph.shutdown
|
39
|
+
Pacer.open_graphs[path] = nil
|
112
40
|
end
|
41
|
+
PacerGraph.new(Pacer::YamlEncoder, open, shutdown)
|
113
42
|
else
|
114
|
-
|
115
|
-
|
116
|
-
end
|
117
|
-
|
118
|
-
if 'x'.to_yaml[0, 5] == '%YAML'
|
119
|
-
def decode_property(value)
|
120
|
-
if value.is_a? String and value[0, 5] == '%YAML'
|
121
|
-
YAML.load(value)
|
122
|
-
elsif value.is_a? ArrayJavaProxy
|
123
|
-
value.to_a
|
124
|
-
else
|
125
|
-
value
|
126
|
-
end
|
127
|
-
end
|
128
|
-
else
|
129
|
-
def decode_property(value)
|
130
|
-
if value.is_a? String and value[0, 3] == '---'
|
131
|
-
YAML.load(value)
|
132
|
-
elsif value.is_a? ArrayJavaProxy
|
133
|
-
value.to_a
|
134
|
-
else
|
135
|
-
value
|
136
|
-
end
|
43
|
+
# Don't register the new graph so that it won't be automatically closed.
|
44
|
+
PacerGraph.new Pacer::YamlEncoder, proc { graph.neo.new(path_or_graph) }
|
137
45
|
end
|
138
46
|
end
|
47
|
+
end
|
139
48
|
|
140
|
-
def supports_circular_edges?
|
141
|
-
false
|
142
|
-
end
|
143
49
|
|
144
|
-
def supports_custom_element_ids?
|
145
|
-
false
|
146
|
-
end
|
147
|
-
end
|
148
50
|
end
|
data/lib/pacer-neo4j/rspec.rb
CHANGED
@@ -33,11 +33,7 @@ class RSpec::GraphRunner
|
|
33
33
|
dir = Pathname.new(path3)
|
34
34
|
dir.rmtree if dir.exist?
|
35
35
|
@neo_graph_no_indices = Pacer.neo4j(path3)
|
36
|
-
@neo_graph_no_indices.drop_index :vertices
|
37
|
-
@neo_graph_no_indices.drop_index :edges
|
38
36
|
@neo_graph_no_indices
|
39
37
|
end
|
40
38
|
end
|
41
|
-
|
42
|
-
include Neo4j
|
43
39
|
end
|
data/lib/pacer-neo4j/version.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
module Pacer
|
2
2
|
module Neo4j
|
3
|
-
VERSION = "
|
3
|
+
VERSION = "2.0.0"
|
4
4
|
JAR = "pacer-neo4j-#{ VERSION }-standalone.jar"
|
5
5
|
JAR_PATH = "lib/#{ JAR }"
|
6
|
-
BLUEPRINTS_VERSION = "1.0"
|
7
|
-
PIPES_VERSION = "0
|
6
|
+
BLUEPRINTS_VERSION = "2.1.0"
|
7
|
+
PIPES_VERSION = "2.1.0"
|
8
|
+
PACER_REQ = ">= 1.0.0"
|
8
9
|
end
|
9
10
|
end
|
Binary file
|
data/lib/pacer-neo4j.rb
CHANGED
data/pacer-neo4j.gemspec
CHANGED
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
|
-
<gem.version>
|
11
|
-
<blueprints.version>1.0</blueprints.version>
|
12
|
-
<pipes.version>0
|
10
|
+
<gem.version>2.0.0</gem.version>
|
11
|
+
<blueprints.version>2.1.0</blueprints.version>
|
12
|
+
<pipes.version>2.1.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
@@ -1,25 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pacer-neo4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
4
5
|
prerelease:
|
5
|
-
version: 1.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: 2012-
|
12
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pacer
|
16
|
-
version_requirements:
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ! '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: 1.0.0
|
21
|
+
none: false
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.0.0
|
21
27
|
none: false
|
22
|
-
requirement: *2056
|
23
28
|
prerelease: false
|
24
29
|
type: :runtime
|
25
30
|
description: Neo4J jars and related code for Pacer
|
@@ -34,16 +39,13 @@ files:
|
|
34
39
|
- README.md
|
35
40
|
- Rakefile
|
36
41
|
- lib/pacer-neo4j.rb
|
37
|
-
- lib/pacer-neo4j/edge.rb
|
38
42
|
- lib/pacer-neo4j/graph.rb
|
39
|
-
- lib/pacer-neo4j/index.rb
|
40
43
|
- lib/pacer-neo4j/rspec.rb
|
41
44
|
- lib/pacer-neo4j/version.rb
|
42
|
-
- lib/pacer-neo4j/vertex.rb
|
43
45
|
- pacer-neo4j.gemspec
|
44
46
|
- pom.xml
|
45
47
|
- pom/standalone.xml
|
46
|
-
- lib/pacer-neo4j-
|
48
|
+
- lib/pacer-neo4j-2.0.0-standalone.jar
|
47
49
|
homepage: http://neo4j.org
|
48
50
|
licenses: []
|
49
51
|
post_install_message:
|
@@ -54,20 +56,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
56
|
requirements:
|
55
57
|
- - ! '>='
|
56
58
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
59
|
+
version: !binary |-
|
60
|
+
MA==
|
58
61
|
none: false
|
59
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
63
|
requirements:
|
61
64
|
- - ! '>='
|
62
65
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
66
|
+
version: !binary |-
|
67
|
+
MA==
|
64
68
|
none: false
|
65
69
|
requirements: []
|
66
70
|
rubyforge_project: pacer-neo4j
|
67
|
-
rubygems_version: 1.8.
|
71
|
+
rubygems_version: 1.8.24
|
68
72
|
signing_key:
|
69
73
|
specification_version: 3
|
70
74
|
summary: Neo4J jars and related code for Pacer
|
71
75
|
test_files: []
|
72
76
|
has_rdoc:
|
73
|
-
...
|
data/lib/pacer-neo4j/edge.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
module Pacer
|
4
|
-
Neo4jEdge = com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jEdge
|
5
|
-
|
6
|
-
# Extend the java class imported from blueprints.
|
7
|
-
class Neo4jEdge
|
8
|
-
include Pacer::Core::Graph::EdgesRoute
|
9
|
-
include ElementMixin
|
10
|
-
include EdgeMixin
|
11
|
-
|
12
|
-
def in_vertex(extensions = nil)
|
13
|
-
v = inVertex
|
14
|
-
v.graph = graph
|
15
|
-
if extensions.is_a? Enumerable
|
16
|
-
v.add_extensions extensions
|
17
|
-
elsif extensions
|
18
|
-
v.add_extensions [extensions]
|
19
|
-
else
|
20
|
-
v
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def out_vertex(extensions = nil)
|
25
|
-
v = outVertex
|
26
|
-
v.graph = graph
|
27
|
-
if extensions.is_a? Enumerable
|
28
|
-
v.add_extensions extensions
|
29
|
-
elsif extensions
|
30
|
-
v.add_extensions [extensions]
|
31
|
-
else
|
32
|
-
v
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
data/lib/pacer-neo4j/index.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
module Pacer
|
4
|
-
import com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jIndex
|
5
|
-
import com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jAutomaticIndex
|
6
|
-
|
7
|
-
class Neo4jIndex
|
8
|
-
include IndexMixin
|
9
|
-
JVertex = com.tinkerpop.blueprints.pgm.Vertex.java_class.to_java
|
10
|
-
JEdge = com.tinkerpop.blueprints.pgm.Edge.java_class.to_java
|
11
|
-
JNeo4jVertex = com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex.java_class.to_java
|
12
|
-
JNeo4jEdge = com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jEdge.java_class.to_java
|
13
|
-
|
14
|
-
def index_class
|
15
|
-
et = getIndexClass
|
16
|
-
if et == JVertex
|
17
|
-
JNeo4jVertex
|
18
|
-
elsif et == JEdge
|
19
|
-
JNeo4jEdge
|
20
|
-
else
|
21
|
-
et
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
class Neo4jAutomaticIndex
|
28
|
-
include IndexMixin
|
29
|
-
JVertex = com.tinkerpop.blueprints.pgm.Vertex.java_class.to_java
|
30
|
-
JEdge = com.tinkerpop.blueprints.pgm.Edge.java_class.to_java
|
31
|
-
JNeo4jVertex = com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex.java_class.to_java
|
32
|
-
JNeo4jEdge = com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jEdge.java_class.to_java
|
33
|
-
|
34
|
-
def index_class
|
35
|
-
et = getIndexClass
|
36
|
-
if et == JVertex
|
37
|
-
JNeo4jVertex
|
38
|
-
elsif et == JEdge
|
39
|
-
JNeo4jEdge
|
40
|
-
else
|
41
|
-
et
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/lib/pacer-neo4j/vertex.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
module Pacer
|
4
|
-
Neo4jVertex = com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex
|
5
|
-
# Extend the java class imported from blueprints.
|
6
|
-
class Neo4jVertex
|
7
|
-
include Pacer::Core::Graph::VerticesRoute
|
8
|
-
include ElementMixin
|
9
|
-
include VertexMixin
|
10
|
-
end
|
11
|
-
end
|