Re: [rules-users] Apply role to whole class hierarchy

2012-07-27 Thread Joerg Henne
Thanks for your help, Edson!

We are using drools 5.4.0.Final via maven. 

Maybe I am missing something, so here's a quick overview of what we do. We
have a model class ButtonEvent which is derived like this: 
ButtonEvent -> ZonedEvent -> VSCPEvent

Then there's a rulebase with something like this:

import test.vscp.VSCPEvent;
import test.vscp.information.ButtonEvent;

declare VSCPEvent
@role( event )
@timestamp( timestamp )
@expires( 1h )
end
declare ButtonEvent
@role( event )
@timestamp( timestamp )
@expires( 1h )
end

rule "Button long pressed"
when
b : ButtonEvent( action == Action.PRESSED )
not( ButtonEvent( action == Action.RELEASED, this after[0s,1s] b ) )
then
...
end

What I would have expected is that the second 'declare' statement to be
unnecessary. However, if I take it away, this is what I get:

java.lang.ClassCastException: org.drools.common.DefaultFactHandle
at
org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedRight(AfterEvaluatorDefinition.java:316)
at
org.drools.rule.constraint.EvaluatorConstraint.isAllowedCachedRight(EvaluatorConstraint.java:80)
at
org.drools.common.SingleBetaConstraints.isAllowedCachedRight(SingleBetaConstraints.java:139)
at org.drools.reteoo.NotNode.assertObject(NotNode.java:133)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at 
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at 
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:337)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:888)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
...

Thanks
Joerg





--
View this message in context: 
http://drools.46999.n3.nabble.com/Apply-role-to-whole-class-hierarchy-tp4018930p4018942.html
Sent 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-users


Re: [rules-users] Guvnor: Accessing Bound Variable in "Then" Statement

2012-07-27 Thread Michael Anstis
Hello,

Please advise which version of Guvnor you are using.

Please also provide a few explicit examples where behavior is not as you'd
expect (screen shots of the rule and a few words would be cool).

Thanks,

Mike

On 26 July 2012 20:42, Vann_the_Red  wrote:

> Hello.  I started with a search and didn't find an answer.  I apologize if
> my
> search-fu was lacking today.
>
> I'm a non-developer tasked with rules creation and testing using guvnor.  I
> have found some scenarios where I can bind a variable to either the whole
> input model or a fact in the input model and then later access those in the
> output model by selecting "Bound Variable" from the popup box in the Then
> statement.  In other scenarios, "Bound Variable" is not an option (only
> Literal or Formula).  What must I do to be able to access the bound
> variables from the When statement(s) in the Then statement(s)?
>
> TIA,
>
> Vann
>
> This is a repost because I wasn't on the mailing list yet and I gather most
> didn't see it.  Apologies again.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Guvnor-Accessing-Bound-Variable-in-Then-Statement-tp4018932.html
> Sent 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-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] [Planner][DRL] Changable problem facts?

2012-07-27 Thread mSkiba
Hello!

I am working on task scheduling system. My system works fine, but I want to
make it faster. For my current problem we can assume that my domain consists
of:

* Worker (int id, List workingHours)
* TaskAssignment (int id, List possibleExecutionTime, Duration
leadTime, Worker worker)

I am trying to assing each Task Assignment to 1 worker. It's obvious. All I
need to do is to make my rules computing faster. For example I have a rule:

rule "ASSIGN_OUT_OF_WORKING_TIME"
when
$w : Worker($id : id != 0, $wh : workingHours)
$ta : TaskAssignment(worker != null, worker.id == $id)
not TimePeriod( isBetweenInclusive($ta.getTimeSlot()),
isBetweenInclusive($ta.getEndTimeSlot()) ) from $wh
then
insertLogical(new 
IntConstraintOccurrence("ASSIGN_OUT_OF_WORKING_TIME",
ConstraintType.NEGATIVE_HARD, 
100, $w ));
end

This rule checks if every TaskAssignment assigned to a Worker lies in the
worker's working hours. The problem is that score calculator is trying to
pair given Worker with every TaskAssignment. So I have to make set of
TaskAssignment as small as possible. I can acquire that by storing in a
Worker any kind of Set including all assigned TaskAssignments. After this my
domain should looks like this:

* Worker (int id, List workingHours, Set
cashedTaskAssignments)
* TaskAssignment (int id, List possibleExecutionTime, Duration
leadTime, Worker worker)

and my rule:

