Neo4j::Driver::Type::Node - Describes a node from a Neo4j graph
version 0.15
$query = 'MATCH (m:Movie) RETURN m LIMIT 1'; $node = $driver->session->run($query)->single->get('m'); say 'Movie # ', $node->id(), ' :'; say ' ', $node->get('name'), ' / ', $node->get('year'); say ' Labels: ', join ', ', $node->labels;
Describes a node from a Neo4j graph. A node may be a part of records returned from Cypher statement execution. Its description contains the node's properties as well as certain meta data, all accessible by methods that this class provides.
Neo4j::Driver::Type::Node objects are not in a one-to-one relation with nodes in a Neo4j graph. If the same Neo4j node is fetched multiple times, then multiple distinct Neo4j::Driver::Type::Node objects will be created by the driver. If your intention is to verify that two Neo4j::Driver::Type::Node objects in Perl describe the same node in the Neo4j database, you need to compare their IDs.
Neo4j::Driver::Type::Node implements the following methods.
$value = $node->get('property_key');
Retrieve the value of this node's property with the given key. If no such key exists, return undef.
undef
$id = $node->id;
Return a unique ID for this node.
In the Neo4j Driver API, entity IDs are only guaranteed to remain stable for the duration of the current session. Although in practice server versions at least up to and including Neo4j 3.5 may appear to use persistent IDs, your code should not depend upon that.
A node with the ID 0 may exist. Nodes and relationships do not share the same ID space.
0
@labels = $node->labels;
Return all labels of this node.
$hashref = $node->properties; $value = $hashref->{property_key};
Return all properties of this node as a hash reference.
Neo4j::Driver::Type::Node implements the following experimental features. These are subject to unannounced modification or removal in future versions. Expect your code to break if you depend upon these features.
$labels = $node->labels; # fails
The labels() method dies if called in scalar context.
labels()
die
$property_value = $node->{property_key};
Currently, the node's properties may be directly accessed as if the node was a simple hashref. This is a concession to backwards compatibility, as the data structure only started being blessed as an object in version 0.13.
Relying on this implementation detail is deprecated. Use the accessor methods get() and properties() instead.
get()
properties()
$node_exists = ! $node->deleted;
In some circumstances, Cypher statements using DELETE may still RETURN nodes that were deleted. To help avoid confusion in such cases, the server sometimes reports whether or not a node was deleted.
DELETE
RETURN
This method is experimental because that information is not reliably available. In particular, there is a known issue with the Neo4j server (#12306), and old Neo4j versions may not report it at all. If unavailable, undef will be returned by this method.
The value of properties named _meta, _node, or _labels may not be returned correctly.
_meta
_node
_labels
When using HTTP, the labels of nodes that are returned as part of a Neo4j::Driver::Type::Path are unavailable, because that information is not currently reported by the Neo4j server. undef is returned instead.
labels
Neo4j::Driver
Equivalent documentation for the official Neo4j drivers: Node (Java), Node (Python)
Arne Johannessen <ajnn@cpan.org>
This software is Copyright (c) 2016-2020 by Arne Johannessen.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Neo4j::Driver, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Neo4j::Driver
CPAN shell
perl -MCPAN -e shell install Neo4j::Driver
For more information on module installation, please visit the detailed CPAN module installation guide.