neo4j-core 3.0.0.alpha.17 → 3.0.0.alpha.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/neo4j-core/query.rb +13 -3
  3. data/lib/neo4j-core/query_clauses.rb +3 -1
  4. data/lib/neo4j-core/version.rb +1 -1
  5. data/lib/neo4j-embedded/property.rb +52 -10
  6. data/lib/neo4j-server/cypher_response.rb +1 -1
  7. metadata +2 -50
  8. data/lib/mydb/active_tx_log +0 -1
  9. data/lib/mydb/index/lucene-store.db +0 -0
  10. data/lib/mydb/index/lucene.log.active +0 -0
  11. data/lib/mydb/index/lucene.log.v0 +0 -0
  12. data/lib/mydb/messages.log +0 -684
  13. data/lib/mydb/neostore +0 -0
  14. data/lib/mydb/neostore.id +0 -0
  15. data/lib/mydb/neostore.labeltokenstore.db +0 -0
  16. data/lib/mydb/neostore.labeltokenstore.db.id +0 -0
  17. data/lib/mydb/neostore.labeltokenstore.db.names +0 -0
  18. data/lib/mydb/neostore.labeltokenstore.db.names.id +0 -0
  19. data/lib/mydb/neostore.nodestore.db +0 -0
  20. data/lib/mydb/neostore.nodestore.db.id +0 -0
  21. data/lib/mydb/neostore.nodestore.db.labels +0 -0
  22. data/lib/mydb/neostore.nodestore.db.labels.id +0 -0
  23. data/lib/mydb/neostore.propertystore.db +0 -0
  24. data/lib/mydb/neostore.propertystore.db.arrays +0 -0
  25. data/lib/mydb/neostore.propertystore.db.arrays.id +0 -0
  26. data/lib/mydb/neostore.propertystore.db.id +0 -0
  27. data/lib/mydb/neostore.propertystore.db.index +0 -0
  28. data/lib/mydb/neostore.propertystore.db.index.id +0 -0
  29. data/lib/mydb/neostore.propertystore.db.index.keys +0 -0
  30. data/lib/mydb/neostore.propertystore.db.index.keys.id +0 -0
  31. data/lib/mydb/neostore.propertystore.db.strings +0 -0
  32. data/lib/mydb/neostore.propertystore.db.strings.id +0 -0
  33. data/lib/mydb/neostore.relationshipgroupstore.db +0 -0
  34. data/lib/mydb/neostore.relationshipgroupstore.db.id +0 -0
  35. data/lib/mydb/neostore.relationshipstore.db +0 -0
  36. data/lib/mydb/neostore.relationshipstore.db.id +0 -0
  37. data/lib/mydb/neostore.relationshiptypestore.db +0 -1
  38. data/lib/mydb/neostore.relationshiptypestore.db.id +0 -0
  39. data/lib/mydb/neostore.relationshiptypestore.db.names +0 -0
  40. data/lib/mydb/neostore.relationshiptypestore.db.names.id +0 -0
  41. data/lib/mydb/neostore.schemastore.db +0 -0
  42. data/lib/mydb/neostore.schemastore.db.id +0 -0
  43. data/lib/mydb/nioneo_logical.log.active +0 -0
  44. data/lib/mydb/nioneo_logical.log.v0 +0 -0
  45. data/lib/mydb/schema/label/lucene/segments.gen +0 -0
  46. data/lib/mydb/schema/label/lucene/segments_1 +0 -0
  47. data/lib/mydb/store_lock +0 -0
  48. data/lib/mydb/tm_tx_log.1 +0 -0
  49. data/lib/neo4j/session.rb~ +0 -202
  50. data/lib/neo4j-core/version.rb~ +0 -5
  51. data/lib/neo4j-embedded/cypher_response.rb~ +0 -85
  52. data/lib/neo4j-embedded/embedded_node.rb~ +0 -201
  53. data/lib/neo4j-embedded/embedded_relationship.rb~ +0 -62
  54. data/lib/neo4j-embedded/embedded_session.rb~ +0 -145
  55. data/lib/neo4j-server/cypher_response.rb~ +0 -155
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8be042272113088b89f98c812d097faf22861cf
4
- data.tar.gz: 2e9a52899e194e0270a80dc09e01295b63277af4
3
+ metadata.gz: 189f7b0b7187d44d8f5825e6747c033bdba18380
4
+ data.tar.gz: d6748e42f17f0cd18d20009378e2101164df7d5b
5
5
  SHA512:
