Page 1 of 1

Search.byAnnotatedWith not recognizing example's fields

PostPosted: Tue Jan 19, 2010 9:53 am
by bernhard
Hi Josh and others!

I tried using the Search API to find items which are linked to an annotation. I wanted to use either the ID or the namespace of the example annotation to restrict the result, but neither worked. Is this expected?

Here's an example how I perform the search:
Code: Select all
# this is contetn of the ScreenAcquisitionAnnotationLink table:
omero4_1=> select id, parent, child from ScreenAcquisitionAnnotationLink;
id | parent | child
----+--------+-------
  1 |     51 |   121
  2 |     51 |   125

an= FileAnnotationI()
an.ns = rstring('some.namesspace')
search.onlyType("ScreenAcquisition")
s.byAnnotatedWith((an,))
len(s.results())
>>> 2
an.ns = rstring('foo')
s.byAnnotatedWith((an,))
len(s.results())
>>> 2
an.ns = None
an.id = rlong(121)
s.byAnnotatedWith((an,))
len(s.results())
>>> 2


Thanks for help! Bernhard

Re: Search.byAnnotatedWith not recognizing example's fields

PostPosted: Fri Jan 22, 2010 9:10 am
by jmoore
Hi Bernhard,

byAnnotatedWith only takes the "main content" (which is badly explained in the Javadoc) -- i.e. textValue, booleanValue, doubleValue, file -- and the type of the annotation into account (no id, no ns). The implementation is provided by ome.services.search.AnnotatedWith which is a bit clearer. Support for namespaces via byAnnotatedWith would be a part of ticket:976.

Cheers,
~Josh