| RDF-AllegroGraph-Easy documentation | Contained in the RDF-AllegroGraph-Easy distribution. |
RDF::AllegroGraph::Transaction4 - AllegroGraph transaction handle for AGv4
Commits all changes done inside the transaction to the underlying model.
NOTE: When the transaction object is still accessible, it will have the same content as the 'mother' session.
Discards all changes.
NOTE: When the transaction object is still accessible, it will be empty.
Robert Barta, <rho at devc.at>
Copyright 2011 Robert Barta, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| RDF-AllegroGraph-Easy documentation | Contained in the RDF-AllegroGraph-Easy distribution. |
package RDF::AllegroGraph::Transaction4; use strict; use warnings; use base qw(RDF::AllegroGraph::Session4); use Data::Dumper; use feature "switch"; use JSON; use URI::Escape qw/uri_escape_utf8/; use HTTP::Request::Common;
sub new { my $class = shift; return bless { @_ }, $class; } sub DESTROY { my $self = shift; $self->rollback; }
sub commit { my $self = shift; my $url = new URI ($self->{path} . '/commit'); my $resp = $self->{CATALOG}->{SERVER}->{ua}->post ($url); die "protocol error: ".$resp->status_line.' ('.$resp->content.')' unless $resp->is_success; }
sub rollback { my $self = shift; my $url = new URI ($self->{path} . '/rollback'); my $resp = $self->{CATALOG}->{SERVER}->{ua}->post ($url); die "protocol error: ".$resp->status_line.' ('.$resp->content.')' unless $resp->is_success; }
1; __END__