The fields you'll want to examine on the OriginalFile include: name and mimetype. Where name will (probably) be of the form "*.cpe.xml" and mimetype will be "text/xml". You might also check the value of "FileAnnotation.ns" depending on how the protocol files were attached.
1.
Because of my stupidness and laziness, it is so hard to find appropriate sample codes sometimes.
Before coding it in Java, I was trying to test it from omero shell in python.
assuming the Experiment xml file is attached to image 4519,
- Code: Select all
idString = str(4519)
queryService = session.getQueryService()
query_string = "select i from Image i where i.id in (%s)" % idString
images = queryService.findAllByQuery(query_string, None)
img=images[0]
metadata = session.getMetadataService()
annotations = metadata.loadAnnotations("Image",str(4519),"ome.model.annotations.FileAnnotation","null","null")
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (26, 0))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/usr0/local/omero.server/OMERO.server-Beta-4.2.1/lib/scripts/<ipython console> in <module>()
/usr0/local/omero.server/OMERO.server-Beta-4.2.1/lib/python/omero_api_IMetadata_ice.pyc in loadAnnotations(self, rootType, rootIds, annotationTypes, annotatorIds, options, _ctx)
92
93 def loadAnnotations(self, rootType, rootIds, annotationTypes, annotatorIds, options, _ctx=None):
---> 94 return _M_omero.api.IMetadata._op_loadAnnotations.invoke(self, ((rootType, rootIds, annotationTypes, annotatorIds, options), _ctx))
95
96 def loadAnnotations_async(self, _cb, rootType, rootIds, annotationTypes, annotatorIds, options, _ctx=None):
ValueError: expected sequence value
I don't know how to use the loadAnnotations API function in python. I think I'm wrong with the input arguments.
And after getting the annotations, can you please let me know how to examine the file name and the mimetype? (I guess I can use the annotaion.getName().getValue() for the file name)
2.
Could you let me know the java version of it?
I'm so sorry to keep bothering you.
Sincerely,
BK