neo4j-core 5.0.7 → 5.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/neo4j-core/query_clauses.rb +15 -5
- data/lib/neo4j-core/version.rb +1 -1
- metadata +2 -3
- data/lib/neo4j-core/graph_json.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51b5f49436107e6cb6e21dab6fbcaf3ab9b34d7e
|
4
|
+
data.tar.gz: 2d5abdedb5801e570b574be1c11775205f0f02dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 743eb5fe7dade48408e0d6f960c2889d1b44bf383da67ac6f9550932b3ba69f5157aadd5acab38807124317b7f0bca7641e63481d0af205a7320d3401cb452f4
|
7
|
+
data.tar.gz: 06a8b66c2b710bbc47d5ceeb2627eaa7224653e377265a331baa01bbbf4f5d23c5f78c0f9af2a86d012c2429eecc06a48b2aff52018ac14626831050ab4f3f5f
|
@@ -141,12 +141,16 @@ module Neo4j
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
+
def self.paramaterize_key!(key)
|
145
|
+
key.tr_s!('^a-zA-Z0-9', UNDERSCORE)
|
146
|
+
key.gsub!(/^_+|_+$/, '')
|
147
|
+
end
|
148
|
+
|
144
149
|
private
|
145
150
|
|
146
151
|
def key_value_string(key, value, previous_keys = [], is_set = false)
|
147
152
|
param = (previous_keys << key).join(UNDERSCORE)
|
148
|
-
|
149
|
-
param.gsub!(/^_+|_+$/, '')
|
153
|
+
self.class.paramaterize_key!(param)
|
150
154
|
|
151
155
|
if value.is_a?(Range)
|
152
156
|
add_params("#{param}_range_min" => value.min, "#{param}_range_max" => value.max)
|
@@ -237,7 +241,7 @@ module Neo4j
|
|
237
241
|
case value
|
238
242
|
when Hash then hash_key_value_string(key, value, previous_keys)
|
239
243
|
when NilClass then "#{key} IS NULL"
|
240
|
-
when Regexp then regexp_key_value_string(key, value)
|
244
|
+
when Regexp then regexp_key_value_string(key, value, previous_keys)
|
241
245
|
when Array, Range then key_value_string(key, value, previous_keys)
|
242
246
|
else
|
243
247
|
key_value_string(key, value, previous_keys)
|
@@ -263,9 +267,15 @@ module Neo4j
|
|
263
267
|
end.join(AND)
|
264
268
|
end
|
265
269
|
|
266
|
-
def regexp_key_value_string(key, value)
|
270
|
+
def regexp_key_value_string(key, value, previous_keys)
|
267
271
|
pattern = (value.casefold? ? '(?i)' : '') + value.source
|
268
|
-
|
272
|
+
|
273
|
+
param = [previous_keys + [key]].join(UNDERSCORE)
|
274
|
+
self.class.paramaterize_key!(param)
|
275
|
+
|
276
|
+
add_params(param => pattern)
|
277
|
+
|
278
|
+
"#{key} =~ {#{param}}"
|
269
279
|
end
|
270
280
|
|
271
281
|
class << self
|
data/lib/neo4j-core/version.rb
CHANGED
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: 5.0.
|
4
|
+
version: 5.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Ronge, Chris Grigg, Brian Underwood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -262,7 +262,6 @@ files:
|
|
262
262
|
- lib/neo4j-core.rb
|
263
263
|
- lib/neo4j-core/active_entity.rb
|
264
264
|
- lib/neo4j-core/cypher_translator.rb
|
265
|
-
- lib/neo4j-core/graph_json.rb
|
266
265
|
- lib/neo4j-core/hash_with_indifferent_access.rb
|
267
266
|
- lib/neo4j-core/helpers.rb
|
268
267
|
- lib/neo4j-core/label.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module Neo4j
|
2
|
-
module Core
|
3
|
-
module GraphJSON
|
4
|
-
def self.to_graph_json(objects)
|
5
|
-
nodes = {}
|
6
|
-
edges = {}
|
7
|
-
|
8
|
-
objects.each do |object|
|
9
|
-
case object
|
10
|
-
when Neo4j::ActiveNode, Neo4j::Server::CypherNode
|
11
|
-
nodes[object.neo_id] = {
|
12
|
-
id: object.neo_id,
|
13
|
-
labels: (object.is_a?(Neo4j::ActiveNode) ? [object.class.name] : object.labels),
|
14
|
-
properties: object.attributes
|
15
|
-
}
|
16
|
-
when Neo4j::ActiveRel, Neo4j::Server::CypherRelationship
|
17
|
-
edges[[object.start_node.neo_id, object.end_node.neo_id]] = {
|
18
|
-
source: object.start_node.neo_id,
|
19
|
-
target: object.end_node.neo_id,
|
20
|
-
type: object.rel_type,
|
21
|
-
properties: object.props
|
22
|
-
}
|
23
|
-
else
|
24
|
-
fail "Invalid value found: #{object.inspect}"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
{
|
29
|
-
nodes: nodes.values,
|
30
|
-
edges: edges.values
|
31
|
-
}.to_json
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|