RDF::AllegroGraph::Server - AllegroGraph server handle
#-- 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');
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
All methods die with
protocol error if they do not receive an expected success.
To get a handle to the AG server, you can instantiate this class. The following options are recognized:
Specifies the REST HTTP address. Must be an absolute URL, without a trailing slash. The constructor dies otherwise.
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.
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.
This method tries to connect to the server and will return
1 on success. Otherwise an exception will be raised.
@cats = $server->catalogs
This method lists the catalogs available on the remote server. The result is a list of relative paths.
%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.
$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:
This POSIX file mode determines how the model will be opened.
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 the
MODE option is
O_CREAT, then it will be generated. Otherwise an exception
cannot open repository will be raised.
<rho at devc.at>
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.