NAME

Neo4j::Driver::Type::Node - Describes a node from a Neo4j graph

VERSION

version 0.31

SYNOPSIS

 $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;

DESCRIPTION

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.

METHODS

Neo4j::Driver::Type::Node inherits all methods from Neo4j::Types::Node.

get

 $value = $node->get('property_key');

See "get" in Neo4j::Types::Node.

id

 $id = $node->id;

See "id" in Neo4j::Types::Node.

labels

 @labels = $node->labels;

See "labels" in Neo4j::Types::Node.

properties

 $hashref = $node->properties;
 $value = $hashref->{property_key};

See "properties" in Neo4j::Types::Node.

EXPERIMENTAL FEATURES

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.

Calling in scalar context

 $count = $node->labels;

The labels() method returns the number of labels if called in scalar context.

Until version 0.25, it died instead.

BUGS

The value of properties named _meta, _node, or _labels may not be returned correctly.

When using HTTP JSON, 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.

SEE ALSO

AUTHOR

Arne Johannessen <ajnn@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2016-2022 by Arne Johannessen.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)