[BAD Bug]: Re: [rules-users] Drools Expert does not sort integers correctly
by Wolfgang Laun
This BAD bug was introduced on the way from 5.4.0 to 5.5.0 (and seems
to have sneaked into 6.0.0 as well).
Only 5.4.0 and predecessors work as expected.
Damage control? How far can 5.5.0 be trusted?
On 17/01/2013, John Smith <ffirstt.llastt(a)gmail.com> wrote:
> I am new to Drools and am trying to get the sample program to work. This
> sample is given in the drools documentation
> http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_....
> This drool rule is expected to sort integers. I just changed the numbers
> from what are given in the sample and they do not get sorted as expected.
> Tried using drools version 5.5.0, 5.5.1 and the master 6.0.0, but got the
> same wrong results.
>
> Following is the main code:
> package com.sample;
>
> public class Example2 {
> public static void main(String[] args) throws Exception {
> Number[] numbers = new Number[] { wrap(5), wrap(6), wrap(4),
> wrap(1), wrap(2) };
> new RuleRunner().runRules(new String[] { "Example3.drl" },
> numbers);
> }
>
> private static Integer wrap(int i) {
> return new Integer(i);
> }
> }
>
> The RuleRunner class is the same as given in the example and I do not
> think
> I should give that here, since it will clutter the question. It simply
> creates the KnowledgeBase, stateful session, inserts the facts as given in
> the 'numbers' array above and then calls fireAllRules method on the
> session.
>
> The rule file (Example3.drl) is:
>
>
> rule "Rule 04"
> dialect "mvel"
> when
> $number : Number()
> not Number(intValue < $number.intValue)
> then
> System.out.println("Number found with value: " + $number.intValue());
> retract($number);
> end
>
>
> The output I get is as follows:
> Loading file: Example3.drl
> Inserting fact: 5
> Inserting fact: 6
> Inserting fact: 4
> Inserting fact: 1
> Inserting fact: 2
> Number found with value: 1
> Number found with value: 4
> Number found with value: 2
> Number found with value: 5
> Number found with value: 6
>
> Not the correct expected ascending sorted order.
>
> What might I be doing wrong? I cannot imagine that the drools rule engine
> would be broken at this basic level.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-Expert-does-not-sort-integers-co...
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
11 years, 11 months
Re: [rules-dev] guvnor-ng branch will be renamed master
by Toni Rikkola
Work done.
Managed to merge guvnor-ng to master by undoing the changes after the branching.
I will remove guvnor-ng tomorrow, please commit to master from now on.
Toni
On Jan 15, 2013, at 4:53 PM, Toni Rikkola wrote:
> This is a warning for anyone working on guvnor-ng and master branches of the Guvnor repository.
>
> I will rename the master to master-bk and guvnor-ng to master tomorrow.
>
> Current master will not be used in any future releases. It will be stored for a while so we can be sure commits do not get lost.
>
> I'll email this list when I am done. I advice to avoid any fetches or pushing tomorrow before my email.
>
> Why not merge guvnor-ng to master? Sounds easy, but guvnor-ng has a lot of changes. Files changed names and locations, modules were split, code removed and the current master has nothing the new master will need.
>
> Toni Rikkola
11 years, 11 months
[Bug] due to MVEL, once more
by Wolfgang Laun
5.5.0. This simple DRL does not compile unless dialect "mvel" is
removed. "insert" is not recognized within a for loop body.
rule demo
dialect "mvel"
when
then
for( int i = 1; i <= 3; i++ ){
insert( "foo"+i );
}
end
Unable to Analyse Expression for( int i = 1; i <= 3; i++ ){
drools.insert( "foo"+i );
};:
[Error: unable to resolve method using strict-mode:
org.drools.spi.KnowledgeHelper.drools()]
[Near : {... drools.insert( "foo"+i ); ....}]
^
[Line: 1, Column: 0] : [Rule name='demo']
11 years, 11 months
Fwd: [drools] Fixing issue where indented keywords would fail template expansion. (#170)
by Michael Anstis
Anybody care if I merge this pull request? I was involved with the original
emails on drools-user.
It'd be a shame to let (new?) community involvement slip by.
sent on the move
---------- Forwarded message ----------
From: "magnusvojbacke" <notifications(a)github.com>
Date: 22 Dec 2012 15:39
Subject: [drools] Fixing issue where indented keywords would fail template
expansion. (#170)
To: "droolsjbpm/drools" <drools(a)noreply.github.com>
Issue description
In template files, whitespaces before keywords would cause exceptions.
Example of indented "template" keyword
template header
age
type
log
Gives the exception:
org.drools.template.parser.DecisionTableParseException: Missing header
at
org.drools.template.parser.DefaultTemplateContainer.parseTemplate(DefaultTemplateContainer.java:87)
Example of indented "rule" keyword
rule "Cheese fans_(a){row.rowNumber}"
when
Person(age == @{age})
Gives the exception:
java.lang.NullPointerException
at
org.drools.template.parser.DefaultTemplateColumn.createCellCondition(DefaultTemplateColumn.java:67)
Patch description
- Altered the DefaultTemplateContainer.java to trim lines before
comparison.
- Added simple unit-test to expose bug / confirm patch
------------------------------
You can merge this Pull Request by running:
git pull https://github.com/magnusvojbacke/drools templates_indented_keywords
Or view, comment on, or merge it at:
https://github.com/droolsjbpm/drools/pull/170
Commit Summary
- Fixing issue where indented keywords would fail template expansion.
File Changes
- *M*drools-templates/src/main/java/org/drools/template/parser/DefaultTemplateContainer.java
(17)
- *M*drools-templates/src/test/java/org/drools/template/parser/DefaultTemplateContainerTest.java
(11)
- *A*drools-templates/src/test/resources/templates/rule_template_indented.drl
(35)
Patch Links
- https://github.com/droolsjbpm/drools/pull/170.patch
- https://github.com/droolsjbpm/drools/pull/170.diff
—
Reply to this email directly or view it on
GitHub<https://github.com/droolsjbpm/drools/pull/170>.
11 years, 11 months
RuleML 2013: 7th International Web Rule Symposium
by Adrian Paschke
Call for Papers
RuleML 2013: 7th International Web Rule Symposium
Seattle Metropolitan Area, USA, July 11-13, 2013
http://2013.ruleml.org
The annual International Web Rule Symposium (RuleML) is an international conference on research, applications, languages and standards for rule technologies. RuleML is the leading conference for building bridges between academia and industry in the field of rules and its applications, especially as part of the semantic technology stack. It is devoted to rule-based programming and rule-based systems including production rules systems, logic programming rule engines, and business rules engines/business rules management systems; Semantic Web rule languages and rule standards (e.g., RuleML, SWRL, RIF, PRR, SBVR); Legal RuleML; rule-based event processing languages (EPLs) and technologies; hybrid rule-based methods; and research on inference rules, transformation rules, decision rules, production rules, and ECA rules.
The 7th International Symposium on Rules and the Web (RuleML 2013) will be held on July 11-13, 2013 just prior to the AAAI conference in the Seattle Metropolitan Area, Washington. Selected papers will be published in book form in the Springer Lecture Notes in Computer Science (LNCS) series.
Objectives
==========
RuleML-2013 will stimulate cooperation and interoperability between research and business in a community of researchers and practitioners who are interested in the theory and applications of rules. The symposium's areas of research and development have helped drive the rapid progress in technologies for practical rule and event processing. As a result,
RuleML-2013 promises to be an exciting venue for the exchange of new ideas and experiences on issues related to engineering, management, integration, interoperability of rule systems, and interchange of rules in distributed enterprise, intranets, and open distributed environments. Industry practitioners, rule-system providers, users of rules, technical experts and developers, and researchers who are exploring foundational issues, developing systems and applications, or using rule-based systems are invited to share ideas, results, and experiences.
The RuleML2013 Conference is also hosting
- The 7th Int. Rule Challenge: Further information and a separate call for papers and demos for the challenge will be forthcoming.
- The 3rd Doctoral Consortium on Rules: Further information and a separate call for papers and demos for the challenge will be forthcoming
- An OASIS Legal RuleML TC Meeting and Tutorial
Topics
=======
We invite high-quality submissions related (but not limited) to one or more of the following topics:
* Rules and automated reasoning
* Rule-based policies, reputation, and trust
* Rule-based event processing and reaction rules
* Rules and the web
* Fuzzy rules and uncertainty
* Logic programming and nonmonotonic reasoning
* Non-classical logics and the web (e.g modal and epistemic logics)
* Hybrid methods for combining rules and statistical machine learning techniques (e.g., conditional random fields, PSL)
* Rule transformation, extraction, and learning
* Vocabularies, ontologies, and business rules
* Rule markup languages and rule interchange formats
* Rule-based distributed/multi-agent systems
* Rules, agents, and norms
* Rule-based communication, dialogue, and argumentation models
* Vocabularies and ontologies for pragmatic primitives (e.g. speech acts and deontic primitives)
* Pragmatic web reasoning and distributed rule inference / rule execution
* Rules in online market research and online marketing
* Applications of rule technologies in health care and life sciences
* Legal rules and legal reasoning
* Industrial applications of rules
* Controlled natural language for rule encoding (e.g. SBVR, ACE, CLCE)
* Standards activities related to rules
* General rule topics
Conference Chairs
=================
Adrian Paschke (Freie Universitaet Berlin, Germany)
Program Chairs
===============
Leora Morgenstern (Science Applications International Corporation, USA)
Petros Stefaneas (NTUA, Greece)
Important Dates
===============
Abstract submission: Feb. 19, 2013
Paper submission: Feb. 20, 2013
Notification of acceptance/rejection: April 12, 2013 Camera-ready copy due: May 3, 2013
RuleML-2013 dates: July 11-13, 2013
Submission guidelines
=====================
Papers must be original contributions written in English and must be submitted at http://www.easychair.org/conferences/?conf=ruleml2013 as:
* Full Papers (15 pages in the proceedings)
* Short Papers (8 pages in the proceedings)
Please upload all submissions in LNCS format (http://www.springer.de/comp/lncs/authors.html). To ensure high quality, submitted papers will be carefully peer-reviewed by 3 PC members based on originality, significance, technical soundness, and clarity of exposition.
Selected papers will be published in book form in the Springer Lecture Notes in Computer Science (LNCS) series.
11 years, 11 months
Fwd: [rules-users] 14GB of NotNodeLeftTuples produced by one rule?
by Wolfgang Laun
Any takers?
-W
---------- Forwarded message ----------
From: Svenja Brunstein <svenja.brunstein(a)gmail.com>
Date: Fri, 11 Jan 2013 15:00:07 +0100
Subject: Re: [rules-users] 14GB of NotNodeLeftTuples produced by one rule?
To: Rules Users List <rules-users(a)lists.jboss.org>
>
> As you can see, I insert 300,000 facts, and there wasn't a problem
> with memory, so I didn't check the node count. Are there any other
> rules in the rule base?
Thanks! We have six other rules in the rule base, but none of them has a
NOT in it. So I hope all tuples belong to that rule, and as I tested
without that specific rule there were no NotNodeLeftTuples.
In the case where the 14GB of tupels were produced our distribution
actually was *not *randomly distributed, but still with a random
distribution we have a lot of NOT node tuples, e.g., 6 million NOT node
tuples for 128*128=16,384 possible nodes.
Indeed, I'd expect the
> NotNodeLeftTuples to have the same order of magnitude.
Can you explain when a NotNodeLeftTuple is created exactly, and when it is
removed/not created? Unfortunately, I did not find any information or
documentation on this. We definitely want to understand in which case so
many tuples are created to be able to avoid this behavior or construct
rules in other ways.
2013/1/7 Wolfgang Laun <wolfgang.laun(a)gmail.com>
> On 07/01/2013, Svenja Brunstein <svenja.brunstein(a)gmail.com> wrote:
> >>
> >> The system will create network nodes even when only one pattern matches.
> >> 150,000/50,000 = 3 exactly, or average?
> >
> > 3 exactly.
>
> I was running your rule with this data using Drools 5.2/3/4/5.0:
>
> WorkingMemoryEntryPoint ep =
> kSession.getWorkingMemoryEntryPoint("internalstream");
> Event e;
> Random rand = new Random();
> for( int id = 1; id <= 100000; id++ ){
> int iName = rand.nextInt( 1000 ) + 1;
> e = new Event( "a", "Joe" + iName );
> e.put( "id", "id"+id );
> ep.insert( e );
> e = new Event( "a", "Jack" + iName );
> e.put( "id", "id"+id );
> ep.insert( e );
> e = new Event( "a", "Jill" + iName );
> e.put( "id", "id"+id );
> ep.insert( e );
> }
> As you can see, I insert 300,000 facts, and there wasn't a problem
> with memory, so I didn't check the node count. Are there any other
> rules in the rule base?
>
> As you have written: you'll get 50,000 x 6 = 300,000 fact reference
> pairs to represent matching EventA pairs. Indeed, I'd expect the
> NotNodeLeftTuples to have the same order of magnitude.
>
> >> Is the distribution of id/user combinations realistic?
> >
> > What do you mean by realistic?
>
> Is this as it will be in production?
>
> >
> >
> >> What else do
> >> you need to do with Event type "a"? Similar? Completely different? -
> >> There would be a simple solution to significantly reduce the memory
> >> requirements, but it may not be feasible due to these answers.
> >
> > At the moment we are just designing a generic solution, which might be
> > extended by rules afterwards, so that "old" events might need to be
> reused.
> > In a real environment, of course, we would retract some events not needed
> > any longer. But for now we are doing some performance testing and were
> > surprised that we could "crash" the system with one single rule. Of
> course,
> > with a lot of events ;-)
>
> You can crash with even simpler rules :-)
>
> -W
>
> >
> > 2013/1/7 Wolfgang Laun <wolfgang.laun(a)gmail.com>
> >
> >> On 07/01/2013, Svenja Brunstein <svenja.brunstein(a)gmail.com> wrote:
> >> > Thanks for the input. For 150,000 type "a" events we had about 50,000
> >> > different ids and 1,000 user values.
> >> > After all, combinations possible for type "b" were only 1,000,000
> >> > (1,000
> >> > users * 1,000 users), which is why I am surprised to have 88 million
> >> > instances.
> >>
> >> The system will create network nodes even when only one pattern matches.
> >> 150,000/50,000 = 3 exactly, or average?
> >>
> >> If you have 3 events A, B, C with identical ids and different users,
> >> you'll get the following candidates for an activation: (A,B), (B,A),
> >> (A,C), (C,A), (B,C), (C,B)
> >> and this increases O(n^2). - Since you know the exact distribution of
> >> your data, you might compute this precisely.
> >>
> >> Is the distribution of id/user combinations realistic? What else do
> >> you need to do with Event type "a"? Similar? Completely different? -
> >> There would be a simple solution to significantly reduce the memory
> >> requirements, but it may not be feasible due to these answers.
> >>
> >> >
> >> > Yes, it is intentional to have the rule fire twice for each
> combination
> >> :-)
> >> > Unfortunately, retracting events is not an option right now.
> >>
> >> Then, at least, generate both in a single rule.
> >>
> >> >
> >> > I started another round, where I ensured to insert a lot more "b"
> >> > events:
> >> > The memory used by NotNodeLeftTuples is a lot less, even though these
> >> nodes
> >> > still use most of the memory.
> >> > Concluding from all that, I guess it is possible that the nodes take
> >> > that
> >> > much space (up to many GB), and the more events are inserted which
> >> > invalidate the NOT nodes, the less memory is used by them?
> >>
> >> Well, you don't need the NOT node, and their number depends on the
> >> distribution of your data.
> >>
> >> -W
> >>
> >> >
> >> > 2013/1/7 Wolfgang Laun <wolfgang.laun(a)gmail.com>
> >> >
> >> >> The amount of memory required for 150K type "a" depends on the actual
> >> >> distribution of this data w.r.t. fields id and user, and other
> >> >> circumstances; it is not only the rule that is to blame.
> >> >>
> >> >> There is one flaw, though: The rule would fire twice for a matching
> >> >> pair of events of type "a". It's possible that you do want to have a
> >> >> type "b" for both combinations of user and friendid, but you could
> >> >> create both in a single rule, which should halve your memory
> >> >> requirements. If there is no ordered attribute, use the timestamp to
> >> >> restrict a pair to only one combination (hint: "after").
> >> >>
> >> >> This will still generate a lot of network nodes.
> >> >>
> >> >> Other ideas for reduction may have to take the entire application
> >> >> scenario into account, e.g., can you retract events after they have
> >> >> been paired, or how do you do inserts and calls to fireAllRules, etc.
> >> >> Most importantly, however, is the actual frequency of id and user
> >> >> values in relation to type "a" events.
> >> >>
> >> >> -W
> >> >>
> >> >>
> >> >>
> >> >> On 07/01/2013, Svenja Brunstein <svenja.brunstein(a)gmail.com> wrote:
> >> >> > Hi all,
> >> >> >
> >> >> > we observe a strange behavior with one of our rules. After
> >> >> > deployment
> >> >> > and sending lots of events (~150,000 of type "a"), the server slows
> >> >> > down
> >> >> > rapidly until it runs out of memory.
> >> >> > We checked with VisualVM which objects are filling the memory: In
> >> >> > one
> >> >> > moment there were almost 14GB of NotNodeLeftTuples (88,933,186
> >> >> Instances)!
> >> >> >
> >> >> > This is our rule:
> >> >> >
> >> >> > rule "example"
> >> >> > when
> >> >> > $evt1:EventObject(type=='a', $id:data['id'], $user:user) from
> >> >> > entry-point
> >> >> > internalstream
> >> >> > $evt2:EventObject(type=='a', data['id']==$id, user!=$user,
> >> $user2:user)
> >> >> > from entry-point internalstream
> >> >> > not(EventObject(type=='b', user==$user, data['friendid']==$user2)
> >> >> > from
> >> >> > entry-point internalstream)
> >> >> > then
> >> >> > EventObject evt = new EventObject();
> >> >> > evt.setType('b');
> >> >> > evt.setUser($evt1.getUser());
> >> >> > evt.put('friendid', $evt2.getUser());
> >> >> > entryPoints['internalstream'].insert(evt);
> >> >> > end
> >> >> >
> >> >> > Is that behavior correct for such a size of event combinations when
> >> >> using a
> >> >> > NOT in the rule?
> >> >> >
> >> >> > Thanks,
> >> >> > Svenja
> >> >> >
> >> >> _______________________________________________
> >> >> rules-users mailing list
> >> >> rules-users(a)lists.jboss.org
> >> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >> >>
> >> >
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users(a)lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
11 years, 11 months