REST::Neo4p::Node - Neo4j node object
$n1 = REST::Neo4p::Node->new( {name => 'Ferb'} ) $n2 = REST::Neo4p::Node->new( {name => 'Phineas'} ); $n3 = REST::Neo4p::Node->new( {name => 'Perry'} ); $n1->relate_to($n2, 'brother'); $n3->relate_to($n1, 'pet'); $n3->set_property({ species => 'Ornithorhynchus anatinus' });
REST::Neo4p::Node objects represent Neo4j nodes.
$node = REST::Neo4p::Node->new(); $node_with_properties = REST::Neo4p::Node->new( \%props );
Instantiates a new Node object and creates corresponding node in the database.
$node->remove()
CAUTION: Removes a node from the database and destroys the object.
$name = $node->get_property('name'); @vitals = $node->get_property( qw( height weight bp temp ) );
Get the values of properties on nodes and relationships.
$name = $node->set_property( {name => "Sun Tzu", occupation => "General"} ); $node1->relate_to($node2,"is_pal_of")->set_property( {duration => 'old pal'} );
Sets values of properties on nodes and relationships.
$props = $node->get_properties; print "'Sup, Al." if ($props->{name} eq 'Al');
Get all the properties of a node or relationship as a hashref.
$node->remove_property('name'); $node->remove_property(@property_names);
Remove properties from node.
$relationship = $node1->relate_to($node2, 'manager', { matrixed => 'yes' });
Create a relationship between two nodes in the database and return the REST::Neo4p::Relationship object. Call on the "from" node, first argument is the "to" node, second argument is the relationship type, third optional argument is a hashref of relationship properties.
@all_relationships = $node1->get_relationships()
Get all incoming and outgoing relationships of a node. Returns array of REST::Neo4p::Relationship objects;
@incoming_relationships = $node1->get_incoming_relationships();
@outgoing_relationships = $node1->get_outgoing_relationships();
See "Property Auto-accessors" in REST::Neo4p.
$simple_node = $node1->as_simple $node_id = $simple_node->{_node}; $value = $simple_node->{$property_name};
Get node as a simple hashref.
These methods are supported by v2.0+ of the Neo4j server.
my $node = $node->set_labels($label1, $label2);
Sets the node's labels. This replaces any existing node labels.
my $node = $node->add_labels($label3, $label4);
Add labels to the nodes existing labels.
my @labels = $node->get_labels;
Retrieve the node's list of labels, if any.
my $node = $node->drop_labels($label1, $label4);
Remove one or more labels from a node.
REST::Neo4p, REST::Neo4p::Relationship, REST::Neo4p::Index.
Mark A. Jensen CPAN ID: MAJENSEN majensen -at- cpan -dot- org
Copyright (c) 2012-2022 Mark A. Jensen. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install REST::Neo4p, copy and paste the appropriate command in to your terminal.
cpanm
cpanm REST::Neo4p
CPAN shell
perl -MCPAN -e shell install REST::Neo4p
For more information on module installation, please visit the detailed CPAN module installation guide.