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: fd5430032c2297e86a4c69da88f95f3ec4f60a54
4
- data.tar.gz: cc6a1d7ac5a159b93f384df24cb87cd58cb27b7d
3
+ metadata.gz: 490c0c0da4aaf218af104307ca6cbef8e5413dd9
4
+ data.tar.gz: 5cd481b1c909dc50f4321888a5d987302f156aac
5
5
  SHA512:
6
- metadata.gz: e9fad0135b249201d7775a8b71710b0fcc04f257f208e2ebd02591ece50b5ae8fc2e9ff1cc581a71af2e715275f83cd4b9a44a6cd827c092cbebdaa04a6308ef
7
- data.tar.gz: cf64525b051f50d8a75b5a4a68c9a70a1910dee352195820e06d6f32246a40528e7e17cdc4785d86009a0a446e0422d7907203e5e80ce4dcc92e37e4caa0f7cb
6
+ metadata.gz: 798f6c1f42835082807d2ac745e5caa6126dbb44ddf2f35d06906875d5bb331c88f374c33c30919e8a271da29a141d847b3b76a7d42416893cfb449b5d2fcce8
7
+ data.tar.gz: 0ef2c64a880bbf72b3aa9310cc8aa84710c401381e4ce7267bc39a01d11f2c0dd8d316ce0ba74ecaa537eb314f94922c68a98426f2b8fd761110d9c8613c75cb
@@ -1,5 +1,5 @@
1
1
  module Neo4j
2
2
  module Core
3
- VERSION = "3.0.0.alpha.15"
3
+ VERSION = "3.0.0.alpha.16"
4
4
  end
5
5
  end
@@ -32,8 +32,13 @@ module Neo4j::Embedded
32
32
  end
33
33
 
34
34
  def rel_type
35
+ @_rel_type ||= _rel_type
36
+ end
37
+
38
+ def _rel_type
35
39
  getType().name().to_sym
36
40
  end
41
+ tx_methods :rel_type
37
42
 
38
43
  def del
39
44
  delete
@@ -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
- id = r.uncommited? ? rel['row'].first : rel.first
185
- clazz.new(@session, id).wrapper
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.alpha.15
4
+ version: 3.0.0.alpha.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge