Hi Olivier,
This is how we search Samples for a particular annotation. I'm not sure if it will compile because I've simplified it for you. ItemQuery<net.sf.basedb.core.Sample> sampleQuery = net.sf.basedb.core.Sample.getQuery(); sampleQuery.include(Include.SHARED); sampleQuery.setDistinct(true); AnnotationType at = ...; // we get it from a query, see below String query = "something here"; sampleQuery.restrict( new AnnotationSimpleRestriction(Item.SAMPLE.getAlias(), at, Operator.EQ, query, false) ); ItemResultList<net.sf.basedb.core.Sample> samples = sampleQuery.list(dc); ... /* getting the AnnotationType object for annotation type "Shoe size" */ ItemQuery<AnnotationType> typeIq = AnnotationType.getQuery(Item.SAMPLE); typeIq.include(Include.SHARED); typeIq.setDistinct(true); typeIq.restrict( Restrictions.eq( Hql.property(Item.ANNOTATIONTYPE.getAlias(), "name"), Expressions.string("Shoe size") ) ); ItemResultIterator<AnnotationType> typeIt = typeIq.iterate(dc); // this should only contain one AnnotationType object! I'm not sure why we use a ItemResultIterator for one and a ItemResultList for the other. I guess it doesn't matter. If you want to search the actual Annotations, I think you have to hack access to the private method: http://www.mail-archive.com/basedb-de...@lists.sourceforge.net/msg00145.html (we had to do it by creating an extra class inside the net.sf.basedb.core namespace) Hope that helps. cheers, Bob. Olivier Lefevre writes: > The docs leave me unsure of whether one can use the > Query facility to search annotations. Is there any > place I can look? An example would be wonderful. > > Thanks, > > -- O.L. > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > The BASE general discussion mailing list > basedb-users@lists.sourceforge.net > unsubscribe: send a mail with subject "unsubscribe" to > basedb-users-requ...@lists.sourceforge.net -- Bob MacCallum | VectorBase Developer | Kafatos/Christophides Groups | Division of Cell and Molecular Biology | Imperial College London | Phone +442075941945 | Email r.maccal...@imperial.ac.uk ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ The BASE general discussion mailing list basedb-users@lists.sourceforge.net unsubscribe: send a mail with subject "unsubscribe" to basedb-users-requ...@lists.sourceforge.net