I would like find ?word1 and ?word2 such that the absolute value of
?rowNumber1 minus?rowNumber2 is the minimum number and ?word1 is not equal
to ?word2

 

rowNumber are integers, 1, 2, 3....

 

I have verified that there is a single minimum.

 

I have tried 

 

(defrule find-lines-per-block-ssn

           ?word1 <- (word (page ?page) (rowNumber ?rowNumber1) (type ssn)
(text ?text1)  )

            ?word2 <- (word (page ?page) (rowNumber ?rowNumber2&:(<>
?rowNumber1 ?rowNumber2)) (type ssn) (text ?text2) )

            (not 

        (word (page ?page) (rowNumber ?rowNumberVar&:(< (abs (-
?rowNumberVar ?rowNumber1) ) (abs (- ?rowNumber2 ?rowNumber1) ) ) ) )

            )

=>

    ; do something

) 

 

This rule never fired.

 

 

 

I tried  

(defrule find-lines-per-block-ssn

           ?word1 <- (word (page ?page) (rowNumber ?rowNumber1) (type ssn)
(text ?text1)  )

            ?word2 <- (word (page ?page) (rowNumber ?rowNumber2) (type ssn)
(text ?text2) )

            (not 

        (word (page ?page) (rowNumber ?rowNumberVar&:(< (abs (-
?rowNumberVar ?rowNumber1) ) (abs (- ?rowNumber2 ?rowNumber1) ) ) ) )

            )

=>

    ; do someting

)  

 

This fired but ?word1 equals ?word2.

 

Thanks

 

Bob

 

 

Reply via email to