Neo4j::Bolt::Cxn - Container for a Neo4j Bolt connection
use Neo4j::Bolt; $cxn = Neo4j::Bolt->connect("bolt://localhost:7687"); unless ($cxn->connected) { print STDERR "Problem connecting: ".$cxn->errmsg; } $stream = $cxn->run_query( "MATCH (a) RETURN head(labels(a)) as lbl, count(a) as ct", ); if ($stream->failure) { print STDERR "Problem with query run: ". ($stream->client_errmsg || $stream->server_errmsg); }
Neo4j::Bolt::Cxn is a container for a Bolt connection, instantiated by a call to Neo4j::Bolt->connect().
Neo4j::Bolt->connect()
True if server connected successfully. If not, see "errnum()" and "errmsg()".
Run a Cypher query on the server. Returns a Neo4j::Bolt::ResultStream which can be iterated to retrieve query results as Perl types and structures. [$param_hash] is an optional hashref of the form { param => $value, ... }.
{ param => $value, ... }
Send a Cypher query to the server. All results (except error info) are discarded.
($stream, @rows) = do_query($cypher_query); $stream = do_query($cypher_query, $param_hash);
Run a Cypher query on the server, and iterate the stream to retrieve all result rows. do_query is convenient for running write queries (e.g., CREATE (a:Bloog {prop1:"blarg"}) ), since it returns the $stream with "update_counts" in Neo4j::Bolt::ResultStream ready for reading.
do_query
CREATE (a:Bloog {prop1:"blarg"})
Run a Cypher query on the server. Returns a Neo4j::Bolt::ResultStream which can be iterated to retrieve query results as Perl types and structures. $param_hash is a hashref of the form { param => $value, ... }. If there are no params to be set, use {}.
$param_hash
{}
If $send is 1, run_query_ will simply send the query and discard any results (including query stats). Set $send to 0 and follow up with "fetch_next_()" in Neo4j::Bolt::ResultStream to retrieve results.
$send
Easier to use run_query, send_query, do_query.
run_query
send_query
Send a RESET message to the Neo4j server. According to the Bolt protocol, this should force any currently processing query to abort, forget any pending queries, clear any failure state, dispose of outstanding result records, and roll back the current transaction.
Current error state of the connection. If
$cxn->connected == $cxn->errnum == 0
then you have a virgin Cxn object that came from someplace other than Neo4j::Bolt->connect(), which would be weird.
print $cxn->server_id; # "Neo4j/3.3.9"
Get the server ID string, including the version number. undef if connecting wasn't successful or the server didn't identify itself.
undef
Neo4j::Bolt, Neo4j::Bolt::ResultStream.
Mark A. Jensen CPAN: MAJENSEN majensen -at- cpan -dot- org
This software is Copyright (c) 2019-2020 by Mark A. Jensen.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Neo4j::Bolt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Neo4j::Bolt
CPAN shell
perl -MCPAN -e shell install Neo4j::Bolt
For more information on module installation, please visit the detailed CPAN module installation guide.