neo4j 1.2.6-java → 1.3.0-java
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.
- data/CHANGELOG +16 -0
- data/README.rdoc +11 -0
- data/bin/neo4j-upgrade +72 -0
- data/lib/neo4j.rb +18 -19
- data/lib/neo4j/algo/algo.rb +2 -1
- data/lib/neo4j/database.rb +12 -0
- data/lib/neo4j/event_handler.rb +69 -7
- data/lib/neo4j/has_list/class_methods.rb +1 -1
- data/lib/neo4j/has_list/mapping.rb +13 -16
- data/lib/neo4j/index/class_methods.rb +9 -3
- data/lib/neo4j/index/index.rb +2 -1
- data/lib/neo4j/index/indexer.rb +3 -2
- data/lib/neo4j/index/indexer_registry.rb +1 -1
- data/lib/neo4j/jars/core/neo4j-community-1.5.jar +0 -0
- data/lib/neo4j/jars/core/neo4j-cypher-1.5.jar +0 -0
- data/lib/neo4j/jars/core/{neo4j-graph-algo-1.4.1.jar → neo4j-graph-algo-1.5.jar} +0 -0
- data/lib/neo4j/jars/core/neo4j-graph-matching-1.5.jar +0 -0
- data/lib/neo4j/jars/core/neo4j-jmx-1.5.jar +0 -0
- data/lib/neo4j/jars/core/neo4j-kernel-1.5.jar +0 -0
- data/lib/neo4j/jars/core/{neo4j-lucene-index-1.4.1.jar → neo4j-lucene-index-1.5.jar} +0 -0
- data/lib/neo4j/jars/{ha/neo4j-shell-1.4.1.jar → core/neo4j-shell-1.5.jar} +0 -0
- data/lib/neo4j/jars/core/neo4j-udc-1.5.jar +0 -0
- data/lib/neo4j/jars/{ha → core}/org.apache.servicemix.bundles.jline-0.9.94_1.jar +0 -0
- data/lib/neo4j/jars/core/scala-library-2.9.0-1.jar +0 -0
- data/lib/neo4j/jars/core/server-api-1.5.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-backup-1.5.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-com-1.5.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-enterprise-1.5.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-ha-1.5.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-management-1.5.jar +0 -0
- data/lib/neo4j/jars/ha/org.apache.servicemix.bundles.netty-3.2.5.Final_1.jar +0 -0
- data/lib/neo4j/jars/ha/slf4j-api-1.6.1.jar +0 -0
- data/lib/neo4j/neo4j.rb +16 -0
- data/lib/neo4j/node_mixin/node_mixin.rb +2 -2
- data/lib/neo4j/rails/attributes.rb +9 -5
- data/lib/neo4j/rails/compositions.rb +9 -1
- data/lib/neo4j/rails/mapping/property.rb +27 -25
- data/lib/neo4j/rails/model.rb +1 -0
- data/lib/neo4j/rails/persistence.rb +56 -56
- data/lib/neo4j/rails/rel_persistence.rb +1 -1
- data/lib/neo4j/rails/relationship.rb +9 -4
- data/lib/neo4j/rails/relationships/relationships.rb +6 -2
- data/lib/neo4j/rails/relationships/rels_dsl.rb +58 -0
- data/lib/neo4j/rails/relationships/storage.rb +10 -1
- data/lib/neo4j/rails/validations/uniqueness.rb +1 -0
- data/lib/neo4j/rails/versioning/versioning.rb +64 -9
- data/lib/neo4j/rule/event_listener.rb +7 -1
- data/lib/neo4j/rule/functions/count.rb +6 -0
- data/lib/neo4j/rule/rule.rb +20 -5
- data/lib/neo4j/rule/rule_node.rb +31 -19
- data/lib/neo4j/traversal/traverser.rb +38 -0
- data/lib/neo4j/version.rb +1 -1
- data/neo4j.gemspec +1 -1
- metadata +24 -17
- data/lib/neo4j/jars/core/neo4j-backup-1.4.1.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.4.1.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-com-1.4.1.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-ha-1.4.1.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-jmx-1.4.1.jar +0 -0
- data/lib/neo4j/jars/ha/neo4j-management-1.4.1.jar +0 -0
- data/lib/neo4j/jars/ha/netty-3.2.1.Final.jar +0 -0
    
        data/CHANGELOG
    CHANGED
    
    | @@ -1,3 +1,19 @@ | |
