neo4j 1.0.0.beta.27-java → 1.0.0.beta.28-java
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTORS +1 -0
- data/lib/neo4j.rb +38 -72
- data/lib/neo4j/{algo.rb → algo/algo.rb} +5 -1
- data/lib/neo4j/batch/batch.rb +2 -0
- data/lib/neo4j/batch/indexer.rb +108 -0
- data/lib/neo4j/batch/inserter.rb +168 -0
- data/lib/neo4j/database.rb +13 -8
- data/lib/neo4j/{mapping/class_methods/list.rb → has_list/class_methods.rb} +2 -4
- data/lib/neo4j/has_list/has_list.rb +3 -0
- data/lib/neo4j/{mapping/has_list.rb → has_list/mapping.rb} +2 -2
- data/lib/neo4j/{mapping/class_methods/relationship.rb → has_n/class_methods.rb} +42 -12
- data/lib/neo4j/has_n/decl_relationship_dsl.rb +216 -0
- data/lib/neo4j/has_n/has_n.rb +3 -0
- data/lib/neo4j/{mapping/has_n.rb → has_n/mapping.rb} +16 -7
- data/lib/neo4j/index/index.rb +5 -0
- data/lib/neo4j/index/indexer.rb +27 -22
- data/lib/neo4j/index/lucene_query.rb +3 -1
- data/lib/neo4j/jars/core/neo4j-graph-algo-0.8-1.3.M01.jar +0 -0
- data/lib/neo4j/jars/core/neo4j-index-1.3-1.3.M01.jar +0 -0
- data/lib/neo4j/jars/core/neo4j-kernel-1.3-1.3.M01.jar +0 -0
- data/lib/neo4j/jars/core/neo4j-lucene-index-0.5-1.3.M01.jar +0 -0
- data/lib/neo4j/jars/ha/{neo4j-ha-0.6-SNAPSHOT.jar → neo4j-ha-0.6-1.3.M01.jar} +0 -0
- data/lib/neo4j/jars/ha/neo4j-management-1.3-1.3.M01.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-shell-1.3-1.3.M01.jar +0 -0
- data/lib/neo4j/migrations/class_methods.rb +102 -0
- data/lib/neo4j/migrations/extensions.rb +10 -9
- data/lib/neo4j/migrations/lazy_node_mixin.rb +50 -0
- data/lib/neo4j/migrations/migration.rb +84 -81
- data/lib/neo4j/migrations/migrations.rb +6 -100
- data/lib/neo4j/migrations/node_mixin.rb +80 -0
- data/lib/neo4j/migrations/ref_node_wrapper.rb +32 -0
- data/lib/neo4j/neo4j.rb +11 -0
- data/lib/neo4j/node.rb +55 -25
- data/lib/neo4j/{mapping/class_methods/init_node.rb → node_mixin/class_methods.rb} +3 -3
- data/lib/neo4j/{mapping → node_mixin}/node_mixin.rb +35 -18
- data/lib/neo4j/{mapping/class_methods/property.rb → property/class_methods.rb} +5 -4
- data/lib/neo4j/{property.rb → property/property.rb} +2 -0
- data/lib/neo4j/rails/finders.rb +21 -7
- data/lib/neo4j/rails/rails.rb +19 -0
- data/lib/neo4j/rails/timestamps.rb +1 -1
- data/lib/neo4j/relationship.rb +7 -0
- data/lib/neo4j/{mapping/class_methods/init_rel.rb → relationship_mixin/class_methods.rb} +4 -4
- data/lib/neo4j/{mapping → relationship_mixin}/relationship_mixin.rb +23 -5
- data/lib/neo4j/rels/rels.rb +85 -0
- data/lib/neo4j/rels/traverser.rb +102 -0
- data/lib/neo4j/{mapping/class_methods/rule.rb → rule/class_methods.rb} +11 -11
- data/lib/neo4j/rule/functions/count.rb +37 -0
- data/lib/neo4j/rule/functions/function.rb +74 -0
- data/lib/neo4j/rule/functions/functions.rb +3 -0
- data/lib/neo4j/rule/functions/sum.rb +29 -0
- data/lib/neo4j/rule/rule.rb +5 -0
- data/lib/neo4j/rule/rule_event_listener.rb +162 -0
- data/lib/neo4j/rule/rule_node.rb +182 -0
- data/lib/neo4j/to_java.rb +0 -14
- data/lib/neo4j/traversal/filter_predicate.rb +25 -0
- data/lib/neo4j/traversal/prune_evaluator.rb +14 -0
- data/lib/neo4j/traversal/rel_expander.rb +31 -0
- data/lib/neo4j/traversal/traversal.rb +90 -0
- data/lib/neo4j/traversal/traverser.rb +173 -0
- data/lib/neo4j/{type_converters.rb → type_converters/type_converters.rb} +0 -0
- data/lib/neo4j/version.rb +1 -1
- data/lib/test.rb~ +2 -0
- data/neo4j.gemspec +11 -10
- metadata +48 -37
- data/lib/neo4j/functions/count.rb +0 -33
- data/lib/neo4j/functions/function.rb +0 -72
- data/lib/neo4j/functions/sum.rb +0 -27
- data/lib/neo4j/jars/core/neo4j-graph-algo-0.8-SNAPSHOT.jar +0 -0
- data/lib/neo4j/jars/core/neo4j-index-1.3-SNAPSHOT.jar +0 -0
- data/lib/neo4j/jars/core/neo4j-kernel-1.3-SNAPSHOT.jar +0 -0
- data/lib/neo4j/jars/core/neo4j-lucene-index-0.5-SNAPSHOT.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-management-1.3-SNAPSHOT.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-shell-1.3-SNAPSHOT.jar +0 -0
- data/lib/neo4j/mapping/decl_relationship_dsl.rb +0 -214
- data/lib/neo4j/mapping/rule.rb +0 -158
- data/lib/neo4j/mapping/rule_node.rb +0 -176
- data/lib/neo4j/migrations.rb +0 -12
- data/lib/neo4j/migrations/global_migration.rb +0 -29
- data/lib/neo4j/migrations/lazy_migration_mixin.rb +0 -47
- data/lib/neo4j/migrations/migration_mixin.rb +0 -78
- data/lib/neo4j/node_mixin.rb +0 -4
- data/lib/neo4j/node_relationship.rb +0 -161
- data/lib/neo4j/node_traverser.rb +0 -224
- data/lib/neo4j/relationship_mixin.rb +0 -4
- data/lib/neo4j/relationship_traverser.rb +0 -92
@@ -1,100 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
@migrate_to = version
|
8
|
-
end
|
9
|
-
|
10
|
-
def migrate_to
|
11
|
-
@migrate_to
|
12
|
-
end
|
13
|
-
|
14
|
-
def latest_migration
|
15
|
-
migrations.keys.sort.reverse[0]
|
16
|
-
end
|
17
|
-
|
18
|
-
# contains all the migrations defined with the #migration DSL method
|
19
|
-
def migrations
|
20
|
-
@migrations ||= {}
|
21
|
-
end
|
22
|
-
|
23
|
-
# Specifies a migration to be performed.
|
24
|
-
# Updates the migrate_to variable so that it will migrate to the latest migration.
|
25
|
-
#
|
26
|
-
# === Example
|
27
|
-
#
|
28
|
-
# In the following example the up and down method will be evaluated in the context of a Person node.
|
29
|
-
#
|
30
|
-
# Person.migration 1, :my_first_migration do
|
31
|
-
# up { ... }
|
32
|
-
# down { ... }
|
33
|
-
# end
|
34
|
-
#
|
35
|
-
# See the Neo4j::MigrationMixin::Migration which the DSL is evaluated in.
|
36
|
-
#
|
37
|
-
def migration(version, name, &block)
|
38
|
-
migration = Migration.new(version, name)
|
39
|
-
migration.instance_eval(&block)
|
40
|
-
migrations[version] = migration
|
41
|
-
self.migrate_to = latest_migration
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
def _migrate!(context, meta_node, version=nil) #:nodoc:
|
46
|
-
# set the version we want to migrate to if provided
|
47
|
-
self.migrate_to = version if version
|
48
|
-
|
49
|
-
# requested to migrate to a version ?
|
50
|
-
return if self.migrate_to.nil?
|
51
|
-
|
52
|
-
# which version are we on now ?
|
53
|
-
current_version = meta_node[:_db_version] || 0
|
54
|
-
|
55
|
-
# do we need to migrate ?
|
56
|
-
return if current_version == self.migrate_to
|
57
|
-
|
58
|
-
# ok, so we are running some migrations
|
59
|
-
if Neo4j::Config['migration_thread']
|
60
|
-
Thread.new{ _upgrade_or_downgrade(current_version, context, meta_node)}
|
61
|
-
else
|
62
|
-
_upgrade_or_downgrade(current_version, context, meta_node)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def _upgrade_or_downgrade(current_version, context, meta_node) #:nodoc:
|
67
|
-
if (current_version < self.migrate_to)
|
68
|
-
upgrade((current_version+1).upto(self.migrate_to).collect { |ver| migrations[ver] }, context, meta_node)
|
69
|
-
else
|
70
|
-
downgrade(current_version.downto(self.migrate_to+1).collect { |ver| migrations[ver] }, context, meta_node)
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
# Running the up method on the given migrations.
|
77
|
-
#
|
78
|
-
# === Parameters
|
79
|
-
# migrations :: an enumerable of Migration objects
|
80
|
-
def upgrade(migrations, context, meta_node)
|
81
|
-
migrations.each do |m|
|
82
|
-
Neo4j.logger.info "Running upgrade: #{m}"
|
83
|
-
m.execute_up(context, meta_node)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
# Running the down method on the given migrations.
|
88
|
-
#
|
89
|
-
# === Parameters
|
90
|
-
# migrations:: an enumerable of Migration objects
|
91
|
-
def downgrade(migrations, context, meta_node)
|
92
|
-
migrations.each do |m|
|
93
|
-
Neo4j.logger.info "Running downgrade: #{m}"
|
94
|
-
m.execute_down(context, meta_node)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
1
|
+
require 'neo4j/migrations/extensions'
|
2
|
+
require 'neo4j/migrations/class_methods'
|
3
|
+
require 'neo4j/migrations/migration'
|
4
|
+
require 'neo4j/migrations/lazy_node_mixin'
|
5
|
+
require 'neo4j/migrations/node_mixin'
|
6
|
+
require 'neo4j/migrations/ref_node_wrapper'
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Neo4j
|
2
|
+
module Migrations
|
3
|
+
|
4
|
+
|
5
|
+
# By including this mixing on a node class one can add migrations to it.
|
6
|
+
# Each class has a unique db version.
|
7
|
+
#
|
8
|
+
# ==== Example
|
9
|
+
#
|
10
|
+
# class Person
|
11
|
+
# include Neo4j::NodeMixin
|
12
|
+
# include Neo4j::Migrations::NodeMixin
|
13
|
+
# rule :all # adding the method all to make it possible to find all nodes of this class
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# Person.migration 1, :split_property do
|
17
|
+
# up do
|
18
|
+
# all.each_raw do |node|
|
19
|
+
# node[:given_name] = node[:name].split[0]
|
20
|
+
# node[:surname] = node[:name].split[1]
|
21
|
+
# node[:name] = nil
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# down do
|
26
|
+
# all.each_raw do |node|
|
27
|
+
# node[:name] = "#{node[:given_name]} #{node[:surname]}"
|
28
|
+
# node[:surename] = nil
|
29
|
+
# node[:given_name] = nil
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
#
|
34
|
+
# Notice that the up and down methods are evaluated in the context of the class (where the all method is defined
|
35
|
+
# if using the rule :all).
|
36
|
+
#
|
37
|
+
module NodeMixin
|
38
|
+
extend ActiveSupport::Concern
|
39
|
+
|
40
|
+
included do
|
41
|
+
extend Neo4j::Migrations::ClassMethods
|
42
|
+
end
|
43
|
+
|
44
|
+
module ClassMethods
|
45
|
+
def migrate!(version=nil)
|
46
|
+
_migrate!(self, migration_meta_node, version)
|
47
|
+
end
|
48
|
+
|
49
|
+
# The node that holds the db version property
|
50
|
+
def migration_meta_node
|
51
|
+
Neo4j::Rule::RuleEventListener.rule_node_for(self).rule_node
|
52
|
+
end
|
53
|
+
|
54
|
+
# Remote all migration and set migrate_to = nil and set the current version to nil
|
55
|
+
def reset_migrations!
|
56
|
+
@migrations = nil
|
57
|
+
@migrate_to = nil
|
58
|
+
Neo4j::Transaction.run do
|
59
|
+
migration_meta_node[:_db_version] = nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# sets the migration db version for this class on a 'meta' node.
|
64
|
+
def db_version=(version)
|
65
|
+
Neo4j::Transaction.run do
|
66
|
+
migration_meta_node[:_db_version] = version
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# returns the current version of the database for this class.
|
71
|
+
def db_version
|
72
|
+
migration_meta_node[:_db_version]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Neo4j
|
2
|
+
|
3
|
+
module Migrations
|
4
|
+
# This node stores the migrations for Neo4j.migrations
|
5
|
+
# Uses the Neo4j.ref_node for keeping the current version of the db.
|
6
|
+
# When the database starts it will check if it needs to run a migration.
|
7
|
+
class RefNodeWrapper
|
8
|
+
extend ClassMethods
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def migrate!(version=nil)
|
12
|
+
_migrate!(self, Neo4j.ref_node, version)
|
13
|
+
end
|
14
|
+
|
15
|
+
def db_version
|
16
|
+
Neo4j.ref_node[:_db_version] || 0
|
17
|
+
end
|
18
|
+
|
19
|
+
# Remote all migration and set migrate_to = nil and set the current version to nil
|
20
|
+
def reset_migrations!
|
21
|
+
@migrations = nil
|
22
|
+
@migrate_to = nil
|
23
|
+
Neo4j::Transaction.run do
|
24
|
+
Neo4j.ref_node[:_db_version] = nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/lib/neo4j/neo4j.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# external neo4j dependencies
|
2
|
+
require 'neo4j/config'
|
3
|
+
require 'neo4j/database'
|
4
|
+
|
1
5
|
# = Neo4j
|
2
6
|
#
|
3
7
|
# The Neo4j modules is used to interact with an Neo4j Database instance.
|
@@ -44,6 +48,13 @@ module Neo4j
|
|
44
48
|
db
|
45
49
|
end
|
46
50
|
|
51
|
+
# Returns the current storage path of a running neo4j database.
|
52
|
+
# If the database is not running it returns nil.
|
53
|
+
def storage_path
|
54
|
+
return nil unless db.running?
|
55
|
+
db.storage_path
|
56
|
+
end
|
57
|
+
|
47
58
|
# Returns the Neo4j::Config class
|
48
59
|
# Same as typing; Neo4j::Config
|
49
60
|
def config
|
data/lib/neo4j/node.rb
CHANGED
@@ -1,52 +1,43 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# external neo4j dependencies
|
2
|
+
require 'neo4j/property/property'
|
3
|
+
require 'neo4j/rels/rels'
|
4
|
+
require 'neo4j/traversal/traversal'
|
5
|
+
require 'neo4j/index/index'
|
6
|
+
require 'neo4j/equal'
|
7
|
+
require 'neo4j/load'
|
3
8
|
|
9
|
+
module Neo4j
|
4
10
|
|
5
11
|
org.neo4j.kernel.impl.core.NodeProxy.class_eval do
|
6
12
|
include Neo4j::Property
|
7
|
-
include Neo4j::
|
13
|
+
include Neo4j::Rels
|
14
|
+
include Neo4j::Traversal
|
8
15
|
include Neo4j::Equal
|
9
16
|
include Neo4j::Index
|
10
17
|
|
11
|
-
|
12
|
-
#
|
13
|
-
# It might raise an exception if this method was called without a Transaction,
|
14
|
-
# or if it failed to delete the node (it maybe was already deleted).
|
15
|
-
#
|
16
|
-
# If this method raise an exception you may also get an exception when the transaction finish.
|
17
|
-
#
|
18
|
-
# ==== Returns
|
19
|
-
# nil or raise an exception
|
20
|
-
#
|
21
|
-
def del
|
18
|
+
def del #:nodoc:
|
22
19
|
rels.each {|r| r.del}
|
23
20
|
delete
|
24
21
|
nil
|
25
22
|
end
|
26
23
|
|
27
|
-
|
28
|
-
def exist?
|
24
|
+
def exist? #:nodoc:
|
29
25
|
Neo4j::Node.exist?(self)
|
30
26
|
end
|
31
27
|
|
32
|
-
|
33
|
-
# Used so that we have same method for both relationship and nodes
|
34
|
-
def wrapped_entity
|
28
|
+
def wrapped_entity #:nodoc:
|
35
29
|
self
|
36
30
|
end
|
37
31
|
|
38
|
-
|
39
|
-
# If there is no _classname property for this node then it will simply return itself.
|
40
|
-
# Same as Neo4j::Node.wrapper(node)
|
41
|
-
def wrapper
|
32
|
+
def wrapper #:nodoc:
|
42
33
|
self.class.wrapper(self)
|
43
34
|
end
|
44
35
|
|
45
|
-
def _java_node
|
36
|
+
def _java_node #:nodoc:
|
46
37
|
self
|
47
38
|
end
|
48
39
|
|
49
|
-
def class
|
40
|
+
def class #:nodoc:
|
50
41
|
Neo4j::Node
|
51
42
|
end
|
52
43
|
end
|
@@ -76,6 +67,45 @@ module Neo4j
|
|
76
67
|
|
77
68
|
self.node_indexer self
|
78
69
|
|
70
|
+
|
71
|
+
##
|
72
|
+
# :method: del
|
73
|
+
# Delete the node and all its relationship.
|
74
|
+
#
|
75
|
+
# It might raise an exception if this method was called without a Transaction,
|
76
|
+
# or if it failed to delete the node (it maybe was already deleted).
|
77
|
+
#
|
78
|
+
# If this method raise an exception you may also get an exception when the transaction finish.
|
79
|
+
# This method is defined in the org.neo4j.kernel.impl.core.NodeProxy which is return by Neo4j::Node.new
|
80
|
+
#
|
81
|
+
# ==== Returns
|
82
|
+
# nil or raise an exception
|
83
|
+
#
|
84
|
+
|
85
|
+
##
|
86
|
+
# :method: exist?
|
87
|
+
# returns true if the node exists in the database
|
88
|
+
# This method is defined in the org.neo4j.kernel.impl.core.NodeProxy which is return by Neo4j::Node.new
|
89
|
+
|
90
|
+
##
|
91
|
+
# :method: wrapped_entity
|
92
|
+
# same as _java_node
|
93
|
+
# Used so that we have same method for both relationship and nodes
|
94
|
+
# This method is defined in the org.neo4j.kernel.impl.core.NodeProxy which is return by Neo4j::Node.new
|
95
|
+
|
96
|
+
##
|
97
|
+
# :method: wrapper
|
98
|
+
# Loads the Ruby wrapper for this node (unless it is already the wrapper).
|
99
|
+
# If there is no _classname property for this node then it will simply return itself.
|
100
|
+
# Same as Neo4j::Node.wrapper(node)
|
101
|
+
# This method is defined in the org.neo4j.kernel.impl.core.NodeProxy which is return by Neo4j::Node.new
|
102
|
+
|
103
|
+
|
104
|
+
##
|
105
|
+
# :method: _java_node
|
106
|
+
# Returns the java node/relationship object representing this object unless it is already the java object.
|
107
|
+
# This method is defined in the org.neo4j.kernel.impl.core.NodeProxy which is return by Neo4j::Node.new
|
108
|
+
|
79
109
|
class << self
|
80
110
|
|
81
111
|
# Returns a new neo4j Node.
|
@@ -1,7 +1,18 @@
|
|
1
|
+
# external third party dependencies
|
1
2
|
require "active_support/core_ext/module/delegation"
|
2
3
|
|
3
|
-
|
4
|
+
# external neo4j dependencies
|
5
|
+
require 'neo4j/index/index'
|
6
|
+
require 'neo4j/property/property'
|
7
|
+
require 'neo4j/has_n/has_n'
|
8
|
+
require 'neo4j/rule/rule'
|
9
|
+
require 'neo4j/has_list/has_list'
|
4
10
|
|
11
|
+
# internal dependencies
|
12
|
+
require 'neo4j/node_mixin/class_methods'
|
13
|
+
|
14
|
+
|
15
|
+
module Neo4j
|
5
16
|
# This Mixin is used to wrap Neo4j Java Nodes in Ruby objects.
|
6
17
|
#
|
7
18
|
# It includes a number of mixins and forwards some methods to the raw Java node which in term includes a number of mixins, see below.
|
@@ -11,30 +22,31 @@ module Neo4j::Mapping
|
|
11
22
|
# Mixins:
|
12
23
|
# * Neo4j::Index
|
13
24
|
# * Neo4j::Property
|
14
|
-
# * Neo4j::
|
25
|
+
# * Neo4j::Rels
|
15
26
|
# * Neo4j::Equal
|
16
27
|
# * Neo4j::Index
|
17
28
|
#
|
18
29
|
# === Class Methods
|
19
30
|
#
|
20
31
|
# Mixins:
|
21
|
-
# * Neo4j::
|
22
|
-
# * Neo4j::
|
23
|
-
# * Neo4j::
|
24
|
-
# * Neo4j::
|
25
|
-
# * Neo4j::Mapping::ClassMethods::Rule
|
26
|
-
# * Neo4j::Mapping::ClassMethods::List
|
32
|
+
# * Neo4j::NodeMixin::ClassMethods
|
33
|
+
# * Neo4j::Property::ClassMethods
|
34
|
+
# * Neo4j::HasN::ClassMethods
|
35
|
+
# * Neo4j::Rule::ClassMethods
|
27
36
|
# * Neo4j::Index::ClassMethods
|
37
|
+
# * Neo4j::HasList::ClassMethods
|
38
|
+
#
|
39
|
+
# This class also includes the class mixin WillPaginate::Finders::Base, see http://github.com/mislav/will_paginate/wiki
|
28
40
|
#
|
29
41
|
module NodeMixin
|
30
42
|
include Neo4j::Index
|
31
43
|
|
32
|
-
include Neo4j::Functions
|
44
|
+
include Neo4j::Rule::Functions
|
33
45
|
|
34
46
|
delegate :[]=, :[], :property?, :props, :attributes, :update, :neo_id, :id, :rels, :rel?, :to_param, :getId,
|
35
47
|
:rel, :del, :list?, :print, :print_sub, :outgoing, :incoming, :both, :expand, :get_property, :set_property,
|
36
48
|
:equal?, :eql?, :==, :exist?, :getRelationships, :getSingleRelationship, :_rels, :rel, :wrapped_entity,
|
37
|
-
:to => :@_java_node, :allow_nil => true
|
49
|
+
:to => :@_java_node, :allow_nil => true
|
38
50
|
|
39
51
|
|
40
52
|
# --------------------------------------------------------------------------
|
@@ -55,7 +67,7 @@ module Neo4j::Mapping
|
|
55
67
|
def init_on_create(*args) # :nodoc:
|
56
68
|
self[:_classname] = self.class.to_s
|
57
69
|
if args[0].respond_to?(:each_pair)
|
58
|
-
args[0].each_pair { |k, v| respond_to?("#{k}=")? self.send("#{k}=", v) : @_java_node[k] = v }
|
70
|
+
args[0].each_pair { |k, v| respond_to?("#{k}=") ? self.send("#{k}=", v) : @_java_node[k] = v }
|
59
71
|
end
|
60
72
|
end
|
61
73
|
|
@@ -64,6 +76,10 @@ module Neo4j::Mapping
|
|
64
76
|
@_java_node
|
65
77
|
end
|
66
78
|
|
79
|
+
# Trigger rules.
|
80
|
+
# You don't normally need to call this method (except in Migration) since
|
81
|
+
# it will be triggered automatically by the Neo4j::Rule::RuleEventListener
|
82
|
+
#
|
67
83
|
def trigger_rules
|
68
84
|
self.class.trigger_rules(self)
|
69
85
|
end
|
@@ -72,7 +88,8 @@ module Neo4j::Mapping
|
|
72
88
|
def _decl_rels_for(rel_type)
|
73
89
|
self.class._decl_rels[rel_type]
|
74
90
|
end
|
75
|
-
|
91
|
+
|
92
|
+
# Returns self. Implements the same method as the Neo4j::Node#wrapper - duck typing.
|
76
93
|
def wrapper
|
77
94
|
self
|
78
95
|
end
|
@@ -91,11 +108,11 @@ module Neo4j::Mapping
|
|
91
108
|
c.class_inheritable_hash :_decl_rels
|
92
109
|
c._decl_rels ||= {}
|
93
110
|
|
94
|
-
c.extend ClassMethods
|
95
|
-
c.extend ClassMethods
|
96
|
-
c.extend ClassMethods
|
97
|
-
c.extend
|
98
|
-
c.extend ClassMethods
|
111
|
+
c.extend ClassMethods
|
112
|
+
c.extend Neo4j::Property::ClassMethods
|
113
|
+
c.extend Neo4j::HasN::ClassMethods
|
114
|
+
c.extend Neo4j::Rule::ClassMethods
|
115
|
+
c.extend Neo4j::HasList::ClassMethods
|
99
116
|
c.extend Neo4j::Index::ClassMethods
|
100
117
|
c.extend WillPaginate::Finders::Base
|
101
118
|
|
@@ -112,4 +129,4 @@ module Neo4j::Mapping
|
|
112
129
|
c.node_indexer c
|
113
130
|
end
|
114
131
|
end
|
115
|
-
end
|
132
|
+
end
|