NAME
RDF::Sesame::Connection - A class representing a connection to a Sesame server.
DESCRIPTION
This class represents a connection to a specific Sesame server and provides methods which are generally useful for interacting with a Sesame server. This class is predominantly used to create an RDF::Sesame::Repository object which is in turn used to execute queries, remove triples, upload triples, etc.
METHODS
open ( %opts )
Creates an RDF::Sesame::Repository object. There is no communication with the Sesame server during this call, so it should be very fast. The %opts
parameter provides a series of named options to use when creating the Repository object. A list of options which are currently understood is provided below. If a single scalar is given instead of %opts
, the scalar will be treated as the value of the 'id' option.
id
The ID of the repository that you want to open. The method will return successfully even if there is no repository on the server with the repository ID provided. However, subsequent attempts to do anything useful with the Repository object will fail.
If you're not sure what the valid repository IDs are, use the repositories
method documented below. If no repository ID is given, the method returns the empty string.
query_language
This is equivalent to calling query_language() on the newly created Repository object. See that documentation for further information.
strip
This option serves as a default for the strip option to RDF::Sesame::Repository::select Typically, that method defaults to 'none' however specifying this option when opening the repository changes the default.
repositories ( [ $refresh ] )
When called in list context, returns a list of the IDs of the repositories which are available through this connection. The response in scalar context is reserved for future use. So don't call repositories() in scalar context yet (currently, it returns undef
).
Only the first call to repositories() communicates with the server. Subsequent calls return a cached copy of the results from the first communication. If you want to get new results directly from the server, pass a true value for the $refresh parameter. These new results will replace the previously cached results.
disconnect
Logs out of the Sesame server and closes any connections to the server. Attempts to use this object or any of the RDF::Sesame::Repository objects created by this object after it has been disconnected will result in ugly problems.
This method is not called when an RDF::Sesame::Connection object is destroyed. If you want to explicitly logout of the server, you must call this method.
Returns true upon success, false otherwise.
INTERNAL METHODS
These methods might be useful to some users, so they're documented, but most will never need them.
command ( $repository_id, $name [, $parameters ] )
This method executes a command against a repository using the parameters provided in the hashref. The intended way to execute commands against the server is to use an RDF::Sesame::Repository object.
The $repository_id
parameter is just a shortcut for adding a repository parameter in the call to the server. If you pass undef
as the repository ID, the method should still work fine and no repository parameter will be passed to the server.
The result of this method is an RDF::Sesame::Response object. That object can be used to determine whether the command succeeded or failed.
Parameters :
$repository_id The ID of the repository you want to execute
the query against.
$name The name of the command to execute.
$parameters An optional hashref containing the parameter
names and values to pass to the server when executing
the command.
Return :
RDF::Sesame::Response
AUTHOR
Michael Hendricks <michael@palmcluster.org>