NAME
RDF::AllegroGraph::Repository - AllegroGraph repository handle
DESCRIPTION
An AllegroGraph repository corresponds to an RDF model. Into such a model you can park RDF information, either as individual statements or via file bulk loading. Then you can navigate through it on a statement level, or query that model.
INTERFACE
Constructor
The constructor expects the following fields:
CATALOG
(mandatory)-
This is the handle to the catalog the repository belongs to.
id
(mandatory)-
This identifier is always of the form
/whatever
.
Example:
my $repo = new RDF::AllegroGraph::Repository (CATALOG => $cat, id => '/whereever');
Methods
- id
-
This read-only accessor method returns the id of the repository.
- disband
-
$repo->disband
This method removes the repository from the server. The object cannot be used after that, obviously.
- size
-
$nr_triples = $repo->size
Returns the size of the repository in terms of the number of triples.
NOTE: As of time of writing, AllegroGraph counts duplicate triples!
- add
-
$repo->add ('file://....', ...)
$repo->add ('http://....', ...)
$repo->add (' triples in N3 ', ...)
$repo->add ([ $subj_uri, $pred_uri, $obj_uri ], ...)
This method adds triples to the repository. The information can be provided in any of the following ways (also mixed):
- file, HTTP, FTP URL
-
If a string looks like an URL, it will be dereferenced, the contents of the resource consulted and that shipped to the repository on the server. If the resource cannot be read, an exception
Could not open
will be raised. Any number of these URL can be provided as parameter.NOTE: Only N3 files are supported, and also only when the URL ends with the extension
nt
orn3
. - N3 triple string
-
If the string looks like N3 notated triples, that content is shipped to the server.
- ARRAY reference
-
The reference is interpreted as one triple (statement), containing 3 URIs. These will be shipped as-is to the server.
If the server chokes on any of the above, an exception
protocol error
is raised.NOTE: There are no precautions for over-large content. Yet.
NOTE: Named graphs (aka contexts) are not handled. Yet.
- replace
-
This method behaves exactly like
add
, except that any content is wiped before adding anything. - delete
-
$repo->delete ([ $subj_uri, $pred_uri, $obj_uri ], ...)
This method removes the passed in triples from the repository. In that process, any combination of the subject URI, the predicate or the object URI can be left
undef
. That is interpreted as wildcard which matches anything.Example: This deletes anything where the Stephansdom is the subject:
$air->delete ([ '<urn:x-air:stephansdom>', undef, undef ])
- match
-
@stmts = $repo->match ([ $subj_uri, $pred_uri, $obj_uri ], ...)
This method returns a list of all statements which match one of the triples provided as parameter. Any
undef
as URI within such a triple is interpreted as wildcard, matching any other URI. - sparql
-
@tuples = $repo->sparql ('SELECT ...')
@tuples = $repo->sparql ('SELECT ...' [, $option => $value ])
This method takes a SPARQL query string and returns a list of tuples which the query produced from the repository.
NOTE: At the moment only SELECT queries are supported.
As additional options are accepted:
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.