NAME
RDF::AllegroGraph::Server - AllegroGraph server handle
SYNOPSIS
#-- orthodox approach
my $server = new RDF::AllegroGraph::Server (ADDRESS => 'http://localhost:8080',
TEST => 0,
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 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 trailing slash. The constructor dies otherwise.
TEST
(default: 0)-
If set, the client will try to test connectivity with the AG server.
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
- catalogs
-
@cats = $server->catalogs
This method lists the catalogs available on the remote server. The result is a list of relative paths.
- ping
-
$server->ping
This method tries to connect to the server and will return
1
on success. Otherwise an exception will be raised. - 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 does already 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 200[9] 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.