6
- metadata.gz: bd6fbbf822ad6aed46487b5059aa8d37a2802d38f349ad896fdd02c8330489f212b6bdda28df31ca5876f0115f9e95f8251c96705bcaea0936ee4520561f8b0f
7
- data.tar.gz: 4e5479f9e6d9dbb980add9ab44f381e17c125780424d9272e93629d4591ad4aa9af5ee1c026d00a9a04ce03b3cf6a0d8bfcd4bb6c840acc09c913676c5d26877
6
+ metadata.gz: b35a530b4637e5732589a0689a4125f5727b7ece75e4d2ba4c5efe45b1f4526a824bd3578a5510745c748b6a20a17dd563a96fbec2f3cfc6d49ad9bf0e4b8135
7
+ data.tar.gz: 5127606c4d29c68fe05ad77f79f0614dd16aa3e4faad3c025c7c821a96c8e2f2e643dd6faf9301cf5515362f96619d56b969a639c78dc42e539996556e6476dc
@@ -17,7 +17,7 @@ module Neo4j::Core
17
17
 
18
18
  @options = options
19
19
  @clauses = []
20
- @params = {}
20
+ @_params = {}
21
21
  end
22
22
 
23
23
  # @method start *args
@@ -136,13 +136,13 @@ module Neo4j::Core
136
136
  # Query.new.match('(q: Person {id: {id}})').params(id: 12)
137
137
  #
138
138
  def params(args)
139
- @params = @params.merge(args)
139
+ @_params = @_params.merge(args)
140
140
 
141
141
  self
142
142
  end
143
143
 
144
144
  def response
145
- response = @session._query(self.to_cypher, @params)
145
+ response = @session._query(self.to_cypher, @_params)
146
146
  if !response.respond_to?(:error?) || !response.error?
147
147
  response
148
148
  else
@@ -252,7 +252,17 @@ module Neo4j::Core
252
252
  "#{self.to_cypher} UNION#{options[:all] ? ' ALL' : ''} #{other_query.to_cypher}"
253
253
  end
254
254
 
255
+ def &(other_query)
256
+ raise "Sessions don't match!" if @session != other_query.session
257
+
258
+ self.class.new(session: @session).tap do |new_query|
259
+ new_query.options = self.options.merge(other_query.options)
260
+ new_query.clauses = self.clauses + other_query.clauses
261
+ end.params(other_query._params)
262
+ end
263
+
255
264
  protected
265
+ attr_accessor :session, :options, :clauses, :_params
256
266
 
257
267
  def add_clauses(clauses)
258
268
  @clauses += clauses
@@ -81,7 +81,7 @@ module Neo4j::Core
81
81
  else
82
82
  attributes_string = attributes_string(value)
83
83
  end
84
- when Class
84
+ when Class, Module
85
85
  var = key
86
86
  label_string = defined?(value::CYPHER_LABEL) ? value::CYPHER_LABEL : value.name
87
87
  else
@@ -171,6 +171,8 @@ module Neo4j::Core
171
171
  when Regexp
172
172
  pattern = (value.casefold? ? "(?i)" : "") + value.source
173
173
  "#{key} =~ #{escape_value(pattern.gsub(/\\/, '\\\\\\'))}"
174
+ when /^\{[^\{\}]+\}$/
175
+ "#{key} = #{value}"
174
176
  else
175
177
  "#{key} = #{value.inspect}"
176
178
  end
@@ -1,5 +1,5 @@
1
1
  module Neo4j
2
2
  module Core
3
- VERSION = "3.0.0.alpha.17"
3
+ VERSION = "3.0.0.alpha.18"
4
4
  end
5
5
  end
@@ -11,19 +11,33 @@ module Neo4j::Embedded::Property
11
11
 
12
12
  def [](key)
13
13
  return nil unless has_property?(key.to_s)
14
- get_property(key.to_s)
14
+ val = to_ruby_property(key.to_s)
15
15
  end
16
16
  tx_methods :[]
