Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

ModelSEED Database

Scott Devoid edited this page Jul 25, 2012 · 5 revisions

ModelSEED::Database

An abstract role / interface for database drivers.

Methods

has_data

$bool = $db->has_data(ref, auth);

get_data

$obj = $db->get_data(ref, auth);

get_data_collection

$collection = $db->get_data_collection(ref, auth);

get_data_collection_iterator

$iterator = $db->get_data_collection_itorator(ref, auth);

save_data

$ref = $db->save_data(ref, data, config, auth);

Where config is a hash that currently accepts one parameter:

is_merge

This is a boolean value that, if true, results in the save operation not overwriting the ancestor_uuids field in the object. If it is false or not present, the ancestor_uuids field will be overwritten with the current object's uuid if that object already exists in the data store.

save_data_collection

$bool = save_data_collection(ref, collection, auth);

delete_data

$count = $db->delete_object(ref, auth);

delete_collection

$count = $db->delete_object(ref, auth);

find_objects

([ids]) = $db->find_objects(ref, query, auth);

Allows you to query for objects based on the metadata will use query syntax similar to MongoDB.

Uses MongoDB syntax like here: http://search.cpan.org/~kristina/MongoDB/lib/MongoDB/Tutorial.pod#Queries http://www.mongodb.org/display/DOCS/Advanced+Queries

Alias Functions

These functions manage aliases, which are special pointers to objects. These pointers have viewing permissions and can only be moved to a different object by their owner. Alias strings have the form of "username/arbitraryString" and are used in place of uuids in some specific objects (biochemistry, mapping and model for now). So a reference to a biochemistry would look like biochemistry/chenry/main.

In these functions:

ref is a ModelSEED::Reference
auth is a ModelSEED::Auth
arbitraryString is the free-form portion of the alias
viewerUsername is a username

get_aliases

$arrayRef = $db->get_aliases(query, auth)

Query for aliases. The query object is a HashRef that may contain the following keys: type, owner, alias, uuid. The return value is an array ref of alias objects that have the following structure:

{
    type  => $string,
    owner => $string,
    alias => $string,
    uuid  => $uuid,
}

update_alias

$bool = $db->update_alias(ref, uuid, auth)

add_viewer

$bool = $db->add_viewer(ref, viewerUsername, auth)

remove_viewer

$bool = $db->remove_viewer(ref, viewerUsername, auth)

set_public

$bool = $db->set_public(ref, boolean, auth)

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 76:

Unknown directive: =over4

Around line 78:

'=item' outside of any '=over'