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



79
80
81
# File 'lib/neo4j-core/relationship/relationship.rb', line 79

def _java_entity
  self
end

#_java_relObject

Returns self.

Returns:

  • self



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

def _java_rel
  self
end

#_nodesObject

Same as Java::OrgNeo4jGraphdb::Relationship#getNodes



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

def _nodes
  get_nodes
end

#_other_node(node) ⇒ Object

Same as Java::OrgNeo4jGraphdb::Relationship#getOtherNode



25
26
27
# File 'lib/neo4j-core/relationship/relationship.rb', line 25

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



104
105
106
# File 'lib/neo4j-core/relationship/relationship.rb', line 104

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)


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

def del
  delete
end

#end_node_wrapperObject Also known as: end_node



44
45
46
# File 'lib/neo4j-core/relationship/relationship.rb', line 44

def end_node_wrapper
  _end_node.wrapper
end

#exist?true, false

Returns if the relationship exists.

Returns:

  • (true, false)

    if the relationship exists



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

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:



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

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



100
101
102
# File 'lib/neo4j-core/relationship/relationship.rb', line 100

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

#start_node_wrapperObject Also known as: start_node



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

def start_node_wrapper
  _start_node.wrapper
end