NAME

RDF::Trine::Store - RDF triplestore base class

VERSION

This document describes RDF::Trine::Store version 1.012

DESCRIPTION

RDF::Trine::Store provides a base class and common API for implementations of triple/quadstores for use with the RDF::Trine framework. In general, it should be used only be people implementing new stores. For interacting with stores (e.g. to read, insert, and delete triples) the RDF::Trine::Model interface should be used (using the model as an intermediary between the client/user and the underlying store).

To be used by the RDF::Trine framework, store implementations must implement a set of required functionality:

  • new

  • get_statements

  • get_contexts

  • add_statement

  • remove_statement

  • count_statements

  • supports

Implementations may also provide the following methods if a native implementation would be more efficient than the default provided by RDF::Trine::Store:

  • get_pattern

  • get_sparql

  • remove_statements

  • size

  • nuke

  • _begin_bulk_ops

  • _end_bulk_ops

METHODS

new ( $data )

Returns a new RDF::Trine::Store object based on the supplied data value. This constructor delegates to one of the following methods depending on the value of $data:

* new_with_string if $data is not a reference

* new_with_config if $data is a HASH reference

* new_with_object if $data is a blessed object

new_with_string ( $config )

Returns a new RDF::Trine::Store object based on the supplied configuration string. The format of the string specifies the Store subclass to be instantiated as well as any required constructor arguments. These are separated by a semicolon. An example configuration string for the DBI store would be:

DBI;mymodel;DBI:mysql:database=rdf;user;password

The format of the constructor arguments (everything after the first ';') is specific to the Store subclass.

new_with_config ( \%config )

Returns a new RDF::Trine::Store object based on the supplied configuration hashref. This requires the the Store subclass to be supplied with a storetype key, while other keys are required by the Store subclasses, please refer to each subclass for specific documentation.

An example invocation for the DBI store may be:

my $store = RDF::Trine::Store->new_with_config({
              storetype => 'DBI',
              name      => 'mymodel',
              dsn       => 'DBI:mysql:database=rdf',
              username  => 'dahut',
              password  => 'Str0ngPa55w0RD'
            });
new_with_object ( $object )

Returns a new RDF::Trine::Store object based on the supplied opaque $object. If the $object is recognized by an available backend as being sufficient to construct a store object, the store object will be returned. Otherwise undef will be returned.

nuke

Permanently removes the store and its data.

class_by_name ( $name )

Returns the class of the storage implementation with the given name. For example, 'Memory' would return 'RDF::Trine::Store::Memory'.

temporary_store

Returns a new temporary triplestore (using appropriate default values).

get_statements ($subject, $predicate, $object [, $context] )

Returns a stream object of all statements matching the specified subject, predicate and objects. Any of the arguments may be undef to match any value.

get_contexts

Returns an RDF::Trine::Iterator over the RDF::Trine::Node objects comprising the set of contexts of the stored quads.

add_statement ( $statement [, $context] )

Adds the specified $statement to the underlying model.

remove_statement ( $statement [, $context])

Removes the specified $statement from the underlying model.

remove_statements ( $subject, $predicate, $object [, $context])

Removes the specified $statement from the underlying model.

count_statements ($subject, $predicate, $object)

Returns a count of all the statements matching the specified subject, predicate and objects. Any of the arguments may be undef to match any value.

size

Returns the number of statements in the store.

etag

If the store has the capability and knowledge to support caching, returns a persistent token that will remain consistent as long as the store's data doesn't change. This token is acceptable for use as an HTTP ETag.

supports ( [ $feature ] )

If $feature is specified, returns true if the feature is supported by the store, false otherwise. If $feature is not specified, returns a list of supported features.

BUGS

Please report any bugs or feature requests to through the GitHub web interface at https://github.com/kasei/perlrdf/issues.

AUTHOR

Gregory Todd Williams <gwilliams@cpan.org>

COPYRIGHT

Copyright (c) 2006-2012 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.