[ome-devel] dataset.getname() gives error? Matlab

Will Moore will at lifesci.dundee.ac.uk
Fri Aug 17 14:22:18 BST 2012


Hi Ian,

The search string needed to have "left outer join fetch l.parent"
in order to load the Dataset.
You could do the same with l.child if you wanted to load the Image too. 

The use of param is just a nicer way to add ids to the query (instead of formatting ids into the query string) but shouldn't change the behaviour. 

 Will. 


On 17 Aug 2012, at 14:16, Munro, Ian wrote:

> 
> Thanks Will.
> 
> That worked perfectly but I  but I now have zero understanding  of what I'm doing. 
> Which bit was the problem? the search string or failing to use the param object.
> 
> 
> Ian
> 
> 
> On 17 Aug 2012, at 13:52, Will Moore wrote:
> 
>> Hi Ian,
>> 
>>  This query should load the Datasets
>>  
>> 'select l from DatasetImageLink as l left outer join fetch l.parent as ds where l.child.id = '
>> 
>> Maybe even 
>> 
>> 'select l from DatasetImageLink as l left outer join fetch l.parent where l.child.id = '
>> 
>> 
>> NB: I noticed you didn't use your param object below.
>> 
>> Try 
>> 
>>> list = service.findAllByQuery('select l from DatasetImageLink as l left outer join fetch l.parent where l.child.id =:ids ', param);
>> 
>> 
>> 
>>   Will. 
>> 
>> 
>> 
>> On 17 Aug 2012, at 12:09, Munro, Ian wrote:
>> 
>>> Hello 
>>> 
>>> I wonder if anyone can help me with this?
>>> Given a valid imageId I'm trying to get the name of the  parent dataset using Matlab.
>>> 
>>> this snippet
>>> 
>>> ids = java.util.ArrayList();
>>> ids.add(imageId); %add the id of the image.
>>>  
>>>          param = omero.sys.ParametersI;
>>>          param.addIds(ids);
>>>          service = session.getQueryService();
>>>          list = service.findAllByQuery(['select l from DatasetImageLink as l where l.child.id = ', num2str(ID)], []);
>>>          dataset = list.get(0).getParent();
>>>          
>>>          datasetId = dataset.getId().getValue()
>>> 
>>> runs fine & gives me a datasetId that looks good (ie matches what I see with insight)
>>> 
>>> However this line 
>>> 
>>> dataset.getName() 
>>> 
>>> 
>>> Gives me the following errors
>>> 
>>> Error using omero.model.DatasetI/getName
>>> Java exception occurred:
>>> omero.UnloadedEntityException: Object unloaded:omero.model.DatasetI at d0c94c0
>>> at omero.model.DatasetI.errorIfUnloaded(DatasetI.java:22)
>>> at omero.model.DatasetI.getName(DatasetI.java:668)
>>> at omero.model.Dataset.getName(Dataset.java:218)
>>> 
>>> Any help welcome at this point. I assume "Object Unloaded" is a clue here?
>>> 
>>> Thanks
>>> 
>>> Ian
>>> 
>>> 
>>> _______________________________________________
>>> ome-devel mailing list
>>> ome-devel at lists.openmicroscopy.org.uk
>>> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel
>> 
> 
> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20120817/1bbede8e/attachment.html>


More information about the ome-devel mailing list