Neo4j::Driver::Record - container for Cypher result values
version 0.08
use Neo4j::Driver; my $session = Neo4j::Driver->new->basic_auth(...)->session; my $query = 'MATCH (m:Movie) RETURN m.name, m.year'; my $records = $session->run($query)->list; foreach my $record ( @$records ) { say $record->get('m.name'); } $query .= ' ORDER BY m.year LIMIT 1'; my $record = $session->run($query)->single; say 'Age of oldest movie: ', $record->get(1);
Container for Cypher result values. Records are returned from Cypher statement execution, contained within a StatementResult. A record is a form of ordered map and, as such, contained values can be accessed by either positional index or textual key.
Neo4j::Driver::Record implements the following methods.
my $value1 = $record->get('field_key'); my $value2 = $record->get(2);
Get a value from this record, either by field key or by zero-based index.
Nodes, relationships and maps are returned as hash references of their properties. Lists and paths are returned as array references. Boolean values are returned as JSON types; use !! to force-convert to a plain Perl boolean value if necessary.
!!
Neo4j::Driver::Record 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.
column_keys
my $size = $record->{column_keys}->count; $record->{column_keys}->add('new_field_key');
Allows adding new columns to the record's field key / index resolution used by the get method. Can be used to synthesize 'virtual' fields based on other data in the result. The new fields can then be accessed just like regular columns.
get
graph
my $nodes = $record->{graph}->{nodes}; my $rels = $record->{graph}->{relationships};
Allows accessing the graph response the Neo4j server can deliver via HTTP. Requires the return_graph field to be set on the transaction before the statement is executed.
return_graph
meta
my $meta = $record->{meta};
Allows accessing the entity meta data that some versions of the Neo4j server provide.
Neo4j::Driver, Neo4j Java Driver, Neo4j JavaScript Driver, Neo4j .NET Driver
Arne Johannessen <ajnn@cpan.org>
This software is Copyright (c) 2016-2018 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.