Module: Neo4j::Core::Relationship

Included in:
Relationship
Defined in:
lib/neo4j-core/relationship/relationship.rb,
lib/neo4j-core/relationship/class_methods.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#_end_nodeObject

Same as Java::OrgNeo4jGraphdb::Relationship#getEndNode



7
8
9
# File 'lib/neo4j-core/relationship/relationship.rb', line 7

def _end_node
  get_end_node
end

#_java_entityObject

same as #_java_rel Used so that we have same method for both relationship and nodes



63
64
65
# File 'lib/neo4j-core/relationship/relationship.rb', line 63

def _java_entity
  self
end

#_java_relObject

Returns self.

Returns:

  • self



68
69
70
# File 'lib/neo4j-core/relationship/relationship.rb', line 68

def _java_rel
  self
end

#_other_node(node) ⇒ Object

Same as Java::OrgNeo4jGraphdb::Relationship#getOtherNode



19
20
21
# File 'lib/neo4j-core/relationship/relationship.rb', line 19

def _other_node(node)
  get_other_node(node)
end

#_start_nodeObject

Same as Java::OrgNeo4jGraphdb::Relationship#getStartNode



13
14
15
# File 'lib/neo4j-core/relationship/relationship.rb', line 13

def _start_node
  get_start_node
end

#classObject



88
89
90
# File 'lib/neo4j-core/relationship/relationship.rb', line 88

def class
  Neo4j::Relationship
end

#delnil

Deletes the relationship between the start and end node May raise an exception if delete was unsuccessful.

Returns:

  • (nil)


27
28
29
# File 'lib/neo4j-core/relationship/relationship.rb', line 27

def del
  delete
end

#end_nodeObject

Same as Java::OrgNeo4jGraphdb::Relationship#getEndNode but returns the wrapper for it (if it exist)

See Also:

  • Node#wrapper


33
34
35
# File 'lib/neo4j-core/relationship/relationship.rb', line 33

def end_node
  _end_node.wrapper
end

#exist?true, false

Returns if the relationship exists.

Returns:

  • (true, false)

    if the relationship exists



73
74
75
# File 'lib/neo4j-core/relationship/relationship.rb', line 73

def exist?
  Neo4j::Relationship.exist?(self)
end

#other_node(node) ⇒ Neo4j::Node

A convenience operation that, given a node that is attached to this relationship, returns the other node. For example if node is a start node, the end node will be returned, and vice versa. This is a very convenient operation when you’re manually traversing the node space by invoking one of the #rels method on a node. For example, to get the node “at the other end” of a relationship, use the following:

Examples:

end_node = node.rels.first.other_node(node)

Parameters:

  • node (Neo4j::Node)

    the node that we don’t want to return

Returns:

Raises:

  • This operation will throw a runtime exception if node is neither this relationship’s start node nor its end node.

See Also:



56
57
58
# File 'lib/neo4j-core/relationship/relationship.rb', line 56

def other_node(node)
  _other_node(node._java_node).wrapper
end

#rel_typeSymbol

Returns the relationship name

Examples:

a = Neo4j::Node.new
a.outgoing(:friends) << Neo4j::Node.new
a.rels.first.rel_type # => :friends

Returns:

  • (Symbol)

    the type of the relationship



84
85
86
# File 'lib/neo4j-core/relationship/relationship.rb', line 84

def rel_type
  getType().name().to_sym
end

#start_nodeObject

Same as Java::OrgNeo4jGraphdb::Relationship#getStartNode but returns the wrapper for it (if it exist)

See Also:

  • Node#wrapper


39
40
41
# File 'lib/neo4j-core/relationship/relationship.rb', line 39

def start_node
  _start_node.wrapper
end