Sha256: 016367a5341aa9408ebaa3567487bcc672c028703e7527b1846b8964a7d6cb15

Contents?: true

Size: 1.27 KB

Versions: 13

Compression:

Stored size: 1.27 KB

Contents

module Neo4j


  module NodeRelationship
    include ToJava

    def outgoing(type=nil)
      if type
        NodeTraverser.new(self).outgoing(type)
      else
        raise "not implemented yet"
        NodeTraverser.new(self)
      end
    end

    def incoming(type=nil)
      if type
        NodeTraverser.new(self).incoming(type)
      else
        raise "not implemented yet"
        NodeTraverser.new(self)
      end
    end

    def both(type=nil)
      if type
        NodeTraverser.new(self).both(type)
      else
        NodeTraverser.new(self) # default is both
      end
    end

    def rels(*type)
      RelationshipTraverser.new(self, type, :both)
    end


    # Check if the given relationship exists
    # Returns true if there are one or more relationships from this node to other nodes
    # with the given relationship.
    #
    # ==== Parameters
    # type:: the key and value to be set, default any type
    # dir:: optional default :both (either, :outgoing, :incoming, :both)
    #
    # ==== Returns
    # true if one or more relationships exists for the given type and dir
    # otherwise false
    #
    def rel? (type=nil, dir=:both)
      if type
        hasRelationship(type_to_java(type), dir_to_java(dir))
      else
        hasRelationship
      end
    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
neo4j-1.0.0.beta.13 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.12 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.11 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.10 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.9 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.8 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.7 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.6 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.5 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.4 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.3 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.2 lib/neo4j/node_relationship.rb
neo4j-1.0.0.beta.1 lib/neo4j/node_relationship.rb