rule "ASSIGN_OUT_OF_WORKING_TIME"
when
$w : Worker($id : id != 0, $wh : workingHours, *$cta :
cachedTaskAssignments*)
$ta : TaskAssignment() *from $cta*
not TimePeriod( isBetweenInclusive($ta.getTimeSlot()),
isBetweenInclusive($ta.getEndTimeSlot()) ) from $wh
then
insertLogical(new 
IntConstraintOccurrence("ASSIGN_OUT_OF_WORKING_TIME",
ConstraintType.NEGATIVE_HARD, 
ASSIGN_OUT_OF_WORKING_TIME, $w ));
end

My cloneSolution() method is cloning everything right (deep clone of every
TaskAssignment and Worker). I've checked it via many tests. Anyways I'm
getting:
*Score corruption: the workingScore (-1800hard/0soft) is not the
uncorruptedScore (-1904hard/0soft):*
or similar error.

To sum up:
* my system works fine without any changes in Worker class
* I want to make it faster by caching assigned TaskAssignments in a Worker
objects
* I'm getting 'Score corruption' error

Is my idea possible to play out?



--
View this message in context: 
http://drools.46999.n3.nabble.com/Planner-DRL-Changable-problem-facts-tp4018944.html
Sent 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-users


Re: [rules-users] Drools Planner JIT selectors: release date

2012-07-27 Thread Geoffrey De Smet
No exact date for 5.5.0.Beta1 has been set yet: Planner follows Drools's 
release lifecycle.
That selector functionality is ready to be released though, so it will 
be part of the next release.

Op 25-07-12 22:41, Ricardo schreef:
> I learned from the following link, this sounds very good for performance,
> this is available from 5.5 only,  when can we expect the Drools Planner 5.5.
> Do you have any idea about the release date?
>
> http://planet.jboss.org/post/scaling_planner_with_jit_selectors_in_memory_consumption_and_performance
>
> thanks,
>
>
>
> -
> with kind regards,
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Drools-Planner-JIT-selectors-tp4018906.html
> Sent 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-users
>

-- 
With kind regards,
Geoffrey De Smet


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Using global variable in DRL file

2012-07-27 Thread zeeshan
Hi Laune !

I applied your suggested changes but the loop is running infinitely and same
policyAPE is used to generated cumulated value I mean for 1 agent it is
expected that all the policy APEs should sum up to generate Agent APE but
same policy APE getting summed up infinitely.plz find attached of my
consolewe printing in console in following order --->  *
System.out.println($agAPE+"ZZeeesshhaaannn"+$polAPE);*

Also find my updated RuleMain and Sample.DRL...


thanks very much again !

http://drools.46999.n3.nabble.com/file/n4018946/Sample.drl Sample.drl 
http://drools.46999.n3.nabble.com/file/n4018946/console_snapshot.png
console_snapshot.png 
http://drools.46999.n3.nabble.com/file/n4018946/RuleMain.java RuleMain.java 



--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp4018911p4018946.html
Sent 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-users


Re: [rules-users] Using global variable in DRL file

2012-07-27 Thread Wolfgang Laun
Sorry, I think I missed this, all you  need is a no-loop in the rule :)
-W



On 27/07/2012, zeeshan  wrote:
> Hi Laune !
>
> I applied your suggested changes but the loop is running infinitely and
> same
> policyAPE is used to generated cumulated value I mean for 1 agent it is
> expected that all the policy APEs should sum up to generate Agent APE but
> same policy APE getting summed up infinitely.plz find attached of my
> consolewe printing in console in following order --->  *
> System.out.println($agAPE+"ZZeeesshhaaannn"+$polAPE);*
>
> Also find my updated RuleMain and Sample.DRL...
>
>
> thanks very much again !
>
> http://drools.46999.n3.nabble.com/file/n4018946/Sample.drl Sample.drl
> http://drools.46999.n3.nabble.com/file/n4018946/console_snapshot.png
> console_snapshot.png
> http://drools.46999.n3.nabble.com/file/n4018946/RuleMain.java RuleMain.java
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp4018911p4018946.html
> Sent 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-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Apply role to whole class hierarchy

