struct Redis::Graph::Relationship

Overview

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(Redis::Graph::Relationship)
  # ...
end

Defined in:

graph.cr

Instance Method Summary

Instance Method Detail

def dest_node : Int64 #

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.


[View source]
def id : Int64 #

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. RedisGraph provides no guarantees that this relationship will be at the same offset it was at the last time you queried it.


[View source]
def properties : Hash(String, Property) #

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}

[View source]
def src_node : Int64 #

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.


[View source]
def type : String #

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


[View source]