VERSION
This document describes RDF::Trine::Store::DBI version 1.014SYNOPSIS
use RDF::Trine::Store::DBI;
my $user = 'me';
my $pass = 'secret';
my $modelname = 'mymodel';
# First, construct a DBI connection to your database
my $dsn = "DBI:mysql:database=perlrdf";
my $dbh = DBI->connect( $dsn, $user, $pass );
# Second, create a new Store object with the database connection
# and specifying (by name) which model in the Store you want to use
my $store = RDF::Trine::Store::DBI->new( $modelname, $dbh );
# Finally, wrap the Store objec into a Model, and use it to access your data
my $model = RDF::Trine::Model->new($store);
print $model->size . " RDF statements in store\n";
DESCRIPTION
RDF::Trine::Store::DBI provides a persistent triple-store using the DBI module.METHODS
Beyond the methods documented below, this class inherits methods from the RDF::Trine::Store class.- "new ( $model_name, $dbh )"
- "new ( $model_name, $dsn, $user, $pass )"
- Returns a new storage object using the supplied arguments to construct a DBI object for the underlying database.
- "new_with_config ( $hashref )"
-
Returns a new storage object configured with a hashref with certain
keys as arguments.
The "storetype" key must be "DBI" for this backend.
These keys should also be used:
-
- "name"
- The name of the model.
- "dsn"
- The DBI Data Source Name for the underlying database.
- "username"
- The username of the database user.
- "password"
- The password of the database user.
-
- "new_with_object ( $dbi_db )"
- Initialize the store with a DBI::db object.
- "nuke"
- Permanently removes the store and its data. Note that because of this module's use of the Redland schema, removing a store with this method will only delete the Statements table and remove the model's entry in the Models table. The node entries in the Literals, Bnodes, and Resources tables will still exist.
- "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.
- "temporary_store"
- "clear_restrictions"
- Clear's the restrictions put on the binding of node types to the different statement positions. By default, the subject position is restricted to resources and blank nodes, and the predicate position to only resources. Calling this method will allow any node type in any statement position.
- "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_pattern ( $bgp [, $context] )"
- Returns a stream object of all bindings matching the specified graph pattern.
- "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.
- "add_uri ( $uri, $named, $format )"
- Addsd the contents of the specified $uri to the model. If $named is true, the data is added to the model using $uri as the named context.
- "add_string ( $data, $base_uri, $named, $format )"
- Addsd the contents of $data to the model. If $named is true, the data is added to the model using $base_uri as the named context.
- "add_statement ( $statement )"
- Adds the specified $statement to the underlying model.
- "remove_statement ( $statement )"
- Removes the specified $statement from the underlying model.
- "variable_columns ( $var )"
- Given a variable name, returns the set of column aliases that store the values for the column (values for Literals, URIs, and Blank Nodes).
- "add_variable_values_joins"
- Modifies the query by adding LEFT JOINs to the tables in the database that contain the node values (for literals, resources, and blank nodes).
- "_mysql_hash ( $data )"
- Returns a hash value for the supplied $data string. This value is computed using the same algorithm that Redland's mysql storage backend uses.
- "_mysql_node_hash ( $node )"
- Returns a hash value (computed by "_mysql_hash" for the supplied $node. The hash value is based on the string value of the node and the node type.
- "statements_table"
- Returns the name of the Statements table.
- "statements_prefix"
- Returns the prefix for the underlying Statements database table.
- "set_statements_prefix ( $prefix )"
- Sets the prefix for the underlying Statements database table.
- "model_name"
- Returns the name of the underlying model.
- "make_private_predicate_view ( $prefix, @preds )"
- "dbh"
- Returns the underlying DBI database handle.
- "init"
- Creates the necessary tables in the underlying database.
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 "<[email protected]>"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.