NAME

NNexus::DB::API - Routines for commonly used NNexus queries

SYNOPSIS

use NNexus::DB;
$db = NNexus::DB->new(%options);
$db->method(@arguments);

DESCRIPTION

This class provides API methods for specific SQL queries commonly needed by NNexus.

The intended design of the NNexus::DB family of classes is to encapsulate all raw verbatim SQL statements and stick to safe method-dispatch for database interactions from the other NNexus classes.

METHODS

Table: Objects

$db->add_object_by(url=>$url,domain=>$domain);

Adds a new object, identified by its $url and $domain. The $domain should match the name of the NNexus::Index::$domain plug-in class.

$db->select_object_by(url=>$url,objectid=>$objectid);

Retrieve the DB row of an object, identified by its $url, OR $objectid. Returns a Perl hashref, each key being a DB column name.

Table: Concepts

$db->add_concept_by(%options);
$db->select_concept_by(%options);
$db->delete_concept_by(%options);
$db->select_firstword_matches($word);
$db->add_linkscache_by(%options);
$db->select_linkscache_by(%options);
$db->delete_linkscache_by(%options);
$db->invalidate_by(%options);

Generic Methods

$db->last_inserted_id;

Return the last inserted id, in an auto-generated primary key column. DBMS-independent, supports MySQL and SQLite so far.

$db->reset_db;

Reset, and if necessary initialize, a SQLite database. This routine holds the reference code, defining the NNexus database schema. NOTE: Only works for a SQLite backend.

SEE ALSO

NNexus::DB

AUTHOR

Deyan Ginev <d.ginev@jacobs-university.de>

COPYRIGHT

Research software, produced as part of work done by 
the KWARC group at Jacobs University Bremen.
Released under the MIT license (MIT)