0 Replies Latest reply on Oct 10, 2006 8:52 AM by Andrea Langner

    Example Code

    Andrea Langner Newbie

      Hello there,
      i´m a beginner on rules and BREs and still trying to understand the Drools examples.
      In my attempt to implement my own example adapted from the "golf" example I encountered a problem.

      Here is my example:
      There are 3 Girls, each has a name, a lastname, a fad and gets some pocket-money.
      The task is, to find a solution for following facts and rules:

      girl-names: Marion, Susi, Uschi
      lastnames: Müller, Bauer, Weber
      fads: records, sweets, dresses
      money: 6?, 7?, 8?

      1) Marion loves Sweets. She gets less money than the Girl with the lastname Weber.
      2) Susi gets 7?.
      3) Uschi doesn´t spent her money on records. Uschi and the girl with the lastname Bauer get another amount than 6?.

      the information about the girls works exactly like the "Golf" example.
      g1:Girl($marionsName:name=="Marion", .... )
      g2:Girl($susisName:name=="Susi", .... )
      g3:Girl($uschisName:name=="Uschi", .... )

      My Problem is, how to bring the information in "that the girl with the lastname Bauer gets another amount than 6?".

      my first idea was to add something like
      Girl(lastname == "Bauer", money!=6)
      but this does not want to do, what I want it to.
      As far, as I understand it, this only selects the matching facts from the working memory. How can I tell the system, that I don´t want to find new Girls, but only add some additional information to the girls, which are already found?
      Is there something like a "union" function in Drools?

      Thanks for your help.

      P.S. excuse the errors in my english, I´m german ;)