2012-07-27 Thread Edson Tirelli
   Looks like a bug. :( The code to inherit @role event is there, but
apparently there is something else going on:

https://github.com/droolsjbpm/drools/blob/master/drools-core/src/main/java/org/drools/rule/Package.java#L485

   Please open a JIRA with the information bellow.

   Edson

On Fri, Jul 27, 2012 at 3:01 AM, Joerg Henne
wrote:

> Thanks for your help, Edson!
>
> We are using drools 5.4.0.Final via maven.
>
> Maybe I am missing something, so here's a quick overview of what we do. We
> have a model class ButtonEvent which is derived like this:
> ButtonEvent -> ZonedEvent -> VSCPEvent
>
> Then there's a rulebase with something like this:
>
> import test.vscp.VSCPEvent;
> import test.vscp.information.ButtonEvent;
>
> declare VSCPEvent
> @role( event )
> @timestamp( timestamp )
> @expires( 1h )
> end
> declare ButtonEvent
> @role( event )
> @timestamp( timestamp )
> @expires( 1h )
> end
>
> rule "Button long pressed"
> when
> b : ButtonEvent( action == Action.PRESSED )
> not( ButtonEvent( action == Action.RELEASED, this after[0s,1s] b )
> )
> then
> ...
> end
>
> What I would have expected is that the second 'declare' statement to be
> unnecessary. However, if I take it away, this is what I get:
>
> java.lang.ClassCastException: org.drools.common.DefaultFactHandle
> at
>
> org.drools.base.evaluators.AfterEvaluatorDefinition$AfterEvaluator.evaluateCachedRight(AfterEvaluatorDefinition.java:316)
> at
>
> org.drools.rule.constraint.EvaluatorConstraint.isAllowedCachedRight(EvaluatorConstraint.java:80)
> at
>
> org.drools.common.SingleBetaConstraints.isAllowedCachedRight(SingleBetaConstraints.java:139)
> at org.drools.reteoo.NotNode.assertObject(NotNode.java:133)
> at
>
> org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
> at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:141)
> at
>
> org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
> at
>
> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
> at
> org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
> at
> org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
> at
> org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:337)
> at
> org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:298)
> at
>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:888)
> at
>
> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:847)
> at
>
> org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:269)
> ...
>
> Thanks
> Joerg
>
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Apply-role-to-whole-class-hierarchy-tp4018930p4018942.html
> Sent 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-users
>



-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Using global variable in DRL file

2012-07-27 Thread zeeshan
Hi Laune !


  Thanks for ur solution , I resolved the heap Size problem with
your solution but even using *no-loop* is not helping in solving infinite
loop issue . Can u suggest why it is not accessing other agent objects and
simply updating same agent object infinite times..After adding no-loop,
console shows



*6.902394919998737E7ZZeeesshhaaannn1881.4
6.902583059998737E7ZZeeesshhaaannn2802.0
6.902863259998737E7ZZeeesshhaaannn1881.4
6.90305138738E7ZZeeesshhaaannn2802.0
6.90333158738E7ZZeeesshhaaannn1881.4
6.903519739998738E7ZZeeesshhaaannn2802.0
6.903799939998738E7ZZeeesshhaaannn1881.4
6.903988079998739E7ZZeeesshhaaannn2802.0
6.904268279998739E7ZZeeesshhaaannn1881.4
6.90445641999874E7ZZeeesshhaaannn2802.0
6.90473661999874E7ZZeeesshhaaannn1881.4
6.90492475999874E7ZZeeesshhaaannn2802.0
6.90520495999874E7ZZeeesshhaaannn1881.4
6.90539308741E7ZZeeesshhaaannn2802.0
6.90567328741E7ZZeeesshhaaannn1881.4
6.905861439998741E7ZZeeesshhaaannn2802.0
6.906141639998741E7ZZeeesshhaaannn1881.4
6.906329779998742E7ZZeeesshhaaannn2802.0
6.906609979998742E7ZZeeesshhaaannn1881.4
6.906798119998743E7ZZeeesshhaaannn2802.0
6.907078319998743E7ZZeeesshhaaannn1881.4
6.907266459998743E7ZZeeesshhaaannn2802.0
6.907546659998743E7ZZeeesshhaaannn1881.4
6.90773478744E7ZZeeesshhaaannn2802.0
6.90801498744E7ZZeeesshhaaannn1881.4
6.908203139998744E7ZZeeesshhaaannn2802.0
6.908483339998744E7ZZeeesshhaaannn1881.4
6.908671479998745E7ZZeeesshhaaannn2802.0
6.908951679998745E7ZZeeesshhaaannn1881.4
6.909139819998746E7ZZeeesshhaaannn2802.0
6.909420019998746E7ZZeeesshhaaannn1881.4
*
laune wrote
> 
> Sorry, I think I missed this, all you  need is a no-loop in the rule :)
> -W
> 
> 
> 
> On 27/07/2012, zeeshan  wrote:
>> Hi Laune !
>>
>> I applied your suggested changes but the loop is running infinitely and
>> same
>> policyAPE is used to generated cumulated value I mean for 1 agent it is
>> expected that all the policy APEs should sum up to generate Agent APE but
>> same policy APE getting summed up infinitely.plz find attached of my
>> consolewe printing in console in following order --->  *
>> System.out.println($agAPE+"ZZeeesshhaaannn"+$polAPE);*
>>
>> Also find my updated RuleMain and Sample.DRL...
>>
>>
>> thanks very much again !
>>
>> http://drools.46999.n3.nabble.com/file/n4018946/Sample.drl Sample.drl
>> http://drools.46999.n3.nabble.com/file/n4018946/console_snapshot.png
>> console_snapshot.png
>> http://drools.46999.n3.nabble.com/file/n4018946/RuleMain.java
>> RuleMain.java
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp4018911p4018946.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> ___
>> rules-users mailing list
>> rules-users@.jboss
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
> ___
> rules-users mailing list
> rules-users@.jboss
> https://lists.jboss.org/mailman/listinfo/rules-users
> 




