activegraph 10.0.0.pre.alpha.11 → 10.0.0.pre.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/{neo4j.gemspec → activegraph.gemspec} +7 -9
  4. data/config/neo4j/config.yml +4 -4
  5. data/lib/active_graph.rb +120 -0
  6. data/lib/{neo4j → active_graph}/ansi.rb +1 -1
  7. data/lib/{neo4j → active_graph}/attribute_set.rb +3 -3
  8. data/lib/{neo4j/active_base.rb → active_graph/base.rb} +18 -12
  9. data/lib/{neo4j → active_graph}/class_arguments.rb +5 -5
  10. data/lib/{neo4j → active_graph}/config.rb +10 -10
  11. data/lib/active_graph/core.rb +14 -0
  12. data/lib/{neo4j → active_graph}/core/connection_failed_error.rb +1 -1
  13. data/lib/{neo4j → active_graph}/core/cypher_error.rb +1 -1
  14. data/lib/{neo4j → active_graph}/core/driver.rb +5 -5
  15. data/lib/{neo4j → active_graph}/core/has_uri.rb +1 -1
  16. data/lib/{neo4j → active_graph}/core/instrumentable.rb +4 -4
  17. data/lib/{neo4j → active_graph}/core/label.rb +13 -13
  18. data/lib/{neo4j → active_graph}/core/logging.rb +2 -2
  19. data/lib/{neo4j → active_graph}/core/node.rb +2 -2
  20. data/lib/{neo4j → active_graph}/core/querable.rb +7 -7
  21. data/lib/{neo4j → active_graph}/core/query.rb +16 -16
  22. data/lib/{neo4j → active_graph}/core/query_builder.rb +3 -3
  23. data/lib/{neo4j → active_graph}/core/query_clauses.rb +1 -1
  24. data/lib/{neo4j → active_graph}/core/query_ext.rb +5 -5
  25. data/lib/{neo4j → active_graph}/core/query_find_in_batches.rb +2 -2
  26. data/lib/{neo4j → active_graph}/core/relationship.rb +2 -2
  27. data/lib/{neo4j → active_graph}/core/responses.rb +3 -3
  28. data/lib/{neo4j → active_graph}/core/result.rb +1 -1
  29. data/lib/{neo4j → active_graph}/core/schema.rb +1 -1
  30. data/lib/{neo4j → active_graph}/core/schema_errors.rb +1 -1
  31. data/lib/{neo4j → active_graph}/core/wrappable.rb +1 -1
  32. data/lib/{neo4j → active_graph}/errors.rb +1 -1
  33. data/lib/{neo4j → active_graph}/lazy_attribute_hash.rb +1 -1
  34. data/lib/{neo4j → active_graph}/migration.rb +11 -11
  35. data/lib/{neo4j → active_graph}/migrations.rb +5 -5
  36. data/lib/{neo4j → active_graph}/migrations/base.rb +7 -7
  37. data/lib/{neo4j → active_graph}/migrations/check_pending.rb +3 -3
  38. data/lib/{neo4j → active_graph}/migrations/helpers.rb +4 -4
  39. data/lib/{neo4j → active_graph}/migrations/helpers/id_property.rb +3 -3
  40. data/lib/{neo4j → active_graph}/migrations/helpers/relationships.rb +1 -1
  41. data/lib/{neo4j → active_graph}/migrations/helpers/schema.rb +7 -7
  42. data/lib/{neo4j → active_graph}/migrations/migration_file.rb +1 -1
  43. data/lib/{neo4j → active_graph}/migrations/runner.rb +3 -3
  44. data/lib/{neo4j → active_graph}/migrations/schema.rb +1 -1
  45. data/lib/{neo4j → active_graph}/migrations/schema_migration.rb +2 -2
  46. data/lib/{neo4j → active_graph}/model_schema.rb +8 -8
  47. data/lib/{neo4j/active_node.rb → active_graph/node.rb} +32 -32
  48. data/lib/{neo4j/active_node → active_graph/node}/callbacks.rb +3 -3
  49. data/lib/{neo4j/active_node → active_graph/node}/dependent.rb +2 -2
  50. data/lib/{neo4j/active_node → active_graph/node}/dependent/association_methods.rb +2 -2
  51. data/lib/{neo4j/active_node → active_graph/node}/dependent/query_proxy_methods.rb +4 -4
  52. data/lib/{neo4j/active_node → active_graph/node}/dependent_callbacks.rb +4 -4
  53. data/lib/{neo4j/active_node → active_graph/node}/enum.rb +3 -3
  54. data/lib/{neo4j/active_node → active_graph/node}/has_n.rb +20 -20
  55. data/lib/{neo4j/active_node → active_graph/node}/has_n/association.rb +8 -8
  56. data/lib/{neo4j/active_node → active_graph/node}/has_n/association/rel_factory.rb +4 -4
  57. data/lib/{neo4j/active_node → active_graph/node}/has_n/association/rel_wrapper.rb +4 -4
  58. data/lib/{neo4j/active_node → active_graph/node}/has_n/association_cypher_methods.rb +2 -2
  59. data/lib/{neo4j/active_node → active_graph/node}/id_property.rb +7 -7
  60. data/lib/{neo4j/active_node → active_graph/node}/id_property/accessor.rb +1 -1
  61. data/lib/{neo4j/active_node → active_graph/node}/initialize.rb +3 -3
  62. data/lib/{neo4j/active_node → active_graph/node}/labels.rb +18 -18
  63. data/lib/{neo4j/active_node → active_graph/node}/labels/index.rb +6 -6
  64. data/lib/{neo4j/active_node → active_graph/node}/labels/reloading.rb +1 -1
  65. data/lib/{neo4j/active_node → active_graph/node}/node_list_formatter.rb +1 -1
  66. data/lib/{neo4j/active_node → active_graph/node}/node_wrapper.rb +5 -5
  67. data/lib/{neo4j/active_node → active_graph/node}/orm_adapter.rb +2 -2
  68. data/lib/{neo4j/active_node → active_graph/node}/persistence.rb +7 -7
  69. data/lib/{neo4j/active_node → active_graph/node}/property.rb +3 -3
  70. data/lib/{neo4j/active_node → active_graph/node}/query.rb +9 -9
  71. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy.rb +19 -19
  72. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_eager_loading.rb +3 -3
  73. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_eager_loading/association_tree.rb +2 -2
  74. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_enumerable.rb +4 -4
  75. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_find_in_batches.rb +2 -2
  76. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_link.rb +3 -3
  77. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_methods.rb +12 -12
  78. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_methods_of_mass_updating.rb +4 -4
  79. data/lib/{neo4j/active_node → active_graph/node}/query_methods.rb +4 -4
  80. data/lib/{neo4j/active_node → active_graph/node}/reflection.rb +3 -3
  81. data/lib/{neo4j/active_node → active_graph/node}/rels.rb +1 -1
  82. data/lib/{neo4j/active_node → active_graph/node}/scope.rb +4 -4
  83. data/lib/{neo4j/active_node → active_graph/node}/unpersisted.rb +2 -2
  84. data/lib/{neo4j/active_node → active_graph/node}/validations.rb +3 -3
  85. data/lib/{neo4j → active_graph}/paginated.rb +1 -1
  86. data/lib/{neo4j → active_graph}/railtie.rb +18 -18
  87. data/lib/{neo4j/active_rel.rb → active_graph/relationship.rb} +19 -19
  88. data/lib/active_graph/relationship/callbacks.rb +21 -0
  89. data/lib/{neo4j/active_rel → active_graph/relationship}/initialize.rb +5 -5
  90. data/lib/{neo4j/active_rel → active_graph/relationship}/persistence.rb +6 -6
  91. data/lib/{neo4j/active_rel → active_graph/relationship}/persistence/query_factory.rb +7 -7
  92. data/lib/{neo4j/active_rel → active_graph/relationship}/property.rb +6 -6
  93. data/lib/{neo4j/active_rel → active_graph/relationship}/query.rb +7 -7
  94. data/lib/{neo4j/active_rel → active_graph/relationship}/rel_wrapper.rb +5 -5
  95. data/lib/{neo4j/active_rel → active_graph/relationship}/related_node.rb +7 -7
  96. data/lib/{neo4j/active_rel → active_graph/relationship}/types.rb +6 -6
  97. data/lib/active_graph/relationship/validations.rb +8 -0
  98. data/lib/{neo4j → active_graph}/schema/operation.rb +5 -5
  99. data/lib/{neo4j → active_graph}/shared.rb +7 -7
  100. data/lib/{neo4j → active_graph}/shared/attributes.rb +10 -10
  101. data/lib/{neo4j → active_graph}/shared/callbacks.rb +3 -3
  102. data/lib/{neo4j → active_graph}/shared/cypher.rb +1 -1
  103. data/lib/{neo4j → active_graph}/shared/declared_properties.rb +8 -8
  104. data/lib/{neo4j → active_graph}/shared/declared_property.rb +9 -9
  105. data/lib/{neo4j → active_graph}/shared/declared_property/index.rb +3 -3
  106. data/lib/{neo4j → active_graph}/shared/enum.rb +6 -6
  107. data/lib/{neo4j → active_graph}/shared/filtered_hash.rb +2 -2
  108. data/lib/{neo4j → active_graph}/shared/identity.rb +2 -2
  109. data/lib/{neo4j → active_graph}/shared/initialize.rb +3 -3
  110. data/lib/{neo4j → active_graph}/shared/marshal.rb +1 -1
  111. data/lib/{neo4j → active_graph}/shared/mass_assignment.rb +2 -2
  112. data/lib/{neo4j → active_graph}/shared/permitted_attributes.rb +1 -1
  113. data/lib/{neo4j → active_graph}/shared/persistence.rb +4 -4
  114. data/lib/{neo4j → active_graph}/shared/property.rb +10 -10
  115. data/lib/{neo4j → active_graph}/shared/query_factory.rb +5 -5
  116. data/lib/{neo4j → active_graph}/shared/rel_type_converters.rb +6 -6
  117. data/lib/{neo4j → active_graph}/shared/serialized_properties.rb +1 -1
  118. data/lib/{neo4j → active_graph}/shared/type_converters.rb +11 -13
  119. data/lib/{neo4j → active_graph}/shared/typecasted_attributes.rb +7 -7
  120. data/lib/{neo4j → active_graph}/shared/typecaster.rb +3 -3
  121. data/lib/{neo4j → active_graph}/shared/validations.rb +1 -1
  122. data/lib/{neo4j → active_graph}/tasks/migration.rake +25 -25
  123. data/lib/{neo4j → active_graph}/timestamps.rb +3 -3
  124. data/lib/{neo4j → active_graph}/timestamps/created.rb +1 -1
  125. data/lib/{neo4j → active_graph}/timestamps/updated.rb +1 -1
  126. data/lib/{neo4j → active_graph}/transaction.rb +9 -9
  127. data/lib/active_graph/transactions.rb +54 -0
  128. data/lib/{neo4j → active_graph}/type_converters.rb +2 -2
  129. data/lib/{neo4j → active_graph}/undeclared_properties.rb +1 -1
  130. data/lib/active_graph/version.rb +3 -0
  131. data/lib/{neo4j → active_graph}/wrapper.rb +1 -1
  132. data/lib/rails/generators/neo4j/migration/migration_generator.rb +4 -4
  133. data/lib/rails/generators/neo4j/migration/templates/migration.erb +2 -2
  134. data/lib/rails/generators/neo4j/model/model_generator.rb +4 -4
  135. data/lib/rails/generators/neo4j/model/templates/migration.erb +1 -1
  136. data/lib/rails/generators/neo4j/model/templates/model.erb +1 -1
  137. data/lib/rails/generators/neo4j/upgrade_v8/templates/migration.erb +1 -1
  138. data/lib/rails/generators/neo4j/upgrade_v8/upgrade_v8_generator.rb +6 -6
  139. data/lib/rails/generators/neo4j_generator.rb +4 -4
  140. metadata +134 -133
  141. data/lib/neo4j.rb +0 -119
  142. data/lib/neo4j/active_rel/callbacks.rb +0 -21
  143. data/lib/neo4j/active_rel/validations.rb +0 -8
  144. data/lib/neo4j/core.rb +0 -14
  145. data/lib/neo4j/version.rb +0 -3
