Re: [base] Querying annotations
Olivier Lefevre wrote: 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. The net.sf.basedb.core.query.Annotations class contains a collection of factory methods for creating restrictions based on annotations. The javadoc is found here: http://base.thep.lu.se/chrome/site/latest/api/net/sf/basedb/core/query/Annotations.html The restrictions can be used on queries for items that are annotatable. /Nicklas -- 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
Re: [base] Querying annotations
Olivier Lefevre wrote: Thanks. Between that and the other thread I am getting I should be able to work out something. What about AnnotationSet.getQuery(), though: can't you search that and then use getItem() to go back to the item? This is not a public method since the query will return items that a user may not have access to. And... the restrictions that are created by the Annotations class doesn't work on this query either. /Nicklas -- 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
Re: [base] Querying annotations
AnnotationSet.getQuery() seems to be private also, but there are ways to get at it... Olivier Lefevre writes: Thanks. Between that and the other thread I am getting I should be able to work out something. What about AnnotationSet.getQuery(), though: can't you search that and then use getItem() to go back to the item? -- 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
[base] Querying annotations
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. ItemQuerynet.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) ); ItemResultListnet.sf.basedb.core.Sample samples = sampleQuery.list(dc); ... /* getting the AnnotationType object for annotation type Shoe size */ ItemQueryAnnotationType 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) ) ); ItemResultIteratorAnnotationType 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
Re: [base] Querying annotations
Thanks. Between that and the other thread I am getting I should be able to work out something. What about AnnotationSet.getQuery(), though: can't you search that and then use getItem() to go back to the item? -- 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