Sha256: a222d5ec38d6bdd64bc652494c382010c997a7e994b5b7fde58a6981ddd76f28

Contents?: true

Size: 817 Bytes

Versions: 21

Compression:

Stored size: 817 Bytes

Contents

module Neo4j
  module Rule
    module Functions

      # A function for counting number of nodes of a given class.
      class Count < Function
        def initialize
          @property = '_classname'
        end

        def calculate?(changed_property)
          true
        end

        def delete(rule_name, rule_node, old_value)
          key = rule_node_property(rule_name)
          rule_node[key] ||= 0
          rule_node[key] -= 1
        end

        def add(rule_name, rule_node, new_value)
          key = rule_node_property(rule_name)
          rule_node[key] ||= 0
          rule_node[key] += 1
        end

        def update(*)
          # we are only counting, not interested in property changes
        end

        def self.function_name
          :count
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
neo4j-1.2.6-java lib/neo4j/rule/functions/count.rb
neo4j-1.2.5-java lib/neo4j/rule/functions/count.rb
neo4j-1.2.4-java lib/neo4j/rule/functions/count.rb
neo4j-1.2.3-java lib/neo4j/rule/functions/count.rb
neo4j-1.2.2-java lib/neo4j/rule/functions/count.rb
neo4j-1.2.1-java lib/neo4j/rule/functions/count.rb
neo4j-1.2.0-java lib/neo4j/rule/functions/count.rb
neo4j-1.1.4-java lib/neo4j/rule/functions/count.rb
neo4j-1.1.3-java lib/neo4j/rule/functions/count.rb
neo4j-1.1.2-java lib/neo4j/rule/functions/count.rb
neo4j-1.1.1-java lib/neo4j/rule/functions/count.rb
neo4j-1.1.0-java lib/neo4j/rule/functions/count.rb
neo4j-1.1.0.beta.3-java lib/neo4j/rule/functions/count.rb
neo4j-1.1.0.beta.2-java lib/neo4j/rule/functions/count.rb
neo4j-1.1.0.beta.1-java lib/neo4j/rule/functions/count.rb
neo4j-1.0.0-java lib/neo4j/rule/functions/count.rb
neo4j-1.0.0.beta.32-java lib/neo4j/rule/functions/count.rb
neo4j-1.0.0.beta.31-java lib/neo4j/rule/functions/count.rb
neo4j-1.0.0.beta.30-java lib/neo4j/rule/functions/count.rb
neo4j-1.0.0.beta.29-java lib/neo4j/rule/functions/count.rb