Wolf in Sheep's Clothings (Part III)

I still have my eyeballs fixated on the AllegroGraph server. Since v3.2 it has a new HTTP server exposing a pretty RESTful interface (not perfect, but close) derived from Sesame.

The Python client shipped with the distribution is using it, so I wondered how this would pan out in Perl. Pan out on CPAN, so to say. Last weekend I did some tinkering and concocted a first, naive Perl client.

The Commodity Interface

Rather than simply exposing the Sesame-ness to the programmer, on the surface I wanted to have things look mega-trivial:

my $storage = new RDF::AllegroGraph::Easy (
                      'http://my:secret@localhost:8080');
my $model   = $storage->model (
                      '/scratch/catlitter',
                      mode => O_CREAT);

$model->add (....);
my @tuples = $model->sparql ('SELECT ...');

The plan is that at that level all methods should allow a wide range of parameters. One example is add:

$model->add ('<http://whatever/rho>
              <http://whatever/is_disgusted_by>
              <http://whatever/java> .'
);

Here obviously N3 is parsed. And several of these strings can be passed in. But also this works:

$model->add ([ '<http://whatever/rho>',
               '<http://whatever/is_disgusted_by>',
               '<http://whatever/java>' ]);

and that too:

$model->add ('file:some.n3');

Depending on the data, the client will choose different ways to communicate with the AllegroGraph backend.

The Chores

Underneath I started to capture the most important AllegroGraph concepts: catalog, repository, server. In that I have not spent any thought yet on speed, size limits and other profane things. So beware if you load DBpedia.

Much functionality is missing, such as named graphs, indexing, all the full-text stuff and, of course, the geospatial types. I'll concentrate on that in another iteration.

Any thoughts (or help) is appreciated.

Posted In