[ome-devel] Potential Webtagging API Stuff
Douglas Russell
douglas.russell at bioch.ox.ac.uk
Tue Apr 8 16:57:47 BST 2014
There are actually very few queries so far. I have yet to optimize the
preview section, that still uses the gateway, but I will follow up this
email with those optimizations, plus any I make in webtagging to optimize
that.
Cheers,
Douglas
In the subquery, take a list of tag IDs and find which images have all of
these present. Use the list of imageIds that the subquery generates to find
the list of all other tags which are present on those images. These are the
potential criteria for refinements to the tag search space.
selected_tags = [1L,2L,3L,4L] # e.g.
sub_hql = "select link.parent.id from ImageAnnotationLink link
" \
"where link.child.id in (:oids) " \
"group by link.parent.id " \
"having count (link.parent) = %s" % len(selected_tags)
hql = "select distinct link.child.id from ImageAnnotationLink
link " \
"where link.parent.id in (%s)" % sub_hql
params = Parameters()
params.map = {}
params.map["oids"] = rlist([rlong(o) for o in
set(selected_tags)])
qs = conn.getQueryService()
results = qs.projection(hql, params)
Get the Ids and text values of all the tags, excluding any tags which are
not applied to anything as those do not make sense in the context of
navigation.
hql = "select distinct link.child.id, link.child.textValue " \
"from ImageAnnotationLink link " \
"where link.child.class is TagAnnotation " \
"order by link.child.textValue"
params = Parameters()
qs = self.conn.getQueryService()
tags = [(result[0].val, result[1].val) for result in
qs.projection(hql, params)]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20140408/f9293d28/attachment.html>
More information about the ome-devel
mailing list