Task #5785 (closed)
Opened 8 years ago
Closed 8 years ago
BUG: loadTagSets return AnnotationAnnotationLinkI
| Reported by: | atarkowska | Owned by: | jburel |
|---|---|---|---|
| Priority: | blocker | Milestone: | OMERO-Beta4.3 |
| Component: | Services | Version: | n.a. |
| Keywords: | n.a. | Cc: | jburel, jamoore, cxallan |
| Resources: | n.a. | Referenced By: | n.a. |
| References: | n.a. | Remaining Time: | 0.0d |
| Sprint: | 2011-06-16 (14) |
Description (last modified by atarkowska)
loadTagSet return AnnotationAnnotationLinkI rather then AnnotationI. It complicate to build hierarchy because everything is returned separately. Currently omero.gateway lazy loading approch does not allow to use wrap the implementation. It should return hierarchy of:
- TagAnnotationI (tagset)
- TagAnnotationI (tag1)
- TagAnnotationI (tag2)
- TagAnnotationI (tag3)
...
Change History (10)
comment:1 Changed 8 years ago by atarkowska
- Component changed from General to Services
- Description modified (diff)
- Priority changed from minor to blocker
comment:2 Changed 8 years ago by atarkowska
- Cc jburel jmoore cxallan added
- Owner jmoore deleted
comment:3 Changed 8 years ago by jmoore
- Owner set to jburel
comment:4 Changed 8 years ago by jburel
Looking closely at the code we have 2 possibilities:
- actual implementation:A collection of objects (tag annotation or link) is returned
- tag if orphaned
- AnnotationAnnotationLink object so we can extract the tag set linked to the tags i.e. displaying a hierarchical structure from a flat structure
link = (AnnotationAnnotationLink) object; parent = link.getParent(); child = link.getChild(); id = parent.getId().getValue(); if (sets.get(id) == null) { tagSet = new TagAnnotationData((TagAnnotation) parent); sets.put(id, tagSet); result.add(tagSet); tagSet.setTags(new HashSet<TagAnnotationData>()); } else tagSet = sets.get(parent.getId().getValue());
- Change the method and return a map
- key are tag or tag Set
- If it is a tag Set, the value is a list containing tag object.
The first option was chosen to mimic the returned value of loadContainerHierarchy method in ContainerService
comment:5 Changed 8 years ago by atarkowska
I do not see any problems with returning TagAnnotationI and AnnotationAnnotationLinkI list but the problem is that List should contain single AnnotationAnnotationLinkI where Parent is TagSet? and children are tags. Having structure in graph will help a lot.
Currently is see:
<class 'omero.model.AnnotationAnnotationLinkI'> parent 8902 child 6591 <class 'omero.model.AnnotationAnnotationLinkI'> parent 8902 child 8905
comment:6 Changed 8 years ago by jburel
we will use linkedAnnotationList()
comment:7 Changed 8 years ago by atarkowska
We could change the query to:
sql = "select roottag from TagAnnotation as roottag "\
"left outer join fetch roottag.annotationLinks tal "\
"left outer join fetch tal.child tag "\
"left outer join fetch roottag.details.owner ownerroottag "\
"left outer join fetch tag.details.owner ownerTag "
if eid is not None:
params.map = {}
params.map["eid"] = rlong(long(eid))
sql+=" where roottag.details.owner.id = :eid and tag.details.owner.id = :eid"
comment:8 Changed 8 years ago by jburel
Query will be a bit more complicated than that, I will review that later on.
comment:9 Changed 8 years ago by jburel
- Remaining Time set to 0.4
- Status changed from new to accepted
TODO:
- Change method
- Check tests
- modify insight
comment:10 Changed 8 years ago by jburel <j.burel@…>
- Remaining Time changed from 0.4 to 0
- Resolution set to fixed
- Status changed from accepted to closed
(In [24c693aee63b618267f38a3c3f92faa340c27c55/ome.git] on branch develop) Modify the implementation of the loadTagSets mehtod in medataservice.
Now only returned tagAnnotation objects. (close #5785)
Methods were added by J-M:
commit 9c6b400d64e6c7686df46b37702a5393a5e27895 Author: jburel <jburel@05709c45-44f0-0310-885b-81a1db45b4a6> Date: Tue Feb 17 09:46:33 2009 +0000 Added new methods git-svn-id: file:///home/svn/omero/trunk@3622 05709c45-44f0-0310-885b-81a1db45b4a6git blame components/server/src/ome/logic/MetadataImpl.java ... 0770b041 (jburel 2009-02-17 09:43:30 +0000 718) /** 839fdf3c (jburel 2009-07-04 15:45:36 +0000 719) * Implemented as specified by the {@link IMetadata} I/F 009cbb7d (jmoore 2009-03-10 08:54:25 +0000 720) * @see IMetadata#loadTagSets(Parameters) 0770b041 (jburel 2009-02-17 09:43:30 +0000 721) */ 0770b041 (jburel 2009-02-17 09:43:30 +0000 722) @RolesAllowed("user") 0770b041 (jburel 2009-02-17 09:43:30 +0000 723) @Transactional(readOnly = true) 009cbb7d (jmoore 2009-03-10 08:54:25 +0000 724) public Set<IObject> loadTagSets(Parameters options) 0770b041 (jburel 2009-02-17 09:43:30 +0000 725) { 0770b041 (jburel 2009-02-17 09:43:30 +0000 726) Set result = new HashSet(); d0092b19 (jmoore 2009-03-11 15:06:04 +0000 727) Parameters po = new Parameters(options); 0770b041 (jburel 2009-02-17 09:43:30 +0000 728) Parameters param = new Parameters(); 0770b041 (jburel 2009-02-17 09:43:30 +0000 729) StringBuilder sb = new StringBuilder(); bb787da7 (jburel 2010-03-25 16:52:57 +0000 730) sb.append("select link from AnnotationAnnotationLink as link "); bb787da7 (jburel 2010-03-25 16:52:57 +0000 731) sb.append("left outer join fetch link.child child "); bb787da7 (jburel 2010-03-25 16:52:57 +0000 732) sb.append("left outer join fetch link.parent parent "); bb787da7 (jburel 2010-03-25 16:52:57 +0000 733) sb.append("left outer join fetch child.details.owner ownerChild "); bb787da7 (jburel 2010-03-25 16:52:57 +0000 734) sb.append("left outer join fetch parent.details.owner ownerParent "); bb787da7 (jburel 2010-03-25 16:52:57 +0000 735) sb.append("where child member of "+TAG_TYPE); 0770b041 (jburel 2009-02-17 09:43:30 +0000 736) sb.append(" and parent member of "+TAG_TYPE); 7964c034 (jburel 2010-03-22 08:39:24 +0000 737) if (po.isExperimenter()) { 7964c034 (jburel 2010-03-22 08:39:24 +0000 738) sb.append(" and parent.details.owner.id = :userID"); 7964c034 (jburel 2010-03-22 08:39:24 +0000 739) param.addLong("userID", po.getExperimenter());Passing to him to see what he thinks about the change.