[InterMine Dev] Fetch data from DB while parsing in custom source (II)

Norbert Auer norbert.auer at boku.ac.at
Wed Mar 13 16:52:27 GMT 2013


Dear dev team,

I`m now working with Intermine for approximate a week.
I have a similar problem like described in http://mail.intermine.org/pipermail/dev/2011-August/001040.html .

I have created two custom sources Cellbank and Fermentation. Fermentation has a reference field linked to Cellbank. Loading the Cellbank data source work fine, but loading the Fermentation source give me an error:

org.intermine.objectstore.ObjectStoreException: Duplicate objects found for pk org.intermine.model.bio.Cellbank.key_identifier

These are the contents of the two additional files:



   
        
        
   




    
        
        
        
        
        
    


And this is the Converter file:

public void process(Reader reader) throws Exception 
    {
        Iterator lineIter = FormattedTextParser.parseDelimitedReader(reader,',');
        
        // Loop through csv lines
        while (lineIter.hasNext()) 
        {
            String[] line = (String[]) lineIter.next();

            // Create organism if not already in database
            Item ferm = createItem("Fermentation");
            ferm.setAttribute("fermId",line[0]);
            ferm.setAttribute("name", line[1]);
            ferm.setAttribute("description", line[2]);

            Item cb = createItem("Cellbank");

            // primaryIdentifier already in the database
            cb.setAttribute("cbId",line[3]);
            store(cb);

            ferm.setReference("cellbank",cb);
            store(ferm);
        }
    }

For both sources the keys.properties file include:

Cellbank.key_identifier=cbId

I still do not understand how to get the id of an object which is already in the database. If I create the referenced object new and store it like in the code above then a get the duplicate objects error even though I have set the integration key for cbId.

Thanks for any help!

Norbert



DI (FH) Norbert Auer

Department of Biotechnology
University of Natural Resources and Applied Life Sciences, 
Muthgasse 18, A-1190 Vienna, Austria

Tel: +43 1 47654 6837
Fax: +43 1 36006 1249



More information about the dev mailing list