activegraph 10.0.0.pre.alpha.11 → 10.0.0.pre.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/{neo4j.gemspec → activegraph.gemspec} +7 -9
- data/config/neo4j/config.yml +4 -4
- data/lib/active_graph.rb +120 -0
- data/lib/{neo4j → active_graph}/ansi.rb +1 -1
- data/lib/{neo4j → active_graph}/attribute_set.rb +3 -3
- data/lib/{neo4j/active_base.rb → active_graph/base.rb} +18 -12
- data/lib/{neo4j → active_graph}/class_arguments.rb +5 -5
- data/lib/{neo4j → active_graph}/config.rb +10 -10
- data/lib/active_graph/core.rb +14 -0
- data/lib/{neo4j → active_graph}/core/connection_failed_error.rb +1 -1
- data/lib/{neo4j → active_graph}/core/cypher_error.rb +1 -1
- data/lib/{neo4j → active_graph}/core/driver.rb +5 -5
- data/lib/{neo4j → active_graph}/core/has_uri.rb +1 -1
- data/lib/{neo4j → active_graph}/core/instrumentable.rb +4 -4
- data/lib/{neo4j → active_graph}/core/label.rb +13 -13
- data/lib/{neo4j → active_graph}/core/logging.rb +2 -2
- data/lib/{neo4j → active_graph}/core/node.rb +2 -2
- data/lib/{neo4j → active_graph}/core/querable.rb +7 -7
- data/lib/{neo4j → active_graph}/core/query.rb +16 -16
- data/lib/{neo4j → active_graph}/core/query_builder.rb +3 -3
- data/lib/{neo4j → active_graph}/core/query_clauses.rb +1 -1
- data/lib/{neo4j → active_graph}/core/query_ext.rb +5 -5
- data/lib/{neo4j → active_graph}/core/query_find_in_batches.rb +2 -2
- data/lib/{neo4j → active_graph}/core/relationship.rb +2 -2
- data/lib/{neo4j → active_graph}/core/responses.rb +3 -3
- data/lib/{neo4j → active_graph}/core/result.rb +1 -1
- data/lib/{neo4j → active_graph}/core/schema.rb +1 -1
- data/lib/{neo4j → active_graph}/core/schema_errors.rb +1 -1
- data/lib/{neo4j → active_graph}/core/wrappable.rb +1 -1
- data/lib/{neo4j → active_graph}/errors.rb +1 -1
- data/lib/{neo4j → active_graph}/lazy_attribute_hash.rb +1 -1
- data/lib/{neo4j → active_graph}/migration.rb +11 -11
- data/lib/{neo4j → active_graph}/migrations.rb +5 -5
- data/lib/{neo4j → active_graph}/migrations/base.rb +7 -7
- data/lib/{neo4j → active_graph}/migrations/check_pending.rb +3 -3
- data/lib/{neo4j → active_graph}/migrations/helpers.rb +4 -4
- data/lib/{neo4j → active_graph}/migrations/helpers/id_property.rb +3 -3
- data/lib/{neo4j → active_graph}/migrations/helpers/relationships.rb +1 -1
- data/lib/{neo4j → active_graph}/migrations/helpers/schema.rb +7 -7
- data/lib/{neo4j → active_graph}/migrations/migration_file.rb +1 -1
- data/lib/{neo4j → active_graph}/migrations/runner.rb +3 -3
- data/lib/{neo4j → active_graph}/migrations/schema.rb +1 -1
- data/lib/{neo4j → active_graph}/migrations/schema_migration.rb +2 -2
- data/lib/{neo4j → active_graph}/model_schema.rb +8 -8
- data/lib/{neo4j/active_node.rb → active_graph/node.rb} +32 -32
- data/lib/{neo4j/active_node → active_graph/node}/callbacks.rb +3 -3
- data/lib/{neo4j/active_node → active_graph/node}/dependent.rb +2 -2
- data/lib/{neo4j/active_node → active_graph/node}/dependent/association_methods.rb +2 -2
- data/lib/{neo4j/active_node → active_graph/node}/dependent/query_proxy_methods.rb +4 -4
- data/lib/{neo4j/active_node → active_graph/node}/dependent_callbacks.rb +4 -4
- data/lib/{neo4j/active_node → active_graph/node}/enum.rb +3 -3
- data/lib/{neo4j/active_node → active_graph/node}/has_n.rb +20 -20
- data/lib/{neo4j/active_node → active_graph/node}/has_n/association.rb +8 -8
- data/lib/{neo4j/active_node → active_graph/node}/has_n/association/rel_factory.rb +4 -4
- data/lib/{neo4j/active_node → active_graph/node}/has_n/association/rel_wrapper.rb +4 -4
- data/lib/{neo4j/active_node → active_graph/node}/has_n/association_cypher_methods.rb +2 -2
- data/lib/{neo4j/active_node → active_graph/node}/id_property.rb +7 -7
- data/lib/{neo4j/active_node → active_graph/node}/id_property/accessor.rb +1 -1
- data/lib/{neo4j/active_node → active_graph/node}/initialize.rb +3 -3
- data/lib/{neo4j/active_node → active_graph/node}/labels.rb +18 -18
- data/lib/{neo4j/active_node → active_graph/node}/labels/index.rb +6 -6
- data/lib/{neo4j/active_node → active_graph/node}/labels/reloading.rb +1 -1
- data/lib/{neo4j/active_node → active_graph/node}/node_list_formatter.rb +1 -1
- data/lib/{neo4j/active_node → active_graph/node}/node_wrapper.rb +5 -5
- data/lib/{neo4j/active_node → active_graph/node}/orm_adapter.rb +2 -2
- data/lib/{neo4j/active_node → active_graph/node}/persistence.rb +7 -7
- data/lib/{neo4j/active_node → active_graph/node}/property.rb +3 -3
- data/lib/{neo4j/active_node → active_graph/node}/query.rb +9 -9
- data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy.rb +19 -19
- data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_eager_loading.rb +3 -3
- data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_eager_loading/association_tree.rb +2 -2
- data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_enumerable.rb +4 -4
- data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_find_in_batches.rb +2 -2
- data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_link.rb +3 -3
- data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_methods.rb +12 -12
- data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_methods_of_mass_updating.rb +4 -4
- data/lib/{neo4j/active_node → active_graph/node}/query_methods.rb +4 -4
- data/lib/{neo4j/active_node → active_graph/node}/reflection.rb +3 -3
- data/lib/{neo4j/active_node → active_graph/node}/rels.rb +1 -1
- data/lib/{neo4j/active_node → active_graph/node}/scope.rb +4 -4
- data/lib/{neo4j/active_node → active_graph/node}/unpersisted.rb +2 -2
- data/lib/{neo4j/active_node → active_graph/node}/validations.rb +3 -3
- data/lib/{neo4j → active_graph}/paginated.rb +1 -1
- data/lib/{neo4j → active_graph}/railtie.rb +18 -18
- data/lib/{neo4j/active_rel.rb → active_graph/relationship.rb} +19 -19
- data/lib/active_graph/relationship/callbacks.rb +21 -0
- data/lib/{neo4j/active_rel → active_graph/relationship}/initialize.rb +5 -5
- data/lib/{neo4j/active_rel → active_graph/relationship}/persistence.rb +6 -6
- data/lib/{neo4j/active_rel → active_graph/relationship}/persistence/query_factory.rb +7 -7
- data/lib/{neo4j/active_rel → active_graph/relationship}/property.rb +6 -6
- data/lib/{neo4j/active_rel → active_graph/relationship}/query.rb +7 -7
- data/lib/{neo4j/active_rel → active_graph/relationship}/rel_wrapper.rb +5 -5
- data/lib/{neo4j/active_rel → active_graph/relationship}/related_node.rb +7 -7
- data/lib/{neo4j/active_rel → active_graph/relationship}/types.rb +6 -6
- data/lib/active_graph/relationship/validations.rb +8 -0
- data/lib/{neo4j → active_graph}/schema/operation.rb +5 -5
- data/lib/{neo4j → active_graph}/shared.rb +7 -7
- data/lib/{neo4j → active_graph}/shared/attributes.rb +10 -10
- data/lib/{neo4j → active_graph}/shared/callbacks.rb +3 -3
- data/lib/{neo4j → active_graph}/shared/cypher.rb +1 -1
- data/lib/{neo4j → active_graph}/shared/declared_properties.rb +8 -8
- data/lib/{neo4j → active_graph}/shared/declared_property.rb +9 -9
- data/lib/{neo4j → active_graph}/shared/declared_property/index.rb +3 -3
- data/lib/{neo4j → active_graph}/shared/enum.rb +6 -6
- data/lib/{neo4j → active_graph}/shared/filtered_hash.rb +2 -2
- data/lib/{neo4j → active_graph}/shared/identity.rb +2 -2
- data/lib/{neo4j → active_graph}/shared/initialize.rb +3 -3
- data/lib/{neo4j → active_graph}/shared/marshal.rb +1 -1
- data/lib/{neo4j → active_graph}/shared/mass_assignment.rb +2 -2
- data/lib/{neo4j → active_graph}/shared/permitted_attributes.rb +1 -1
- data/lib/{neo4j → active_graph}/shared/persistence.rb +4 -4
- data/lib/{neo4j → active_graph}/shared/property.rb +10 -10
- data/lib/{neo4j → active_graph}/shared/query_factory.rb +5 -5
- data/lib/{neo4j → active_graph}/shared/rel_type_converters.rb +6 -6
- data/lib/{neo4j → active_graph}/shared/serialized_properties.rb +1 -1
- data/lib/{neo4j → active_graph}/shared/type_converters.rb +11 -13
- data/lib/{neo4j → active_graph}/shared/typecasted_attributes.rb +7 -7
- data/lib/{neo4j → active_graph}/shared/typecaster.rb +3 -3
- data/lib/{neo4j → active_graph}/shared/validations.rb +1 -1
- data/lib/{neo4j → active_graph}/tasks/migration.rake +25 -25
- data/lib/{neo4j → active_graph}/timestamps.rb +3 -3
- data/lib/{neo4j → active_graph}/timestamps/created.rb +1 -1
- data/lib/{neo4j → active_graph}/timestamps/updated.rb +1 -1
- data/lib/{neo4j → active_graph}/transaction.rb +9 -9
- data/lib/active_graph/transactions.rb +54 -0
- data/lib/{neo4j → active_graph}/type_converters.rb +2 -2
- data/lib/{neo4j → active_graph}/undeclared_properties.rb +1 -1
- data/lib/active_graph/version.rb +3 -0
- data/lib/{neo4j → active_graph}/wrapper.rb +1 -1
- data/lib/rails/generators/neo4j/migration/migration_generator.rb +4 -4
- data/lib/rails/generators/neo4j/migration/templates/migration.erb +2 -2
- data/lib/rails/generators/neo4j/model/model_generator.rb +4 -4
- data/lib/rails/generators/neo4j/model/templates/migration.erb +1 -1
- data/lib/rails/generators/neo4j/model/templates/model.erb +1 -1
- data/lib/rails/generators/neo4j/upgrade_v8/templates/migration.erb +1 -1
- data/lib/rails/generators/neo4j/upgrade_v8/upgrade_v8_generator.rb +6 -6
- data/lib/rails/generators/neo4j_generator.rb +4 -4
- metadata +134 -133
- data/lib/neo4j.rb +0 -119
- data/lib/neo4j/active_rel/callbacks.rb +0 -21
- data/lib/neo4j/active_rel/validations.rb +0 -8
- data/lib/neo4j/core.rb +0 -14
- data/lib/neo4j/version.rb +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f490d36cc6732adb06aca4752e589f4dfc689d307cd33e54fe912a2273d30160
|
|
4
|
+
data.tar.gz: 61c9355e4403e04dc723071b70b1cc0e27ebb92fae5e27ba6c6c9a349d1dce38
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d51a94b8d915e1815913d28ffb96602c3ca8aa74328313bb5d838af00cb8c77ff2bf9f0d6e70289fcbf12061e6d3665980442193ed0818fd9d41684d571287f3
|
|
7
|
+
data.tar.gz: 5dacdeb85d6b9bff6dbf7ad76e041a98117fa49e36feb702dcac3995c8d573c68af89c413d80f7f9f1c3a52b360d8166858660e4bea99e18072e3982d9bd24b7
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Welcome to Neo4j.rb
|
|
1
|
+
# Welcome to Active Graph (f.k.a. Neo4j.rb)
|
|
2
2
|
|
|
3
3
|
## Code Status
|
|
4
4
|
|
|
@@ -21,7 +21,7 @@ All new documentation will be done via our [readthedocs](http://neo4jrb.readthed
|
|
|
21
21
|
|
|
22
22
|
# Introduction
|
|
23
23
|
|
|
24
|
-
Neo4j.rb is an Active Model compliant Ruby/JRuby wrapper for [the Neo4j graph database](http://www.neo4j.org/). It uses the [neo4j-
|
|
24
|
+
Neo4j.rb is an Active Model compliant Ruby/JRuby wrapper for [the Neo4j graph database](http://www.neo4j.org/). It uses the [neo4j-ruby-driver](https://github.com/neo4jrb/neo4j-ruby-driver) and [active_attr](https://github.com/cgriego/active_attr) gems.
|
|
25
25
|
|
|
26
26
|
Neo4j is a transactional, open-source graph database. A graph database manages data in a connected data structure, capable of representing any kind of data in a very accessible way. Information is stored in nodes and relationships connecting them, both of which can have arbitrary properties. To learn more visit [What is a Graph Database?](http://neo4j.com/developer/graph-database/)
|
|
27
27
|
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
lib = File.expand_path('lib', __dir__)
|
|
2
2
|
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
|
4
|
-
require '
|
|
5
|
-
|
|
4
|
+
require 'active_graph/version'
|
|
6
5
|
|
|
7
6
|
Gem::Specification.new do |s|
|
|
8
7
|
s.name = 'activegraph'
|
|
9
|
-
s.version =
|
|
8
|
+
s.version = ActiveGraph::VERSION
|
|
10
9
|
|
|
11
10
|
s.required_ruby_version = ((RUBY_PLATFORM == 'java') ? '>= 1.9.3' : '>= 2.1.9')
|
|
12
11
|
|
|
13
12
|
s.authors = 'Andreas Ronge, Brian Underwood, Chris Grigg, Heinrich Klobuczek'
|
|
14
13
|
s.email = 'andreas.ronge@gmail.com, public@brian-underwood.codes, chris@subvertallmedia.com, heinrich@mail.com'
|
|
15
|
-
s.homepage = 'https://github.com/neo4jrb/
|
|
16
|
-
s.rubyforge_project = 'neo4j'
|
|
14
|
+
s.homepage = 'https://github.com/neo4jrb/activegraph/'
|
|
17
15
|
s.summary = 'A graph database for Ruby'
|
|
18
16
|
s.license = 'MIT'
|
|
19
17
|
s.description = <<-DESCRIPTION
|
|
@@ -21,15 +19,15 @@ A Neo4j OGM (Object-Graph-Mapper) for Ruby heavily inspired by ActiveRecord.
|
|
|
21
19
|
DESCRIPTION
|
|
22
20
|
|
|
23
21
|
s.require_path = 'lib'
|
|
24
|
-
s.files = Dir.glob('{bin,lib,config}/**/*') + %w(README.md CHANGELOG.md CONTRIBUTORS Gemfile
|
|
22
|
+
s.files = Dir.glob('{bin,lib,config}/**/*') + %w(README.md CHANGELOG.md CONTRIBUTORS Gemfile activegraph.gemspec)
|
|
25
23
|
s.executables = []
|
|
26
24
|
s.extra_rdoc_files = %w( README.md )
|
|
27
25
|
s.rdoc_options = ['--quiet', '--title', 'Neo4j.rb', '--line-numbers', '--main', 'README.rdoc', '--inline-source']
|
|
28
26
|
s.metadata = {
|
|
29
27
|
'homepage_uri' => 'http://neo4jrb.io/',
|
|
30
|
-
'changelog_uri' => 'https://github.com/neo4jrb/
|
|
31
|
-
'source_code_uri' => 'https://github.com/neo4jrb/
|
|
32
|
-
'bug_tracker_uri' => 'https://github.com/neo4jrb/
|
|
28
|
+
'changelog_uri' => 'https://github.com/neo4jrb/activegraph/blob/master/CHANGELOG.md',
|
|
29
|
+
'source_code_uri' => 'https://github.com/neo4jrb/activegraph/',
|
|
30
|
+
'bug_tracker_uri' => 'https://github.com/neo4jrb/activegraph/issues'
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
s.add_dependency('activemodel', '>= 4.0')
|
data/config/neo4j/config.yml
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
#id_property_type: :auto
|
|
9
9
|
#id_property_type_value: :uuid
|
|
10
10
|
|
|
11
|
-
# Example, (probably more useful directly on
|
|
11
|
+
# Example, (probably more useful directly on ActiveGraph::Node classes instead as a global configuration)
|
|
12
12
|
#id_property: title_id
|
|
13
13
|
#id_property_type: :on
|
|
14
14
|
#id_property_type_value: :some_method
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
identity_map: false
|
|
21
21
|
|
|
22
22
|
# TODO
|
|
23
|
-
# When using the
|
|
23
|
+
# When using the ActiveGraph::Model you can let neo4j automatically set timestamps when updating/creating nodes.
|
|
24
24
|
# If set to true neo4j.rb automatically timestamps create and update operations if the model has properties named created_at/created_on or updated_at/updated_on
|
|
25
25
|
# (similar to ActiveRecord).
|
|
26
26
|
timestamps: true
|
|
27
27
|
|
|
28
|
-
# Store a property on objects to cache their
|
|
28
|
+
# Store a property on objects to cache their Node/Relationship class. It prevents each object load from requiring two database queries.
|
|
29
29
|
# Strings shorter than 44 characters are classified, so this will have almost no impact on disk footprint. See http://docs.neo4j.org/chunked/stable/short-strings.html.
|
|
30
|
-
# Alternatively, call class method
|
|
30
|
+
# Alternatively, call class method ActiveGraph::Node:cache_class to set this on specific models.
|
|
31
31
|
# By default, this property is called _classname, set as symbol to override.
|
|
32
32
|
cache_class_names: true
|
|
33
33
|
# class_name_property: :_classname
|
data/lib/active_graph.rb
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
require 'forwardable'
|
|
2
|
+
require 'active_graph/version'
|
|
3
|
+
|
|
4
|
+
require 'active_graph/core'
|
|
5
|
+
require 'active_graph/core/query_ext' # From this gem
|
|
6
|
+
|
|
7
|
+
require 'active_graph/transactions'
|
|
8
|
+
require 'active_graph/base'
|
|
9
|
+
require 'active_graph/model_schema'
|
|
10
|
+
|
|
11
|
+
require 'active_model'
|
|
12
|
+
require 'active_support/concern'
|
|
13
|
+
require 'active_support/core_ext/class/attribute.rb'
|
|
14
|
+
require 'active_support/core_ext/class/subclasses.rb'
|
|
15
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
|
16
|
+
require 'json'
|
|
17
|
+
|
|
18
|
+
require 'active_graph/lazy_attribute_hash'
|
|
19
|
+
require 'active_graph/attribute_set'
|
|
20
|
+
require 'active_graph/errors'
|
|
21
|
+
require 'active_graph/config'
|
|
22
|
+
require 'active_graph/wrapper'
|
|
23
|
+
require 'active_graph/relationship/rel_wrapper'
|
|
24
|
+
require 'active_graph/node/node_wrapper'
|
|
25
|
+
require 'active_graph/shared/type_converters'
|
|
26
|
+
require 'active_graph/shared/rel_type_converters'
|
|
27
|
+
require 'active_graph/shared/marshal'
|
|
28
|
+
require 'active_graph/type_converters'
|
|
29
|
+
require 'active_graph/paginated'
|
|
30
|
+
require 'active_graph/schema/operation'
|
|
31
|
+
|
|
32
|
+
require 'active_graph/timestamps'
|
|
33
|
+
require 'active_graph/undeclared_properties'
|
|
34
|
+
|
|
35
|
+
require 'active_graph/shared/callbacks'
|
|
36
|
+
require 'active_graph/shared/filtered_hash'
|
|
37
|
+
require 'active_graph/shared/declared_property/index'
|
|
38
|
+
require 'active_graph/shared/declared_property'
|
|
39
|
+
require 'active_graph/shared/declared_properties'
|
|
40
|
+
require 'active_graph/shared/enum'
|
|
41
|
+
require 'active_graph/shared/mass_assignment'
|
|
42
|
+
require 'active_graph/shared/attributes'
|
|
43
|
+
require 'active_graph/shared/typecasted_attributes'
|
|
44
|
+
require 'active_graph/shared/property'
|
|
45
|
+
require 'active_graph/shared/persistence'
|
|
46
|
+
require 'active_graph/shared/validations'
|
|
47
|
+
require 'active_graph/shared/identity'
|
|
48
|
+
require 'active_graph/shared/serialized_properties'
|
|
49
|
+
require 'active_graph/shared/typecaster'
|
|
50
|
+
require 'active_graph/shared/initialize'
|
|
51
|
+
require 'active_graph/shared/query_factory'
|
|
52
|
+
require 'active_graph/shared/cypher'
|
|
53
|
+
require 'active_graph/shared/permitted_attributes'
|
|
54
|
+
require 'active_graph/shared'
|
|
55
|
+
|
|
56
|
+
require 'active_graph/relationship/callbacks'
|
|
57
|
+
require 'active_graph/relationship/initialize'
|
|
58
|
+
require 'active_graph/relationship/property'
|
|
59
|
+
require 'active_graph/relationship/persistence/query_factory'
|
|
60
|
+
require 'active_graph/relationship/persistence'
|
|
61
|
+
require 'active_graph/relationship/validations'
|
|
62
|
+
require 'active_graph/relationship/query'
|
|
63
|
+
require 'active_graph/relationship/related_node'
|
|
64
|
+
require 'active_graph/relationship/types'
|
|
65
|
+
require 'active_graph/relationship'
|
|
66
|
+
|
|
67
|
+
require 'active_graph/node/dependent_callbacks'
|
|
68
|
+
require 'active_graph/node/node_list_formatter'
|
|
69
|
+
require 'active_graph/node/dependent'
|
|
70
|
+
require 'active_graph/node/dependent/query_proxy_methods'
|
|
71
|
+
require 'active_graph/node/dependent/association_methods'
|
|
72
|
+
require 'active_graph/node/enum'
|
|
73
|
+
require 'active_graph/node/query_methods'
|
|
74
|
+
require 'active_graph/node/query/query_proxy_methods'
|
|
75
|
+
require 'active_graph/node/query/query_proxy_methods_of_mass_updating'
|
|
76
|
+
require 'active_graph/node/query/query_proxy_enumerable'
|
|
77
|
+
require 'active_graph/node/query/query_proxy_find_in_batches'
|
|
78
|
+
require 'active_graph/node/query/query_proxy_eager_loading'
|
|
79
|
+
require 'active_graph/node/query/query_proxy_eager_loading/association_tree'
|
|
80
|
+
require 'active_graph/node/query/query_proxy_link'
|
|
81
|
+
require 'active_graph/node/labels/index'
|
|
82
|
+
require 'active_graph/node/labels/reloading'
|
|
83
|
+
require 'active_graph/node/labels'
|
|
84
|
+
require 'active_graph/node/id_property/accessor'
|
|
85
|
+
require 'active_graph/node/id_property'
|
|
86
|
+
require 'active_graph/node/callbacks'
|
|
87
|
+
require 'active_graph/node/initialize'
|
|
88
|
+
require 'active_graph/node/property'
|
|
89
|
+
require 'active_graph/node/persistence'
|
|
90
|
+
require 'active_graph/node/validations'
|
|
91
|
+
require 'active_graph/node/rels'
|
|
92
|
+
require 'active_graph/node/reflection'
|
|
93
|
+
require 'active_graph/node/unpersisted'
|
|
94
|
+
require 'active_graph/node/has_n'
|
|
95
|
+
require 'active_graph/node/has_n/association_cypher_methods'
|
|
96
|
+
require 'active_graph/node/has_n/association/rel_wrapper'
|
|
97
|
+
require 'active_graph/node/has_n/association/rel_factory'
|
|
98
|
+
require 'active_graph/node/has_n/association'
|
|
99
|
+
require 'active_graph/node/query/query_proxy'
|
|
100
|
+
require 'active_graph/node/query'
|
|
101
|
+
require 'active_graph/node/scope'
|
|
102
|
+
require 'active_graph/node'
|
|
103
|
+
|
|
104
|
+
require 'active_support/concern'
|
|
105
|
+
require 'active_graph/core/cypher_error'
|
|
106
|
+
require 'active_graph/core/schema_errors'
|
|
107
|
+
|
|
108
|
+
module ActiveGraph
|
|
109
|
+
extend ActiveSupport::Autoload
|
|
110
|
+
autoload :Migrations
|
|
111
|
+
autoload :Migration
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
load 'active_graph/tasks/migration.rake'
|
|
115
|
+
|
|
116
|
+
require 'active_graph/node/orm_adapter'
|
|
117
|
+
if defined?(Rails)
|
|
118
|
+
require 'rails/generators'
|
|
119
|
+
require 'rails/generators/neo4j_generator'
|
|
120
|
+
end
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
require 'active_model/attribute_set'
|
|
4
4
|
|
|
5
|
-
module
|
|
5
|
+
module ActiveGraph
|
|
6
6
|
class AttributeSet < ActiveModel::AttributeSet
|
|
7
7
|
def initialize(attr_hash, attr_list)
|
|
8
|
-
hashmap =
|
|
8
|
+
hashmap = ActiveGraph::LazyAttributeHash.new(attr_hash, attr_list)
|
|
9
9
|
super(hashmap)
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -26,7 +26,7 @@ module Neo4j
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def ==(other)
|
|
29
|
-
other.is_a?(
|
|
29
|
+
other.is_a?(ActiveGraph::AttributeSet) ? super : to_hash == other
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
module
|
|
2
|
-
# To contain any base login for
|
|
1
|
+
module ActiveGraph
|
|
2
|
+
# To contain any base login for Node/Relationship which
|
|
3
3
|
# is external to the main classes
|
|
4
|
-
module
|
|
4
|
+
module Base
|
|
5
|
+
include ActiveGraph::Transactions
|
|
6
|
+
|
|
5
7
|
at_exit do
|
|
6
8
|
@driver&.close
|
|
7
9
|
end
|
|
@@ -14,6 +16,10 @@ module Neo4j
|
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
|
|
19
|
+
def driver
|
|
20
|
+
current_driver.driver
|
|
21
|
+
end
|
|
22
|
+
|
|
17
23
|
def on_establish_driver(&block)
|
|
18
24
|
@establish_driver_block = block
|
|
19
25
|
end
|
|
@@ -23,8 +29,8 @@ module Neo4j
|
|
|
23
29
|
end
|
|
24
30
|
|
|
25
31
|
def new_driver(url, options = {})
|
|
26
|
-
verbose_query_logs =
|
|
27
|
-
|
|
32
|
+
verbose_query_logs = ActiveGraph::Config.fetch(:verbose_query_logs, false)
|
|
33
|
+
ActiveGraph::Core::Driver
|
|
28
34
|
.new(url, options, verbose_query_logs: verbose_query_logs)
|
|
29
35
|
end
|
|
30
36
|
|
|
@@ -50,19 +56,19 @@ module Neo4j
|
|
|
50
56
|
|
|
51
57
|
def new_transaction
|
|
52
58
|
validate_model_schema!
|
|
53
|
-
|
|
59
|
+
ActiveGraph::Transaction.new
|
|
54
60
|
end
|
|
55
61
|
|
|
56
62
|
def new_query(options = {})
|
|
57
63
|
validate_model_schema!
|
|
58
|
-
|
|
64
|
+
ActiveGraph::Core::Query.new({driver: current_driver}.merge(options))
|
|
59
65
|
end
|
|
60
66
|
|
|
61
67
|
def magic_query(*args)
|
|
62
68
|
if args.empty? || args.map(&:class) == [Hash]
|
|
63
|
-
|
|
69
|
+
Base.new_query(*args)
|
|
64
70
|
else
|
|
65
|
-
|
|
71
|
+
Base.current_driver.query(*args)
|
|
66
72
|
end
|
|
67
73
|
end
|
|
68
74
|
|
|
@@ -72,17 +78,17 @@ module Neo4j
|
|
|
72
78
|
end
|
|
73
79
|
|
|
74
80
|
def label_object(label_name)
|
|
75
|
-
|
|
81
|
+
ActiveGraph::Core::Label.new(label_name)
|
|
76
82
|
end
|
|
77
83
|
|
|
78
84
|
def logger
|
|
79
|
-
@logger ||= (
|
|
85
|
+
@logger ||= (ActiveGraph::Config[:logger] || ActiveSupport::Logger.new(STDOUT))
|
|
80
86
|
end
|
|
81
87
|
|
|
82
88
|
private
|
|
83
89
|
|
|
84
90
|
def validate_model_schema!
|
|
85
|
-
|
|
91
|
+
ActiveGraph::ModelSchema.validate_model_schema! unless ActiveGraph::Migrations.currently_running_migrations
|
|
86
92
|
end
|
|
87
93
|
end
|
|
88
94
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module
|
|
1
|
+
module ActiveGraph
|
|
2
2
|
module ClassArguments
|
|
3
3
|
class << self
|
|
4
4
|
INVALID_CLASS_ARGUMENT_ERROR = 'option must by String, Symbol, false, nil, or an Array of Symbols/Strings'
|
|
@@ -14,8 +14,8 @@ module Neo4j
|
|
|
14
14
|
fail ArgumentError, "#{context} #{INVALID_CLASS_ARGUMENT_ERROR} (was #{class_argument.inspect})"
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def
|
|
18
|
-
class_constant.included_modules.include?(
|
|
17
|
+
def node_model?(class_constant)
|
|
18
|
+
class_constant.included_modules.include?(ActiveGraph::Node)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def constantize_argument(class_argument)
|
|
@@ -26,8 +26,8 @@ module Neo4j
|
|
|
26
26
|
class_argument.map(&method(:constantize_argument))
|
|
27
27
|
else
|
|
28
28
|
class_argument.to_s.constantize.tap do |class_constant|
|
|
29
|
-
if !
|
|
30
|
-
fail ArgumentError, "#{class_constant} is not an
|
|
29
|
+
if !node_model?(class_constant)
|
|
30
|
+
fail ArgumentError, "#{class_constant} is not an Node model"
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module
|
|
1
|
+
module ActiveGraph
|
|
2
2
|
# == Keeps configuration for neo4j
|
|
3
3
|
#
|
|
4
4
|
# == Configurations keys
|
|
@@ -43,13 +43,13 @@ module Neo4j
|
|
|
43
43
|
# Yields the configuration
|
|
44
44
|
#
|
|
45
45
|
# @example
|
|
46
|
-
#
|
|
46
|
+
# ActiveGraph::Config.use do |config|
|
|
47
47
|
# config[:storage_path] = '/var/neo4j'
|
|
48
48
|
# end
|
|
49
49
|
#
|
|
50
50
|
# @return nil
|
|
51
51
|
# @yield config
|
|
52
|
-
# @yieldparam [
|
|
52
|
+
# @yieldparam [ActiveGraph::Config] config - this configuration class
|
|
53
53
|
def use
|
|
54
54
|
@configuration ||= ActiveSupport::HashWithIndifferentAccess.new
|
|
55
55
|
yield @configuration
|
|
@@ -100,35 +100,35 @@ module Neo4j
|
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
def fail_on_pending_migrations
|
|
103
|
-
|
|
103
|
+
ActiveGraph::Config[:fail_on_pending_migrations].nil? ? true : ActiveGraph::Config[:fail_on_pending_migrations]
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
def include_root_in_json
|
|
107
107
|
# we use ternary because a simple || will always evaluate true
|
|
108
|
-
|
|
108
|
+
ActiveGraph::Config[:include_root_in_json].nil? ? true : ActiveGraph::Config[:include_root_in_json]
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
def module_handling
|
|
112
|
-
|
|
112
|
+
ActiveGraph::Config[:module_handling] || :none
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
# @return [Class] The configured timestamps type (e.g. Integer) or the default DateTime.
|
|
116
116
|
def timestamp_type
|
|
117
|
-
|
|
117
|
+
ActiveGraph::Config[:timestamp_type] || DateTime
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
def association_model_namespace
|
|
121
|
-
|
|
121
|
+
ActiveGraph::Config[:association_model_namespace] || nil
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
def association_model_namespace_string
|
|
125
|
-
namespace =
|
|
125
|
+
namespace = ActiveGraph::Config[:association_model_namespace]
|
|
126
126
|
return nil if namespace.nil?
|
|
127
127
|
"::#{namespace}"
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
def enums_case_sensitive
|
|
131
|
-
|
|
131
|
+
ActiveGraph::Config[:enums_case_sensitive] || false
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
134
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'active_graph/transaction'
|
|
2
|
+
require 'active_graph/core/instrumentable'
|
|
3
|
+
require 'active_graph/core/query'
|
|
4
|
+
require 'active_graph/core/driver'
|
|
5
|
+
require 'active_graph/core/responses'
|
|
6
|
+
|
|
7
|
+
require 'neo4j_ruby_driver'
|
|
8
|
+
require 'active_graph/core/wrappable'
|
|
9
|
+
require 'active_graph/core/node'
|
|
10
|
+
require 'active_graph/core/relationship'
|
|
11
|
+
|
|
12
|
+
Neo4j::Driver::Types::Entity.include ActiveGraph::Core::Wrappable
|
|
13
|
+
Neo4j::Driver::Types::Node.prepend ActiveGraph::Core::Node
|
|
14
|
+
Neo4j::Driver::Types::Relationship.include ActiveGraph::Core::Relationship
|