[rules-users] nested boolean expressions using prefixOr

Axelrod, Nelson naxelrod at jcvi.org
Tue Jan 19 10:56:07 EST 2010


Hi,

 

I've encountered problems constructing nested Boolean expressions in
Drools 5.0 using the prefixOr syntax.  We're using Drools to build a
genome annotation system at the Venter Institute.     The following
example rule assigns an annotation if there is a blast hit to a gene
GB|AAQ16631.1, or either a blast hit to gene GB|AAQ16631.1, or to any
gene within 500 bases of a gene with an HMM hit to TIGR00905.  I've left
off some details to focus on how we are structuring the syntax of our
prefixOr and prefixAnd expressions.

 

The Drools parser throws errors when it encounters the 2nd "blast_hit"
statement in the example below.  Our prefixOr and prefixAnd expressions
work as expected when we use similar syntax, at least until we attempt
to use nested or expressions.

 

rule "2645|lysine decarboxylase CadA"

when

      (or

            (and

                  blast_hit : BlastHit( hitId=='GB|AAQ16631.1')

                  gene1 : Feature( featureId == blast_hit.queryId )

            )

            (or

                  (and

                        blast_hit : BlastHit( hitId=='GB|AAQ16631.1' )

                        gene1 : Feature( featureId == blast_hit.queryId
)

                  )

                  (and

                        hmm_hit1 : HmmHit( hitId=='TIGR00905' )

                        gene1 : Feature( featureId == hmm_hit1.queryId )

                        gene2 : Feature( eval(gene2.isWithin(gene1,
500)) )

                  )

            )

      )

then      

      Annotation a = new Annotation("lysine decarboxylase CadA");

      gene1.addAnnotation(a);

end

 

Any suggestions are much appreciated.

Thanks,

Nelson

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100119/b0321192/attachment.html 


More information about the rules-users mailing list