@@ -1,5 +1,5 @@
1
- module Neo4j
2
- module ActiveNode
1
+ module ActiveGraph
2
+ module Node
3
3
  module Dependent
4
4
  # methods used to resolve association dependencies
5
5
  module QueryProxyMethods
@@ -22,10 +22,10 @@ module Neo4j
22
22
 
23
23
  # This will match nodes who only have a single relationship of a given type.
24
24
  # It's used by `dependent: :delete_orphans` and `dependent: :destroy_orphans` and may not have much utility otherwise.
25
- # @param [Neo4j::ActiveNode::HasN::Association] association The Association object used throughout the match.
25
+ # @param [ActiveGraph::Node::HasN::Association] association The Association object used throughout the match.
26
26
  # @param [String, Symbol] other_node The identifier to use for the other end of the chain.
27
27
  # @param [String, Symbol] other_rel The identifier to use for the relationship in the optional match.
28
- # @return [Neo4j::ActiveNode::Query::QueryProxy]
28
+ # @return [ActiveGraph::Node::Query::QueryProxy]
29
29
  def unique_nodes(association, self_identifer, other_node, other_rel, ids = [])
30
30
  fail 'Only supported by in QueryProxy chains started by an instance' unless source_object
31
31
  return false if send(association.name).empty?
