Bio-MAGETAB

 view release on metacpan or  search on metacpan

lib/Bio/MAGETAB/Util/Persistence.pm  view on Meta::CPAN

# Copyright 2008-2010 Tim Rayner
# 
# This file is part of Bio::MAGETAB.
# 
# Bio::MAGETAB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# 
# Bio::MAGETAB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Bio::MAGETAB.  If not, see <http://www.gnu.org/licenses/>.
#
# $Id: Persistence.pm 361 2011-04-18 20:01:51Z tfrayner $

package Bio::MAGETAB::Util::Persistence;

use Moose;
use MooseX::FollowPBP;

use Carp;
use Tangram;
use DBI;

use MooseX::Types::Moose qw( Str HashRef ArrayRef );

# Uncomment these to print the SQL statements used to STDOUT.
#$Tangram::TRACE = \*STDOUT;
#$Tangram::DEBUG_LEVEL = 1;

sub class_config {

    my ( $class ) = @_;

    # This is where the magic happens. This needs to be kept synchronised
    # with any changes made to the core MAGETAB model.
    my $hashref = {

    classes => [

        'Bio::MAGETAB::ArrayDesign' => {
            bases  => [ 'Bio::MAGETAB::DatabaseEntry' ],
            fields => {
                string => { name             => {},
                            version          => {},
                            provider         => {},
                            printingProtocol => { sql => 'text default NULL' },
                            uri              => {}, },

                ref    => [ qw( technologyType
                                surfaceType
                                substrateType
                                sequencePolymerType )],

                array  => { designElements => 'Bio::MAGETAB::DesignElement', },
                iarray => { comments => { class  => 'Bio::MAGETAB::Comment',
                                          aggreg => 1 }, },
            },
        },

        'Bio::MAGETAB::Assay' => {
            bases  => [ 'Bio::MAGETAB::Event' ],
            fields => {
                ref => [ qw( arrayDesign
                             technologyType ) ],
            },
        },

        'Bio::MAGETAB::BaseClass' => {
            abstract => 1,
            fields   => {
                string => [ qw( authority namespace ) ],
            },
        },

        'Bio::MAGETAB::CompositeElement' => {
            bases  => [ 'Bio::MAGETAB::DesignElement' ],
            fields => {
                string => [ qw( name ) ],
                array  => { databaseEntries => 'Bio::MAGETAB::DatabaseEntry', },
                iarray => { comments => { class  => 'Bio::MAGETAB::Comment',
                                          aggreg => 1 }, },
            },
        },

        'Bio::MAGETAB::Comment' => {
            bases  => [ 'Bio::MAGETAB::BaseClass' ],
            fields => {
                string => [ qw( name
                                value ) ],
            },
        },

        'Bio::MAGETAB::Contact' => {
            bases  => [ 'Bio::MAGETAB::BaseClass' ],



( run in 3.581 seconds using v1.01-cache-2.11-cpan-5837b0d9d2c )