[InterMine Dev] perl Item API error: InterMine::Model->new()

Pengcheng Yang pengchy at gmail.com
Tue Jul 21 07:50:13 BST 2015


Hi,

I have found the reason.

reference-type -> referenced-type

Sorry for my mistake.

Best,
Pengcheng Yang

On 2015/7/21 12:45, Pengcheng Yang wrote:
> Hi Sergio and list members,
>
> I want to load the expression data with tab seperated into InterMine. 
> the model file [1], perl script [2] and the error message [3] are 
> listed below. I am scrutinizing the details and learning the model 
> construction. However, could you give me any suggestions.
>
> Thanks a lot!
>
> Best,
> Pengcheng Yang
>
> [1] the model file
> <?xml version="1.0"?>
> <!-- This file details any extensions needed to the data model to 
> store data from this source, everything else is automatically 
> generated from the model description so this is all we need to do to 
> add to the model. -->
> <model name="genomic" package="org.intermine.model.bio">
>         <class name="Expression" is-interface="true">
>                 <attribute name="Expr" type="java.lang.Float"/>
>                 <reference name="sample" reference-type="Samples"/>
>                 <reference name="organism" reference-type="Organism"/>
>                 <reference name="gene" reference-type="Gene"/>
>         </class>
>
>         <class name="Samples" is-interface="true">
>                 <attribute name="primaryIdentifier" 
> type="java.lang.String"/>
>                 <attribute name="DevStag" type="java.lang.String"/>
>                 <attribute name="Tissue" type="java.lang.String"/>
>                 <attribute name="Treatment" type="java.lang.String"/>
>                 <attribute name="year" type="java.lang.Integer"/>
>                 <attribute name="phase" type="java.lang.String"/>
>                 <reference name="organism" reference-type="Organism"/>
>         </class>
>
> </model>
>
> [2] my perl script
> #!/usr/bin/perl -w
>
> use strict;
> use InterMine::Model;
> use InterMine::Item::Document;
>
> my($exprTbl,$sample,$modelf,$outDir);
>
> my $model = InterMine::Model->new(file => $modelf);
>
>
> [3] the error messages:
> perl ExpressionXMLConverter.pl -exprTbl 
> /home/pengchy/Project/Mine/expression/test.rpkm.tb --sample 
> /home/pengchy/Project/Mine/expression-xml/samples.txt --outDir 
> /home/pengchy/Project/Mine/expression-xml/ --model 
> /home/pengchy/Project/Mine/expression-xml/expression-xml_model.xml
> Attribute (referenced_type_name) does not pass the type constraint 
> because: Validation failed for 'Str' with value undef at constructor 
> InterMine::Model::Reference::new (defined at 
> /usr/lib64/perl5/lib/perl5/InterMine/Model/Reference.pm line 237) line 72
> InterMine::Model::Reference::new('InterMine::Model::Reference', 
> 'model', 'InterMine::Model=HASH(0xf33350)', 'name', 'sample', 
> 'reverse_reference_name', 'primaryIdentifier', 'referenced_type_name', 
> undef) called at /usr/lib64/perl5/lib/perl5/InterMine/Model/Handler.pm 
> line 142
> InterMine::Model::Handler::start_element('InterMine::Model::Handler=HASH(0x1bf1820)', 
> 'HASH(0x1a2bc08)') called at 
> /usr/lib64/perl5/lib/perl5/XML/Parser/PerlSAX.pm line 229
> XML::Parser::PerlSAX::_handle_start('XML::Parser::PerlSAX=HASH(0xf335f0)', 
> 'XML::Parser::Expat=HASH(0x1819e38)', 'reference', 'name', 'sample', 
> 'reference-type', 'Samples2', 'reverse-reference', 
> 'primaryIdentifier') called at 
> /usr/lib64/perl5/lib/perl5/XML/Parser/PerlSAX.pm line 77
> XML::Parser::PerlSAX::__ANON__('XML::Parser::Expat=HASH(0x1819e38)', 
> 'reference', 'name', 'sample', 'reference-type', 'Samples2', 
> 'reverse-reference', 'primaryIdentifier') called at 
> /usr/lib64/perl5/lib/perl5/x86_64-linux-thread-multi/XML/Parser/Expat.pm 
> line 474
> XML::Parser::Expat::parse('XML::Parser::Expat=HASH(0x1819e38)', 
> '*XML::Parser::FILE') called at 
> /usr/lib64/perl5/lib/perl5/x86_64-linux-thread-multi/XML/Parser.pm 
> line 187
>         eval {...} at 
> /usr/lib64/perl5/lib/perl5/x86_64-linux-thread-multi/XML/Parser.pm 
> line 186
>         XML::Parser::parse('XML::Parser=HASH(0x1848480)', 
> '*XML::Parser::FILE') called at 
> /usr/lib64/perl5/lib/perl5/x86_64-linux-thread-multi/XML/Parser.pm 
> line 233
>         eval {...} at 
> /usr/lib64/perl5/lib/perl5/x86_64-linux-thread-multi/XML/Parser.pm 
> line 232
>         XML::Parser::parsefile('XML::Parser=HASH(0x1848480)', 
> '/home/pengchy/Project/Mine/expression-xml/expression-xml_model.xml') 
> called at /usr/lib64/perl5/lib/perl5/XML/Parser/PerlSAX.pm line 146
> XML::Parser::PerlSAX::parse('XML::Parser::PerlSAX=HASH(0xf335f0)', 
> 'Source', 'HASH(0x256c508)') called at 
> /usr/lib64/perl5/lib/perl5/InterMine/Model.pm line 150
> InterMine::Model::_process('InterMine::Model=HASH(0xf33350)', 
> '/home/pengchy/Project/Mine/expression-xml/expression-xml_model.xml', 
> 0) called at /usr/lib64/perl5/lib/perl5/InterMine/Model.pm line 129
> InterMine::Model::_process_file('InterMine::Model=HASH(0xf33350)', 
> '/home/pengchy/Project/Mine/expression-xml/expression-xml_model.xml') 
> called at /usr/lib64/perl5/lib/perl5/InterMine/Model.pm line 105
>         InterMine::Model::new('InterMine::Model', 'file', 
> '/home/pengchy/Project/Mine/expression-xml/expression-xml_model.xml') 
> called at ../bin/ExpressionXMLConverter.pl line 32




More information about the dev mailing list