--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp4018911p4018951.html
Sent 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-users


Re: [rules-users] Rule Templates

2012-07-27 Thread FrankVhh
Hi,

It is not quite clear to me what you are actually having problems with. I
think the documentation explains it quite nicely.

See section 6.2 Templates

http://docs.jboss.org/drools/release/5.4.0.CR1/drools-expert-docs/html_single/index.html#d0e7468

If you have a more specific question. Feel free to ask.

Regard,
Frank



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p4018952.html
Sent 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-users


Re: [rules-users] Using global variable in DRL file

2012-07-27 Thread Wolfgang Laun
Ah, yes - there are multiple updates of an Agent from several
different policies.

Now, it depend: Is the computed sum of the APEs in the Agent used in
any other rule? If not, the solution is simple. Do not use
modify/update; simply accumulate the values, using the setter, and in
this case you can even omit the no-loop.

rule "accumulate policy APEs into agent APE"
when
$csvAgent : CSVBeanAgent( $agno: agentNo, $agAPE: agentAPE )
$csvPolicy : CSVBeanPolicy( agentNo == $agno, $polAPE: policyAPE )
then
$csvAgent.setAgentAPE(  $agAPE + $polAPE );
end

If you do need the updated CSVBeanAgent.agentAPE, it's a little more
complicated and I should test the solution before I post it. - Or if
you want to try untested: you'll need an accumulate, like this:

rule "accumulate policy APEs into agent APE"
no-loop true
when
$csvAgent : CSVBeanAgent( $agno: agentNo, $agAPE: agentAPE )
accumulate( CSVBeanPolicy( agentNo == $agno, $polAPE: policyAPE );
 $sum: sum(  $polAPE ) )
then
 modify( $csvAgent ){ setAgentAPE( $sum ) }
end

Note that this assumes that the old value in agentAPE is 0 or can be
overwritten; otherwise you might need to add the old value to the
$sum.

-W







