REST::Neo4p::Path - Container for Neo4j path elements
use REST::Neo4p::Query; $query = REST::Neo4p::Query->new( 'START n=node(0), m=node(1) MATCH p=(n)-[*..3]->(m) RETURN p' ); $query->execute; $path = $query->fetch->[0]; @nodes = $path->nodes; @relns = $path->relationships; while ($n = shift @nodes) { my $r = shift @relns; print $r ? $n->id."-".$r->id."->" : $n->id."\n"; }
REST::Neo4p::Path provides a simple container for Neo4j paths as returned by Cypher queries. Nodes and relationships are stored in path order.
Creating de novo instances of this class is really the job of REST::Neo4p::Query.
@nodes = $path->nodes;
Get the nodes in path order.
@relationships = $path->relationships;
Get the relationships in path order.
$a = $path->as_simple; @simple_nodes = grep { $_->{_node} } @$a; @simple_relns = grep { $_->{_relationship} } @$a;
Get the path as an array of simple node and relationship hashes (see "as_simple()" in REST::Neo4p::Node, "as_simple()" in REST::Neo4p::Relationship).
REST::Neo4p, REST::Neo4p::Node, REST::Neo4p::Relationship, REST::Neo4p::Query.
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.