neo4j-core 3.0.0.alpha.15 → 3.0.0.alpha.16
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 490c0c0da4aaf218af104307ca6cbef8e5413dd9
|
4
|
+
data.tar.gz: 5cd481b1c909dc50f4321888a5d987302f156aac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 798f6c1f42835082807d2ac745e5caa6126dbb44ddf2f35d06906875d5bb331c88f374c33c30919e8a271da29a141d847b3b76a7d42416893cfb449b5d2fcce8
|
7
|
+
data.tar.gz: 0ef2c64a880bbf72b3aa9310cc8aa84710c401381e4ce7267bc39a01d11f2c0dd8d316ce0ba74ecaa537eb314f94922c68a98426f2b8fd761110d9c8613c75cb
|
data/lib/neo4j-core/version.rb
CHANGED
@@ -25,7 +25,7 @@ module Neo4j::Server
|
|
25
25
|
def create_rel(type, other_node, props = nil)
|
26
26
|
q = "START a=node(#{neo_id}), b=node(#{other_node.neo_id}) CREATE (a)-[r:`#{type}` #{cypher_prop_list(props)}]->(b) RETURN ID(r)"
|
27
27
|
id = @session._query_or_fail(q, true)
|
28
|
-
CypherRelationship.new(@session, id)
|
28
|
+
CypherRelationship.new(@session, id, type)
|
29
29
|
end
|
30
30
|
|
31
31
|
# (see Neo4j::Node#props)
|
@@ -140,14 +140,14 @@ module Neo4j::Server
|
|
140
140
|
|
141
141
|
# (see Neo4j::Node#rel)
|
142
142
|
def rel(match={})
|
143
|
-
result = match(CypherRelationship, "ID(r)", match)
|
143
|
+
result = match(CypherRelationship, "ID(r), TYPE(r)", match)
|
144
144
|
raise "Expected to only find one relationship from node #{neo_id} matching #{match.inspect} but found #{result.count}" if result.count > 1
|
145
145
|
result.first
|
146
146
|
end
|
147
147
|
|
148
148
|
# (see Neo4j::Node#rel?)
|
149
149
|
def rel?(match={})
|
150
|
-
result = match(CypherRelationship, "ID(r)", match)
|
150
|
+
result = match(CypherRelationship, "ID(r), TYPE(r)", match)
|
151
151
|
!!result.first
|
152
152
|
end
|
153
153
|
|
@@ -159,7 +159,7 @@ module Neo4j::Server
|
|
159
159
|
|
160
160
|
# (see Neo4j::Node#rels)
|
161
161
|
def rels(match = {dir: :both})
|
162
|
-
match(CypherRelationship, "ID(r)", match)
|
162
|
+
match(CypherRelationship, "ID(r), TYPE(r)", match)
|
163
163
|
end
|
164
164
|
|
165
165
|
# @private
|
@@ -181,8 +181,8 @@ module Neo4j::Server
|
|
181
181
|
def _map_result(r, clazz)
|
182
182
|
r.data.map do |rel|
|
183
183
|
next if r.uncommited? ? rel['row'].first.nil? : rel.first.nil?
|
184
|
-
|
185
|
-
clazz.new(@session,
|
184
|
+
row = r.uncommited? ? rel['row'] : rel
|
185
|
+
clazz.new(@session, *row).wrapper
|
186
186
|
end.compact
|
187
187
|
end
|
188
188
|
|
@@ -4,9 +4,10 @@ module Neo4j::Server
|
|
4
4
|
include Neo4j::Server::Resource
|
5
5
|
include Neo4j::Core::CypherTranslator
|
6
6
|
|
7
|
-
def initialize(session, id)
|
7
|
+
def initialize(session, id, rel_type)
|
8
8
|
@session = session
|
9
9
|
@id = id
|
10
|
+
@rel_type = rel_type
|
10
11
|
end
|
11
12
|
|
12
13
|
def ==(o)
|
@@ -78,6 +79,9 @@ module Neo4j::Server
|
|
78
79
|
properties
|
79
80
|
end
|
80
81
|
|
82
|
+
def rel_type
|
83
|
+
@rel_type.to_sym
|
84
|
+
end
|
81
85
|
|
82
86
|
def del
|
83
87
|
id = neo_id
|
@@ -87,9 +87,9 @@ module Neo4j::Server
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def load_relationship(neo_id)
|
90
|
-
cypher_response = _query("START r=relationship(#{neo_id}) RETURN r")
|
90
|
+
cypher_response = _query("START r=relationship(#{neo_id}) RETURN TYPE(r)")
|
91
91
|
if (!cypher_response.error?)
|
92
|
-
CypherRelationship.new(self, neo_id)
|
92
|
+
CypherRelationship.new(self, neo_id, cypher_response.first_data)
|
93
93
|
elsif (cypher_response.error_msg =~ /not found/) # Ugly that the Neo4j API gives us this error message
|
94
94
|
return nil
|
95
95
|
else
|