17
17
 
18
+ # Sets the property of this node.
19
+ # Property keys are always strings. Valid property value types are the primitives(<tt>String</tt>, <tt>Fixnum</tt>, <tt>Float</tt>, <tt>FalseClass</tt>, <tt>TrueClass</tt>) or array of those primitives.
20
+ #
21
+ # ==== Gotchas
22
+ # * Values in the array must be of the same type.
23
+ # * You can *not* delete or add one item in the array (e.g. person.phones.delete('123')) but instead you must create a new array instead.
24
+ #
25
+ # @param [String, Symbol] key of the property to set
26
+ # @param [String,Fixnum,Float,true,false, Array] value to set
27
+ def []=(k, v)
28
+ to_java_property(k, v)
29
+ end
30
+ tx_methods :[]=
31
+
18
32
  def props
19
33
  property_keys.inject({}) do |ret, key|
20
- ret[key.to_sym] = get_property(key)
34
+ val = to_ruby_property(key)
35
+ ret[key.to_sym] = val
21
36
  ret
22
37
  end
23
38
  end
24
39
  tx_methods :props
25
40
 
26
-
27
41
  def props=(hash)
28
42
  property_keys.each do |key|
29
43
  remove_property(key)
@@ -34,13 +48,7 @@ module Neo4j::Embedded::Property
34
48
  tx_methods :props=
35
49
 
36
50
  def _update_props(hash)
37
- hash.each_pair do |k,v|
38
- if v.nil?
39
- remove_property(k)
40
- else
41
- set_property(k,v)
42
- end
43
- end
51
+ hash.each_pair { |k,v| to_java_property(k, v) }
44
52
  hash
45
53
  end
46
54
 
@@ -52,4 +60,38 @@ module Neo4j::Embedded::Property
52
60
  def neo_id
53
61
  get_id
54
62
  end
63
+
64
+ private
65
+
66
+ def to_ruby_property(key)
67
+ val = get_property(key)
68
+ val.class.superclass == ArrayJavaProxy ? val.to_a : val
69
+ end
70
+
71
+ def to_java_property(k, v)
72
+ validate_property(v)
73
+
74
+ k = k.to_s
75
+ if v.nil?
76
+ remove_property(k)
77
+ elsif (Array === v)
78
+ case v[0]
79
+ when NilClass
80
+ set_property(k, [].to_java(:string))
81
+ when String
82
+ set_property(k, v.to_java(:string))
83
+ when Float
84
+ set_property(k, v.to_java(:double))
85
+ when FalseClass, TrueClass
86
+ set_property(k, v.to_java(:boolean))
87
+ when Fixnum
88
+ set_property(k, v.to_java(:long))
89
+ else
90
+ raise "Not allowed to store array with value #{v[0]} type #{v[0].class}"
91
+ end
92
+ else
93
+ set_property(k, v)
94
+ end
95
+ end
96
+
55
97
  end
@@ -71,7 +71,7 @@ module Neo4j::Server
71
71
  end
72
72
 
73
73
  attr_reader :struct
74
-
74
+
75
75
  def initialize(response, uncommited = false)
76
76
  @response = response
77
77
  @uncommited = uncommited
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.alpha.17
4
+ version: 3.0.0.alpha.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-09 00:00:00.000000000 Z
11
+ date: 2014-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -79,47 +79,6 @@ extra_rdoc_files:
79
79
  files:
80
80
  - Gemfile
81
81
  - README.md
