Send rules-users mailing list submissions to
rules-users@lists.jboss.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.jboss.org/mailman/listinfo/rules-usersor, via email, send a message with subject or body 'help' to
rules-users-request@lists.jboss.org
You can reach the person managing the list at
rules-users-owner@lists.jboss.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."
Today's Topics:
1. How to use multiple objects of the same class in RHS
(Dennis Lupiana)
2. Re: How to use multiple objects of the same class in RHS
(Wolfgang Laun)
3. Re: mvel strict-mode not applied in drools 5.3.1.Final
(Mark Proctor)
4. Re: mvel strict-mode not applied in drools 5.3.1.Final
(Wolfgang Laun)
5. Re: mvel strict-mode not applied in drools 5.3.1.Final
(Mark Proctor)
6. Re: KnowledgeAgent Changeset problems (albertorugnone)
----------------------------------------------------------------------
Message: 1
Date: Wed, 04 Apr 2012 12:42:00 +0100
From: "Dennis Lupiana" <Dennis.Lupiana@dit.ie>
Subject: [rules-users] How to use multiple objects of the same class
in RHS
To: rules-users@lists.jboss.org
Message-ID: <7480f0694e64.4f7c4198@dit.ie>
Content-Type: text/plain; charset="us-ascii"
An HTML attachment was scrubbed...
URL:
http://lists.jboss.org/pipermail/rules-users/attachments/20120404/961f91c9/attachment-0001.html ------------------------------
Message: 2
Date: Wed, 4 Apr 2012 14:40:57 +0200
From: Wolfgang Laun <wolfgang.laun@gmail.com>
Subject: Re: [rules-users] How to use multiple objects of the same
class in RHS
To: Rules Users List <rules-users@lists.jboss.org>
Message-ID:
<CANaj1Ld8sid373xXD9Beh7YMqfA86JuiSrwLkDuXYrYq2_=ioQ@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
On 04/04/2012, Dennis Lupiana <Dennis.Lupiana@dit.ie> wrote:
> Please help.
> -----------
>
> I have inserted four objects of the same type in the working memory using
> array.
There's no point in inserting an array Person[]. Insert Person objects.
> I want to write a rule which will be activated when certain values in
> the objects are met. Let say my object is Person and it has a username field
> with values John, Peter, Jane and Judy for each object. I want to write a
> rule that will be activated when username is Peter and Jane.
One name can only have one value. Do you mean "when there is one
Person with username "Peter" and another Person "Jane"?
when
Person( username == "Peter" )
Person( username == "Jane" )
then
...
>
> Thanks
> --------
------------------------------
Message: 3
Date: Wed, 04 Apr 2012 13:54:19 +0100
From: Mark Proctor <mproctor@codehaus.org>
Subject: Re: [rules-users] mvel strict-mode not applied in drools
5.3.1.Final
To: rules-users@lists.jboss.org
Message-ID: <4F7C447B.7010504@codehaus.org>
Content-Type: text/plain; charset="iso-8859-1"
On 04/04/2012 12:32, muenchen@korgen.de wrote:
>
> Hi Mark,
> Thanks for your reply, but the row in the drl the error occurs on is
> in an eval.what do you mean by explicit?
> anyway this does not explain why it runs on jdk1.6 but not on 1.7.
>
You had two questions. The question you ahve about JDK1.7 are already
answered in the JIRA. I'm talking about strict mode. If you use the
eval(....) CE like that, it shoud obey the static mvel strict setting.
If it does not, it's a bug, please file a jira with a self contained
unit test See "getting involved" for how to submit unit tests:
https://hudson.jboss.org/hudson/job/droolsjbpm-knowledge/lastSuccessfulBuild/artifact/droolsjbpm-introduction-docs/target/docbook/publish/en-US/html_single/index.html#gettingstartedMark
>
> Best
>
> J?rg
>
> sent from a mobile device
>
> On Apr 4, 2012 12:55 PM, "Mark Proctor" <mproctor@codehaus.org
> <mailto:mproctor@codehaus.org <mproctor@codehaus.org>>> wrote:
>
> On 04/04/2012 11:04, korgen wrote:
> > Hi folks,
> > In the process of upgrading from Java 1.6 to Java 1.7 (1.7.0_03
> to be
> > precise) we updated Drools from 5.1.1 to 5.3.1 (as in 5.1.1
> language level
> > 1.7 is not supported).
> >
> > However with Drools 5.3.1 the system property
> "drools.dialect.mvel.strict"
> > seems not to be applied all the time. I know this sounds fishy,
> but this is
> > the behaviour:
> MVEL strictness is only applied to explicite eval, consequence, return
> values and accumulates.
>
> It's not applied to field constaints. We foudn some points, around
> collections, where type safeness for constraints is not enforced and
> have strengthened that. You can still get type unsafe execution, by
> using the typesfalse(false), for the specific pattern. We don't
> like to
> encourage lack of type safety, as it creates difficult to maintain
> systems and will not benefit from performance enhancements we do on
> bytecode generation.
>
> Mark
> >
> > In a (junit based) test we create the knowledgebase by loading
> multiple drl
> > files. Each of them has the dialect 'mvel' set in its beginning.
> > In our @BeforeClass of the test we do a:
> > System.setProperty("drools.dialect.mvel.strict", "false");
> >
> > and I also tried using a KnowledgeBuilderConfiguration with the
> appropriate
> > settings.
> > But still sometimes the test fails with a "unable to resolve
> method using
> > strict-mode..." message. I say sometime because running the test
> multiple
> > times via maven "mvn -Dtest=ClassicDroolsTest test" sometimes
> produces
> > failure, sometimes produces success.
> > It might by noteworthy that the method called in the test
> expects two
> > parameters of type Double, but as it seems Drools is not seeing the
> > covariant return type of the class which is actually used (the
> abstract base
> > method has return type Object, the concrete method has return
> type Double).
> >
> > I tried to reproduce the issue with a simpler test setup to be
> able to post
> > it here but did not succeed.
> >
> > I also applied the patch
> >
>
https://github.com/droolsjbpm/drools/commit/1c20018abeef8bee86f896ffff7945404cebb18f> > (comming from
https://issues.jboss.org/browse/JBRULES-3163) to
> the Drools
> > 5.1.1 sources, compiled them myself and everything works like a
> charm with
> > it. However I cannot use this unofficial work around as I can't
> (and don't
> > want) use a patched version of Drools in my environment.
> > Also when I compile& run my sources with jdk 1.6.0_31
> everything is fine.
> >
> > I'd really appreciate any help on this topic as I couldn't find
> any hints on
> > this behaviour in the release notes from Drools versions> 5.1.1
> >
> > Thanks
> >
> > Joerg
> >
> > --
> > View this message in context:
>
http://drools.46999.n3.nabble.com/mvel-strict-mode-not-applied-in-drools-5-3-1-Final-tp3883669p3883669.html> > Sent from the Drools: User forum mailing list archive at Nabble.com.
> > _______________________________________________
> > rules-users mailing list
> > rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org <rules-users@lists.jboss.org>>
> >
https://lists.jboss.org/mailman/listinfo/rules-users>
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org <mailto:rules-users@lists.jboss.org <rules-users@lists.jboss.org>>
>
https://lists.jboss.org/mailman/listinfo/rules-users>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.jboss.org/pipermail/rules-users/attachments/20120404/aac7ced2/attachment-0001.html ------------------------------
Message: 4
Date: Wed, 4 Apr 2012 15:23:12 +0200
From: Wolfgang Laun <wolfgang.laun@gmail.com>
Subject: Re: [rules-users] mvel strict-mode not applied in drools
5.3.1.Final
To: Rules Users List <rules-users@lists.jboss.org>
Message-ID:
<CANaj1LfVJpE+s3VZgfX-yh9KupZ8t61NzPG_mCpc_UKKAiLPxA@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
@J?rg:
>> On 04/04/2012 11:04, korgen wrote:
>> we updated Drools from 5.1.1 to 5.3.1 (as in 5.1.1
>> language level
>> > 1.7 is not supported).
Why would Drools 5.1.1. not be usable with Java 1.7? Byte code is
supposed to be upward compatible.
-W
------------------------------
Message: 5
Date: Wed, 04 Apr 2012 14:25:30 +0100
From: Mark Proctor <mproctor@codehaus.org>
Subject: Re: [rules-users] mvel strict-mode not applied in drools
5.3.1.Final
To: rules-users@lists.jboss.org
Message-ID: <4F7C4BCA.60809@codehaus.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 04/04/2012 14:23, Wolfgang Laun wrote:
> @J?rg:
>
>>> On 04/04/2012 11:04, korgen wrote:
>>> we updated Drools from 5.1.1 to 5.3.1 (as in 5.1.1
>>> language level
>>> > 1.7 is not supported).
> Why would Drools 5.1.1. not be usable with Java 1.7? Byte code is
> supposed to be upward compatible.
Read the jira at the start of the thread:
https://issues.jboss.org/browse/JBRULES-3163It provides a pull request that shows the problem. The JCI code is old
and didn't have version detections for 1.7:
https://github.com/droolsjbpm/drools/pull/42Mark
>
> -W
>
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users------------------------------
Message: 6
Date: Wed, 4 Apr 2012 07:12:47 -0700 (PDT)
From: albertorugnone <arugnonechemical@gmail.com>
Subject: Re: [rules-users] KnowledgeAgent Changeset problems
To: rules-users@lists.jboss.org
Message-ID: <1333548767225-3884201.post@n3.nabble.com>
Content-Type: text/plain; charset=us-ascii
Thank you every body for your answer, unfortunately I was't able to reply to
you until now because other stuff overwhelmed me literally at work.
Anyway I was going ahead using KnowledgeAgent, following your comments and
other suggestion. Now I am able to load rules applying change set with
KnowledgeAgent (thank you!!!), but honestly this is a poor success because,
even if when I change the rule KnowledgeAgent says "incremental build of
KnowledgeBase finished and in use" nothing changes.
It seems that changes at rules have no effect and it is pretty weird. I made
a maven project with eclipse to explain you better my problem. Is a simple
main. I am working for a better junit test. Anyway if you change the rule in
the folder knowledge you can test the problem by yourself.
Briefly I will explain the project:
Here the code:
_l.warn("START");
String xml = "";
xml += "<change-set xmlns='
http://drools.org/drools-5.0/change-set'"; xml += "
xmlns:xs='
http://www.w3.org/2001/XMLSchema-instance'"; xml += "
xs:schemaLocation='
http://drools.org/drools-5.0/change-setdrools-change-set-5.0.xsd' >";
xml += " <add> ";
xml += " <resource source='Z:/EXP/drools-test/knowledge/test.drl'
type='DRL' />";
xml += " </add> ";
xml += "</change-set>";
FileManager fileManager = new FileManager();
File fxml = fileManager.newFile("changeset.xml");
Writer output = new BufferedWriter(new FileWriter(fxml));
output.write(xml);
output.close();
// build a KnowledgeAgent
ResourceFactory.getResourceChangeNotifierService()
.start();
ResourceFactory.getResourceChangeScannerService()
.start();
final ResourceChangeScannerConfiguration sconf =
ResourceFactory.getResourceChangeScannerService()
.newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval", "2");
ResourceFactory.getResourceChangeScannerService()
.configure(sconf);
final KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
aconf.setProperty("drools.agent.scanDirectories", "true");
aconf.setProperty("drools.agent.scanResources", "true");
/*
* important newInstance has to be false in order to update the
* knowledge base and not rebuild a new one
*/
aconf.setProperty("drools.agent.newInstance", "false");
final KnowledgeAgent agent =
KnowledgeAgentFactory.newKnowledgeAgent("pch.sel.knowledge.agent", aconf);
// if (_l.isDebugEnabled()) {
/* we need some log every time */
agent.setSystemEventListener(new PrintStreamSystemEventListener());
agent.applyChangeSet(ResourceFactory.newClassPathResource("pch.sel.kwset.xml"));
// fire rules
StatefulKnowledgeSession session =
agent.getKnowledgeBase().newStatefulKnowledgeSession();
session.fireAllRules();
_l.warn("END");
and here the rule
package it.ipiu.drools.KnowledgeAgent.test
rule "test rule" timer(int: 0s 2s)
when
eval(true);
then
System.out.println("ciao");
end
If I try to change timer from 2s to 2m nothing changes even if
KnowledgeAgent seems to reload all.
*Please help!!! I googled the problem everywhere without solution!!!*
--
View this message in context:
http://drools.46999.n3.nabble.com/KnowledgeAgent-Changeset-problems-tp3787165p3884201.htmlSent from the Drools: User forum mailing list archive at Nabble.com.
------------------------------
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-usersEnd of rules-users Digest, Vol 65, Issue 13
*******************************************