@@ -1,5 +1,5 @@
1
- module Neo4j
2
- module ActiveNode
1
+ module ActiveGraph
2
+ module Node
3
3
  module DependentCallbacks
4
4
  extend ActiveSupport::Concern
5
5
 
@@ -22,8 +22,8 @@ module Neo4j
22
22
  unique_query.each_for_destruction(self, &:destroy) if unique_query
23
23
  end
24
24
 
25
- def callbacks_from_active_rel(active_rel, direction, other_node)
26
- rel = active_rel_corresponding_rel(active_rel, direction, other_node.class).try(:last)
25
+ def callbacks_from_relationship(relationship, direction, other_node)
26
+ rel = relationship_corresponding_rel(relationship, direction, other_node.class).try(:last)
27
27
  public_send("dependent_#{rel.dependent}_callback", rel, [other_node.id]) if rel && rel.dependent
28
28
  end
29
29
  end
@@ -1,14 +1,14 @@
1
- module Neo4j::ActiveNode
1
+ module ActiveGraph::Node
2
2
  module Enum
3
3
  extend ActiveSupport::Concern
4
- include Neo4j::Shared::Enum
4
+ include ActiveGraph::Shared::Enum
5
5
 
6
6
  module ClassMethods
7
7
  protected
8
8
 
