Class: Graphcommons::Signal
Overview
Changes to the nodes and edges of a graph are carried out by a series of commands called signals in the request body. With these signals you can add, update or delete nodes, edges, node types and edge types.
Mind that :id parameter is required in all calls.
Class Method Summary collapse
-
.edge_create(id, options) ⇒ Object
This signal type is used for creating edges.
-
.edge_delete(id, options) ⇒ Object
This signal type is used for deleting edges.
-
.edge_update(id, options) ⇒ Object
This signal type is used for updating an edge.
- .edgetype_delete(id, options) ⇒ Object
- .edgetype_update(id, options) ⇒ Object
-
.node_create(id, options) ⇒ Object
This signal type is used for creating nodes.
-
.node_delete(id, options) ⇒ Object
This signal type is used for deleting nodes.
-
.node_update(id, options) ⇒ Object
This signal type is used for updating a node.
- .nodetype_delete(id, options) ⇒ Object
- .nodetype_update(id, options) ⇒ Object
Methods inherited from API
check_key, delete, get, post, put, set_key
Class Method Details
.edge_create(id, options) ⇒ Object
This signal type is used for creating edges. Source and target nodes for the edge will be created if they don’t already exist. Only one instance of edgetype is allowed between the same nodes. However, there could be multiple edges between the same node pair, as long as the their edge types are different.
Upon saving this signal a new edge id is created. The type of the edge is matched with a predefined edge type from the hub/graph. If the edge type does not already exist, a new edge type is created.
Required options: :from_type, :from_name, :to_type, :to_name, :name
296 297 298 299 |
# File 'lib/graphcommons.rb', line 296 def self.edge_create id, [:action] = :edge_create self._signal id, end |
.edge_delete(id, options) ⇒ Object
This signal type is used for deleting edges.
332 333 334 335 |
# File 'lib/graphcommons.rb', line 332 def self.edge_delete id, [:action] = :edge_delete self._signal id, end |
.edge_update(id, options) ⇒ Object
This signal type is used for updating an edge. All fields except for id will be updated in the node.
Required options: :from, :to
316 317 318 319 |
# File 'lib/graphcommons.rb', line 316 def self.edge_update id, [:action] = :edge_update self._signal id, end |
.edgetype_delete(id, options) ⇒ Object
356 357 358 359 |
# File 'lib/graphcommons.rb', line 356 def self.edgetype_delete id, [:action] = :edgetype_delete self._signal id, end |
.edgetype_update(id, options) ⇒ Object
344 345 346 347 |
# File 'lib/graphcommons.rb', line 344 def self.edgetype_update id, [:action] = :edgetype_update self._signal id, end |
.node_create(id, options) ⇒ Object
This signal type is used for creating nodes. All signals of this type must define a type and name key. type - name pairs must be unique.
Upon saving this signal, a new node id is created. The type of the node is matched with a predefined node type from the hub/graph. If the node type does not already exist, a node type is created.
Required options: :name, :type
278 279 280 281 |
# File 'lib/graphcommons.rb', line 278 def self.node_create id, [:action] = :node_create self._signal id, end |
.node_delete(id, options) ⇒ Object
This signal type is used for deleting nodes.
324 325 326 327 |
# File 'lib/graphcommons.rb', line 324 def self.node_delete id, [:action] = :node_delete self._signal id, end |
.node_update(id, options) ⇒ Object
This signal type is used for updating a node. All fields except for id will be updated in the node.
305 306 307 308 |
# File 'lib/graphcommons.rb', line 305 def self.node_update id, [:action] = :node_update self._signal id, end |
.nodetype_delete(id, options) ⇒ Object
350 351 352 353 |
# File 'lib/graphcommons.rb', line 350 def self.nodetype_delete id, [:action] = :nodetype_delete self._signal id, end |
.nodetype_update(id, options) ⇒ Object
338 339 340 341 |
# File 'lib/graphcommons.rb', line 338 def self.nodetype_update id, [:action] = :nodetype_update self._signal id, end |