[ome-devel] Accessing OMERO.insight attachements via the API.

Jerome Avondo jeromeavondo at msn.com
Tue Jul 28 12:59:16 BST 2009


Hi again,

Thanks again for the help, I've managed to push forward with all this... But... :)

I'm now trying to write some methods to copy annotations from one object to the other.
I have no problems with ratings and tags but I'm still finding fileannotations tricky.

Say I have an image, which already has a fileannotation associated with it. Now I want another Image to have the same fileannotation attached to it as well... I don't want to duplicate the file. Just want the second Image pointing to the same file.

so I tried,

using the loadAnnotations() from the IMetadataPrx object, to get all annotations for  my ImageID and of type ome.model.annotations.FileAnnotation. Which seems to work fine as I can get to the data that way.

Then I try to set the retrieved FileAnnotation objects to my second Image object, using the Image member function, linkAnnotation(), to create a ImageAnnotationLink which I then save the new link to the database via the gateway saveObject(). But this doesn't work. 
 
When I try and save the link, I get, message = "could not insert: [ome.model.annotations.ImageAnnotationLink]; nested exception is org.hibernate.exception.ConstraintViolationException:"

I also tried creating a new FileAnnotation object, and pointing it to the OriginalFile of the retrieved FileAnnotation. Still same error, when saving the link.

And I also tried retrieving the FileAnnotation or OriginalFile objects by their ids via queries, thinking I might not have the full objects loaded, but same issue...

Running out of ideas, any help welcome....

Thanks,

J.

________________________________
> CC: ome-devel at lists.openmicroscopy.org.uk
> From: j.burel at dundee.ac.uk
> Subject: Re: [ome-devel] Accessing OMERO.insight attachements via the API.
> Date: Wed, 22 Jul 2009 16:14:58 +0100
> To: jeromeavondo at msn.com
>
>
> Hi Jerome
>
> If you want to remove the tag, you need to delete the link.
> We should add some methods to the API to improve the usability
>
> Retrieve the link using the findByQuery of the IQuery service i.e.
> query =
> "select link from ImageAnnotationLink as link where " +
> "link.parent.id = :imageID and link.child.id =: tagID";
>
> then delete the link
> using the deleteObject method from the IUpdate service.
>
> Hope it helps
>
> Jmarie

_________________________________________________________________
Windows Live Messenger: Happy 10-Year Anniversary—get free winks and emoticons.
http://clk.atdmt.com/UKM/go/157562755/direct/01/


More information about the ome-devel mailing list