9
9
  def define_property(property_name, *args)
10
10
  super
11
- Neo4j::ModelSchema.add_required_index(self, property_name) unless args[1][:_index] == false
11
+ ActiveGraph::ModelSchema.add_required_index(self, property_name) unless args[1][:_index] == false
12
12
  end
13
13
 
14
14
  def define_enum_methods(property_name, enum_keys, options)
@@ -1,9 +1,9 @@
1
- module Neo4j::ActiveNode
1
+ module ActiveGraph::Node
2
2
  module HasN
3
3
  extend ActiveSupport::Concern
4
4
 
5
- class NonPersistedNodeError < Neo4j::Error; end
6
- class HasOneConstraintError < Neo4j::Error; end
5
+ class NonPersistedNodeError < ActiveGraph::Error; end
6
+ class HasOneConstraintError < ActiveGraph::Error; end
7
7
  # Return this object from associations
8
8
  # It uses a QueryProxy to get results
9
9
  # But also caches results and can have results cached on it
@@ -23,7 +23,7 @@ module Neo4j::ActiveNode
23
23
  # States:
24
24
  # Default
25
25
  def inspect
26
- formatted_nodes = ::Neo4j::ActiveNode::NodeListFormatter.new(result_nodes)
26
+ formatted_nodes = ::ActiveGraph::Node::NodeListFormatter.new(result_nodes)
27
27
  "#<AssociationProxy #{@query_proxy.context} #{formatted_nodes.inspect}>"
28
28
  end
29
29
 
@@ -87,7 +87,7 @@ module Neo4j::ActiveNode
87
87
 
88
88
  def result_ids
89
89
  result.map do |object|
90
- object.is_a?(Neo4j::ActiveNode) ? object.id : object
90
+ object.is_a?(ActiveGraph::Node) ? object.id : object
91
91
  end
92
92
  end
93
93
 
@@ -151,8 +151,8 @@ module Neo4j::ActiveNode
151
151
  target = target_for_missing_method(method_name)
152
152
  super if target.nil?
153
153
 
154
- cache_query_proxy_result if !cached? && !target.is_a?(Neo4j::ActiveNode::Query::QueryProxy)
155
- clear_cache_result if target.is_a?(Neo4j::ActiveNode::Query::QueryProxy)
154
+ cache_query_proxy_result if !cached? && !target.is_a?(ActiveGraph::Node::Query::QueryProxy)
155
+ clear_cache_result if target.is_a?(ActiveGraph::Node::Query::QueryProxy)
156
156
 
157
157
  target.public_send(method_name, *args, &block)
158
158
  end
@@ -165,7 +165,7 @@ module Neo4j::ActiveNode
165
165
 
166
166
  def map_results_as_nodes(result)
167
167
  result.map do |object|
168
- object.is_a?(Neo4j::ActiveNode) ? object : @query_proxy.model.find(object)
168
+ object.is_a?(ActiveGraph::Node) ? object : @query_proxy.model.find(object)
169
169
  end
170
170
  end
171
171
 
@@ -241,8 +241,8 @@ module Neo4j::ActiveNode
241
241
  reverse_assoc && reverse_assoc.last
242
242
  end
243
243
 
