struct

FalkorDB::Relationship

Inherits Struct < Value < Object

Represents a relationship in your graph

result = graph.read_query(<<-CYPHER)
  MATCH (:User)-[membership:MEMBER_OF]->(:Team)
  RETURN membership
CYPHER

result.each do |(membership)|
  membership = membership.as(FalkorDB::Relationship)
  # ...
end

Constructors

new(id : Int64, type : String, src_node : Int64, dest_node : Int64, properties : Hash(String, FalkorDB::Value))
Source

Class methods

matches_falkordb_type?(type : FalkorDB::ValueType) : Bool
Source

Instance methods

dest_node

The node that this relationship points to, for example with (person)-[membership]->(team), it will be the node id of team.

WARNING: This will not match an id property of the destination node.

Source
id

The identifier of the relationship.

NOTE: If this relationship has an id property, this is not that. WARNING: Do not try to query against this. FalkorDB provides no guarantees that this relationship will be at the same offset it was at the last time you queried it.

Source
properties

The hash of properties for this relationship.

result = graph.write_query <<-CYPHER, now: Time.utc.to_unix_ms
  CREATE (person)-[membership{since: $now}]->(team)
  RETURN membership
CYPHER
result.first.properties # => {"since" => 2022-05-15T05:48:23 UTC}
Source
src_node

The node that this relationship originates from, for example with (person)-[membership]->(team), it will be the node id of person.

WARNING: This will not match an id property of the source node.

Source
type

The type of relationship, for example with [:MEMBER_OF], the type will be "MEMBER_OF".

Source