| 1 | 
            +
             == 1.3.0 / 2011-12-06
         | 
| 2 | 
            +
            * Added neo4j-upgrade script to rename lucene index files and upgrade to 1.5 [#197]
         | 
| 3 | 
            +
            * Expose Neo4j::NodeMixin#index_types returning available indices (useful for Cypher queries) [#194]
         | 
| 4 | 
            +
            * The to_other method is now available also in the Neo4j::Rails API [#193]
         | 
| 5 | 
            +
            * Expose rel_type method for Neo4j::Rails::Relationship [#196]
         | 
| 6 | 
            +
            * Support for breadth and depth first traversals [#198]
         | 
| 7 | 
            +
            * Support for cypher query [#197]
         | 
| 8 | 
            +
            * Fix for rule node concurrency issue (pull #78, Vivek Prahlad)
         | 
| 9 | 
            +
            * Bugfix for the uniqueness validation for properties with quotes (pull #76, Vivek Prahlad)
         | 
| 10 | 
            +
            * More performance tweaks (pull #75, #77, Vivek Prahlad)
         | 
| 11 | 
            +
            * Fixing add_index for properties other than type string (pull #74, Deepak N)
         | 
| 12 | 
            +
            * Significant performance boost for creating large numbers of models in a transaction (pull #73, Vivek Prahlad)
         | 
| 13 | 
            +
            * Upgrade to neo4j 1.5 jars (pull #72, Vivek Prahlad)
         | 
| 14 | 
            +
            * Fix for assigning nil values to incoming has_one relation (pull #70, Deepak N)
         | 
| 15 | 
            +
            * Support for revert and fixes for Neo4j::Rails::Versioning (pull #71, Vivek Prahlad)
         | 
| 16 | 
            +
             | 
| 1 17 | 
             
             == 1.2.6 / 2011-11-02
         | 
| 2 18 | 
             
            * Generators can now generate relationships as well [#195]
         | 
| 3 19 | 
             
            * Better will_paginate support for Neo4j::Rails::Model [#194]
         | 
    
        data/README.rdoc
    CHANGED
    
    | @@ -12,7 +12,9 @@ It uses two powerful and mature Java libraries: | |
| 12 12 | 
             
            === Documentation
         | 
| 13 13 |  | 
| 14 14 | 
             
            * {Guides and API}[http://neo4j.rubyforge.org/guides/index.html]
         | 
| 15 | 
            +
            * {RDoc}[http://neo4j.rubyforge.org]
         | 
| 15 16 | 
             
            * {Blog: Neo4j and Rails 3}[http://blog.jayway.com/2011/03/02/neo4j-rb-1-0-0-and-rails-3/]
         | 
| 17 | 
            +
            * {Kvitter Example Application}[https://github.com/andreasronge/kvitter/]
         | 
| 16 18 |  | 
| 17 19 | 
             
            === Why Neo4j.rb or a Graph Database ?
         | 
| 18 20 |  | 
| @@ -107,6 +109,15 @@ To run it with Tomcat instead of WEBrick | |
| 107 109 | 
             
              gem install trinidad
         | 
| 108 110 | 
             
              trinidad
         | 
| 109 111 |  | 
| 112 | 
            +
            === Architecture
         | 
| 113 | 
            +
             | 
| 114 | 
            +
            As you seen above, neo4j.rb consists of a three layers API:
         | 
| 115 | 
            +
             | 
| 116 | 
            +
            * Layer 1. For interacting with the basic building blocks of the graph database (node, properties and relationship), see Neo4j::Node and Neo4j::Relationship classes.
         | 
| 117 | 
            +
            * Layer 2. A binding API to Ruby objects, see Neo4j::NodeMixin and Neo4j::RelationshipMixin modules.
         | 
| 118 | 
            +
            * Layer 3. An implementation of the Rails Active Model and a subset of the Active Record API, see Neo4j::Rails::Model class.
         | 
| 119 | 
            +
             | 
| 120 | 
            +
            Notice that you can always access the lower layers if you want to do some more advanced. You can even access the Java API directly.
         | 
| 110 121 |  | 
| 111 122 | 
             
            === Presentation Materials and other URLs
         | 
| 112 123 | 
             
            * {Presentation: RailsConf 2011}[http://andreasronge.github.com/neo4j-railsconf.pdf]
         | 
    
        data/bin/neo4j-upgrade
    ADDED
    
    | @@ -0,0 +1,72 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'fileutils'
         | 
| 4 | 
            +
            require 'neo4j'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            if ARGV.length == 0
         | 
| 7 | 
            +
              puts <<TEXT
         | 
| 8 | 
            +
            A tool for upgrading the neo4j database to #{Neo4j::VERSION}.
         | 
| 9 | 
            +
            Make sure you shutdown the database cleanly before running this script.
         | 
| 10 | 
            +
            More info:  http://neo4j.rubyforge.org/guides/configuration.html#upgrade-to-a-new-neo4j-version
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            Usage   : neo4j-upgrade <location of database>
         | 
| 13 | 
            +
            Example : neo4j-upgrade db/neo4j-development
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            TEXT
         | 
| 16 | 
            +
            exit
         | 
| 17 | 
            +
            end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            def error(msg)
         | 
| 20 | 
            +
              puts msg
         | 
| 21 | 
            +
              exit
         | 
| 22 | 
            +
            end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            def rename_index(folder, file)
         | 
| 25 | 
            +
              new_file = File.join(folder, file.gsub(/-/, '_'))
         | 
| 26 | 
            +
              old_file = File.join(folder, file)
         | 
| 27 | 
            +
              puts "moved index '#{old_file}' to '#{new_file}'"
         | 
| 28 | 
            +
              FileUtils.move(old_file, new_file)
         | 
| 29 | 
            +
            end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            def upgrade(path)
         | 
| 32 | 
            +
              Dir.entries(path).each do |file|
         | 
| 33 | 
            +
                rename_index(path, file) if file =~ /(-exact)|(-fulltext)$/
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
            end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            root = ARGV[0]
         | 
| 38 | 
            +
            error("Can't find database at location #{root}") unless File.exist?(root)
         | 
| 39 | 
            +
            error("Expected location #{root} to be a folder") unless File.directory?(root)
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            # Upgrade
         | 
| 42 | 
            +
            puts "upgrade database to Neo4j.rb version #{Neo4j::VERSION}, this might take a while ...."
         | 
| 43 | 
            +
            Neo4j::Config[:storage_path] = root
         | 
| 44 | 
            +
            Neo4j::Config[:allow_store_upgrade] = 'true'
         | 
| 45 | 
            +
            Neo4j.start
         | 
| 46 | 
            +
            puts "Neo4j database at #{root} upgraded to #{Neo4j::VERSION}, now shutdown"
         | 
| 47 | 
            +
            Neo4j.shutdown
         | 
| 48 | 
            +
            puts "Rename lucene index files"
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            nodes_path = File.join(root, "index", "lucene", "node")
         | 
| 51 | 
            +
            if File.exist?(nodes_path)
         | 
| 52 | 
            +
              upgrade(nodes_path)
         | 
| 53 | 
            +
            else
         | 
| 54 | 
            +
              puts("Can't find lucene index at location #{nodes_path}")
         | 
| 55 | 
            +
            end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
             | 
| 58 | 
            +
            nodes_path = File.join(root, "index", "lucene", "node")
         | 
| 59 | 
            +
            if File.exist?(nodes_path)
         | 
| 60 | 
            +
              upgrade(nodes_path)
         | 
| 61 | 
            +
            else
         | 
| 62 | 
            +
              puts("No lucene index for nodes found at location #{nodes_path}, continue")
         | 
| 63 | 
            +
            end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
            nodes_path = File.join(root, "index", "lucene", "relationship")
         | 
| 66 | 
            +
            if File.exist?(nodes_path)
         | 
| 67 | 
            +
              upgrade(nodes_path)
         | 
| 68 | 
            +
            else
         | 
| 69 | 
            +
              puts("No lucene index for relationship found at location #{nodes_path}")
         | 
| 70 | 
            +
            end
         | 
| 71 | 
            +
             | 
| 72 | 
            +
            puts "Upgraded database done at '#{root}'"
         | 
    
        data/lib/neo4j.rb
    CHANGED
    
    | @@ -20,43 +20,42 @@ require 'neo4j/core_ext/class/inheritable_attributes' | |
| 20 20 |  | 
| 21 21 | 
             
            require 'neo4j/jars/core/geronimo-jta_1.1_spec-1.1.1.jar'
         | 
| 22 22 | 
             
            require 'neo4j/jars/core/lucene-core-3.1.0.jar'
         | 
| 23 | 
            -
            require 'neo4j/jars/core/neo4j- | 
| 24 | 
            -
            require 'neo4j/jars/core/neo4j-kernel-1. | 
| 25 | 
            -
            require 'neo4j/jars/ | 
| 26 | 
            -
            require 'neo4j/jars/ | 
| 23 | 
            +
            require 'neo4j/jars/core/neo4j-cypher-1.5.jar'
         | 
| 24 | 
            +
            require 'neo4j/jars/core/neo4j-kernel-1.5.jar'
         | 
| 25 | 
            +
            require 'neo4j/jars/core/neo4j-lucene-index-1.5.jar'
         | 
| 26 | 
            +
            require 'neo4j/jars/core/neo4j-jmx-1.5.jar'
         | 
| 27 | 
            +
            require 'neo4j/jars/core/neo4j-udc-1.5.jar'
         | 
| 28 | 
            +
            require 'neo4j/jars/core/org.apache.servicemix.bundles.jline-0.9.94_1.jar'
         | 
| 29 | 
            +
            require 'neo4j/jars/core/scala-library-2.9.0-1.jar'
         | 
| 30 | 
            +
            require 'neo4j/jars/core/server-api-1.5.jar'
         | 
| 31 | 
            +
            require 'neo4j/jars/ha/neo4j-management-1.5.jar'
         | 
| 27 32 |  | 
| 28 33 | 
             
            module Neo4j
         | 
| 29 34 |  | 
| 30 35 | 
             
              def self.load_local_jars
         | 
| 31 | 
            -
                # This is a temporary fix since the HA does not yet work with this JAR
         | 
| 32 | 
            -
                # It will be solved in a future version of the Java Neo4j library.
         | 
| 33 36 | 
             
                if Neo4j.config[:online_backup_enabled]
         | 
| 34 37 | 
             
                  Neo4j.load_online_backup
         | 
| 35 | 
            -
                else
         | 
| 36 | 
            -
                  # backup and HA does not work with this JAR FILE
         | 
| 37 | 
            -
                  require 'neo4j/jars/core/neo4j-index-1.3-1.3.M01.jar'
         | 
| 38 38 | 
             
                end
         | 
| 39 39 | 
             
              end
         | 
| 40 40 |  | 
| 41 41 | 
             
              def self.load_shell_jars
         | 
| 42 | 
            -
                require 'neo4j/jars/ | 
| 42 | 
            +
                require 'neo4j/jars/core/neo4j-shell-1.5.jar'
         | 
| 43 43 | 
             
              end
         | 
| 44 44 |  | 
| 45 45 | 
             
              def self.load_online_backup
         | 
| 46 | 
            -
                require 'neo4j/jars/ha/neo4j-com-1. | 
| 47 | 
            -
                require 'neo4j/jars/ | 
| 48 | 
            -
                require 'neo4j/jars/ha/netty-3.2. | 
| 46 | 
            +
                require 'neo4j/jars/ha/neo4j-com-1.5.jar'
         | 
| 47 | 
            +
                require 'neo4j/jars/ha/neo4j-backup-1.5.jar'
         | 
| 48 | 
            +
                require 'neo4j/jars/ha/org.apache.servicemix.bundles.netty-3.2.5.Final_1.jar'
         | 
| 49 49 | 
             
                Neo4j.send(:const_set, :OnlineBackup, org.neo4j.backup.OnlineBackup)
         | 
| 50 50 | 
             
              end
         | 
| 51 51 |  | 
| 52 52 | 
             
              def self.load_ha_jars
         | 
| 53 | 
            -
                require 'neo4j/jars/ | 
| 53 | 
            +
                require 'neo4j/jars/ha/neo4j-backup-1.5.jar'
         | 
| 54 | 
            +
                require 'neo4j/jars/ha/neo4j-com-1.5.jar'
         | 
| 55 | 
            +
                require 'neo4j/jars/ha/neo4j-ha-1.5.jar'
         | 
| 54 56 | 
             
                require 'neo4j/jars/ha/log4j-1.2.16.jar'
         | 
| 55 | 
            -
                require 'neo4j/jars/ha/ | 
| 56 | 
            -
                require 'neo4j/jars/ha/ | 
| 57 | 
            -
                require 'neo4j/jars/ha/netty-3.2.1.Final.jar'
         | 
| 58 | 
            -
                require 'neo4j/jars/ha/org.apache.servicemix.bundles.jline-0.9.94_1.jar'
         | 
| 59 | 
            -
                # require 'neo4j/jars/ha/org.apache.servicemix.bundles.lucene-3.0.1_2.jar' # TODO IS THIS NEEDED ?
         | 
| 57 | 
            +
                require 'neo4j/jars/ha/org.apache.servicemix.bundles.netty-3.2.5.Final_1.jar'
         | 
| 58 | 
            +
                require 'neo4j/jars/ha/slf4j-api-1.6.1.jar'
         | 
| 60 59 | 
             
                require 'neo4j/jars/ha/zookeeper-3.3.2.jar'
         | 
| 61 60 | 
             
              end
         | 
| 62 61 | 
             
            end
         | 
    
        data/lib/neo4j/algo/algo.rb
    CHANGED
    
    
    
        data/lib/neo4j/database.rb
    CHANGED
    
    | @@ -13,6 +13,8 @@ module Neo4j | |
| 13 13 | 
             
              class Database
         | 
| 14 14 | 
             
                attr_reader :graph, :lucene, :event_handler, :storage_path
         | 
| 15 15 |  | 
| 16 | 
            +
                alias_method :index, :lucene # needed by cypher
         | 
| 17 | 
            +
             | 
| 16 18 | 
             
                def initialize()
         | 
| 17 19 | 
             
                  @event_handler = EventHandler.new
         | 
| 18 20 | 
             
                end
         | 
| @@ -62,6 +64,16 @@ module Neo4j | |
| 62 64 | 
             
                  @event_handler.neo4j_started(self)
         | 
| 63 65 | 
             
                end
         | 
| 64 66 |  | 
| 67 | 
            +
                # needed by cypher
         | 
| 68 | 
            +
                def getNodeById(id) #:nodoc:
         | 
| 69 | 
            +
                  Neo4j::Node.load(id)
         | 
| 70 | 
            +
                end
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                # needed by cypher
         | 
| 73 | 
            +
                def getRelationshipById(id) #:nodoc:
         | 
| 74 | 
            +
                  Neo4j::Relationship.load(id)
         | 
| 75 | 
            +
                end
         | 
| 76 | 
            +
             | 
| 65 77 | 
             
                def start_ha_graph_db
         | 
| 66 78 | 
             
                  Neo4j.logger.info "starting Neo4j in HA mode, machine id: #{Neo4j.config['ha.machine_id']} at #{Neo4j.config['ha.server']} db #{@storage_path}"
         | 
| 67 79 | 
             
                  Neo4j.load_ha_jars # those jars are only needed for the HighlyAvailableGraphDatabase
         | 
    
        data/lib/neo4j/event_handler.rb
    CHANGED
    
    | @@ -71,6 +71,9 @@ module Neo4j | |
| 71 71 | 
             
              # * <tt>old_value</tt> :: old value of the property
         | 
| 72 72 | 
             
              # * <tt>new_value</tt> :: new value of the property
         | 
| 73 73 | 
             
              #
         | 
| 74 | 
            +
              # ==== classes_changed(class_change_map)
         | 
| 75 | 
            +
              # * <tt>class_change_map</tt> :: a hash with class names as keys, and class changes as values. See Neo4j::ClassChanges
         | 
| 76 | 
            +
              #
         | 
| 74 77 | 
             
              # == Usage
         | 
| 75 78 | 
             
              #
         | 
| 76 79 | 
             
              #   class MyListener
         | 
| @@ -99,25 +102,37 @@ module Neo4j | |
| 99 102 | 
             
                end
         | 
| 100 103 |  | 
| 101 104 | 
             
                def before_commit(data)
         | 
| 102 | 
            -
                   | 
| 103 | 
            -
                   | 
| 105 | 
            +
                  class_change_map = java.util.HashMap.new
         | 
| 106 | 
            +
                  created_node_identity_map = iterate_created_nodes(data.created_nodes, class_change_map)
         | 
| 107 | 
            +
                  deleted_node_identity_map = deleted_node_identity_map(data.deleted_nodes)
         | 
| 104 108 | 
             
                  deleted_relationship_set = relationship_set(data.deleted_relationships)
         | 
| 105 109 | 
             
                  removed_node_properties_map = property_map(data.removed_node_properties)
         | 
| 106 110 | 
             
                  removed_relationship_properties_map = property_map(data.removed_relationship_properties)
         | 
| 111 | 
            +
                  add_deleted_nodes(data, class_change_map, removed_node_properties_map)
         | 
| 107 112 | 
             
                  empty_map = java.util.HashMap.new
         | 
| 108 | 
            -
                  data. | 
| 109 | 
            -
                  data.assigned_node_properties.each { |tx_data| property_changed(tx_data.entity, tx_data.key, tx_data.previously_commited_value, tx_data.value) }
         | 
| 113 | 
            +
                  data.assigned_node_properties.each { |tx_data| property_changed(tx_data.entity, tx_data.key, tx_data.previously_commited_value, tx_data.value) unless tx_data.key == '_classname'}
         | 
| 110 114 | 
             
                  data.removed_node_properties.each { |tx_data| property_changed(tx_data.entity, tx_data.key, tx_data.previously_commited_value, nil) unless deleted_node_identity_map.containsKey(tx_data.entity.getId) }
         | 
| 111 115 | 
             
                  data.deleted_nodes.each { |node| node_deleted(node, removed_node_properties_map.get(node.getId)||empty_map, deleted_relationship_set, deleted_node_identity_map)}
         | 
| 112 116 | 
             
                  data.created_relationships.each {|rel| relationship_created(rel, created_node_identity_map)}
         | 
| 113 117 | 
             
                  data.deleted_relationships.each {|rel| relationship_deleted(rel, removed_relationship_properties_map.get(rel.getId)||empty_map, deleted_relationship_set, deleted_node_identity_map)}
         | 
| 114 118 | 
             
                  data.assigned_relationship_properties.each { |tx_data| rel_property_changed(tx_data.entity, tx_data.key, tx_data.previously_commited_value, tx_data.value) }
         | 
| 115 119 | 
             
                  data.removed_relationship_properties.each {|tx_data| rel_property_changed(tx_data.entity, tx_data.key, tx_data.previously_commited_value, nil) unless deleted_relationship_set.contains_rel?(tx_data.entity) }
         | 
| 120 | 
            +
                  classes_changed(class_change_map)
         | 
| 116 121 | 
             
                end
         | 
| 117 122 |  | 
| 118 | 
            -
                def  | 
| 123 | 
            +
                def iterate_created_nodes(nodes, class_change_map)
         | 
| 119 124 | 
             
                  identity_map = java.util.HashMap.new(nodes.size)
         | 
| 120 | 
            -
                  nodes.each | 
| 125 | 
            +
                  nodes.each do |node|
         | 
| 126 | 
            +
                    identity_map.put(node.neo_id,node) #using put due to a performance regression in JRuby 1.6.4
         | 
| 127 | 
            +
                    instance_created(node, class_change_map)
         | 
| 128 | 
            +
                    node_created(node)
         | 
| 129 | 
            +
                  end
         | 
| 130 | 
            +
                  identity_map
         | 
| 131 | 
            +
                end
         | 
| 132 | 
            +
             | 
| 133 | 
            +
                def deleted_node_identity_map(nodes)
         | 
| 134 | 
            +
                  identity_map = java.util.HashMap.new(nodes.size)
         | 
| 135 | 
            +
                  nodes.each{|node| identity_map.put(node.neo_id,node)} #using put due to a performance regression in JRuby 1.6.4
         | 
| 121 136 | 
             
                  identity_map
         | 
| 122 137 | 
             
                end
         | 
| 123 138 |  | 
| @@ -192,5 +207,52 @@ module Neo4j | |
| 192 207 | 
             
                def rel_property_changed(rel, key, old_value, new_value)
         | 
| 193 208 | 
             
                  @listeners.each {|li| li.on_rel_property_changed(rel, key, old_value, new_value) if li.respond_to?(:on_rel_property_changed)}
         | 
| 194 209 | 
             
                end
         | 
| 210 | 
            +
             | 
| 211 | 
            +
                def add_deleted_nodes(data, class_change_map, removed_node_properties_map)
         | 
| 212 | 
            +
                  data.deleted_nodes.each{|node| instance_deleted(node, removed_node_properties_map, class_change_map)}
         | 
| 213 | 
            +
                end
         | 
| 214 | 
            +
             | 
| 215 | 
            +
                def instance_created(node, class_change_map)
         | 
| 216 | 
            +
                  classname = node[:_classname]
         | 
| 217 | 
            +
                  class_change(classname, class_change_map).add(node) if classname
         | 
| 218 | 
            +
                end
         | 
| 219 | 
            +
             | 
| 220 | 
            +
                def instance_deleted(node, removed_node_properties_map, class_change_map)
         | 
| 221 | 
            +
                  properties = removed_node_properties_map.get(node.getId)
         | 
| 222 | 
            +
                  if properties
         | 
| 223 | 
            +
                    classname = properties.get("_classname")
         | 
| 224 | 
            +
                    class_change(classname, class_change_map).delete(node) if classname
         | 
| 225 | 
            +
                  end
         | 
| 226 | 
            +
                end
         | 
| 227 | 
            +
             | 
| 228 | 
            +
                def class_change(classname, class_change_map)
         | 
| 229 | 
            +
                  class_change_map.put(classname, ClassChanges.new) if class_change_map.get(classname).nil?
         | 
| 230 | 
            +
                  class_change_map.get(classname)
         | 
| 231 | 
            +
                end
         | 
| 232 | 
            +
             | 
| 233 | 
            +
                def classes_changed(changed_class_map)
         | 
| 234 | 
            +
                  @listeners.each {|li| li.classes_changed(changed_class_map) if li.respond_to?(:classes_changed)}
         | 
| 235 | 
            +
                end
         | 
| 236 | 
            +
              end
         | 
| 237 | 
            +
             | 
| 238 | 
            +
              class ClassChanges
         | 
| 239 | 
            +
                attr_accessor :added, :deleted
         | 
| 240 | 
            +
             | 
| 241 | 
            +
                def initialize
         | 
| 242 | 
            +
                  self.added = []
         | 
| 243 | 
            +
                  self.deleted = []
         | 
| 244 | 
            +
                end
         | 
| 245 | 
            +
             | 
| 246 | 
            +
                def add(node)
         | 
| 247 | 
            +
                  self.added << node
         | 
| 248 | 
            +
                end
         | 
| 249 | 
            +
             | 
| 250 | 
            +
                def delete(node)
         | 
| 251 | 
            +
                  self.deleted << node
         | 
| 252 | 
            +
                end
         | 
| 253 | 
            +
             | 
| 254 | 
            +
                def net_change
         | 
| 255 | 
            +
                  self.added.size - self.deleted.size
         | 
| 256 | 
            +
                end
         | 
| 195 257 | 
             
              end
         | 
| 196 | 
            -
            end
         | 
| 258 | 
            +
            end
         | 
| @@ -35,10 +35,11 @@ module Neo4j | |
| 35 35 | 
             
                  include Enumerable
         | 
| 36 36 | 
             
                  include ToJava
         | 
| 37 37 | 
             
                  include WillPaginate::Finders::Base
         | 
| 38 | 
            -
                  
         | 
| 39 38 |  | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 39 | 
            +
             | 
| 40 | 
            +
                  def initialize(indexer_for, node, name)
         | 
| 41 | 
            +
                    @index = Neo4j.started_db.lucene.for_nodes("#{indexer_for.to_s.gsub('::', '_')}_#{name}-timeline", Neo4j::Config[:lucene][:exact])
         | 
| 42 | 
            +
                    @time_line = org.neo4j.index.lucene.LuceneTimeline.new(Neo4j.started_db.graph, @index)
         | 
| 42 43 | 
             
                    @node      = node
         | 
| 43 44 | 
             
                    @name      = name
         | 
| 44 45 | 
             
                    self.size = 0 unless size
         | 
| @@ -57,38 +58,38 @@ module Neo4j | |
| 57 58 |  | 
| 58 59 | 
             
                  # returns the first node with index n
         | 
| 59 60 | 
             
                  def [](n)
         | 
| 60 | 
            -
                    @time_line. | 
| 61 | 
            +
                    @time_line.getBetween(n, n).first
         | 
| 61 62 | 
             
                  end
         | 
| 62 63 |  | 
| 63 64 | 
             
                  # returns all nodes with the given index n
         | 
| 64 65 | 
             
                  def all(n)
         | 
| 65 | 
            -
                    @time_line. | 
| 66 | 
            +
                    @time_line.getBetween(n, n)
         | 
| 66 67 | 
             
                  end
         | 
| 67 68 |  | 
| 68 69 | 
             
                  # returns the first node in the list or nil
         | 
| 69 70 | 
             
                  def first
         | 
| 70 | 
            -
                    @time_line. | 
| 71 | 
            +
                    @time_line.getFirst()
         | 
| 71 72 | 
             
                  end
         | 
| 72 73 |  | 
| 73 74 | 
             
                  # returns the last node in the list or nil
         | 
| 74 75 | 
             
                  def last
         | 
| 75 | 
            -
                    @time_line. | 
| 76 | 
            +
                    @time_line.getLast
         | 
| 76 77 | 
             
                  end
         | 
| 77 78 |  | 
| 78 79 | 
             
                  # adds a node to the list with the given index n
         | 
| 79 80 | 
             
                  def []=(n, other_node)
         | 
| 80 | 
            -
                    @time_line. | 
| 81 | 
            +
                    @time_line.add(other_node, n)
         | 
| 81 82 | 
             
                    self.size = self.size + 1
         | 
| 82 83 | 
             
                  end
         | 
| 83 84 |  | 
| 84 85 | 
             
                  # returns all the nodes between the given Range
         | 
| 85 86 | 
             
                  def between(range)
         | 
| 86 | 
            -
                    @time_line. | 
| 87 | 
            +
                    @time_line.getBetween(range.first, range.end)
         | 
| 87 88 | 
             
                  end
         | 
| 88 89 |  | 
| 89 90 | 
             
                  # removes one node from the list and decrases the size of the list,
         | 
| 90 91 | 
             
                  def remove(node)
         | 
| 91 | 
            -
                    @ | 
| 92 | 
            +
                    @index.remove(node, "timestamp")
         | 
| 92 93 | 
             
                    self.size = self.size - 1
         | 
| 93 94 | 
             
                  end
         | 
| 94 95 |  | 
| @@ -104,7 +105,7 @@ module Neo4j | |
| 104 105 | 
             
                  #  person.feeds.each {|node| node}
         | 
| 105 106 | 
             
                  #
         | 
| 106 107 | 
             
                  def each
         | 
| 107 | 
            -
                    @time_line. | 
| 108 | 
            +
                    @time_line.getBetween(java.lang.Long::MIN_VALUE,java.lang.Long::MAX_VALUE).iterator.each do |node|
         | 
| 108 109 | 
             
                      if @raw then
         | 
| 109 110 | 
             
                        yield node
         | 
| 110 111 | 
             
                      else
         | 
| @@ -135,19 +136,15 @@ module Neo4j | |
| 135 136 | 
             
                  end
         | 
| 136 137 |  | 
| 137 138 | 
             
                  def <<(other)
         | 
| 138 | 
            -
                    @time_line. | 
| 139 | 
            +
                    @time_line.add(other._java_node, size)
         | 
| 139 140 | 
             
                    self.size = self.size + 1
         | 
| 140 141 | 
             
                    self
         | 
| 141 142 | 
             
                  end
         | 
| 142 143 |  | 
| 143 | 
            -
             | 
| 144 144 | 
             
                  private
         | 
| 145 145 | 
             
                  def size=(size)
         | 
| 146 146 | 
             
                    @node["_list_size_#{@name}"] = size
         | 
| 147 147 | 
             
                  end
         | 
| 148 | 
            -
             | 
| 149 | 
            -
             | 
| 150 148 | 
             
                end
         | 
| 151 | 
            -
             | 
| 152 149 | 
             
              end
         | 
| 153 150 | 
             
            end
         | 
| @@ -53,13 +53,19 @@ module Neo4j | |
| 53 53 | 
             
                  #
         | 
| 54 54 | 
             
                  #  Person.index_names[:fulltext] => 'my_location'
         | 
| 55 55 | 
             
                  #  Person.index_names[:exact] => 'Foo_Person-exact' # default Location
         | 
| 56 | 
            -
                  # | 
| 57 | 
            -
                  # | 
| 56 | 
            +
                  #
         | 
| 57 | 
            +
                  # The index can be prefixed, see Neo4j#threadlocal_ref_node= and multi dendency.
         | 
| 58 58 | 
             
                  #
         | 
| 59 59 | 
             
                  # :singleton-method: index_names
         | 
| 60 60 |  | 
| 61 61 |  | 
| 62 | 
            -
                   | 
| 62 | 
            +
                  ##
         | 
| 63 | 
            +
                  # Returns a hash of which indexes has been defined and the type of index (:exact or :fulltext)
         | 
| 64 | 
            +
                  #
         | 
| 65 | 
            +
                  # :singleton-method: index_types
         | 
| 66 | 
            +
             | 
| 67 | 
            +
             | 
| 68 | 
            +
                  def_delegators :@_indexer, :index, :find, :index?, :index_type?, :delete_index_type, :rm_field_type, :add_index, :rm_index, :index_type_for, :index_names, :index_types
         | 
| 63 69 |  | 
| 64 70 | 
             
                  # Sets which indexer should be used for the given node class.
         | 
| 65 71 | 
             
                  # You can share an indexer between several different classes.
         |