244
- def delete_reverse_has_one_active_rel(active_rel, direction, other_node)
245
- rel = active_rel_corresponding_rel(active_rel, direction, other_node.class)
244
+ def delete_reverse_has_one_relationship(relationship, direction, other_node)
245
+ rel = relationship_corresponding_rel(relationship, direction, other_node.class)
246
246
  delete_has_one_rel!(rel.last) if rel && rel.last.type == :has_one
247
247
  end
248
248
 
@@ -251,10 +251,10 @@ module Neo4j::ActiveNode
251
251
  association_proxy_cache.clear
252
252
  end
253
253
 
254
- def active_rel_corresponding_rel(active_rel, direction, target_class)
254
+ def relationship_corresponding_rel(relationship, direction, target_class)
255
255
  self.class.associations.find do |_key, assoc|
256
- assoc.relationship_class_name == active_rel.class.name ||
257
- (assoc.relationship_type == active_rel.type.to_sym && assoc.target_class == target_class && assoc.direction == direction)
256
+ assoc.relationship_class_name == relationship.class.name ||
257
+ (assoc.relationship_type == relationship.type.to_sym && assoc.target_class == target_class && assoc.direction == direction)
258
258
  end
259
259
  end
260
260
 
@@ -377,11 +377,11 @@ module Neo4j::ActiveNode
377
377
  # Post.has_one :in, :author, type: :has_author, model_class: :Person
378
378
  #
379
379
  # *model_class*: The model class to which the association is referring. Can be a
380
- # Symbol/String (or an ``Array`` of same) with the name of the `ActiveNode` class,
380
+ # Symbol/String (or an ``Array`` of same) with the name of the `Node` class,
381
381
  # `false` to specify any model, or nil to specify that it should be guessed.
382
382
  #
383
- # *rel_class*: The ``ActiveRel`` class to use for this association. Can be either a
384
- # model object ``include`` ing ``ActiveRel`` or a Symbol/String (or an ``Array`` of same).
383
+ # *rel_class*: The ``Relationship`` class to use for this association. Can be either a
384
+ # model object ``include`` ing ``Relationship`` or a Symbol/String (or an ``Array`` of same).
385
385
  # **A Symbol or String is recommended** to avoid load-time issues
386
386
  #
387
387
  # *dependent*: Enables deletion cascading.
@@ -402,7 +402,7 @@ module Neo4j::ActiveNode
402
402
  #
403
403
  # This would define the methods: ``#vehicle``, ``#vehicle=``, and ``.vehicle``.
404
404
  #
405
- # See :ref:`#has_many <Neo4j/ActiveNode/HasN/ClassMethods#has_many>` for anything
405
+ # See :ref:`#has_many <Neo4j/Node/HasN/ClassMethods#has_many>` for anything
406
406
  # not specified here
407
407
  #
408
408
  def has_one(direction, name, options = {}) # rubocop:disable Naming/PredicateName
@@ -543,7 +543,7 @@ module Neo4j::ActiveNode
543
543
  def association_query_proxy(name, options = {})
544
544
  previous_query_proxy = options[:previous_query_proxy] || current_scope
545
545
  query_proxy = previous_query_proxy || default_association_query_proxy
