neo4j 2.0.0.alpha.5-java → 2.0.0.alpha.6-java
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +12 -0
- data/Gemfile +0 -4
- data/README.rdoc +106 -62
- data/lib/neo4j.rb +7 -33
- data/lib/neo4j/performance.rb +43 -0
- data/lib/neo4j/rails/accept_id.rb +19 -18
- data/lib/neo4j/rails/attributes.rb +366 -120
- data/lib/neo4j/rails/finders.rb +41 -15
- data/lib/neo4j/rails/has_n.rb +203 -0
- data/lib/neo4j/rails/identity.rb +25 -0
- data/lib/neo4j/rails/model.rb +65 -242
- data/lib/neo4j/rails/nested_attributes.rb +108 -0
- data/lib/neo4j/rails/node_persistance.rb +56 -0
- data/lib/neo4j/rails/observer.rb +0 -2
- data/lib/neo4j/rails/persistence.rb +32 -154
- data/lib/neo4j/rails/rack_middleware.rb +26 -2
- data/lib/neo4j/rails/rails.rb +9 -6
- data/lib/neo4j/rails/railtie.rb +1 -2
- data/lib/neo4j/rails/relationship.rb +18 -125
- data/lib/neo4j/rails/relationship_persistence.rb +107 -0
- data/lib/neo4j/rails/relationships/node_dsl.rb +72 -44
- data/lib/neo4j/rails/relationships/relationships.rb +187 -59
- data/lib/neo4j/rails/relationships/rels_dsl.rb +18 -17
- data/lib/neo4j/rails/relationships/storage.rb +19 -17
- data/lib/neo4j/rails/timestamps.rb +53 -51
- data/lib/neo4j/rails/transaction.rb +9 -1
- data/lib/neo4j/rails/validations/uniqueness.rb +1 -1
- data/lib/neo4j/rails/versioning/versioning.rb +2 -2
- data/lib/neo4j/version.rb +1 -1
- data/lib/orm_adapter/adapters/neo4j.rb +47 -46
- data/neo4j.gemspec +1 -1
- metadata +10 -69
- data/lib/neo4j/algo/algo.rb +0 -294
- data/lib/neo4j/batch/batch.rb +0 -4
- data/lib/neo4j/batch/indexer.rb +0 -109
- data/lib/neo4j/batch/inserter.rb +0 -179
- data/lib/neo4j/batch/rule_inserter.rb +0 -24
- data/lib/neo4j/batch/rule_node.rb +0 -72
- data/lib/neo4j/config.rb +0 -177
- data/lib/neo4j/core_ext/class/inheritable_attributes.rb +0 -12
- data/lib/neo4j/core_ext/class/rewrite_inheritable_attributes.rb +0 -170
- data/lib/neo4j/database.rb +0 -158
- data/lib/neo4j/equal.rb +0 -21
- data/lib/neo4j/event_handler.rb +0 -263
- data/lib/neo4j/has_list/class_methods.rb +0 -11
- data/lib/neo4j/has_list/has_list.rb +0 -3
- data/lib/neo4j/has_list/mapping.rb +0 -133
- data/lib/neo4j/has_n/class_methods.rb +0 -119
- data/lib/neo4j/has_n/decl_relationship_dsl.rb +0 -246
- data/lib/neo4j/has_n/has_n.rb +0 -3
- data/lib/neo4j/has_n/mapping.rb +0 -98
- data/lib/neo4j/identity_map.rb +0 -140
- data/lib/neo4j/index/class_methods.rb +0 -108
- data/lib/neo4j/index/index.rb +0 -39
- data/lib/neo4j/index/indexer.rb +0 -341
- data/lib/neo4j/index/indexer_registry.rb +0 -68
- data/lib/neo4j/index/lucene_query.rb +0 -256
- data/lib/neo4j/load.rb +0 -25
- data/lib/neo4j/migrations/class_methods.rb +0 -110
- data/lib/neo4j/migrations/extensions.rb +0 -58
- data/lib/neo4j/migrations/lazy_node_mixin.rb +0 -41
- data/lib/neo4j/migrations/migration.rb +0 -112
- data/lib/neo4j/migrations/migrations.rb +0 -6
- data/lib/neo4j/migrations/node_mixin.rb +0 -80
- data/lib/neo4j/migrations/ref_node_wrapper.rb +0 -32
- data/lib/neo4j/model.rb +0 -4
- data/lib/neo4j/neo4j.rb +0 -216
- data/lib/neo4j/node.rb +0 -270
- data/lib/neo4j/node_mixin/class_methods.rb +0 -51
- data/lib/neo4j/node_mixin/node_mixin.rb +0 -141
- data/lib/neo4j/paginated.rb +0 -23
- data/lib/neo4j/property/class_methods.rb +0 -79
- data/lib/neo4j/property/property.rb +0 -111
- data/lib/neo4j/rails/mapping/property.rb +0 -183
- data/lib/neo4j/rails/rel_persistence.rb +0 -237
- data/lib/neo4j/relationship.rb +0 -239
- data/lib/neo4j/relationship_mixin/class_methods.rb +0 -36
- data/lib/neo4j/relationship_mixin/relationship_mixin.rb +0 -142
- data/lib/neo4j/relationship_set.rb +0 -58
- data/lib/neo4j/rels/rels.rb +0 -110
- data/lib/neo4j/rels/traverser.rb +0 -102
- data/lib/neo4j/rule/class_methods.rb +0 -201
- data/lib/neo4j/rule/event_listener.rb +0 -66
- data/lib/neo4j/rule/functions/count.rb +0 -43
- data/lib/neo4j/rule/functions/function.rb +0 -74
- data/lib/neo4j/rule/functions/functions.rb +0 -3
- data/lib/neo4j/rule/functions/sum.rb +0 -29
- data/lib/neo4j/rule/rule.rb +0 -150
- data/lib/neo4j/rule/rule_node.rb +0 -217
- data/lib/neo4j/to_java.rb +0 -31
- data/lib/neo4j/transaction.rb +0 -73
- data/lib/neo4j/traversal/filter_predicate.rb +0 -25
- data/lib/neo4j/traversal/prune_evaluator.rb +0 -14
- data/lib/neo4j/traversal/rel_expander.rb +0 -31
- data/lib/neo4j/traversal/traversal.rb +0 -141
- data/lib/neo4j/traversal/traverser.rb +0 -284
- data/lib/neo4j/type_converters/type_converters.rb +0 -288
data/lib/neo4j/node.rb
DELETED
@@ -1,270 +0,0 @@
|
|
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'
|
8
|
-
|
9
|
-
module Neo4j
|
10
|
-
# A node in the graph with properties and relationships to other entities.
|
11
|
-
# Along with relationships, nodes are the core building blocks of the Neo4j data representation model.
|
12
|
-
# Node has three major groups of operations: operations that deal with relationships, operations that deal with properties and operations that traverse the node space.
|
13
|
-
# The property operations give access to the key-value property pairs.
|
14
|
-
# Property keys are always strings. Valid property value types are the primitives(<tt>String</tt>, <tt>Fixnum</tt>, <tt>Float</tt>, <tt>Boolean</tt>), and arrays of those primitives.
|
15
|
-
#
|
16
|
-
# === Instance Methods from Included Mixins
|
17
|
-
# * Neo4j::Property - methods that deal with properties
|
18
|
-
# * Neo4j::Rels methods for accessing incoming and outgoing relationship and nodes of depth one.
|
19
|
-
# * Neo4j::Equal equality operators: <tt>eql?</tt>, <tt>equal</tt>, <tt>==</tt>
|
20
|
-
# * Neo4j::Index lucene index methods, like indexing a node
|
21
|
-
# * Neo4j::Traversal - provides an API for accessing outgoing and incoming nodes by traversing from this node of any depth.
|
22
|
-
#
|
23
|
-
# === Class Methods from Included Mixins
|
24
|
-
# * Neo4j::Index::ClassMethods lucene index class methods, like find
|
25
|
-
# * Neo4j::Load - methods for loading a node
|
26
|
-
#
|
27
|
-
# === Neo4j::Node#new and Wrappers
|
28
|
-
#
|
29
|
-
# The Neo4j::Node#new method does not return a new Ruby instance (!). Instead it will call the Neo4j Java API which will return a
|
30
|
-
# *org.neo4j.kernel.impl.core.NodeProxy* object. This java object includes those mixins, see above. The #class method on the java object
|
31
|
-
# returns Neo4j::Node in order to make it feel like an ordnary Ruby object.
|
32
|
-
#
|
33
|
-
# If you want to map your own class to a neo4j node you can use the Neo4j::NodeMixin or the Neo4j::Rails::Model.
|
34
|
-
# The Neo4j::NodeMixin and Neo4j::Rails::Model wraps the Neo4j::Node object. The raw java node/Neo4j::Node object can be access with the Neo4j::NodeMixin#java_node method.
|
35
|
-
#
|
36
|
-
class Node
|
37
|
-
extend Neo4j::Index::ClassMethods
|
38
|
-
extend Neo4j::Load
|
39
|
-
|
40
|
-
self.node_indexer self
|
41
|
-
|
42
|
-
|
43
|
-
##
|
44
|
-
# :method: del
|
45
|
-
# Delete the node and all its relationship.
|
46
|
-
#
|
47
|
-
# It might raise an exception if this method was called without a Transaction,
|
48
|
-
# or if it failed to delete the node (it maybe was already deleted).
|
49
|
-
#
|
50
|
-
# If this method raise an exception you may also get an exception when the transaction finish.
|
51
|
-
# This method is defined in the org.neo4j.kernel.impl.core.NodeProxy which is return by Neo4j::Node.new
|
52
|
-
#
|
53
|
-
# ==== Returns
|
54
|
-
# nil or raise an exception
|
55
|
-
#
|
56
|
-
|
57
|
-
##
|
58
|
-
# :method: exist?
|
59
|
-
# returns true if the node exists in the database
|
60
|
-
# This method is defined in the org.neo4j.kernel.impl.core.NodeProxy which is return by Neo4j::Node.new
|
61
|
-
|
62
|
-
##
|
63
|
-
# :method: wrapped_entity
|
64
|
-
# same as _java_node
|
65
|
-
# Used so that we have same method for both relationship and nodes
|
66
|
-
# This method is defined in the org.neo4j.kernel.impl.core.NodeProxy which is return by Neo4j::Node.new
|
67
|
-
|
68
|
-
##
|
69
|
-
# :method: wrapper
|
70
|
-
# Loads the Ruby wrapper for this node (unless it is already the wrapper).
|
71
|
-
# If there is no _classname property for this node then it will simply return itself.
|
72
|
-
# Same as Neo4j::Node.wrapper(node)
|
73
|
-
# This method is defined in the org.neo4j.kernel.impl.core.NodeProxy which is return by Neo4j::Node.new
|
74
|
-
|
75
|
-
|
76
|
-
##
|
77
|
-
# :method: _java_node
|
78
|
-
# Returns the java node/relationship object representing this object unless it is already the java object.
|
79
|
-
# This method is defined in the org.neo4j.kernel.impl.core.NodeProxy which is return by Neo4j::Node.new
|
80
|
-
|
81
|
-
|
82
|
-
##
|
83
|
-
# :method: expand
|
84
|
-
# See Neo4j::Traversal#expand
|
85
|
-
|
86
|
-
##
|
87
|
-
# :method: outgoing
|
88
|
-
# See Neo4j::Traversal#outgoing
|
89
|
-
|
90
|
-
|
91
|
-
##
|
92
|
-
# :method: incoming
|
93
|
-
# See Neo4j::Traversal#incoming
|
94
|
-
|
95
|
-
##
|
96
|
-
# :method: both
|
97
|
-
# See Neo4j::Traversal#both
|
98
|
-
|
99
|
-
##
|
100
|
-
# :method: eval_paths
|
101
|
-
# See Neo4j::Traversal#eval_paths
|
102
|
-
|
103
|
-
##
|
104
|
-
# :method: unique
|
105
|
-
# See Neo4j::Traversal#unique
|
106
|
-
|
107
|
-
##
|
108
|
-
# :method: node
|
109
|
-
# See Neo4j::Rels#node or Neo4j::Rels
|
110
|
-
|
111
|
-
##
|
112
|
-
# :method: _node
|
113
|
-
# See Neo4j::Rels#_node or Neo4j::Rels
|
114
|
-
|
115
|
-
##
|
116
|
-
# :method: rels
|
117
|
-
# See Neo4j::Rels#rels or Neo4j::Rels
|
118
|
-
|
119
|
-
##
|
120
|
-
# :method: _rels
|
121
|
-
# See Neo4j::Rels#_rels or Neo4j::Rels
|
122
|
-
|
123
|
-
##
|
124
|
-
# :method: rel
|
125
|
-
# See Neo4j::Rels#rel
|
126
|
-
|
127
|
-
##
|
128
|
-
# :method: _rel
|
129
|
-
# See Neo4j::Rels#_rel
|
130
|
-
|
131
|
-
##
|
132
|
-
# :method: rel?
|
133
|
-
# See Neo4j::Rels#rel?
|
134
|
-
|
135
|
-
##
|
136
|
-
# :method: props
|
137
|
-
# See Neo4j::Property#props
|
138
|
-
|
139
|
-
##
|
140
|
-
# :method: neo_id
|
141
|
-
# See Neo4j::Property#neo_id
|
142
|
-
|
143
|
-
##
|
144
|
-
# :method: attributes
|
145
|
-
# See Neo4j::Property#attributes
|
146
|
-
|
147
|
-
##
|
148
|
-
# :method: property?
|
149
|
-
# See Neo4j::Property#property?
|
150
|
-
|
151
|
-
##
|
152
|
-
# :method: update
|
153
|
-
# See Neo4j::Property#update
|
154
|
-
|
155
|
-
##
|
156
|
-
# :method: []
|
157
|
-
# See Neo4j::Property#[]
|
158
|
-
|
159
|
-
##
|
160
|
-
# :method: []=
|
161
|
-
# See Neo4j::Property#[]=
|
162
|
-
|
163
|
-
##
|
164
|
-
# :method: []=
|
165
|
-
# See Neo4j::Property#[]=
|
166
|
-
|
167
|
-
class << self
|
168
|
-
|
169
|
-
# Returns a new neo4j Node.
|
170
|
-
# The return node is actually an Java obejct of type org.neo4j.graphdb.Node java object
|
171
|
-
# which has been extended (see the included mixins for Neo4j::Node).
|
172
|
-
#
|
173
|
-
# The created node will have a unique id - Neo4j::Property#neo_id
|
174
|
-
#
|
175
|
-
# ==== Parameters
|
176
|
-
# *args :: a hash of properties to initialize the node with or nil
|
177
|
-
#
|
178
|
-
# ==== Returns
|
179
|
-
# org.neo4j.graphdb.Node java object
|
180
|
-
#
|
181
|
-
# ==== Examples
|
182
|
-
#
|
183
|
-
# Neo4j::Transaction.run do
|
184
|
-
# Neo4j::Node.new
|
185
|
-
# Neo4j::Node.new :name => 'foo', :age => 100
|
186
|
-
# end
|
187
|
-
#
|
188
|
-
#
|
189
|
-
def new(*args)
|
190
|
-
# the first argument can be an hash of properties to set
|
191
|
-
props = args[0].respond_to?(:each_pair) && args[0]
|
192
|
-
|
193
|
-
# a db instance can be given, is the first argument if that was not a hash, or otherwise the second
|
194
|
-
db = (!props && args[0]) || args[1] || Neo4j.started_db
|
195
|
-
|
196
|
-
node = db.graph.create_node
|
197
|
-
props.each_pair { |k, v| node[k]= v } if props
|
198
|
-
node
|
199
|
-
end
|
200
|
-
|
201
|
-
# create is the same as new
|
202
|
-
alias_method :create, :new
|
203
|
-
|
204
|
-
# Loads a node or wrapped node given a native java node or an id.
|
205
|
-
# If there is a Ruby wrapper for the node then it will create a Ruby object that will
|
206
|
-
# wrap the java node (see Neo4j::NodeMixin).
|
207
|
-
#
|
208
|
-
# If the node does not exist it will return nil
|
209
|
-
#
|
210
|
-
def load(node_id, db = Neo4j.started_db)
|
211
|
-
node = _load(node_id, db)
|
212
|
-
node && node.wrapper
|
213
|
-
end
|
214
|
-
|
215
|
-
# Same as load but does not return the node as a wrapped Ruby object.
|
216
|
-
#
|
217
|
-
def _load(node_id, db = Neo4j.started_db)
|
218
|
-
return nil if node_id.nil?
|
219
|
-
db.graph.get_node_by_id(node_id.to_i)
|
220
|
-
rescue java.lang.IllegalStateException
|
221
|
-
nil # the node has been deleted
|
222
|
-
rescue org.neo4j.graphdb.NotFoundException
|
223
|
-
nil
|
224
|
-
end
|
225
|
-
|
226
|
-
def extend_java_class(java_clazz) #:nodoc:
|
227
|
-
java_clazz.class_eval do
|
228
|
-
include Neo4j::Property
|
229
|
-
include Neo4j::Rels
|
230
|
-
include Neo4j::Traversal
|
231
|
-
include Neo4j::Equal
|
232
|
-
include Neo4j::Index
|
233
|
-
|
234
|
-
def del #:nodoc:
|
235
|
-
rels.each { |r| r.del }
|
236
|
-
delete
|
237
|
-
nil
|
238
|
-
end
|
239
|
-
|
240
|
-
def exist? #:nodoc:
|
241
|
-
Neo4j::Node.exist?(self)
|
242
|
-
end
|
243
|
-
|
244
|
-
def wrapped_entity #:nodoc:
|
245
|
-
self
|
246
|
-
end
|
247
|
-
|
248
|
-
def wrapper #:nodoc:
|
249
|
-
self.class.wrapper(self)
|
250
|
-
end
|
251
|
-
|
252
|
-
def _java_node #:nodoc:
|
253
|
-
self
|
254
|
-
end
|
255
|
-
|
256
|
-
def class #:nodoc:
|
257
|
-
Neo4j::Node
|
258
|
-
end
|
259
|
-
end
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
# org.neo4j.kernel.HighlyAvailableGraphDatabase$LookupNode
|
265
|
-
#
|
266
|
-
Neo4j::Node.extend_java_class(org.neo4j.kernel.impl.core.NodeProxy)
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
module Neo4j
|
2
|
-
module NodeMixin
|
3
|
-
module ClassMethods
|
4
|
-
|
5
|
-
def load_wrapper(node)
|
6
|
-
wrapped_node = self.orig_new
|
7
|
-
wrapped_node.init_on_load(node)
|
8
|
-
wrapped_node
|
9
|
-
end
|
10
|
-
|
11
|
-
|
12
|
-
# Creates a new node or loads an already existing Neo4j node.
|
13
|
-
#
|
14
|
-
# You can use two callback method to initialize the node
|
15
|
-
# init_on_load:: this method is called when the node is loaded from the database
|
16
|
-
# init_on_create:: called when the node is created, will be provided with the same argument as the new method
|
17
|
-
#
|
18
|
-
#
|
19
|
-
# Does
|
20
|
-
# * sets the neo4j property '_classname' to self.class.to_s
|
21
|
-
# * creates a neo4j node java object (in @_java_node)
|
22
|
-
#
|
23
|
-
# If you want to provide your own initialize method you should instead implement the
|
24
|
-
# method init_on_create method.
|
25
|
-
#
|
26
|
-
# === Example
|
27
|
-
#
|
28
|
-
# class MyNode
|
29
|
-
# include Neo4j::NodeMixin
|
30
|
-
#
|
31
|
-
# def init_on_create(name, age)
|
32
|
-
# self[:name] = name
|
33
|
-
# self[:age] = age
|
34
|
-
# end
|
35
|
-
# end
|
36
|
-
#
|
37
|
-
# node = MyNode.new('jimmy', 23)
|
38
|
-
#
|
39
|
-
def new(*args)
|
40
|
-
node = Neo4j::Node.create
|
41
|
-
wrapped_node = super()
|
42
|
-
Neo4j::IdentityMap.add(node, wrapped_node)
|
43
|
-
wrapped_node.init_on_load(node)
|
44
|
-
wrapped_node.init_on_create(*args)
|
45
|
-
wrapped_node
|
46
|
-
end
|
47
|
-
|
48
|
-
alias_method :create, :new
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,141 +0,0 @@
|
|
1
|
-
# external third party dependencies
|
2
|
-
require "active_support/core_ext/module/delegation"
|
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'
|
10
|
-
|
11
|
-
# internal dependencies
|
12
|
-
require 'neo4j/node_mixin/class_methods'
|
13
|
-
|
14
|
-
|
15
|
-
module Neo4j
|
16
|
-
# This Mixin is used to wrap Neo4j Java Nodes in Ruby objects.
|
17
|
-
#
|
18
|
-
# It includes a number of mixins and forwards some methods to the raw Java node (Neo4j::Node) which includes the mixins below:
|
19
|
-
#
|
20
|
-
# === Instance Methods
|
21
|
-
#
|
22
|
-
# Mixins:
|
23
|
-
# * Neo4j::Index
|
24
|
-
# * Neo4j::Property
|
25
|
-
# * Neo4j::Rels
|
26
|
-
# * Neo4j::Equal
|
27
|
-
# * Neo4j::Index
|
28
|
-
#
|
29
|
-
# === Class Methods
|
30
|
-
#
|
31
|
-
# Mixins:
|
32
|
-
# * Neo4j::NodeMixin::ClassMethods
|
33
|
-
# * Neo4j::Property::ClassMethods
|
34
|
-
# * Neo4j::HasN::ClassMethods
|
35
|
-
# * Neo4j::Rule::ClassMethods
|
36
|
-
# * Neo4j::Index::ClassMethods
|
37
|
-
# * Neo4j::HasList::ClassMethods
|
38
|
-
#
|
39
|
-
module NodeMixin
|
40
|
-
include Neo4j::Index
|
41
|
-
|
42
|
-
include Neo4j::Rule::Functions
|
43
|
-
|
44
|
-
delegate :[]=, :[], :property?, :props, :attributes, :update, :neo_id, :id, :rels, :rel?, :node, :to_param, :getId,
|
45
|
-
:rel, :del, :list?, :print, :print_sub, :outgoing, :incoming, :both, :expand, :get_property, :set_property,
|
46
|
-
:equal?, :eql?, :==, :exist?, :getRelationships, :getSingleRelationship, :_rels, :rel, :wrapped_entity, :_node,
|
47
|
-
:to => :@_java_node, :allow_nil => true
|
48
|
-
|
49
|
-
|
50
|
-
# --------------------------------------------------------------------------
|
51
|
-
# Initialization methods
|
52
|
-
#
|
53
|
-
|
54
|
-
|
55
|
-
# Init this node with the specified java neo node
|
56
|
-
#
|
57
|
-
def init_on_load(java_node) # :nodoc:
|
58
|
-
@_java_node = java_node
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
# Creates a new node and initialize with given properties.
|
63
|
-
# You can override this to provide your own initialization.
|
64
|
-
#
|
65
|
-
def init_on_create(*args) # :nodoc:
|
66
|
-
self[:_classname] = self.class.to_s
|
67
|
-
if args[0].respond_to?(:each_pair)
|
68
|
-
args[0].each_pair { |k, v| respond_to?("#{k}=") ? self.send("#{k}=", v) : @_java_node[k] = v }
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# Returns the org.neo4j.graphdb.Node wrapped object
|
73
|
-
def _java_node
|
74
|
-
@_java_node
|
75
|
-
end
|
76
|
-
|
77
|
-
# same as _java_node - so that we can use the same method for both relationships and nodes
|
78
|
-
def _java_entity
|
79
|
-
@_java_node
|
80
|
-
end
|
81
|
-
|
82
|
-
# Trigger rules.
|
83
|
-
# You don't normally need to call this method (except in Migration) since
|
84
|
-
# it will be triggered automatically by the Neo4j::Rule::Rule
|
85
|
-
#
|
86
|
-
def trigger_rules
|
87
|
-
self.class.trigger_rules(self)
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
def _decl_rels_for(rel_type)
|
92
|
-
self.class._decl_rels[rel_type]
|
93
|
-
end
|
94
|
-
|
95
|
-
# Returns self. Implements the same method as the Neo4j::Node#wrapper - duck typing.
|
96
|
-
def wrapper
|
97
|
-
self
|
98
|
-
end
|
99
|
-
|
100
|
-
def pagination_source(*a)
|
101
|
-
binding.pry
|
102
|
-
end
|
103
|
-
|
104
|
-
def self.pagination_source(*a)
|
105
|
-
binding.pry
|
106
|
-
end
|
107
|
-
|
108
|
-
def self.included(c) # :nodoc:
|
109
|
-
c.instance_eval do
|
110
|
-
class << self
|
111
|
-
alias_method :orig_new, :new
|
112
|
-
end
|
113
|
-
end unless c.respond_to?(:orig_new)
|
114
|
-
|
115
|
-
c.class_inheritable_accessor :_decl_props
|
116
|
-
c._decl_props ||= {}
|
117
|
-
|
118
|
-
c.class_inheritable_accessor :_decl_rels
|
119
|
-
c._decl_rels ||= {}
|
120
|
-
|
121
|
-
c.extend ClassMethods
|
122
|
-
c.extend Neo4j::Property::ClassMethods
|
123
|
-
c.extend Neo4j::HasN::ClassMethods
|
124
|
-
c.extend Neo4j::Rule::ClassMethods
|
125
|
-
c.extend Neo4j::HasList::ClassMethods
|
126
|
-
c.extend Neo4j::Index::ClassMethods
|
127
|
-
|
128
|
-
def c.inherited(subclass)
|
129
|
-
# inherit the index properties
|
130
|
-
subclass.node_indexer self
|
131
|
-
|
132
|
-
# inherit the rules too
|
133
|
-
subclass.inherit_rules_from self
|
134
|
-
|
135
|
-
super
|
136
|
-
end
|
137
|
-
|
138
|
-
c.node_indexer c unless c == Neo4j::Rails::Model
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|