Database Reference
In-Depth Information
# Delete node that has no relationships
neo.delete_node(greg)
# Delete an unrelated node
neo.delete_node!(greg)
You cannot delete any node that is currently set as the start point or end point of any relationship. You must
remove the relationship before you can delete the node.
Note
Creating a Relationship
Neography offers two different methods to create relationships, one using the relateTo method and another using the
makeRelationship method. In the example in Listing 10-8, it sets up the relationship using the relateTo method, which
is the less verbose of the two options.
Listing 10-8. Relating Two Nodes
require 'neography'
neo = Neography::Rest.new({ :protocol => 'http://', :server => 'localhost', :port => 7474,
:directory => '/db/data'})
greg = neo.get_node(1)
daniel = neo.get_node(10)
neo.create_relationship("FOLLOWS", greg, daniel)
both the start and end nodes of a relationship must already be established within the database before the
relationship can be saved.
Note
 
 
Search WWH ::




Custom Search