neo4j-core 3.0.0.alpha.13 → 3.0.0.alpha.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +60 -49
- data/lib/mydb/active_tx_log +1 -0
- data/lib/mydb/index/lucene-store.db +0 -0
- data/lib/mydb/index/lucene.log.1 +0 -0
- data/lib/mydb/index/lucene.log.active +0 -0
- data/lib/mydb/lock +0 -0
- data/lib/mydb/messages.log +313 -0
- data/lib/mydb/neostore +0 -0
- data/lib/mydb/neostore.id +0 -0
- data/lib/mydb/neostore.labeltokenstore.db +0 -0
- data/lib/mydb/neostore.labeltokenstore.db.id +0 -0
- data/lib/mydb/neostore.labeltokenstore.db.names +0 -0
- data/lib/mydb/neostore.labeltokenstore.db.names.id +0 -0
- data/lib/mydb/neostore.nodestore.db +0 -0
- data/lib/mydb/neostore.nodestore.db.id +0 -0
- data/lib/mydb/neostore.nodestore.db.labels +0 -0
- data/lib/mydb/neostore.nodestore.db.labels.id +0 -0
- data/lib/mydb/neostore.propertystore.db +0 -0
- data/lib/mydb/neostore.propertystore.db.arrays +0 -0
- data/lib/mydb/neostore.propertystore.db.arrays.id +0 -0
- data/lib/mydb/neostore.propertystore.db.id +0 -0
- data/lib/mydb/neostore.propertystore.db.index +0 -0
- data/lib/mydb/neostore.propertystore.db.index.id +0 -0
- data/lib/mydb/neostore.propertystore.db.index.keys +0 -0
- data/lib/mydb/neostore.propertystore.db.index.keys.id +0 -0
- data/lib/mydb/neostore.propertystore.db.strings +0 -0
- data/lib/mydb/neostore.propertystore.db.strings.id +0 -0
- data/lib/mydb/neostore.relationshipstore.db +0 -0
- data/lib/mydb/neostore.relationshipstore.db.id +0 -0
- data/lib/mydb/neostore.relationshiptypestore.db +0 -0
- data/lib/mydb/neostore.relationshiptypestore.db.id +0 -0
- data/lib/mydb/neostore.relationshiptypestore.db.names +0 -0
- data/lib/mydb/neostore.relationshiptypestore.db.names.id +0 -0
- data/lib/mydb/neostore.schemastore.db +0 -0
- data/lib/mydb/neostore.schemastore.db.id +0 -0
- data/lib/mydb/nioneo_logical.log.1 +0 -0
- data/lib/mydb/nioneo_logical.log.active +0 -0
- data/lib/mydb/schema/label/lucene/write.lock +0 -0
- data/lib/mydb/store_lock +0 -0
- data/lib/mydb/tm_tx_log.1 +0 -0
- data/lib/neo4j-core.rb +1 -2
- data/lib/neo4j-core/query_builder.rb +200 -0
- data/lib/neo4j-core/version.rb +1 -1
- data/lib/neo4j-embedded.rb +1 -0
- data/lib/neo4j-embedded/cypher_response.rb +89 -0
- data/lib/neo4j-embedded/cypher_response.rb~ +85 -0
- data/lib/neo4j-embedded/embedded_node.rb +12 -0
- data/lib/neo4j-embedded/embedded_node.rb~ +201 -0
- data/lib/neo4j-embedded/embedded_relationship.rb +8 -0
- data/lib/neo4j-embedded/embedded_relationship.rb~ +62 -0
- data/lib/neo4j-embedded/embedded_session.rb +20 -12
- data/lib/neo4j-embedded/embedded_session.rb~ +145 -0
- data/lib/neo4j-server/cypher_relationship.rb +6 -11
- data/lib/neo4j-server/cypher_response.rb +43 -5
- data/lib/neo4j-server/cypher_response.rb~ +155 -0
- data/lib/neo4j-server/cypher_session.rb +54 -19
- data/lib/neo4j/label.rb +7 -51
- data/lib/neo4j/node.rb +21 -19
- data/lib/neo4j/relationship.rb +7 -7
- data/lib/neo4j/session.rb +70 -28
- data/lib/neo4j/session.rb~ +202 -0
- data/neo4j-core.gemspec +0 -1
- metadata +49 -16
@@ -8,6 +8,10 @@ module Neo4j::Embedded
|
|
8
8
|
@match = match
|
9
9
|
end
|
10
10
|
|
11
|
+
def inspect
|
12
|
+
"Enumerable<Neo4j::Relationship>"
|
13
|
+
end
|
14
|
+
|
11
15
|
def each(&block)
|
12
16
|
@node._rels(@match).each {|r| block.call(r.wrapper)}
|
13
17
|
end
|
@@ -28,6 +32,10 @@ module Neo4j::Embedded
|
|
28
32
|
@match = match
|
29
33
|
end
|
30
34
|
|
35
|
+
def inspect
|
36
|
+
"Enumerable<Neo4j::Node>"
|
37
|
+
end
|
38
|
+
|
31
39
|
def each(&block)
|
32
40
|
@node._rels(@match).each {|r| block.call(r.other_node(@node))}
|
33
41
|
end
|
@@ -48,6 +56,10 @@ module Neo4j::Embedded
|
|
48
56
|
include Neo4j::EntityEquality
|
49
57
|
extend Neo4j::Core::TxMethods
|
50
58
|
|
59
|
+
def inspect
|
60
|
+
"EmbeddedNode neo_id: #{neo_id}"
|
61
|
+
end
|
62
|
+
|
51
63
|
def exist?
|
52
64
|
!!graph_database.get_node_by_id(neo_id)
|
53
65
|
rescue Java::OrgNeo4jGraphdb.NotFoundException
|
@@ -0,0 +1,201 @@
|
|
1
|
+
module Neo4j::Embedded
|
2
|
+
class RelsIterator
|
3
|
+
include Enumerable
|
4
|
+
extend Neo4j::Core::TxMethods
|
5
|
+
|
6
|
+
def initialize(node, match)
|
7
|
+
@node = node
|
8
|
+
@match = match
|
9
|
+
end
|
10
|
+
|
11
|
+
def inspect
|
12
|
+
"Enumerable<Neo4j::Relationship>"
|
13
|
+
end
|
14
|
+
|
15
|
+
def each(&block)
|
16
|
+
@node._rels(@match).each {|r| block.call(r.wrapper)}
|
17
|
+
end
|
18
|
+
tx_methods :each
|
19
|
+
|
20
|
+
def empty?
|
21
|
+
first == nil
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
class NodesIterator
|
27
|
+
include Enumerable
|
28
|
+
extend Neo4j::Core::TxMethods
|
29
|
+
|
30
|
+
def initialize(node, match)
|
31
|
+
@node = node
|
32
|
+
@match = match
|
33
|
+
end
|
34
|
+
|
35
|
+
def each(&block)
|
36
|
+
@node._rels(@match).each {|r| block.call(r.other_node(@node))}
|
37
|
+
end
|
38
|
+
tx_methods :each
|
39
|
+
|
40
|
+
def empty?
|
41
|
+
first == nil
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
class EmbeddedNode
|
47
|
+
class << self
|
48
|
+
# This method is used to extend a Java Neo4j class so that it includes the same mixins as this class.
|
49
|
+
def extend_java_class(java_clazz)
|
50
|
+
java_clazz.class_eval do
|
51
|
+
include Neo4j::Embedded::Property
|
52
|
+
include Neo4j::EntityEquality
|
53
|
+
extend Neo4j::Core::TxMethods
|
54
|
+
|
55
|
+
def inspect
|
56
|
+
"EmbeddedNode neo_id: #{neo_id}"
|
57
|
+
end
|
58
|
+
|
59
|
+
def exist?
|
60
|
+
!!graph_database.get_node_by_id(neo_id)
|
61
|
+
rescue Java::OrgNeo4jGraphdb.NotFoundException
|
62
|
+
nil
|
63
|
+
end
|
64
|
+
tx_methods :exist?
|
65
|
+
|
66
|
+
def labels
|
67
|
+
_labels.iterator.map{|x| x.name.to_sym}
|
68
|
+
end
|
69
|
+
tx_methods :labels
|
70
|
+
|
71
|
+
alias_method :_labels, :getLabels
|
72
|
+
|
73
|
+
def _java_label(label_name)
|
74
|
+
Java::OrgNeo4jGraphdb.DynamicLabel.label(label_name)
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
def _add_label(*label_name)
|
79
|
+
label_name.each do |name|
|
80
|
+
addLabel(_java_label(name))
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
alias_method :add_label, :_add_label
|
85
|
+
tx_methods :add_label
|
86
|
+
|
87
|
+
def _remove_label(*label_name)
|
88
|
+
label_name.each do |name|
|
89
|
+
removeLabel(_java_label(name))
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
alias_method :remove_label, :_remove_label
|
94
|
+
tx_methods :remove_label
|
95
|
+
|
96
|
+
def set_label(*label_names)
|
97
|
+
label_as_symbols = label_names.map(&:to_sym)
|
98
|
+
to_keep = labels & label_as_symbols
|
99
|
+
to_remove = labels - to_keep
|
100
|
+
_remove_label(*to_remove)
|
101
|
+
to_add = label_as_symbols - to_keep
|
102
|
+
_add_label(*to_add)
|
103
|
+
end
|
104
|
+
tx_methods :set_label
|
105
|
+
|
106
|
+
def del
|
107
|
+
_rels.each { |r| r.del }
|
108
|
+
delete
|
109
|
+
nil
|
110
|
+
end
|
111
|
+
tx_methods :del
|
112
|
+
|
113
|
+
def create_rel(type, other_node, props = nil)
|
114
|
+
rel = create_relationship_to(other_node.neo4j_obj, ToJava.type_to_java(type))
|
115
|
+
props.each_pair { |k, v| rel[k] = v } if props
|
116
|
+
rel
|
117
|
+
end
|
118
|
+
tx_methods :create_rel
|
119
|
+
|
120
|
+
|
121
|
+
def rels(match={})
|
122
|
+
RelsIterator.new(self, match)
|
123
|
+
end
|
124
|
+
|
125
|
+
def nodes(match={})
|
126
|
+
NodesIterator.new(self, match)
|
127
|
+
end
|
128
|
+
|
129
|
+
def node(match={})
|
130
|
+
rel = _rel(match)
|
131
|
+
rel && rel.other_node(self).wrapper
|
132
|
+
end
|
133
|
+
tx_methods :node
|
134
|
+
|
135
|
+
def rel?(match={})
|
136
|
+
_rels(match).has_next
|
137
|
+
end
|
138
|
+
tx_methods :rel?
|
139
|
+
|
140
|
+
def rel(match={})
|
141
|
+
_rel(match)
|
142
|
+
end
|
143
|
+
tx_methods :rel
|
144
|
+
|
145
|
+
def _rel(match={})
|
146
|
+
dir = match[:dir] || :both
|
147
|
+
rel_type = match[:type]
|
148
|
+
|
149
|
+
rel = if rel_type
|
150
|
+
get_single_relationship(ToJava.type_to_java(rel_type), ToJava.dir_to_java(dir))
|
151
|
+
else
|
152
|
+
iter = get_relationships(ToJava.dir_to_java(dir)).iterator
|
153
|
+
if (iter.has_next)
|
154
|
+
first = iter.next
|
155
|
+
raise "Expected to only find one relationship from node #{neo_id} matching #{match.inspect}" if iter.has_next
|
156
|
+
first
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
between_id = match[:between] && match[:between].neo_id
|
161
|
+
|
162
|
+
if (rel && between_id)
|
163
|
+
rel.other_node(self).neo_id == between_id ? rel : nil
|
164
|
+
else
|
165
|
+
rel
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def _rels(match={})
|
170
|
+
dir = match[:dir] || :both
|
171
|
+
rel_type = match[:type]
|
172
|
+
|
173
|
+
rels = if rel_type
|
174
|
+
get_relationships(ToJava.type_to_java(rel_type), ToJava.dir_to_java(dir)).iterator
|
175
|
+
else
|
176
|
+
get_relationships(ToJava.dir_to_java(dir)).iterator
|
177
|
+
end
|
178
|
+
|
179
|
+
between_id = match[:between] && match[:between].neo_id
|
180
|
+
|
181
|
+
if (between_id)
|
182
|
+
rels.find_all{|r| r.end_node.neo_id == between_id || r.start_node.neo_id == between_id}
|
183
|
+
else
|
184
|
+
rels
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
def class
|
190
|
+
Neo4j::Node
|
191
|
+
end
|
192
|
+
|
193
|
+
include Neo4j::Node::Wrapper
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
extend_java_class(Java::OrgNeo4jKernelImplCore::NodeProxy)
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
@@ -18,6 +18,10 @@ module Neo4j::Embedded
|
|
18
18
|
end
|
19
19
|
tx_methods :exist?
|
20
20
|
|
21
|
+
def inspect
|
22
|
+
"EmbeddedRelationship neo_id: #{neo_id}"
|
23
|
+
end
|
24
|
+
|
21
25
|
def start_node
|
22
26
|
_start_node.wrapper
|
23
27
|
end
|
@@ -27,6 +31,10 @@ module Neo4j::Embedded
|
|
27
31
|
getStartNode
|
28
32
|
end
|
29
33
|
|
34
|
+
def rel_type
|
35
|
+
getType().name().to_sym
|
36
|
+
end
|
37
|
+
|
30
38
|
def del
|
31
39
|
delete
|
32
40
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Neo4j::Embedded
|
2
|
+
class EmbeddedRelationship
|
3
|
+
class << self
|
4
|
+
# This method is used to extend a Java Neo4j class so that it includes the same mixins as this class.
|
5
|
+
def extend_java_class(java_clazz)
|
6
|
+
java_clazz.class_eval do
|
7
|
+
include Neo4j::Embedded::Property
|
8
|
+
include Neo4j::EntityEquality
|
9
|
+
include Neo4j::Relationship::Wrapper
|
10
|
+
extend Neo4j::Core::TxMethods
|
11
|
+
|
12
|
+
alias_method :_other_node, :getOtherNode
|
13
|
+
|
14
|
+
def exist?
|
15
|
+
!!graph_database.get_relationship_by_id(neo_id)
|
16
|
+
rescue Java::OrgNeo4jGraphdb.NotFoundException
|
17
|
+
nil
|
18
|
+
end
|
19
|
+
tx_methods :exist?
|
20
|
+
|
21
|
+
def start_node
|
22
|
+
_start_node.wrapper
|
23
|
+
end
|
24
|
+
tx_methods :start_node
|
25
|
+
|
26
|
+
def _start_node
|
27
|
+
getStartNode
|
28
|
+
end
|
29
|
+
|
30
|
+
def rel_type
|
31
|
+
getType().name().to_sym
|
32
|
+
end
|
33
|
+
|
34
|
+
def del
|
35
|
+
delete
|
36
|
+
end
|
37
|
+
tx_methods :del
|
38
|
+
|
39
|
+
def other_node(n)
|
40
|
+
_other_node(n.neo4j_obj).wrapper
|
41
|
+
end
|
42
|
+
tx_methods :other_node
|
43
|
+
|
44
|
+
def end_node
|
45
|
+
_end_node.wrapper
|
46
|
+
end
|
47
|
+
tx_methods :end_node
|
48
|
+
|
49
|
+
def _end_node
|
50
|
+
getEndNode
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
extend_java_class(Java::OrgNeo4jKernelImplCore::RelationshipProxy)
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
end
|
@@ -21,6 +21,11 @@ module Neo4j::Embedded
|
|
21
21
|
@db_location = db_location
|
22
22
|
@auto_commit = !!config[:auto_commit]
|
23
23
|
Neo4j::Session.register(self)
|
24
|
+
@query_builder = Neo4j::Core::QueryBuilder.new
|
25
|
+
end
|
26
|
+
|
27
|
+
def inspect
|
28
|
+
"#{self.class} db_location: '#{@db_location}', running: #{running?}"
|
24
29
|
end
|
25
30
|
|
26
31
|
def start
|
@@ -80,15 +85,17 @@ module Neo4j::Embedded
|
|
80
85
|
nil
|
81
86
|
end
|
82
87
|
|
83
|
-
def query(*params
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
raise CypherError.new(e,nil,nil)
|
88
|
+
def query(*params)
|
89
|
+
query_hash = @query_builder.to_query_hash(params, :to_node)
|
90
|
+
cypher = @query_builder.to_cypher(query_hash)
|
91
|
+
|
92
|
+
result = _query(cypher, query_hash[:params])
|
93
|
+
if result.respond_to?(:error?) && result.error?
|
94
|
+
raise Neo4j::Session::CypherError.new(result.error_msg, result.error_code, result.error_status)
|
91
95
|
end
|
96
|
+
|
97
|
+
map_return_procs = @query_builder.to_map_return_procs(query_hash)
|
98
|
+
ResultWrapper.new(result, map_return_procs, cypher)
|
92
99
|
end
|
93
100
|
|
94
101
|
def find_all_nodes(label)
|
@@ -105,12 +112,13 @@ module Neo4j::Embedded
|
|
105
112
|
# @return (see #query)
|
106
113
|
def _query(q, params={})
|
107
114
|
engine = Java::OrgNeo4jCypherJavacompat::ExecutionEngine.new(@graph_db)
|
108
|
-
|
109
|
-
|
115
|
+
engine.execute(q, Neo4j::Core::HashWithIndifferentAccess.new(params))
|
116
|
+
rescue Exception => e
|
117
|
+
raise Neo4j::Session::CypherError.new(e.message, e.class, 'cypher error')
|
110
118
|
end
|
111
119
|
|
112
|
-
def query_default_return
|
113
|
-
" RETURN
|
120
|
+
def query_default_return(as)
|
121
|
+
" RETURN #{as}"
|
114
122
|
end
|
115
123
|
|
116
124
|
def _query_or_fail(q)
|
@@ -0,0 +1,145 @@
|
|
1
|
+
# Plugin
|
2
|
+
|
3
|
+
Neo4j::Session.register_db(:embedded_db) do |*args|
|
4
|
+
Neo4j::Embedded::EmbeddedSession.new(*args)
|
5
|
+
end
|
6
|
+
|
7
|
+
|
8
|
+
module Neo4j::Embedded
|
9
|
+
class EmbeddedSession < Neo4j::Session
|
10
|
+
|
11
|
+
class Error < StandardError
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_reader :graph_db, :db_location
|
15
|
+
extend Forwardable
|
16
|
+
extend Neo4j::Core::TxMethods
|
17
|
+
def_delegator :@graph_db, :begin_tx
|
18
|
+
|
19
|
+
|
20
|
+
def initialize(db_location, config={})
|
21
|
+
@db_location = db_location
|
22
|
+
@auto_commit = !!config[:auto_commit]
|
23
|
+
Neo4j::Session.register(self)
|
24
|
+
@query_builder = Neo4j::Core::QueryBuilder.new
|
25
|
+
end
|
26
|
+
|
27
|
+
def start
|
28
|
+
raise Error.new("Embedded Neo4j db is already running") if running?
|
29
|
+
puts "Start embedded Neo4j db at #{db_location}"
|
30
|
+
factory = Java::OrgNeo4jGraphdbFactory::GraphDatabaseFactory.new
|
31
|
+
@graph_db = factory.newEmbeddedDatabase(db_location)
|
32
|
+
Neo4j::Session._notify_listeners(:session_available, self)
|
33
|
+
end
|
34
|
+
|
35
|
+
def factory_class
|
36
|
+
Java::OrgNeo4jGraphdbFactory::GraphDatabaseFactory
|
37
|
+
Java::OrgNeo4jTest::ImpermanentGraphDatabase
|
38
|
+
end
|
39
|
+
|
40
|
+
def close
|
41
|
+
super
|
42
|
+
shutdown
|
43
|
+
end
|
44
|
+
|
45
|
+
def shutdown
|
46
|
+
graph_db && graph_db.shutdown
|
47
|
+
@graph_db = nil
|
48
|
+
end
|
49
|
+
|
50
|
+
def running?
|
51
|
+
!!graph_db
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_label(name)
|
55
|
+
EmbeddedLabel.new(self, name)
|
56
|
+
end
|
57
|
+
|
58
|
+
def load_node(neo_id)
|
59
|
+
_load_node(neo_id)
|
60
|
+
end
|
61
|
+
tx_methods :load_node
|
62
|
+
|
63
|
+
# Same as load but does not return the node as a wrapped Ruby object.
|
64
|
+
#
|
65
|
+
def _load_node(neo_id)
|
66
|
+
return nil if neo_id.nil?
|
67
|
+
@graph_db.get_node_by_id(neo_id.to_i)
|
68
|
+
rescue Java::OrgNeo4jGraphdb.NotFoundException
|
69
|
+
nil
|
70
|
+
end
|
71
|
+
|
72
|
+
def load_relationship(neo_id)
|
73
|
+
_load_relationship(neo_id)
|
74
|
+
end
|
75
|
+
tx_methods :load_relationship
|
76
|
+
|
77
|
+
def _load_relationship(neo_id)
|
78
|
+
return nil if neo_id.nil?
|
79
|
+
@graph_db.get_relationship_by_id(neo_id.to_i)
|
80
|
+
rescue Java::OrgNeo4jGraphdb.NotFoundException
|
81
|
+
nil
|
82
|
+
end
|
83
|
+
|
84
|
+
def query(*params)
|
85
|
+
query_hash = @query_builder.to_query_hash(params, :to_node)
|
86
|
+
cypher = @query_builder.to_cypher(query_hash)
|
87
|
+
|
88
|
+
result = _query(cypher, query_hash[:params])
|
89
|
+
if result.respond_to?(:error?) && result.error?
|
90
|
+
raise Neo4j::Session::CypherError.new(result.error_msg, result.error_code, result.error_status)
|
91
|
+
end
|
92
|
+
|
93
|
+
map_return_procs = @query_builder.to_map_return_procs(query_hash)
|
94
|
+
ResultWrapper.new(result, map_return_procs, cypher)
|
95
|
+
end
|
96
|
+
|
97
|
+
def find_all_nodes(label)
|
98
|
+
EmbeddedLabel.new(self, label).find_nodes
|
99
|
+
end
|
100
|
+
|
101
|
+
def find_nodes(label, key, value)
|
102
|
+
EmbeddedLabel.new(self, label).find_nodes(key,value)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Performs a cypher query with given string.
|
106
|
+
# Remember that you should close the resource iterator.
|
107
|
+
# @param [String] q the cypher query as a String
|
108
|
+
# @return (see #query)
|
109
|
+
def _query(q, params={})
|
110
|
+
engine = Java::OrgNeo4jCypherJavacompat::ExecutionEngine.new(@graph_db)
|
111
|
+
engine.execute(q, Neo4j::Core::HashWithIndifferentAccess.new(params))
|
112
|
+
rescue Exception => e
|
113
|
+
raise Neo4j::Session::CypherError.new(e.message, e.class, 'cypher error')
|
114
|
+
end
|
115
|
+
|
116
|
+
def query_default_return(as)
|
117
|
+
" RETURN #{as}"
|
118
|
+
end
|
119
|
+
|
120
|
+
def _query_or_fail(q)
|
121
|
+
engine = Java::OrgNeo4jCypherJavacompat::ExecutionEngine.new(@graph_db)
|
122
|
+
engine.execute(q)
|
123
|
+
end
|
124
|
+
|
125
|
+
def search_result_to_enumerable(result)
|
126
|
+
result.map {|column| column['n'].wrapper}
|
127
|
+
end
|
128
|
+
|
129
|
+
def create_node(properties = nil, labels=[])
|
130
|
+
if labels.empty?
|
131
|
+
_java_node = graph_db.create_node
|
132
|
+
else
|
133
|
+
labels = EmbeddedLabel.as_java(labels)
|
134
|
+
_java_node = graph_db.create_node(labels)
|
135
|
+
end
|
136
|
+
properties.each_pair { |k, v| _java_node[k]=v } if properties
|
137
|
+
_java_node
|
138
|
+
end
|
139
|
+
tx_methods :create_node
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
end
|