We're Hiring!

Search.byAnnotatedWith not recognizing example's fields

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Search.byAnnotatedWith not recognizing example's fields

Postby bernhard » Tue Jan 19, 2010 9:53 am

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
bernhard
 
Posts: 37
Joined: Mon Jun 22, 2009 7:18 am

Re: Search.byAnnotatedWith not recognizing example's fields

Postby jmoore » Fri Jan 22, 2010 9:10 am

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
User avatar
jmoore
Site Admin
 
Posts: 1591
Joined: Fri May 22, 2009 1:29 pm
Location: Germany


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest