NAME
InterMine::Item::Document - a module for writing InterMine-Items-XML files
SYNOPSIS
use InterMine::Model;
use InterMine::Item::Document;
my ($model_file, $output_file) = @ARGV;
my $model = InterMine::Model->new(file => $model_file);
my $doc = InterMine::Item::Document->new(
model => $model,
output => $output_file, # defaults to STDOUT
auto_write => 1, # automatically write each item as it is made
);
my $organism = $doc->add_item(
"Organism",
"taxonId" => 7227
);
my $pub1 = $doc->add_item(
"Publication",
"pubMedId" => 11700288,
);
my $pub2 = $doc->make_item(
"Publication",
"pubMedId" => 16496002,
);
$doc->add_item(
'Gene',
'identifier' => "CG10811",
'organism' => $organism,
'publications' => [$pub1, $pub2],
);
$doc->close; # writes the end tags - only needed when auto_write is on
DESCRIPTION
This module allows you to make and write out InterMine-Items-XML for integrating data into InterMine databases
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::ItemFactory
You can also look for information at:
FlyMine
Documentation
COPYRIGHT & LICENSE
Copyright 2006,2007,2008 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 : $factory = new InterMine::ItemFactory($model);
Function: return a factory that can be used to create Item objects
Args : model - the InterMine::Model object to use to check field validity
writer
Function : Return the writer for this document
write
Function : write all unwritten items to the xml output. This is
called automatically on item creation if auto_write is
set.
close
Function : close the document by writing any unwritten
items and closing the items tag.
make_item
Title : make_item
Usage : $item = $doc->make_item("Gene", [%attributes]);
Function: return a new Item object of the given type
while not storing it
Args : the classname of the new Item
Any attributes for the item
add_item
Title : add_item
Usage : $item = $doc->add_item("Gene");
Function: return a new Item object of the given type,
while storing it in an internal record for writing
out later
Args : the classname of the new Item
Any attributes for the item