struct Redis::Graph::Relationship
- Redis::Graph::Relationship
- Struct
- Value
- Object
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.crInstance Method Summary
-
#dest_node : Int64
The node that this relationship points to, for example with
(person)-[membership]->(team)
, it will be the node id ofteam
. -
#id : Int64
The identifier of the relationship.
-
#properties : Hash(String, Property)
The hash of properties for this relationship.
-
#src_node : Int64
The node that this relationship originates from, for example with
(person)-[membership]->(team)
, it will be the node id ofperson
. -
#type : String
The type of relationship, for example with
[:MEMBER_OF]
, the#type
will be"MEMBER_OF"
.
Instance Method Detail
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.
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.
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}
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.