<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">All,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I have solved the issue – after a lot of attempts, research and a little swearing!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I have done the following to search for a given “tag”:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:#1F497D">obs = Blitz.getObjects("TagAnnotation", attributes={'textValue':tag})<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:#1F497D">obs = list(obs)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">If this returns a blank list, I create the tag and link it to the Image as required. If this returns any items, then I do the following to link the existing tag to the image:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:#1F497D">upServ = conn.getUpdateService()<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:#1F497D">link = ImageAnnotationLinkI()<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:#1F497D">link.setParent(ImageI(im_id, False))<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:#1F497D">link.setChild(obs[0]._obj)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="color:#1F497D">ret = upServ.saveAndReturnObject(link)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">John<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="mso-fareast-language:EN-GB">From:</span></b><span lang="EN-US" style="mso-fareast-language:EN-GB"> ome-users-bounces@lists.openmicroscopy.org.uk [mailto:ome-users-bounces@lists.openmicroscopy.org.uk]
<b>On Behalf Of </b>John Webber (NBI)<br>
<b>Sent:</b> 13 March 2014 10:47<br>
<b>To:</b> ome-users@lists.openmicroscopy.org.uk<br>
<b>Subject:</b> [ome-users] List all tags<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">All,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Please can you advice how I can list all of the tags owned by a given Omero user account, using the Omero APIs?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am able to list all tags for a project, dataset or an image, using code like the following:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> img = Blitz.getObject("Image", "479")<o:p></o:p></p>
<p class="MsoNormal"> for ann in img.listAnnotations():<o:p></o:p></p>
<p class="MsoNormal"> if ann.OMERO_TYPE == tag_type:<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:36.0pt"><do something><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Please can anyone assist in listing the tags for a specific user?<o:p></o:p></p>
<p class="MsoNormal"><br>
Thanks<o:p></o:p></p>
<p class="MsoNormal">John<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><b><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#4F81BD;mso-fareast-language:EN-GB">-------------------------------------------------------------------------------------------------------------------------------------------- </span></b><span style="color:#0F126F;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><b><span style="font-family:"Arial","sans-serif";color:#548DD4;mso-fareast-language:EN-GB">John Webber<br>
</span></b><span style="color:#1F497D;mso-fareast-language:EN-GB">Computing and Information Services</span><span style="color:#0F126F;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB">NBI Partnership Ltd</span><span style="color:#0F126F;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB">Norwich Research park</span><span style="color:#0F126F;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB">Colney Lane</span><span style="color:#0F126F;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB">Norwich</span><span style="color:#0F126F;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB">NR4 7UH</span><span style="color:#0F126F;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB"> </span><span style="color:#0F126F;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB">E-Mail:</span><span style="mso-fareast-language:EN-GB">
<span style="color:#1F497D"><a href="mailto:john.webber@nbi.ac.uk"><span style="color:blue">john.webber@nbi.ac.uk</span></a></span><span style="color:#0F126F"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB">Web:</span><span style="mso-fareast-language:EN-GB">
<span style="color:#1F497D"> <a href="http://www.nbi.ac.uk/"><span style="color:blue">http://www.nbi.ac.uk</span></a></span><span style="color:#0F126F"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB">Tel:</span><span style="mso-fareast-language:EN-GB">
<span style="color:#1F497D"> +44(0)1603 450 818<o:p></o:p></span></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB">Helpdesk (Tel): 1234</span><span style="mso-fareast-language:EN-GB">
<span style="color:#1F497D"> HPC Support (Web):</span> <span style="color:#1F497D">
<a href="http://hpc.nbi.ac.uk/"><span style="color:blue">http://hpc.nbi.ac.uk</span></a> (NBI internal)<o:p></o:p></span></span></p>
<p class="MsoNormal" style="line-height:12.0pt;background:white"><span style="color:#1F497D;mso-fareast-language:EN-GB"> HPC Support (Tel):</span><span style="mso-fareast-language:EN-GB">
<span style="color:#1F497D"> 2003 (NBI internal)<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="color:#1F497D;mso-fareast-language:EN-GB"> </span><span style="color:#0F126F;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal"><i><span style="color:#1F497D;mso-fareast-language:EN-GB">The NBI Partnership Ltd provides non-scientific services to the Institute of Food Research, the John Innes Centre, The Genome Analysis Centre and The Sainsbury Laboratory</span></i><span style="color:#0F126F;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>