.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "RDF::Trine::Store::DBI 3pm" .TH RDF::Trine::Store::DBI 3pm "2018-11-03" "perl v5.28.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" RDF::Trine::Store::DBI \- Persistent RDF storage based on DBI .SH "VERSION" .IX Header "VERSION" This document describes RDF::Trine::Store::DBI version 1.019 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use RDF::Trine::Store::DBI; \& \& my $user = \*(Aqme\*(Aq; \& my $pass = \*(Aqsecret\*(Aq; \& my $modelname = \*(Aqmymodel\*(Aq; \& \& # 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\en"; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" RDF::Trine::Store::DBI provides a persistent triple-store using the \s-1DBI\s0 module. .SH "METHODS" .IX Header "METHODS" Beyond the methods documented below, this class inherits methods from the RDF::Trine::Store class. .ie n .IP """new ( $model_name, $dbh )""" 4 .el .IP "\f(CWnew ( $model_name, $dbh )\fR" 4 .IX Item "new ( $model_name, $dbh )" .PD 0 .ie n .IP """new ( $model_name, $dsn, $user, $pass )""" 4 .el .IP "\f(CWnew ( $model_name, $dsn, $user, $pass )\fR" 4 .IX Item "new ( $model_name, $dsn, $user, $pass )" .PD Returns a new storage object using the supplied arguments to construct a \s-1DBI\s0 object for the underlying database. .ie n .IP """new_with_config ( $hashref )""" 4 .el .IP "\f(CWnew_with_config ( $hashref )\fR" 4 .IX Item "new_with_config ( $hashref )" Returns a new storage object configured with a hashref with certain keys as arguments. .Sp The \f(CW\*(C`storetype\*(C'\fR key must be \f(CW\*(C`DBI\*(C'\fR for this backend. .Sp These keys should also be used: .RS 4 .ie n .IP """name""" 4 .el .IP "\f(CWname\fR" 4 .IX Item "name" The name of the model. .ie n .IP """dsn""" 4 .el .IP "\f(CWdsn\fR" 4 .IX Item "dsn" The \s-1DBI\s0 Data Source Name for the underlying database. .ie n .IP """username""" 4 .el .IP "\f(CWusername\fR" 4 .IX Item "username" The username of the database user. .ie n .IP """password""" 4 .el .IP "\f(CWpassword\fR" 4 .IX Item "password" The password of the database user. .RE .RS 4 .RE .ie n .IP """new_with_object ( $dbi_db )""" 4 .el .IP "\f(CWnew_with_object ( $dbi_db )\fR" 4 .IX Item "new_with_object ( $dbi_db )" Initialize the store with a DBI::db object. .ie n .IP """nuke""" 4 .el .IP "\f(CWnuke\fR" 4 .IX Item "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. .ie n .IP """supports ( [ $feature ] )""" 4 .el .IP "\f(CWsupports ( [ $feature ] )\fR" 4 .IX Item "supports ( [ $feature ] )" If \f(CW$feature\fR is specified, returns true if the feature is supported by the store, false otherwise. If \f(CW$feature\fR is not specified, returns a list of supported features. .ie n .IP """temporary_store""" 4 .el .IP "\f(CWtemporary_store\fR" 4 .IX Item "temporary_store" .PD 0 .ie n .IP """clear_restrictions""" 4 .el .IP "\f(CWclear_restrictions\fR" 4 .IX Item "clear_restrictions" .PD 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. .ie n .IP """get_statements ($subject, $predicate, $object [, $context] )""" 4 .el .IP "\f(CWget_statements ($subject, $predicate, $object [, $context] )\fR" 4 .IX Item "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. .ie n .IP """get_pattern ( $bgp [, $context] )""" 4 .el .IP "\f(CWget_pattern ( $bgp [, $context] )\fR" 4 .IX Item "get_pattern ( $bgp [, $context] )" Returns a stream object of all bindings matching the specified graph pattern. .ie n .IP """get_contexts""" 4 .el .IP "\f(CWget_contexts\fR" 4 .IX Item "get_contexts" Returns an RDF::Trine::Iterator over the RDF::Trine::Node objects comprising the set of contexts of the stored quads. .ie n .IP """add_statement ( $statement [, $context] )""" 4 .el .IP "\f(CWadd_statement ( $statement [, $context] )\fR" 4 .IX Item "add_statement ( $statement [, $context] )" Adds the specified \f(CW$statement\fR to the underlying model. .ie n .IP """remove_statement ( $statement [, $context])""" 4 .el .IP "\f(CWremove_statement ( $statement [, $context])\fR" 4 .IX Item "remove_statement ( $statement [, $context])" Removes the specified \f(CW$statement\fR from the underlying model. .ie n .IP """remove_statements ( $subject, $predicate, $object [, $context])""" 4 .el .IP "\f(CWremove_statements ( $subject, $predicate, $object [, $context])\fR" 4 .IX Item "remove_statements ( $subject, $predicate, $object [, $context])" Removes the specified \f(CW$statement\fR from the underlying model. .ie n .IP """count_statements ($subject, $predicate, $object)""" 4 .el .IP "\f(CWcount_statements ($subject, $predicate, $object)\fR" 4 .IX Item "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. .ie n .IP """add_uri ( $uri, $named, $format )""" 4 .el .IP "\f(CWadd_uri ( $uri, $named, $format )\fR" 4 .IX Item "add_uri ( $uri, $named, $format )" Addsd the contents of the specified \f(CW$uri\fR to the model. If \f(CW$named\fR is true, the data is added to the model using \f(CW$uri\fR as the named context. .ie n .IP """add_string ( $data, $base_uri, $named, $format )""" 4 .el .IP "\f(CWadd_string ( $data, $base_uri, $named, $format )\fR" 4 .IX Item "add_string ( $data, $base_uri, $named, $format )" Addsd the contents of \f(CW$data\fR to the model. If \f(CW$named\fR is true, the data is added to the model using \f(CW$base_uri\fR as the named context. .ie n .IP """add_statement ( $statement )""" 4 .el .IP "\f(CWadd_statement ( $statement )\fR" 4 .IX Item "add_statement ( $statement )" Adds the specified \f(CW$statement\fR to the underlying model. .ie n .IP """remove_statement ( $statement )""" 4 .el .IP "\f(CWremove_statement ( $statement )\fR" 4 .IX Item "remove_statement ( $statement )" Removes the specified \f(CW$statement\fR from the underlying model. .ie n .IP """variable_columns ( $var )""" 4 .el .IP "\f(CWvariable_columns ( $var )\fR" 4 .IX Item "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). .ie n .IP """add_variable_values_joins""" 4 .el .IP "\f(CWadd_variable_values_joins\fR" 4 .IX Item "add_variable_values_joins" Modifies the query by adding \s-1LEFT\s0 JOINs to the tables in the database that contain the node values (for literals, resources, and blank nodes). .ie n .IP """_mysql_hash ( $data )""" 4 .el .IP "\f(CW_mysql_hash ( $data )\fR" 4 .IX Item "_mysql_hash ( $data )" Returns a hash value for the supplied \f(CW$data\fR string. This value is computed using the same algorithm that Redland's mysql storage backend uses. .ie n .IP """_mysql_node_hash ( $node )""" 4 .el .IP "\f(CW_mysql_node_hash ( $node )\fR" 4 .IX Item "_mysql_node_hash ( $node )" Returns a hash value (computed by \f(CW\*(C`_mysql_hash\*(C'\fR for the supplied \f(CW$node\fR. The hash value is based on the string value of the node and the node type. .ie n .IP """statements_table""" 4 .el .IP "\f(CWstatements_table\fR" 4 .IX Item "statements_table" Returns the name of the Statements table. .ie n .IP """statements_prefix""" 4 .el .IP "\f(CWstatements_prefix\fR" 4 .IX Item "statements_prefix" Returns the prefix for the underlying Statements database table. .ie n .IP """set_statements_prefix ( $prefix )""" 4 .el .IP "\f(CWset_statements_prefix ( $prefix )\fR" 4 .IX Item "set_statements_prefix ( $prefix )" Sets the prefix for the underlying Statements database table. .ie n .IP """model_name""" 4 .el .IP "\f(CWmodel_name\fR" 4 .IX Item "model_name" Returns the name of the underlying model. .ie n .IP """make_private_predicate_view ( $prefix, @preds )""" 4 .el .IP "\f(CWmake_private_predicate_view ( $prefix, @preds )\fR" 4 .IX Item "make_private_predicate_view ( $prefix, @preds )" .PD 0 .ie n .IP """dbh""" 4 .el .IP "\f(CWdbh\fR" 4 .IX Item "dbh" .PD Returns the underlying \s-1DBI\s0 database handle. .ie n .IP """init""" 4 .el .IP "\f(CWinit\fR" 4 .IX Item "init" Creates the necessary tables in the underlying database. .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to through the GitHub web interface at . .SH "AUTHOR" .IX Header "AUTHOR" Gregory Todd Williams \f(CW\*(C`\*(C'\fR .SH "COPYRIGHT" .IX Header "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.