Edson Tirelli | 1 Sep 2007 19:58
Favicon

Re: mvel bug ??


   What we do support is:

list:Variable() from SOME_MVEL_CODE

    And MVEL supports an extended java syntax, so basically I think you can do anything, as long as the code returns something not null.

    []s
    Edson


2007/8/31, pentarious <cristiano.giuffrida <at> gmail.com>:

Hi,
I believe the following syntax is not supported in Drools:
list:Variable() from SOME_JAVA_CODE
You should use something like: "from $list" or "from collect" or "from
accumulate", and embed any Java code in an eval statement. Edson, am I
missing something?

Regards,

CG



hypnosat7 wrote:
>
> Hi,
>
>    I have a variable declaration as bellow :
>
>>list:Variable() from ruleApp.getVariable ("variableName")
>
> and this is the result :
> Exception in thread "AWT-EventQueue-0" org.mvel.CompileException: cannot
> invoke method
>       at
> org.mvel.optimizers.impl.refl.MethodAccessor.getValue (MethodAccessor.java:54)
>       at
> org.mvel.optimizers.impl.refl.VariableAccessor.getValue(VariableAccessor.java:39)
>       at
> org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated (VariableDeepPropertyNode.java:26)
>       at
> org.mvel.ast.PropertyASTNode.getReducedValueAccelerated(PropertyASTNode.java:19)
>       at org.mvel.MVELRuntime.execute(MVELRuntime.java:88)
>       at org.mvel.CompiledExpression.getValue(CompiledExpression.java:99)
>       at org.mvel.MVEL.executeExpression(MVEL.java:236)
>       at
> org.drools.base.dataproviders.MVELDataProvider.getResults(MVELDataProvider.java :45)
>       at org.drools.reteoo.FromNode.assertTuple(FromNode.java:61)
>       at
> org.drools.reteoo.CompositeTupleSinkAdapter.createAndPropagateAssertTuple(CompositeTupleSinkAdapter.java:73)
>       at
> org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:131)
>       at
> org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:20)
>       at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:160)
>       at org.drools.reteoo.Rete.assertObject(Rete.java:176)
>       at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java :196)
>       at
> org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(ReteooWorkingMemory.java:164)
>       at
> org.drools.common.AbstractWorkingMemory.executeQueuedActions (AbstractWorkingMemory.java:1260)
>       at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:864)
>       at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java :826)
>       at
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:627)
>       at
> mcmipih.rules.rules.integration.drools.ExecutionContext.executeRuleFlow(ExecutionContext.java :54)
>       at
> mcmipih.rules.demo.service.DemoRuleService.validerRumList(DemoRuleService.java:50)
>       at
> mcmipih.rules.demo.service.DemoRuleService$$FastClassByCGLIB$$beeddc5a.invoke(<generated>)
>       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
>       at
> org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:693)
>       at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139)
>       at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java :107)
>       at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
>       at
> org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept (Cglib2AopProxy.java:628)
>       at
> mcmipih.rules.demo.service.DemoRuleService$$EnhancerByCGLIB$$961244c9.validerRumList(<generated>)
>       at
> mcmipih.rules.demo.controller.ValidationAppController$ActionValiderSelectionLst.actionPerformed (ValidationAppController.java:185)
>       at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
>       at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
>       at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
>       at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
>       at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
> Source)
>       at java.awt.Component.processMouseEvent (Unknown Source)
>       at javax.swing.JComponent.processMouseEvent(Unknown Source)
>       at java.awt.Component.processEvent(Unknown Source)
>       at java.awt.Container.processEvent(Unknown Source)
>       at java.awt.Component.dispatchEventImpl(Unknown Source)
>       at java.awt.Container.dispatchEventImpl(Unknown Source)
>       at java.awt.Component.dispatchEvent(Unknown Source)
>       at java.awt.LightweightDispatcher.retargetMouseEvent (Unknown Source)
>       at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
>       at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
>       at java.awt.Container.dispatchEventImpl (Unknown Source)
>       at java.awt.Window.dispatchEventImpl(Unknown Source)
>       at java.awt.Component.dispatchEvent(Unknown Source)
>       at java.awt.EventQueue.dispatchEvent(Unknown Source)
>       at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
>       at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
>       at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>       at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>       at java.awt.EventDispatchThread.run(Unknown Source)
> Caused by: java.lang.NullPointerException
>       at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke (Unknown Source)
>       at
> org.mvel.optimizers.impl.refl.MethodAccessor.getValue(MethodAccessor.java:46)
>       ... 54 more
>