546
- Neo4j::ActiveNode::Query::QueryProxy.new(association_target_class(name),
546
+ ActiveGraph::Node::Query::QueryProxy.new(association_target_class(name),
547
547
  associations[name],
548
548
  {driver: neo4j_driver,
549
549
  query_proxy: query_proxy,
@@ -577,13 +577,13 @@ module Neo4j::ActiveNode
577
577
  end
578
578
 
579
579
  def default_association_query_proxy
580
- Neo4j::ActiveNode::Query::QueryProxy.new("::#{self.name}".constantize, nil,
580
+ ActiveGraph::Node::Query::QueryProxy.new("::#{self.name}".constantize, nil,
581
581
  driver: neo4j_driver, query_proxy: nil, context: self.name.to_s)
582
582
  end
583
583
 
584
584
  def build_association(macro, direction, name, options)
585
585
  options[:model_class] = options[:model_class].name if options[:model_class] == self
586
- Neo4j::ActiveNode::HasN::Association.new(macro, direction, name, options).tap do |association|
586
+ ActiveGraph::Node::HasN::Association.new(macro, direction, name, options).tap do |association|
587
587
  add_association(name, association)
588
588
  create_reflection(macro, name, association, self)
589
589
  end
@@ -1,13 +1,13 @@
1
1
  require 'active_support/inflector/inflections'
2
- require 'neo4j/class_arguments'
2
+ require 'active_graph/class_arguments'
3
3
 
4
- module Neo4j
5
- module ActiveNode
4
+ module ActiveGraph
5
+ module Node
6
6
  module HasN
7
7
  class Association
8
- include Neo4j::Shared::RelTypeConverters
9
- include Neo4j::ActiveNode::Dependent::AssociationMethods
10
- include Neo4j::ActiveNode::HasN::AssociationCypherMethods
8
+ include ActiveGraph::Shared::RelTypeConverters
9
+ include ActiveGraph::Node::Dependent::AssociationMethods
10
+ include ActiveGraph::Node::HasN::AssociationCypherMethods
11
11
 
12
12
  attr_reader :type, :name, :relationship, :direction, :dependent, :model_class
13
13
 
@@ -89,7 +89,7 @@ module Neo4j
89
89
 
90
90
  def discovered_model
91
91
  target_classes.select do |constant|
92
- constant.ancestors.include?(::Neo4j::ActiveNode)
92
+ constant.ancestors.include?(::ActiveGraph::Node)
93
93
  end
94
94
  end
95
95
 
@@ -153,7 +153,7 @@ module Neo4j
153
153
  private
154
154
 
155
155
  def association_model_namespace
156
- Neo4j::Config.association_model_namespace_string
156
+ ActiveGraph::Config.association_model_namespace_string
157
157
  end
158
158
 
159
159
  def get_direction(create, reverse = false)
@@ -1,4 +1,4 @@
1
- module Neo4j::ActiveNode::HasN
1
+ module ActiveGraph::Node::HasN
2
2
  class Association
3
3
  class RelFactory
4
4
  [:start_object, :other_node_or_nodes, :properties, :association].tap do |accessors|
@@ -36,7 +36,7 @@ module Neo4j::ActiveNode::HasN
36
36
  Array(other_node_or_nodes).each do |other_node|
37
37
  wrapper = _rel_wrapper(properties)
38
38
  base = _match_query(other_node, wrapper)
39
- factory = Neo4j::Shared::RelQueryFactory.new(wrapper, wrapper.rel_identifier)
39
+ factory = ActiveGraph::Shared::RelQueryFactory.new(wrapper, wrapper.rel_identifier)
40
40
  factory.base_query = base
41
41
  factory.query.exec
42
42
  end
@@ -44,7 +44,7 @@ module Neo4j::ActiveNode::HasN
44
44
 
45
45
  def _match_query(other_node, wrapper)
46
46
  nodes = _nodes_for_create(other_node, wrapper.from_node_identifier, wrapper.to_node_identifier)
47
- Neo4j::ActiveBase.new_query.match_nodes(nodes)
47
+ ActiveGraph::Base.new_query.match_nodes(nodes)
48
48
  end
49
49
 
50
50
  def _nodes_for_create(other_node, from_node_id, to_node_id)
@@ -54,7 +54,7 @@ module Neo4j::ActiveNode::HasN
54
54
  end
55
55
 
56
56
  def _rel_wrapper(properties)
57
- Neo4j::ActiveNode::HasN::Association::RelWrapper.new(association, properties)
57
+ ActiveGraph::Node::HasN::Association::RelWrapper.new(association, properties)
58
58
  end
59
59
  end
60
60
  end
@@ -1,8 +1,8 @@
1
- class Neo4j::ActiveNode::HasN::Association
2
- # Provides the interface needed to interact with the ActiveRel query factory.
1
+ class ActiveGraph::Node::HasN::Association
2
+ # Provides the interface needed to interact with the Relationship query factory.
3
3
  class RelWrapper
4
- include Neo4j::Shared::Cypher::RelIdentifiers
5
- include Neo4j::Shared::Cypher::CreateMethod
4
+ include ActiveGraph::Shared::Cypher::RelIdentifiers
5
+ include ActiveGraph::Shared::Cypher::CreateMethod
6
6
 
7
7
  attr_reader :type, :association
8
8
  attr_accessor :properties
@@ -1,5 +1,5 @@
1
- module Neo4j
2
- module ActiveNode
1
+ module ActiveGraph
2
+ module Node
3
3
  module HasN
4
4
  module AssociationCypherMethods
5
5
  # Return cypher partial query string for the relationship part of a MATCH (arrow / relationship definition)
@@ -1,16 +1,16 @@
1
- module Neo4j::ActiveNode
1
+ module ActiveGraph::Node
2
2
  # This module makes it possible to use other IDs than the build it neo4j id (neo_id)
3
3
  #
4
4
  # @example using generated UUIDs
5
5
  # class Person
6
- # include Neo4j::ActiveNode
6
+ # include ActiveGraph::Node
7
7
  # # creates a 'secret' neo4j property my_uuid which will be used as primary key
8
8
  # id_property :my_uuid, auto: :uuid
9
9
  # end
10
10
  #
11
11
  # @example using user defined ids
12
12
  # class Person
13
- # include Neo4j::ActiveNode
13
+ # include ActiveGraph::Node
14
14
  # property :title
15
15
  # validates :title, :presence => true
16
16
  # id_property :title_id, on: :title_to_url
@@ -22,7 +22,7 @@ module Neo4j::ActiveNode
22
22
  #
23
23
  # @example using already exsting ids that you don't want a constraint added to
24
24
  # class Person
25
- # include Neo4j::ActiveNode
25
+ # include ActiveGraph::Node
26
26
  # property :title
27
27
  # validates :title, :presence => true
28
28
  # id_property :id, on: :id_builder, constraint: false
@@ -198,18 +198,18 @@ module Neo4j::ActiveNode
198
198
  return
199
199
  end
200
200
 
201
- Neo4j::ModelSchema.add_defined_constraint(self, id_property_name)
201
+ ActiveGraph::ModelSchema.add_defined_constraint(self, id_property_name)
202
202
  end
203
203
 
204
204
  def warn_constraint_option_false!(id_property_name)
205
- Neo4j::ActiveBase.logger.warn <<MSG
205
+ ActiveGraph::Base.logger.warn <<MSG
206
206
  WARNING: The constraint option for id_property is no longer supported (Used on #{self.name}.#{id_property_name}).
207
207
  Since you specified `constraint: false` this option can simply be removed.
208
208
  MSG
209
209
  end
210
210
 
211
211
  def id_property_name_type_value
212
- name, type, value = Neo4j::Config.to_hash.values_at('id_property', 'id_property_type', 'id_property_type_value')
212
+ name, type, value = ActiveGraph::Config.to_hash.values_at('id_property', 'id_property_type', 'id_property_type_value')
213
213
 
214
214
  unless name == :neo_id || (name && type && value)
215
215
  name = :uuid
@@ -1,4 +1,4 @@
1
- module Neo4j::ActiveNode::IdProperty
1
+ module ActiveGraph::Node::IdProperty
2
2
  # Provides get/set of the Id Property values.
3
3
  # Some methods
4
4
  module Accessor
@@ -1,11 +1,11 @@
1
- module Neo4j::ActiveNode::Initialize
1
+ module ActiveGraph::Node::Initialize
2
2
  extend ActiveSupport::Concern
3
- include Neo4j::Shared::Initialize
3
+ include ActiveGraph::Shared::Initialize
4
4
 
5
5
  attr_reader :called_by
6
6
 
7
7
  # called when loading the node from the database
8
- # @param [Neo4j::Node] persisted_node the node this class wraps
8
+ # @param [ActiveGraph::Node] persisted_node the node this class wraps
9
9
  # @param [Hash] properties of the persisted node.
10
10
  def init_on_load(persisted_node, properties)
11
11
  self.class.extract_association_attributes!(properties)
@@ -1,24 +1,24 @@
1
- require 'neo4j/core/label'
1
+ require 'active_graph/core/label'
2
2
 
3
- module Neo4j
4
- module ActiveNode
3
+ module ActiveGraph
4
+ module Node
5
5
  # Provides a mapping between neo4j labels and Ruby classes
6
6
  module Labels
7
7
  extend ActiveSupport::Concern
8
- include Neo4j::ActiveNode::Labels::Index
9
- include Neo4j::ActiveNode::Labels::Reloading
8
+ include ActiveGraph::Node::Labels::Index
9
+ include ActiveGraph::Node::Labels::Reloading
10
10
 
11
11
  WRAPPED_CLASSES = []
12
12
  MODELS_FOR_LABELS_CACHE = {}
13
13
  MODELS_FOR_LABELS_CACHE.clear
14
14
 
15
15
  included do |model|
16
- Neo4j::ActiveNode::Labels.clear_wrapped_models
16
+ ActiveGraph::Node::Labels.clear_wrapped_models
17
17
 
18
- Neo4j::ActiveNode::Labels.add_wrapped_class(model) unless Neo4j::ActiveNode::Labels._wrapped_classes.include?(model)
18
+ ActiveGraph::Node::Labels.add_wrapped_class(model) unless ActiveGraph::Node::Labels._wrapped_classes.include?(model)
19
19
  end
20
20
 
21
- class RecordNotFound < Neo4j::RecordNotFound; end
21
+ class RecordNotFound < ActiveGraph::RecordNotFound; end
22
22
 
23
23
  # @return the labels
24
24
  # @see Neo4j-core
@@ -76,11 +76,11 @@ module Neo4j
76
76
 
77
77
  def self.clear_wrapped_models
78
78
  MODELS_FOR_LABELS_CACHE.clear
79
- Neo4j::NodeWrapping::CONSTANTS_FOR_LABELS_CACHE.clear
79
+ ActiveGraph::NodeWrapping::CONSTANTS_FOR_LABELS_CACHE.clear
80
80
  end
81
81
 
82
82
  module ClassMethods
83
- include Neo4j::ActiveNode::QueryMethods
83
+ include ActiveGraph::Node::QueryMethods
84
84
 
85
85
  delegate :update_all, to: :all
86
86
 
@@ -129,14 +129,14 @@ module Neo4j
129
129
  @mapped_label_name || label_for_model
130
130
  end
131
131
 
132
- # @return [Neo4j::Label] the label for this class
132
+ # @return [ActiveGraph::Label] the label for this class
133
133
  def mapped_label
134
- Neo4j::Core::Label.new(mapped_label_name)
134
+ ActiveGraph::Core::Label.new(mapped_label_name)
135
135
  end
136
136
 
137
137
  def base_class
138
- unless self < Neo4j::ActiveNode
139
- fail "#{name} doesn't belong in a hierarchy descending from ActiveNode"
138
+ unless self < ActiveGraph::Node
139
+ fail "#{name} doesn't belong in a hierarchy descending from Node"
140
140
  end
141
141
 
142
142
  if superclass == Object
@@ -149,7 +149,7 @@ module Neo4j
149
149
  protected
150
150
 
151
151
  def mapped_labels
152
- mapped_label_names.map { |label_name| Neo4j::Label.create(label_name) }
152
+ mapped_label_names.map { |label_name| ActiveGraph::Label.create(label_name) }
153
153
  end
154
154
 
155
155
  def mapped_label_name=(name)
@@ -176,7 +176,7 @@ module Neo4j
176
176
 
177
177
  def find_callbacks!(result)
178
178
  case result
179
- when Neo4j::ActiveNode
179
+ when ActiveGraph::Node
180
180
  result.run_callbacks(:find)
181
181
  when Array
182
182
  result.each { |r| find_callbacks!(r) }
@@ -190,11 +190,11 @@ module Neo4j
190
190
  end
191
191
 
192
192
  def decorated_label_name
193
- name = case Neo4j::Config[:module_handling]
193
+ name = case ActiveGraph::Config[:module_handling]
194
194
  when :demodulize
195
195
  self.name.demodulize
196
196
  when Proc
197
- Neo4j::Config[:module_handling].call self.name
197
+ ActiveGraph::Config[:module_handling].call self.name
198
198
  else
199
199
  self.name
200
200
  end
@@ -1,4 +1,4 @@
1
- module Neo4j::ActiveNode::Labels
1
+ module ActiveGraph::Node::Labels
2
2
  module Index
3
3
  extend ActiveSupport::Concern
4
4
 
@@ -9,20 +9,20 @@ module Neo4j::ActiveNode::Labels
9
9
 
10
10
  # Creates a Neo4j index on given property
11
11
  #
12
- # This can also be done on the property directly, see Neo4j::ActiveNode::Property::ClassMethods#property.
12
+ # This can also be done on the property directly, see ActiveGraph::Node::Property::ClassMethods#property.
13
13
  #
14
14
  # @param [Symbol] property the property we want a Neo4j index on
15
15
  #
16
16
  # @example
17
17
  # class Person
18
- # include Neo4j::ActiveNode
18
+ # include ActiveGraph::Node
19
19
  # property :name
20
20
  # index :name
21
21
  # end
22
22
  def index(property)
23
- return if Neo4j::ModelSchema.defined_constraint?(self, property)
23
+ return if ActiveGraph::ModelSchema.defined_constraint?(self, property)
24
24
 
25
- Neo4j::ModelSchema.add_defined_index(self, property)
25
+ ActiveGraph::ModelSchema.add_defined_index(self, property)
26
26
  end
27
27
 
28
28
  # Creates a neo4j constraint on this class for given property
@@ -30,7 +30,7 @@ module Neo4j::ActiveNode::Labels
30
30
  # @example
31
31
  # Person.constraint :name, type: :unique
32
32
  def constraint(property, _constraints = {type: :unique})
33
- Neo4j::ModelSchema.add_defined_constraint(self, property)
33
+ ActiveGraph::ModelSchema.add_defined_constraint(self, property)
34
34
  end
35
35
  end
36
36
  end