neo4j-core 5.0.3 → 5.0.4

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: d2160daa8962ca2c3473801e1a9bd5aa69d49f3f
4
- data.tar.gz: b2dd9812b8e775c8e827376dd753d6d3fe20aaf8
3
+ metadata.gz: a37e37a07f6054aaeac7358caded883bcfd4bb5f
4
+ data.tar.gz: e7ca9a6f7dbbe383e84d9f70f886dd8e7acc21a7
5
5
  SHA512:
6
- metadata.gz: d6b5547d132c434f796e912cb14978bb33df054d3d8d203ac99a50b765984cb5a4003ebea17a0308e498a7fe38af9fa3d5a8200ace05cbd7e75fb68d36edd4ab
7
- data.tar.gz: df6d567989bef93a58e05133de6e73fa6c419e8b46ca581aede542ac0b46889b45c765f59be171ff58787418289546ccf310133288c9ff584debe6422916daaa
6
+ metadata.gz: 8f78d21ff52527fa33e748840bb4f223dde573453ebf5e7929b891d4481a31d254c362129f028c83787a2c81c7ff98022d38f15ab369a4fec51ed41a8bb48f65
7
+ data.tar.gz: 6ad3a8a9fab3e2f6b06c20995fedccdd97c1fd0af63d9eda7fd59dfcc01914193618a9890d534785fb54be2773ccb1b044523b931b1d93aab458d59585c59002
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Neo4j
2
2
  module Core
3
- VERSION = '5.0.3'
3
+ VERSION = '5.0.4'
4
4
  end
5
5
  end
@@ -92,6 +92,7 @@ namespace :neo4j do
92
92
 
93
93
  desc 'Install Neo4j with auth disabled in v2.2+, example neo4j:install[community-latest,development]'
94
94
  task :install, :edition, :environment do |_, args|
95
+ args.with_default_arguments(edition: 'community-latest', environment: 'development')
95
96
  edition = get_edition(args)
96
97
  environment = get_environment(args)
97
98
  puts "Installing Neo4j-#{edition} environment: #{environment}"
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.3
4
+ version: 5.0.4
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-07-02 00:00:00.000000000 Z
11
+ date: 2015-07-14 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