I have create a rule for recommending books:

(defrule recommend-book
"recommend the book"
(book (name ?name)(price ?price)(publisher oreilly)(keyword Java))
(not (book (price ?p&:(< ?p ?price))))
=>
(assert(recommend (name ?name)(price ?price)))
)

In my Java program I am creating a facts catalog similar to the program (listing 18.1/page 312)in the book Jess in action.

The listing of my facts in the working memory looks like this:

==> f-1 (MAIN::book (name "Java for beginners") (keyword "Java") (publisher "oreilly") (price 15))
==> f-2 (MAIN::book (name "New Java for beginners") (keyword "Java") (publisher "manning") (price 20))
==> f-3 (MAIN::book (name "Java for experts") (keyword "Java") (publisher "oreilly") (price 30))
==> f-4 (MAIN::book (name "Java for intermediate") (keyword "Java") (publisher "oreilly") (price 35))


My rules are not firing for the above facts.

However, when I create a fact
engine.executeCommand("(assert (book (name samplebook)(price 14)(keyword Java)(publisher oreilly)))");


and the fact looks like this in the working memory
==> f-5 (MAIN::book (name samplebook) (keyword Java) (publisher oreilly) (price 14))


The only difference I see is that the new fact and the original fact is " " - (keyword "Java") vs (keyword Java).

Is Jess behaving correctly. How do I create a fact without the  quotes.

Thanks
Rajani

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------



Reply via email to