module Redgraph::NodeModel::GraphManipulation
Public Instance Methods
add_relation(type:, node:, properties: nil, allow_duplicates: true)
click to toggle source
Adds a relation between the node and another node.
-
type: type of relation
-
node: the destination node
-
properties: optional properties hash
-
allow_duplicates: if false it will create a relation between two nodes with the same type
and properties only if not present
# File lib/redgraph/node_model/graph_manipulation.rb, line 12 def add_relation(type:, node:, properties: nil, allow_duplicates: true) edge = Edge.new(type: type, src: to_node, dest: node.to_node, properties: properties) allow_duplicates ? graph.add_edge(edge) : graph.merge_edge(edge) end
query(cmd)
click to toggle source
Runs a custom query on the graph
# File lib/redgraph/node_model/graph_manipulation.rb, line 19 def query(cmd) self.class.query(cmd) end