NAME
RDF::AllegroGraph::Server - AllegroGraph server handle
SYNOPSIS
#-- orthodox approach
my $server = new RDF::AllegroGraph::Server (ADDRESS => 'http://localhost:8080',
AUTHENTICATION => 'joe:secret');
my @catalogs = $server->catalogs;
#-- commodity
# get handles to all models (repositories) at the server
my @models = $server->models;
# get one in particular
my $model = $server->model ('/testcat/testrepo');
DESCRIPTION
Objects of this class represent handles to a remote AllegroGraph HTTP server. Such a server can hold several catalogs and each of them can hold repositories. Here we also use the orthodox concept of a model which is simply one particular repository in one particular catalog.
For addressing one model we use a simple path structure, such as /testcat/testrepo
.
All methods die with protocol error
if they do not receive an expected success.
INTERFACE
Constructor
To get a handle to the AG server, you can instantiate this class. The following options are recognized:
ADDRESS
(no default)-
Specifies the REST HTTP address. Must be an absolute URL, without a trailing slash. The constructor dies otherwise.
AUTHENTICATION
(no default)-
String which must be of the form
something:somethingelse
(separated by:
). That will be interpreted as username and password to do basic HTTP authentication against the server.
Methods
- protocol
-
This method tries to figure out which protocol version the server talks. As the AG 3.x servers do not seem to support a dedicated endpoint, some guesswork is involved.
- ping
-
$server->ping
This method tries to connect to the server and will return
1
on success. Otherwise an exception will be raised. - catalogs
-
@cats = $server->catalogs
This method lists the catalogs available on the remote server. The result is a list of relative paths.
- models
-
%models = $server->models
This method lists all models available on the server. Returned is a hash reference. The keys are the model identifiers, all of the form
/somecatalog/somerepository
. The values are repository objects. - model
-
$server->model ($mod_id, option1 => value1, ...)
This method tries to find an repository in a certain catalog. This model id is always of the form
/somecatalog/somerepository
. The following options are understood:If the model already does exist, then an RDF::AllegroGraph::Repository object will be returned. If the specified catalog does not exist, then a
no catalog
exception will be raised. Otherwise, if the repository there does not exist and theMODE
option isO_CREAT
, then it will be generated. Otherwise an exceptioncannot open repository
will be raised.
AUTHOR
Robert Barta, <rho at devc.at>
COPYRIGHT & LICENSE
Copyright 20(09|11) 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.