82
- - lib/mydb/active_tx_log
83
- - lib/mydb/index/lucene-store.db
84
- - lib/mydb/index/lucene.log.active
85
- - lib/mydb/index/lucene.log.v0
86
- - lib/mydb/messages.log
87
- - lib/mydb/neostore
88
- - lib/mydb/neostore.id
89
- - lib/mydb/neostore.labeltokenstore.db
90
- - lib/mydb/neostore.labeltokenstore.db.id
91
- - lib/mydb/neostore.labeltokenstore.db.names
92
- - lib/mydb/neostore.labeltokenstore.db.names.id
93
- - lib/mydb/neostore.nodestore.db
94
- - lib/mydb/neostore.nodestore.db.id
95
- - lib/mydb/neostore.nodestore.db.labels
96
- - lib/mydb/neostore.nodestore.db.labels.id
97
- - lib/mydb/neostore.propertystore.db
98
- - lib/mydb/neostore.propertystore.db.arrays
99
- - lib/mydb/neostore.propertystore.db.arrays.id
100
- - lib/mydb/neostore.propertystore.db.id
101
- - lib/mydb/neostore.propertystore.db.index
102
- - lib/mydb/neostore.propertystore.db.index.id
103
- - lib/mydb/neostore.propertystore.db.index.keys
104
- - lib/mydb/neostore.propertystore.db.index.keys.id
105
- - lib/mydb/neostore.propertystore.db.strings
106
- - lib/mydb/neostore.propertystore.db.strings.id
107
- - lib/mydb/neostore.relationshipgroupstore.db
108
- - lib/mydb/neostore.relationshipgroupstore.db.id
109
- - lib/mydb/neostore.relationshipstore.db
110
- - lib/mydb/neostore.relationshipstore.db.id
111
- - lib/mydb/neostore.relationshiptypestore.db
112
- - lib/mydb/neostore.relationshiptypestore.db.id
113
- - lib/mydb/neostore.relationshiptypestore.db.names
114
- - lib/mydb/neostore.relationshiptypestore.db.names.id
115
- - lib/mydb/neostore.schemastore.db
116
- - lib/mydb/neostore.schemastore.db.id
117
- - lib/mydb/nioneo_logical.log.active
118
- - lib/mydb/nioneo_logical.log.v0
119
- - lib/mydb/schema/label/lucene/segments.gen
120
- - lib/mydb/schema/label/lucene/segments_1
121
- - lib/mydb/store_lock
122
- - lib/mydb/tm_tx_log.1
123
82
  - lib/neo4j-core.rb
124
83
  - lib/neo4j-core/cypher_translator.rb
125
84
  - lib/neo4j-core/hash_with_indifferent_access.rb
@@ -128,19 +87,14 @@ files:
128
87
  - lib/neo4j-core/query.rb
129
88
  - lib/neo4j-core/query_clauses.rb
130
89
  - lib/neo4j-core/version.rb
131
- - lib/neo4j-core/version.rb~
132
90
  - lib/neo4j-embedded.rb
133
91
  - lib/neo4j-embedded/cypher_response.rb
134
- - lib/neo4j-embedded/cypher_response.rb~
135
92
  - lib/neo4j-embedded/embedded_database.rb
136
93
  - lib/neo4j-embedded/embedded_impermanent_session.rb
137
94
  - lib/neo4j-embedded/embedded_label.rb
138
95
  - lib/neo4j-embedded/embedded_node.rb
139
- - lib/neo4j-embedded/embedded_node.rb~
140
96
  - lib/neo4j-embedded/embedded_relationship.rb
141
- - lib/neo4j-embedded/embedded_relationship.rb~
142
97
  - lib/neo4j-embedded/embedded_session.rb
143
- - lib/neo4j-embedded/embedded_session.rb~
144
98
  - lib/neo4j-embedded/property.rb
145
99
  - lib/neo4j-embedded/to_java.rb
146
100
  - lib/neo4j-server.rb
@@ -149,7 +103,6 @@ files:
149
103
  - lib/neo4j-server/cypher_node_uncommited.rb
150
104
  - lib/neo4j-server/cypher_relationship.rb
151
105
  - lib/neo4j-server/cypher_response.rb
152
- - lib/neo4j-server/cypher_response.rb~
153
106
  - lib/neo4j-server/cypher_session.rb
154
107
  - lib/neo4j-server/cypher_transaction.rb
155
108
  - lib/neo4j-server/neo4j_server_endpoint.rb
@@ -161,7 +114,6 @@ files:
161
114
  - lib/neo4j/property_validator.rb
162
115
  - lib/neo4j/relationship.rb
163
116
  - lib/neo4j/session.rb
164
- - lib/neo4j/session.rb~
165
117
  - lib/neo4j/tasks/neo4j_server.rb
166
118
  - lib/neo4j/transaction.rb
167
119
  - neo4j-core.gemspec
@@ -1 +0,0 @@
1
- tm_tx_log.1
Binary file
Binary file
Binary file