NAME

AtteanX::Store::DBI - Database quad-store

VERSION

This document describes AtteanX::Store::DBI version 0.001_01

SYNOPSIS

use Attean;
my $store = Attean->get_store('DBI')->new( dbh => $dbh );

DESCRIPTION

AtteanX::Store::DBI provides a quad-store backed by a relational database.

ATTRIBUTES

dbh

ROLES

This class consumes Attean::API::QuadStore, Attean::API::MutableQuadStore, and Attean::API::BulkUpdatableStore.

METHODS

new ( dbh => $dbh )

Returns a new quad-store object backed by the database referenced by the supplied database handle.

init()

Create the tables and indexes required for using the database as a quadstore.

temporary_store()

Returns a temporary (in-memory, SQLite) store.

get_quads ( $subject, $predicate, $object, $graph )

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, or an ARRAY reference of terms that are allowable in the respective quad position.

count_quads ( $subject, $predicate, $object, $graph )

Returns the count of all statements matching the specified subject, predicate and objects. Any of the arguments may be undef to match any value, or an ARRAY reference of terms that are allowable in the respective quad position.

get_graphs

Returns an iterator over the Attean::API::Term objects comprising the set of graphs of the stored quads.

add_quad ( $quad )

Adds the specified $quad to the underlying model.

remove_quad ( $statement )

Removes the specified $statement from the underlying model.

create_graph( $graph )

This is a no-op function for the memory quad-store.

drop_graph( $graph )

Removes all quads with the given $graph.

clear_graph( $graph )

Removes all quads with the given $graph.

begin_transaction

Begin a database transaction.

abort_transaction

Rollback the current database transaction.

end_transaction

Commit the current database transaction.

begin_bulk_updates

Begin a database transaction.

end_bulk_updates

Commit the current database transaction.

database_type

Returns the database type name as a string (e.g. 'mysql', 'sqlite', or 'postgresql').

initialize_version

Insert data into the attean_version table.

create_schema_file

Returns the path to the file containing the database DDL for quadstore creation for the current database type if available, undef otherwise.

drop_schema_file

Returns the path to the file containing the database DDL for quadstore deletion for the current database type if available, undef otherwise.

available_database_types

Returns the names of the database types for which the system has schemas available to create and drop quadstore tables.

dbi_connect_args ( $type, %args )
dbi_connect_args ( %args )

Returns a quad $dsn, $user, $password, \%connect_args suitable for passing to DBI->connect to obtain a database handle to be used in constructing a AtteanX::Store::DBI quadstore.

%args must contain a value for the database key. It may also contain values for the optional keys: user, password, host, and port.

If invoked as a class method, the $type parameter is required, and must be one of the database types returned by available_database_types.

If invoked as an object method, the $type parameter must not be included; this information will be obtained directly from the AtteanX::Store::DBI object.

plans_for_algebra( $algebra, $model, $active_graphs, $default_graphs )

For BGP algebras, returns a DBI-specific Attean::API::Plan object, otherwise returns undef.

cost_for_plan( $plan )

Returns the estimated cost for a DBI-specific query plan, undef otherwise.

BUGS

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

AUTHOR

Gregory Todd Williams <gwilliams@cpan.org>

COPYRIGHT

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