On 27/07/2012, zeeshan  wrote:
> Hi Laune !
>
>
>   Thanks for ur solution , I resolved the heap Size problem
> with
> your solution but even using *no-loop* is not helping in solving infinite
> loop issue . Can u suggest why it is not accessing other agent objects and
> simply updating same agent object infinite times..After adding no-loop,
> console shows
>
>
>
> *6.902394919998737E7ZZeeesshhaaannn1881.4
> 6.902583059998737E7ZZeeesshhaaannn2802.0
> 6.902863259998737E7ZZeeesshhaaannn1881.4
> 6.90305138738E7ZZeeesshhaaannn2802.0
> 6.90333158738E7ZZeeesshhaaannn1881.4
> 6.903519739998738E7ZZeeesshhaaannn2802.0
> 6.903799939998738E7ZZeeesshhaaannn1881.4
> 6.903988079998739E7ZZeeesshhaaannn2802.0
> 6.904268279998739E7ZZeeesshhaaannn1881.4
> 6.90445641999874E7ZZeeesshhaaannn2802.0
> 6.90473661999874E7ZZeeesshhaaannn1881.4
> 6.90492475999874E7ZZeeesshhaaannn2802.0
> 6.90520495999874E7ZZeeesshhaaannn1881.4
> 6.90539308741E7ZZeeesshhaaannn2802.0
> 6.90567328741E7ZZeeesshhaaannn1881.4
> 6.905861439998741E7ZZeeesshhaaannn2802.0
> 6.906141639998741E7ZZeeesshhaaannn1881.4
> 6.906329779998742E7ZZeeesshhaaannn2802.0
> 6.906609979998742E7ZZeeesshhaaannn1881.4
> 6.906798119998743E7ZZeeesshhaaannn2802.0
> 6.907078319998743E7ZZeeesshhaaannn1881.4
> 6.907266459998743E7ZZeeesshhaaannn2802.0
> 6.907546659998743E7ZZeeesshhaaannn1881.4
> 6.90773478744E7ZZeeesshhaaannn2802.0
> 6.90801498744E7ZZeeesshhaaannn1881.4
> 6.908203139998744E7ZZeeesshhaaannn2802.0
> 6.908483339998744E7ZZeeesshhaaannn1881.4
> 6.908671479998745E7ZZeeesshhaaannn2802.0
> 6.908951679998745E7ZZeeesshhaaannn1881.4
> 6.909139819998746E7ZZeeesshhaaannn2802.0
> 6.909420019998746E7ZZeeesshhaaannn1881.4
> *
> laune wrote
>>
>> Sorry, I think I missed this, all you  need is a no-loop in the rule :)
>> -W
>>
>>
>>
>> On 27/07/2012, zeeshan  wrote:
>>> Hi Laune !
>>>
>>> I applied your suggested changes but the loop is running infinitely and
>>> same
>>> policyAPE is used to generated cumulated value I mean for 1 agent it is
>>> expected that all the policy APEs should sum up to generate Agent APE
>>> but
>>> same policy APE getting summed up infinitely.plz find attached of my
>>> consolewe printing in console in following order --->  *
>>> System.out.println($agAPE+"ZZeeesshhaaannn"+$polAPE);*
>>>
>>> Also find my updated RuleMain and Sample.DRL...
>>>
>>>
>>> thanks very much again !
>>>
>>> http://drools.46999.n3.nabble.com/file/n4018946/Sample.drl Sample.drl
>>> http://drools.46999.n3.nabble.com/file/n4018946/console_snapshot.png
>>> console_snapshot.png
>>> http://drools.46999.n3.nabble.com/file/n4018946/RuleMain.java
>>> RuleMain.java
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp4018911p4018946.html
>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>>> ___
>>> rules-users mailing list
>>> rules-users@.jboss
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>> ___
>> rules-users mailing list
>> rules-users@.jboss
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Using-global-variable-in-DRL-file-tp4018911p4018951.html
> Sent 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-users
>
__

Re: [rules-users] Rule Templates

2012-07-27 Thread FrankVhh
>The information that would help me is (using Eclipse or JBDS) can one edit, 
It depends if you mean edit the templates or edit the data that you use to
populate it.

You can create a rule template in any text editor you like and, AFAIK, it
can have any extension you prefer. Convert it to an inputstream and use it
in the code as is documented.

Regarding the data source, you have multiple options to collect the data.
Editing this data depends a bit on the type you are using. I typically
convert xml objects to java objects and use (and, sometimes, abuse) them to
fill the template and "generate" rules. 

>compile to drl 
Compile to drl is done using the code as documented.

String drl = converter.compile( objs, templateStream );

You can do with the String whatever you like. use it to feed a
knowledgebuilder directly, or write it to a file.

>and test the rule templates
Again. This depends on what you mean. If test the rule templates means:
"check whether it generates a correct drl", than there are 2 things you can
do.
1) Manually check that the rules are as you expect them to be.
2) Verify that the drl compiles in a knowledgebuilder.

If "test" means, check whether my generated rules can construct a correct
decision, then you wikk have to set up a service/a method/ a unit test in
which you use the rules to create a knowledge base and which takes input
data to generate a certain output.

If you want, you can use guvnor to create test scenarios or implement a
testing tool by your own.

Regards,
Frank


mclovis wrote
> 
> Frank,
>  Thank you for your quick reply. I had previously read your suggested
> documentation and understand the basics of rule templates. The information
> that would help me is (using Eclipse or JBDS) can one edit, compile to drl
> and test the rule templates. The information in the article does not
> reflect these things and furthermore has a lists of file types for Drools
> that is not in current versions of IDEs (example: rules resource). If you
> have knowledge of the mechanics of these things (using even Ant or Maven
> to compile), it would be much appreciated. 
> 
> Thanks in advance,
> 
> Mike
> 




--
View this message in context: 
http://drools.46999.n3.nabble.com/Rule-Templates-tp2820139p4018956.html
Sent 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-users