Class: Neo4j::Driver::Types::Relationship

Inherits:
Entity
  • Object
show all
Defined in:
lib/neo4j/driver/types/relationship.rb

Overview

Represents a Relationship in the Neo4j graph. Mirrors Java's org.neo4j.driver.types.Relationship — an Entity with a type and start/end node ids.

Instance Attribute Summary collapse

Attributes inherited from Entity

#element_id, #id, #properties

Instance Method Summary collapse

Methods inherited from Entity

#==, #[], #hash

Constructor Details

#initialize(id, start_node_id, end_node_id, type, properties, element_id = nil, start_node_element_id = nil, end_node_element_id = nil) ⇒ Relationship

Bolt 4.x wire doesn't include start/end_node_element_id — PackStream hydration passes nil for those slots. Fall back to the stringified node id so callers always see a value (matches what Java's driver does for 4.x). Path-bound relationships pass the actual node element_ids from #bind, which override the fallback.



19
20
21
22
23
24
25
26
27
28
# File 'lib/neo4j/driver/types/relationship.rb', line 19

def initialize(id, start_node_id, end_node_id, type, properties,
               element_id = nil, start_node_element_id = nil,
               end_node_element_id = nil)
  super(id, properties, element_id)
  @start_node_id = start_node_id
  @end_node_id = end_node_id
  @type = type
  @start_node_element_id = start_node_element_id || start_node_id.to_s
  @end_node_element_id = end_node_element_id || end_node_id.to_s
end

Instance Attribute Details

#end_node_element_idObject (readonly)

Returns the value of attribute end_node_element_id.



10
11
12
# File 'lib/neo4j/driver/types/relationship.rb', line 10

def end_node_element_id
  @end_node_element_id
end

#end_node_idObject (readonly)

Returns the value of attribute end_node_id.



10
11
12
# File 'lib/neo4j/driver/types/relationship.rb', line 10

def end_node_id
  @end_node_id
end

#start_node_element_idObject (readonly)

Returns the value of attribute start_node_element_id.



10
11
12
# File 'lib/neo4j/driver/types/relationship.rb', line 10

def start_node_element_id
  @start_node_element_id
end

#start_node_idObject (readonly)

Returns the value of attribute start_node_id.



10
11
12
# File 'lib/neo4j/driver/types/relationship.rb', line 10

def start_node_id
  @start_node_id
end

#typeObject (readonly)

Returns the value of attribute type.



10
11
12
# File 'lib/neo4j/driver/types/relationship.rb', line 10

def type
  @type
end