<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">You should realize that the LHS
      ("when") and RHS ("then") are different and use different
      syntaxes.<br>
      The RHS is essentially java... you can't use ":" and "from". <br>
      <br>
      Also.. "Event(..) from .." is a pattern - a filter that tries to
      match existing objects asserted in the WM.<br>
      What you need there is to create a new Event.. just do it the way
      you would in Java.<br>
      <br>
      You will have to learn to read error messages, too. <br>
      What the error is trying to say, is that it interpreted the Event(
      .. ) statement as a method call,<br>
      which is of course undefined.<br>
      <br>
      On 03/10/2014 08:19 PM, Sandhya Sree wrote:<br>
    </div>
    <blockquote
cite="mid:CAJftt0E4EAbOHU6eFRm8nwRv=Oe0m4Xp2gX3OrPh+FE7pxbcGQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">i tried this :
        <div><br>
        </div>
        <div>
          <div style="font-family:arial,sans-serif;font-size:13px"><font
              face="arial, sans-serif">rule "new file"</font></div>
          <div class="im"
            style="font-family:arial,sans-serif;font-size:13px">
            <div><font face="arial, sans-serif">when</font></div>
            <div><font face="arial, sans-serif">&nbsp; &nbsp; FileData($old :
                fileOld, $new : fileNew, fileOld != fileNew)</font></div>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13px">
            <font face="arial, sans-serif">&nbsp;&nbsp;&nbsp;</font><font face="arial,
              sans-serif"><font face="arial, sans-serif">&nbsp;$newFile :
                String( this not memberOf $old ) from $new</font><br>
            </font></div>
          <div><font style="font-family:arial,sans-serif;font-size:13px"
              face="arial, sans-serif">then&nbsp;&nbsp;&nbsp;<br>
              &nbsp; &nbsp;&nbsp;</font><font face="arial, sans-serif">event :
              Event("file added", filename, new Date()) from $plus<br>
            </font></div>
          <div><font face="arial, sans-serif">&nbsp; &nbsp;
              Event.listOfEvents.add(event);</font></div>
          <div><font face="arial, sans-serif">&nbsp; &nbsp; event.display();</font><span
              style="font-family:arial,sans-serif">&nbsp;</span></div>
          <font style="font-family:arial,sans-serif;font-size:13px"
            face="arial, sans-serif">end</font><br>
        </div>
        <div><font style="font-family:arial,sans-serif;font-size:13px"
            face="arial, sans-serif"><br>
          </font></div>
        <div><font style="font-family:arial,sans-serif;font-size:13px"
            face="arial, sans-serif"><br>
          </font></div>
        <div><font style="font-family:arial,sans-serif;font-size:13px"
            face="arial, sans-serif">this gives the following error:</font></div>
        <div><font style="font-family:arial,sans-serif;font-size:13px"
            face="arial, sans-serif">
            <div>
              The method Event(String, File, Date) is undefined for the
              type Rule_new_file_0c90fff8d9b74b439ab79971b13b75ac</div>
            <div><span class="" style="white-space:pre"> </span>&nbsp;Syntax
              error on token "from", ; expected</div>
            <div><span class="" style="white-space:pre"> </span>&nbsp;$plus
              cannot be resolved to a type</div>
            <div><span class="" style="white-space:pre"> </span>&nbsp;Syntax
              error on token ".", ; expected</div>
            <div><span class="" style="white-space:pre"> </span>&nbsp;listOfEvents
              cannot be resolved</div>
          </font></div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Tue, Mar 11, 2014 at 12:09 AM,
          Davide Sottara <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:dsotty@gmail.com" target="_blank">dsotty@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>"from" will iterate for you, exactly like
                "accumulate" counted the events. <br>
                If you need more details, please consult the
                documentation
                <div>
                  <div class="h5"><br>
                    <br>
                    <br>
                    On 03/10/2014 07:29 PM, Sandhya Sree wrote:<br>
                  </div>
                </div>
              </div>
              <div>
                <div class="h5">
                  <blockquote type="cite">
                    <div dir="ltr">The problem here is even if multiple
                      files are added, there is only one event object
                      created. i want to have like say if 3 new files
                      are added, 3 event objects must be created, and
                      all three event objects must be added to
                      List&lt;Event&gt; listOfEvents.&nbsp;
                      <div> <br>
                      </div>
                      <div><br>
                      </div>
                      <div>Thanks.</div>
                    </div>
                    <div class="gmail_extra"><br>
                      <br>
                      <div class="gmail_quote">On Mon, Mar 10, 2014 at
                        11:48 PM, Davide Sottara <span dir="ltr">&lt;<a
                            moz-do-not-send="true"
                            href="mailto:dsotty@gmail.com"
                            target="_blank">dsotty@gmail.com</a>&gt;</span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">
                          <div bgcolor="#FFFFFF" text="#000000">
                            <div>The "accumulates" should not be in the
                              "then" part of a rule (see my previous
                              email).<br>
                              That rule gave you two lists, in the
                              variables $plus and $mins, that you can
                              use in the consequence.<br>
                              <br>
                              If you need to process each file
                              separately, you may want to do something
                              like this:<br>
                              <br>
                              <div><font face="arial, sans-serif">rule
                                  "new file"</font></div>
                              <div>
                                <div><font face="arial, sans-serif">when</font></div>
                                <div><font face="arial, sans-serif">&nbsp; &nbsp;
                                    FileData($old : fileOld, $new :
                                    fileNew, fileOld != fileNew)</font></div>
                              </div>
                              <div><font face="arial, sans-serif">&nbsp;&nbsp;&nbsp;</font><font
                                  face="arial, sans-serif"><font
                                    face="arial, sans-serif"> $newFile :
                                    String( this not memberOf $old )
                                    from $new</font><br>
                                </font></div>
                              <div> <font face="arial, sans-serif">then&nbsp;&nbsp;
                                  <br>
                                  &nbsp;&nbsp; // create new event for a new file
                                  : new Event(...)<br>
                                  &nbsp;&nbsp; // add to list :
                                  Event.listOfEvents.add(...)<br>
                                </font></div>
                              <font face="arial, sans-serif">end</font>
                              <div><br>
                              </div>
                              You'll need another rule for the files
                              that have been removed.<br>
                              <br>
                              Notice that your Event class has no way to
                              distinguish "added" from "removed" files,
                              you may want to<br>
                              add a boolean or something there.<br>
                              Best<br>
                              Davide
                              <div>
                                <div><br>
                                  <br>
                                  On 03/10/2014 07:04 PM, Sandhya Sree
                                  wrote:<br>
                                </div>
                              </div>
                            </div>
                            <blockquote type="cite">
                              <div>
                                <div>
                                  <div dir="ltr">hi,
                                    <div>im new to drools..im trying to
                                      create a project as follows. i
                                      have a class called Monitor &nbsp;which
                                      monitors a folder and creates two
                                      lists called fileOld( which is the
                                      list of filenames in that folder
                                      at time t1) &nbsp;and fileNew(which is
                                      the list of filenames in that
                                      folder at time t2). i have another
                                      class called FileData which
                                      contains two members fileOld and
                                      fileNew (list of strings) with
                                      getters,setters and constructor.
                                      fileOld and fileNew from Monitor
                                      Class are passed to FileData
                                      class.</div>
                                    <div><br>
                                    </div>
                                    <div>i also have another class
                                      called Event which is as follows:</div>
                                    <div>
                                      <div>public class Event {</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span></div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span> public static String
                                        name;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span> private &nbsp;File source;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span> private &nbsp;Date timeStamp;</div>
                                      <div>&nbsp; &nbsp; &nbsp; &nbsp; public &nbsp;static
                                        &nbsp;List&lt;Event&gt; listOfEvents
                                        = new ArrayList&lt;Event&gt;();</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span></div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>&nbsp;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>public Event(String name,
                                        File source, Date timeStamp) {</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span><a moz-do-not-send="true"
                                          href="http://this.name"
                                          target="_blank">this.name</a>
                                        = name;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>this.source = source;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>this.timeStamp =
                                        timeStamp;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>}</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span></div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span></div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>public String getName() {</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>return name;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>}</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>public void
                                        setName(String name) {</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span><a moz-do-not-send="true"
                                          href="http://this.name"
                                          target="_blank">this.name</a>
                                        = name;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>}</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>public File getSource() {</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>return source;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>}</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>public void
                                        setSource(File source) {</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>this.source = source;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>}</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>public Date
                                        getTimeStamp() {</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>return timeStamp;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>}</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>public void
                                        setTimeStamp(Date timeStamp) {</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>this.timeStamp =
                                        timeStamp;</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span>}</div>
                                      <div><span
                                          style="white-space:pre-wrap">
                                        </span></div>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div>now i have to compare these two
                                      lists(fileOld and fileNew) in a
                                      rule file and if they are not
                                      equal i have to create an event
                                      object for every file added and
                                      deleted and put it in the
                                      List&lt;Event&gt; listOfEvents.</div>
                                    <div><br>
                                    </div>
                                    <div>here is my rule file:</div>
                                    <div><br>
                                    </div>
                                    <div>
                                      <div><span
                                          style="font-family:arial,sans-serif;font-size:13px">r</span><font
                                          face="arial, sans-serif">rule
                                          "files are equal"</font></div>
                                      <div><span
                                          style="font-family:arial,sans-serif">&nbsp;
                                          &nbsp; when&nbsp;</span></div>
                                      <div><font face="arial,
                                          sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FileData(
                                          fileOld == fileNew)</font></div>
                                      <div><font face="arial,
                                          sans-serif">&nbsp; &nbsp; then</font></div>
                                      <div><font face="arial,
                                          sans-serif">&nbsp; &nbsp; &nbsp;
                                          &nbsp;System.out.println("files are
                                          equal");</font></div>
                                      <div><font face="arial,
                                          sans-serif">&nbsp; &nbsp; </font><span
style="font-family:arial,sans-serif">end</span></div>
                                      <div><font face="arial,
                                          sans-serif"><br>
                                        </font></div>
                                      <div><font face="arial,
                                          sans-serif"><br>
                                        </font></div>
                                      <div><font face="arial,
                                          sans-serif">rule "files not
                                          equal"</font></div>
                                      <div><font face="arial,
                                          sans-serif">when</font></div>
                                      <div><font face="arial,
                                          sans-serif">&nbsp; &nbsp; FileData($old
                                          : fileOld, $new : fileNew,
                                          fileOld != fileNew)</font></div>
                                      <div><font face="arial,
                                          sans-serif">&nbsp; &nbsp;&nbsp;</font></div>
                                      <div> <font face="arial,
                                          sans-serif">then</font></div>
                                      <div><font face="arial,
                                          sans-serif">&nbsp; &nbsp;accumulate( $s
                                          : String( this not memberOf
                                          $old ) from $new, $plus :
                                          collectList( $s ) )&nbsp;</font></div>
                                      <div><font face="arial,
                                          sans-serif">&nbsp; &nbsp;accumulate( $t
                                          : String( this not memberOf
                                          $new ) from $old, $mins :
                                          collectList( $t ) )&nbsp;</font></div>
                                      <div><font face="arial,
                                          sans-serif">&nbsp;
                                          &nbsp;System.out.println("files
                                          added:" + $plus );&nbsp;</font></div>
                                      <div><font face="arial,
                                          sans-serif">&nbsp;
                                          &nbsp;System.out.println( "files
                                          deleted:" + $mins );</font></div>
                                      <div> <font face="arial,
                                          sans-serif">end</font></div>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div>how can i loop through each of
                                      the file added or deleted and
                                      create an Event Class object for
                                      every file added and deleted &nbsp;and
                                      finally add all the created
                                      objects to List&lt;Event&gt;
                                      listOfEvents..</div>
                                    <div><br>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div>Thanks.</div>
                                  </div>
                                  <br>
                                  <fieldset></fieldset>
                                  <br>
                                </div>
                              </div>
                              <pre>_______________________________________________
rules-users mailing list
<a moz-do-not-send="true" href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
                            </blockquote>
                            <br>
                          </div>
                          <br>
_______________________________________________<br>
                          rules-users mailing list<br>
                          <a moz-do-not-send="true"
                            href="mailto:rules-users@lists.jboss.org"
                            target="_blank">rules-users@lists.jboss.org</a><br>
                          <a moz-do-not-send="true"
                            href="https://lists.jboss.org/mailman/listinfo/rules-users"
                            target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_______________________________________________
rules-users mailing list
<a moz-do-not-send="true" href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            rules-users mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
            <a moz-do-not-send="true"
              href="https://lists.jboss.org/mailman/listinfo/rules-users"
              target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></pre>
    </blockquote>
    <br>
  </body>
</html>