--
View this message in context: http://www.nabble.com/mvel-bug----tf4360199.html#a12429712
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat <at> www.jboss.com
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Edson Tirelli | 1 Sep 2007 20:01
Favicon

Re: check dups


   Tim,

   It must work. If it is not working, you can provide me a zip with the code you are using and I can check, but it is something really basic to not work.

   Regarding iterating the list and asserting individual objects, there are other options like using "from" to avoid the need of inserting individual objects, but usually it is better to assert the individual objects.

   I'll not be on-line full time this week, so if you send me the example I will try to look at it as soon as possible, but no promises.

   []s
   Edson

2007/8/31, Tim.Nguyen <at> expeditors.com <Tim.Nguyen <at> expeditors.com>:
Thanks Edson

The trick is that I have to use the list :(. So I iterate the list, then
insert individual Reference object to the Working memory before I check if
any dups, but no luck




Best Regards,
Tim Nguyen




             "Edson Tirelli"
             <tirelli <at> post.com
             >                                                          To
             Sent by:                  "Rules Users List"
             rules-users-bounc         <rules-users <at> lists.jboss.org>
             es <at> lists.jboss.or                                          cc
             g
                                                                   Subject
                                       Re: [rules-users] check dups
             08/31/2007 10:01
             AM


             Please respond to
             Rules Users List
             <rules-users <at> list
               s.jboss.org >







    Tim,

    Your rule expects to get Reference objects from the working memory, and
they are not there, since you are adding a List of them and not them.
Insert individual references and it will work.

    []s
    Edson

2007/8/31, Tim.Nguyen <at> expeditors.com <Tim.Nguyen <at> expeditors.com>:


  Here is my test

              Reference ref_test2 = new Reference();
              ref_test2.setReferenceType(new ReferenceType("MISC"));
              ref_test2.setReferenceValue("111222");

              Reference ref_test3 = new Reference();
              ref_test3.setReferenceType(new ReferenceType("MISC"));
              ref_test3.setReferenceValue("111222");

              references.add(ref_test2);
              references.add (ref_test2);



              final StatefulSession session =
  ruleBase.newStatefulSession();
              session.insert(references);
              session.fireAllRules();



  Thanks!
  Tim



               "Edson Tirelli"
               <tirelli <at> post.com
               >
  To
               Sent by:                  "Rules Users List"
               rules-users-bounc         <rules-users <at> lists.jboss.org>
               es <at> lists.jboss.or
  cc
               g

  Subject
                                         Re: [rules-users] check dups
               08/31/2007 08:57
               AM


               Please respond to
               Rules Users List
               <rules-users <at> list
                 s.jboss.org >







     Hey Tim,

     Can you please provide a self contained test case? There is no reason
  why it would not work.

     Thanks
      Edson

  2007/8/31, Tim.Nguyen <at> expeditors.com <Tim.Nguyen <at> expeditors.com >:


    Hi List,

    I'd like to check if any duplicate exists in my collection as below:

    rule "check Duplicate"
          when
                ref1: Reference ($type1: referenceType, $value1:
    referenceValue)
                ref2: Reference (this != ref1, referenceType ==
    $referenceType,
    referenceValue == $value1)

          then
                 errorHandler.record("Duplicate Reference is not
  allowed.");
    end


    Both my referenceType and referenceValue are String. I didn't get any
    error
    but it didn't work. Any idea?
    I am using 4.01 GA


    Thanks,
    Tim

    _______________________________________________
    rules-users mailing list
     rules-users <at> lists.jboss.org
     https://lists.jboss.org/mailman/listinfo/rules-users



  --
    Edson Tirelli
    Software Engineer - JBoss Rules Core Developer
    Office: +55 11 3529-6000
    Mobile: +55 11 9287-5646
    JBoss, a division of Red Hat <at> www.jboss.com
  _______________________________________________
  rules-users mailing list
  rules-users <at> lists.jboss.org
   https://lists.jboss.org/mailman/listinfo/rules-users


  _______________________________________________
  rules-users mailing list
  rules-users <at> lists.jboss.org
  https://lists.jboss.org/mailman/listinfo/rules-users



--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat <at> www.jboss.com
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat <at> www.jboss.com
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Edson Tirelli | 1 Sep 2007 20:06
Favicon

Re: single result


     Yes, you just need to rewrite your rule accordingly.


2007/8/31, Tim.Nguyen <at> expeditors.com < Tim.Nguyen <at> expeditors.com>:


Is there anyway to only display 1 error message in the RHS instead of
displaying bunch of duplicate error message when I have multiple data
matching the condition in the LHS.

Or, if the first time the data matches the condition in the LHS, then do
the RHS then stop



Is there anyway to do either 1 of those above?  Thank you!



Tim

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat <at> www.jboss.com
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Edson Tirelli | 1 Sep 2007 20:07
Favicon

Re: LHS functions not in eval()...


   Yes, the only way to call functions is inside eval or RHS. Although, drools executes some time coercion. Did you tried a direct comparison? I'm not positive it will work, but you may try.

2007/8/31, wasabifan <bryan.rickman <at> kewill.com>:

I am trying to write a function that takes a numeric value and returns a
string.  Basically, I have a numeric number I need to match to a string
number (so I need to convert one to the other type).  I wrote a function to
do this, but it only seems to work in the RHS or inside an eval().

Is there a way to convert numerics to strings (or vice-versa) in the LHS not
in an eval?  Or is a big function inside the eval() the only way to do this?

Thanks,
Bryan
--
View this message in context: http://www.nabble.com/LHS-functions-not-in-eval%28%29...-tf4362273.html#a12433462
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat <at> www.jboss.com
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Mark Proctor | 2 Sep 2007 04:13

[drools-user] 4.0.2

We will be releasing 4.0.2 on the week of the 10th, so it's a quick 
release. Calling functions and static method calls with MVEL is already 
fixed. It looks like the jci/janino recursion on import bug has been 
fixed, so we'll update those for 4.0.2. The MVEL code completion and 
debug will also be fixed for 4.0.2. We will try and fix 
accumulate/collect for querries but if it gets difficult they may have 
to wait.

Mark

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Mark Proctor | 2 Sep 2007 04:53

4.0.2

We will be releasing 4.0.2 on the week of the 10th, so it's a quick
release. Calling functions and static method calls with MVEL is already
fixed. It looks like the jci/janino recursion on import bug has been
fixed, so we'll update those for 4.0.2. The MVEL code completion and
debug will also be fixed for 4.0.2. We will try and fix
accumulate/collect for querries but if it gets difficult they may have
to wait.

Mark

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Adrian Paschke | 2 Sep 2007 15:15
Picon
Favicon

CfPart: International RuleML Symposium on Rule Interchange and Applications (RuleML-2007)


[ our apologies should you receive this message more than one time ]

=====================================================================
                        CALL FOR PARTICIPATION

                  The International RuleML Symposium
             on Rule Interchange and Applications (RuleML-2007)

                October 25-26, 2007, Orlando, Florida

*** NOTE: The early registration deadline is on 15 September 2007 ***

                        http://2007.ruleml.org

=====================================================================
Co-located with:

               The 10th International Business Rules Forum

                    http://www.businessrulesforum.com
=====================================================================

In Co-operation with:

ECCAI, AAAI, ACM, ACM SIGAPP, ACM SIGMIS, ACM SIGART, ACM SIGMOD, IEEE,
IEEE Computer TCAAS, IEEE SMCS, BPM-Forum, W3C, OMG, and OASIS

We invite you to attend the International RuleML Symposium on Rule
Interchange and Applications (RuleML-2007) to be held during October
25-26, 2007 in Orlando, Florida. As this is a 'first-of-its-kind' event,
participants can make a difference about shaping the future direction
and structure of the field, including about rule standards supporting
their own approaches and about their own possible involvement in the
organization of future events.

Co-located with the 10th International Business Rules Forum, the
International Symposium on Rule Interchange and Applications
(RuleML-2007) is the first event devoted to work on practical
distributed rule technologies and rule-based applications. These need
language standards for rules operating in the context of, e.g., the
Semantic Web, Intelligent Multi-Agent Systems, Event-Driven
Architectures and Service-Oriented Computing Applications. After a
series of successful RuleML workshops and then conferences (e.g.
http://2006.ruleml.org), this is a new kind of event where the Web Logic
community joins the established, practically oriented Forum of the
Business Rules community (http://www.businessrulesforum.com) to help
cross-fertilizing between Web and Business Logic technology.

The goal of RuleML-2007 is to bring together rule system providers,
representatives of, and participants in, rule standardization efforts
(e.g., RuleML, RIF, PRR, CL, SBVR) and open source rules communities
(e.g., jBoss Rules, Jess, Prova, OO jDREW, Mandarax, XSB, XQuery),
practitioners and technical experts, developers, users, and researchers.
It is an excellent opportunity, for experienced rule researchers/
practitioners as well as newcomers, to learn more about this
innovation-driven technology market, characterized by strong growth and
commercial opportunities. They will be offered an exciting venue to
exchange new ideas, practical developments and experiences on issues
related to the engineering, management, integration, interoperation and
interchange of rules in open distributed environments such as the Web.

The scope of RuleML-2007 covers all topics relevant to rule-based
technologies, rule interchange formats and rule-based applications as
well as discussions of lessons learned that have to be taken into
account when employing rule-based technologies in distributed,
(partially) open, heterogeneous environments.

=======================
Technical Program
=======================

The symposium will feature a strong, single-track technical program
consisting of:

         * Keynote speakers:
             * Ron Ross, Business Rules Solution LLC, USA:
               "Business Requirements for Rule Modeling"
             * Jürgen Angele, Ontoprise, Germany:
               "How Ontologies and Rules Help to Advance Automobile
               Development"
             * Adrian Bowles, OMG, USA:
               "Sharing Policy Rules for IT Governance"
             * Harold Boley, National Research Council, Canada:
               "Are Your Rules Online? Four Web Rule Essentials"

          * 2 Invited papers
          * 9 Long research papers
          * 9 Short research papers
          * Industry and demo presentations
          * Challenge with awards
          * Panel discussion on Web Business Rules

The full symposium program is available at:
http://2007.ruleml.org/index-Dateien/Page646.htm

==========================
RuleML-2007 Registration
==========================

Early Registration Deadline:   September 15, 2007
Late Registration Deadline:    after September 15, 2007
RuleML-2007 Symposium:         October 25-26, 2007

The registration page is available at:
http://2007.ruleml.org/index-Dateien/Page930.htm

As shown there, special discounts are available for our collaboration
partners and sponsors.

The symposium will be held at the Buena Vista Palace in Orlando,
Florida, near the Walt Disney World Resort. Information about
accommodation and the symposium venue is available here:

http://2007.ruleml.org/index-Dateien/Page716.htm (Venue)
http://2007.ruleml.org/index-Dateien/Page861.htm (Accommodation)

=======================
Program Committee
=======================

- Asaf Adi, IBM Research Laboratory Haifa, Israel
- Bill Andersen, Ontology Works, USA
- Grigoris Antoniou, University of Crete, Greece
- Arun Ayachitula, IBM TJ Watson Research Center, USA
- Youcef Baghdadi, Sultan Qaboos University, Oman
- Sidney Bailin, Knowledge Evolution, USA
- Claudio Bartolini, HP Labs Palo Alto, USA
- Tim Bass, SilkRoad Inc., USA
- Nick Bassiliades, Aristotle University of Thessaloniki, Greece
- Bernhard Bauer, University of Augsburg, Germany
- Leopoldo Bertossi, Carleton University, Canada
- Anthony Brown, University of New Brunswick, Canada
- Loreto Bravo, University of Edinburgh, UK
- Diego Calvanese, Free University of Bozen-Bolzano, Italy
- Donald Chapin, Business Semantics Ltd, UK
- Keith Clark, Imperial College, UK
- Jorge Cuellar, Siemens AG, Germany
- Mike Dean, BBN Technologies, USA
- Stan Devitt, Agfa Healthcare, Canada
- Jens Dietrich, Massey University, New Zeeland
- Juergen Dix, Technische Universitaet Clausthal, Germany
- Scharam Dustdar, Vienna University of Technology, Austria
- Andreas Eberhart, HP, Germany
- Maarten van Emden, University of Victoria, Canada
- Opher Etzion, IBM Research Laboratory Haifa, Israel
- Dieter Fensel, DERI Innsbruck, Austria
- Tim Finin, University of Maryland Baltimore County, USA
- Dragan Gasevic, Athabasca University, Canada
- Allen Ginsberg, MITRE, USA
- Robert Golan, DBmind Technologies, USA
- Christine Golbreich, Univ. of Versailles Saint-Quentin, France
- Guido Governatori, University of Queensland, Australia
- Sung Ho Ha, Kyungpook National University, South Korea
- Gary Hallmark, Oracle, USA
- Marek Hatala, Simon Fraser University, Canada
- Ivan Herman, W3C Semantic Web Activity, Netherlands
- Jochen Hiller, Top Logic, Germany
- David Hirtle, University of Waterloo, Canada
- Christian Huemer, Vienna University of Technology, Austria
- Jane Hunter, University of Queensland, Australia
- Elisa Kendall, Sandpiper Software, USA
- Matthias Klusch, DFKI GmbH, Saarbrücken, Germany
- Holger Lausen, DERI Innsbruck, Austria
- John Lee, Hong Kong Polytechnic University, Hong Kong
- Heiko Ludwig, IBM TJ Watson Research Center, USA
- Thomas Lukasiewicz, University Roma La Sapienza, Italy
- Christopher Matheus, Vistology, Inc., USA
- Mala Mehrota, Pragati Research, USA
- Jing Mei, IBM China Research Lab, China
- Zoran Milosevic, Deontik, Australia
- Jang Minsu, E&T Research Institute, Korea
- Leora Morgenstern, Stanford University, USA
- Joerg Mueller, TU Clausthal, Germany
- Chieko Nakabasami, Toyo University, Japan
- Matthias Nickles, Technical University Munich, Germany
- Ilkka Niemelae, Helsinki University of Technology, Finland
- Bart Orriens, Tilburg University, Netherlands
- Paula-Lavinia Patranjan, Rewerse, Germany
- Cheyne Patterson, USAchurch, USA
- Axel Polleres, DERI Galway, Irland
- Jeff Pollock, Oracle, USA
- Alun Preece, University of Aberdeen, UK
- Maher Rahmouni, HP Labs, UK
- Girish Ranganathan, University of New Brunswick, Canada
- Dave Reynolds, HP, England
- Norman Sadeh, Carnegie Mellon University, USA
- Marco Seirioe, RuleCore, Sweden
- Kai Simon, Albert-Ludwigs University Freiburg, Germany
- Michael Sintek, DFKI, Germany
- Silvie Spreeuwenberg, LibRT, Netherlands
- Giorgos Stoilos, NTU Athens, Greece
- Terrance Swift, XSB, Inc., USA
- Kuldar Taveter, University of Melbourne, Australia
- Vagan Terziyan, University of Jyvaskyla, Finland
- Paul Vincent, TIBCO Software, Inc., USA
- Kewen Wang, Griffith University, Australia
- Guizhen Yang, SRI, USA

=======================
Organizing Committee
=======================

General Chair

Said Tabet, Inferware Corp.
stabet AT ruleml.org

Program Co-Chairs

Adrian Paschke, Technical University Munich, Germany
paschke AT in.tum.de
Yevgen Biletskiy, University of New Brunswick, Canada
biletski AT unb.ca

Challenge Co-Chairs

Alexander Kozlenkov, Betfair Ltd., London, UK
alex.kozlenkov AT betfair.com
Ralph Hodgson, TopQuadrant, Inc., Mountain View, USA
rhodgson AT topquadrant.com

Panel Chair

John Hall, Model Systems, UK
john.hall AT modelsys.com

Publicity Chair

Suzette Stoutenburg, MITRE Corporation, USA
suzette AT mitre.org

=======================================================================
Sponsorship from:
-------------------
Top Logic <http://www.top-logic.com>,
Vistology <http://vistology.com/>,
Inferware <http://www.inferware.com/>
=======================================================================

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Andy Mei | 3 Sep 2007 05:21
Picon

Re: DSL field constraint question

Any idea? 

I really appreciate any help or pointers!

Andy

On 8/31/07, Andy Mei <andy.d.mei <at> gmail.com > wrote:
Hi,

  I am new to Drools and working with 4.0.1 version.
  I am playing with DSL and having trouble with conditional field constraints.
  I really appreciate any help, i like drools a lot and would love to use it.

  Here is the simple rule i have:

rule "Credit Approved"
    salience 5
    when
        //notice here we are using our own domain specific language that's defined within
        #credit.dsl file
        There is a person with
            #-must has a name
            -age is at least 18 years old
    then
>        System.out.println( "[ALLOW] Credit approved for " + person.getName());
end

  Here is my dsl definition:
[when]There is a person with=person:Person()
[when]-age is at least {age} years old=(age >= {age})
[when]-age is less than {age} years old=(age < {age})
[when]-must has a name=(name != "" && name != null)
[when]-id must be positive integer=id > 0

Everything works fine if i use only 'age is least 18 years old' or 'must has a name'.
However, if i try to do a connective and between these two constraints, i am getting
 package build errors:
Package build error found:
[13,43]: unknown:13:43 mismatched token: [ <at> 59,331:331=',',<11>,13:43]; expecting type RIGHT_PAREN[13,59]: unknown:13:59 mismatched token: [ <at> 71,347:347=')',<12>,13:59]; expecting type THEN
Exception in thread "main" org.drools.rule.InvalidRulePackage: [13,43]: unknown:13:43 mismatched token: [ <at> 59,331:331=',',<11>,13:43]; expecting type RIGHT_PAREN[13,59]: unknown:13:59 mismatched token: [ <at> 71,347:347=')',<12>,13:59]; expecting type THEN
    at org.drools.rule.Package.checkValidity(Package.java:419)
    at org.drools.common.AbstractRuleBase.addPackage (AbstractRuleBase.java:292)
    at com.trg.play.rules.PersonTest.readRule(PersonTest.java:103)
    at com.trg.play.rules.PersonTest.main(PersonTest.java:51)

I have attached my test program for your review.



_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
vdelbart | 3 Sep 2007 08:46
Picon

Re: DSL field constraint question


Hi Andy Mei,

In your DSL file you put some parentheses. I think it's the problem. Try
with this :

> [when]There is a person with=person:Person()
> [when]-age is at least {age} years old=age >= {age}
> [when]-age is less than {age} years old=age < {age}
> [when]-must has a name=name != "" && name != null
> [when]-id must be positive integer=id > 0

Good luck,

vdelbart
--

-- 
View this message in context: http://www.nabble.com/DSL-field-constraint-question-tf4360996.html#a12457145
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Edgardo | 3 Sep 2007 17:37
Picon

Web Service deploy out of memory

Hi list,

     I have developed a web service for deploy my rule package, this rule  
package is in the BRMS, the source code of the web service class is:

public class ValidaLlamadaWS {

	RuleAgent agent = RuleAgent.newRuleAgent("/brmsdeployedrules.properties");
	RuleBase ruleBase = agent.getRuleBase();
	StatelessSession session = ruleBase.newStatelessSession();
	
	public Object[] ValidaLlamada(Integer cantsegundos){
		Validaciones validaciones = new Validaciones();
		validaciones.setCantsegundos(cantsegundos);
		
		session.execute(validaciones);

		return validaciones.getResult();
	}
}

The BRMS run over JBoss AS 4.2.1.GA and the web service over Apache Tomcat  
5.5 on the same machine, the rule base contain only 2 rules

The problem is that I need to call the web service more than 400.000  
times, and with 1000 times, I obtain the Java Heap Exception.
If I monitoring my machine memory, this only increase between calls. And  
the process that more memory expensive is java.exe (JBoss AS 4.2.1.GA).
The process javaw.exe (Apache Tomcat 5.5)also is expensive, but less than  
java.exe

The question are:

How I can "dispose" the objects that I use?
Is correct this use for StatelessSession?
You are the experts, any other idea for implement my web service?

PD: sorry for my bad english.

Greetings

--

-- 
Edgardo Ibañez O.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Gmane