NAME

InterMine::Model - the representation of an InterMine model

SYNOPSIS

use InterMine::Model;

my $model_file = 'flymine/dbmodel/build/model/genomic_model.xml';
my $model = InterMine::Model->new(file => $model_file);
my $gene = $model->make_new(
  Gene => {
      primaryIdentifier => "FBgn0004053",
      secondaryIdentifier => "CG1046",
      symbol              => "zen",
      name                => "zerknullt",
      length              => "3474",
      organism            => {
          shortName => "D. melanogaster",
      }
      ncbiGeneNumber      => 40828,
  });

$gene->getName(); # "zerknullt"

...

DESCRIPTION

The class is the Perl representation of an InterMine data model. The new() method can parse the model file. The get_classdescriptor_by_name() method will return an InterMine::Model::ClassDescriptor object for the class with the given name.

For an example model see: http://trac.flymine.org/browser/trunk/intermine/objectstore/model/testmodel/testmodel_model.xml

AUTHOR

FlyMine <support@flymine.org>

BUGS

Please report any bugs or feature requests to support@flymine.org.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc InterMine::Model;

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2006,2007,2008,2009 FlyMine, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

FUNCTIONS

new

Title   : new
Usage   : $model = new InterMine::Model(file => $model_file);
            or
          $model = new InterMine::Model(string => $model_string);
Function: return a Model object for the given file
Args    : file - the InterMine model XML file

get_classdescriptor_by_name

Title   : get_classdescriptor_by_name
Usage   : $cd = $model->get_classdescriptor_by_name("Gene");
Function: return the InterMine::Model::ClassDescriptor for the given class or
          undef if the class isn't in the model
Args    : the classname

make_new($class_name, [%attributes|$attributes])

Return an object of the desired class, with the attributes given

my $gene = $model->make_new(Gene => {symbol => "zen", organism => {name => 'D. melanogaster}});

say $gene->get_symbol             # "zen"
say $gene->get_organism->get_name # "D. melanogaster"

get_all_classdescriptors

Title   : get_all_classdescriptors
Usage   : @cds = $model->get_all_classdescriptors();
Function: return all the InterMine::Model::ClassDescriptor objects for this
          model
Args    : none

get_referenced_classdescriptor

Usage    : my $cd = $model->get_referenced_classdescriptor($ref);
Function : get the class descriptor at the other end of a reference
Args     : The reference

find_classes_declaring_field

Usage    : my @classes = $model->find_classes_declaring_field($str);
Function : get the class descriptors that declare fields of a certain name  
Args     : The field's name

package_name

Title   : package_name
Usage   : $package_name = $model->package_name();
Function: return the package name derived from the name space
          eg. "org.intermine.model"
Args    : none

model_name

Title   : model_name
Usage   : $model_name = $model->model_name();
Function: return the model name from the model file eg. "testmodel"
Args    : none