neo4j-core 5.0.0.rc.2 → 5.0.0.rc.3
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/graph_json.rb +35 -0
- data/lib/neo4j-core/query_clauses.rb +2 -2
- data/lib/neo4j-core/version.rb +1 -1
- data/lib/neo4j-server/cypher_node.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efd3a180ba80337ada8311b1ca7dbf2c9d3a1d5b
|
4
|
+
data.tar.gz: feaef1009aca073d05b6ac7e54b22a746c76d552
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a141d208d880c0aa0ef8ac89c9264dffc382b84ce7c9703f376bb9fb8cf87fa8d19d28e25128c9312d9174d04cf24c3d6bb00482d8cd74d168d0478a98f7bc72
|
7
|
+
data.tar.gz: 8bfa569810bcacd5d96246864570ff642d50cfa7832bff07e4f14b4bb84b1bf01d4880ed496ce3539f87df834a17856836821e36dbe63593c1096e891ab5187d
|
@@ -0,0 +1,35 @@
|
|
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
|
@@ -465,8 +465,8 @@ module Neo4j
|
|
465
465
|
when String, Symbol then "#{key}:`#{value}`"
|
466
466
|
when Hash
|
467
467
|
if @options[:set_props]
|
468
|
-
|
469
|
-
"#{key} = {#{
|
468
|
+
@params["#{key}_set_props".freeze.to_sym] = value
|
469
|
+
"#{key} = {#{key}_set_props}"
|
470
470
|
else
|
471
471
|
value.map { |k, v| key_value_string("#{key}.`#{k}`", v, ['setter'], true) }
|
472
472
|
end
|
data/lib/neo4j-core/version.rb
CHANGED
@@ -31,7 +31,7 @@ module Neo4j
|
|
31
31
|
# (see Neo4j::Node#create_rel)
|
32
32
|
def create_rel(type, other_node, props = nil)
|
33
33
|
q = @session.query.match(:a, :b).where(a: {neo_id: neo_id}, b: {neo_id: other_node.neo_id})
|
34
|
-
.create("(a)-[r:`#{type}`]->(b)").break.
|
34
|
+
.create("(a)-[r:`#{type}`]->(b)").break.set_props(r: props).return(r: :neo_id)
|
35
35
|
|
36
36
|
id = @session._query_or_fail(q, true)
|
37
37
|
|
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.0.rc.
|
4
|
+
version: 5.0.0.rc.3
|
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-05-
|
11
|
+
date: 2015-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -262,6 +262,7 @@ 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
|
265
266
|
- lib/neo4j-core/hash_with_indifferent_access.rb
|
266
267
|
- lib/neo4j-core/helpers.rb
|
267
268
|
- lib/neo4j-core/label.rb
|