Skip to content

Commit

Permalink
Merge pull request #29 from johannessen/fix-bolt-pr27
Browse files Browse the repository at this point in the history
Fix Bolt support
  • Loading branch information
majensen authored Feb 3, 2021
2 parents 13e4588 + 088829b commit bb4bf90
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions lib/REST/Neo4p/Agent/Neo4j/Driver.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ my $WARN_ON_ERROR;
BEGIN {
}

my %REST_ACTIONS = (
all_relationships => 'relationships/all',
all_typed_relationships => 'relationships/all/{-list|&|types}',
create_relationship => 'relationships',
incoming_relationships => 'relationships/in',
incoming_typed_relationships => 'relationships/in/{-list|&|types}',
labels => 'labels',
outgoing_relationships => 'relationships/out',
outgoing_typed_relationships => 'relationships/out/{-list|&|types}',
paged_traverse => 'paged/traverse/{returnType}{?pageSize,leaseTime}',
properties => 'properties',
property => 'properties/{key}',
traverse => 'traverse/{returnType}',
);

sub new {
my ($class, @args) = @_;
my $self = {
Expand Down Expand Up @@ -177,21 +192,7 @@ sub connect {
last if $f;
}
# set actions
try {
my $tx = $self->session->begin_transaction;
my $n = $tx->run('create (n) return n')->single;
my $actions = $n->{rest}[0];
$tx->rollback;
foreach (keys %$actions) {
next if /^extensions|metadata|self$/;
# strip any trailing slash
$actions->{$_} =~ s|/+$||;
my ($suffix) = $actions->{$_} =~ m|.*node/[0-9]+/(.*)|;
$self->{_actions}{$_} = $suffix;
}
} catch {
REST::Neo4p::LocalException->throw("While determining actions: $_");
};
$self->{_actions}{$_} = $REST_ACTIONS{$_} for keys %REST_ACTIONS;
return 1;
}

Expand Down

0 comments on commit bb4bf90

Please sign in to comment.