Re: [rules-users] Is it possible to retrieve the collection of Conditions from DecisionTable?

2011-10-03 Thread Toni Rikkola
If you take a look at the Verifier it goes through the Drools AST with a 
visitor pattern.
It starts by using getting the PackageDescr using DrlParser, this uses Drools 
internals so be warned that it might change in the future.

  Reader drlReader = new InputStreamReader( stream );
  PackageDescr descr = new DrlParser().parse( drlReader );

After that it goes through the PackageDescr using PackageDescrVisitor. 
RuleDescrVisitor shows how to get the condition part from each rule.

https://github.com/droolsjbpm/drools/blob/master/drools-verifier/src/main/java/org/drools/verifier/visitor/PackageDescrVisitor.java
https://github.com/droolsjbpm/drools/blob/master/drools-verifier/src/main/java/org/drools/verifier/visitor/RuleDescrVisitor.java

Toni


On Oct 3, 2011, at 8:11 PM, Mark Proctor wrote:

> On 03/10/2011 18:03, Wolfgang Laun wrote:
>> A condition does not have a "name", as you write; values of the cells
>> below a condition are (usually) literals.
>> 
>> There is no API for extracting parts of a spreadsheet. You can look at
>> the Drools source code (in the packages org.drools.decisiontable and
>> .../parser) and write whatever you need - it is not too difficult.
> You can also look at drools-verifier, as that shows ho to analyse 
> resulting rule fragments.
> 
> Mark
>> 
>> -W
>> 
>> 
>> On 3 October 2011 17:05, RaviCKota  wrote:
>>> Hi All, for suppose I have a DecisionTable like below
>>> 
>>> CONDITION   ACTION
>>> -
>>> COND1 ACTION1
>>> COND2 ACTION2
>>> COND3 ACTION3
>>> -
>>> 
>>> This is just a representation of the DecisionTable. So I need to retrieve
>>> all the conditions and store them into a Collection like Set. Does Drools
>>> provide any such feature.
>>> 
>>> We load the drools as below
>>> PackageBuilder builder = new PackageBuilder();
>>> builder.addPackageFromDrl(new StringReader(drl)); //drl is the filepath of
>>> decisiontable excel
>>> 
>>> // add the package to a rulebase (deploy the rule package).
>>> RuleBase ruleBase = RuleBaseFactory.newRuleBase();
>>> ruleBase.addPackage(builder.getPackage());
>>> 
>>> I tried to look into api of RuleBase, tried to get the packages, Rules,
>>> Consequence, etc etc, but could not find any method, that gets me the
>>> condition name.
>>> 
>>> When I tried to do
>>> Package[] packages = rulebase.getPackages();
>>> 
>>> for(Package pack : packages){
>>> System.out.println("Package Name is : "+pack.getName());
>>> Rule[] rules = pack.getRules();
>>> for(Rule rule : rules){
>>> System.out.println("Rule name is : "+rule.getName());
>>> 
>>> All I get is some representation of each row, but I'm specifically looking
>>> for the value of the first column (CONDITION) for each rule.
>>> 
>>> Please offer some guidance here.
>>> 
>>> --
>>> View this message in context: 
>>> http://drools.46999.n3.nabble.com/Is-it-possible-to-retrieve-the-collection-of-Conditions-from-DecisionTable-tp3390026p3390026.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 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] Using object.getter in Decision table

2011-10-03 Thread jilani
Hi,

I have a scenario, where for decision table I will inject one object which
holds all facts. Using those facts the decision table has rules. How to
retrieve the child fact from parent in decision table.

sample for this is as follows

Java Code snippet:
DataObject dataObj = new DataObject();
Fact1 fact1 = new Fact1();
Fact2 fact2 = new Fact2();
dataObj.setFact1(fact1);
dataObj.setFact2(fact2);
statelessKnowledgeSession.execute(dataObj);


In decision table:

---
CONDITION   

fact1 : DataObject().getFact1(); 

fact1.getData1().equalsIgnoreCase("$param")

"Hello"


Here I am getting error.

Please suggest me how to access the child fact from parent fact in decision
table.













--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-object-getter-in-Decision-table-tp3392337p3392337.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] Embed BRL Editor in application

2011-10-03 Thread shubhranshu
Hello everybody,

I am new to drools. I want to embed the BRL Editor in our application. I
have read somewhere that it can be done by calling the
standaloneEditorServlet. When I call the standaloneEditorServlet it appends
pUUID=7c89819b-221d-470b-9fce-4bd3bbe02e75. I have to pass some
initialization parameters to the servlet. I know the package name,
categoryName but what will be the brlSource. Do I need to pass the whole brl
(xml) file as parameter?

Another thing on which action the standaloneEditorServlet is called.

Please help

Regards


--
View this message in context: 
http://drools.46999.n3.nabble.com/Embed-BRL-Editor-in-application-tp3392242p3392242.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] Embeding BRL Editor in application

2011-10-03 Thread shubhranshu
Hello everybody,

I am new to drools. I want to embed the BRL Editor in our application. I
have read somewhere that it can be done by calling the
standaloneEditorServlet. When I call the standaloneEditorServlet it appends
pUUID=7c89819b-221d-470b-9fce-4bd3bbe02e75. I have to pass some
initialization parameters to the servlet. I know the package name,
categoryName but what will be the brlSource. Do I need to pass the whole brl
(xml) file as parameter?

Another thing on which action the standaloneEditorServlet is called.

Please help

Regards




--
View this message in context: 
http://drools.46999.n3.nabble.com/Embeding-BRL-Editor-in-application-tp3392239p3392239.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] pipeline API

2011-10-03 Thread jliu

On 2011/10/4 9:08, Bobby Richards wrote:
looking for any documentation regarding the pipeline api.  Trying to 
get an amqp queue set as an entry point


Have you looked into Drools Camel integration [1]? Camel should already 
have AMQP component.


[1]. 
http://docs.jboss.org/drools/release/5.3.0.CR1/droolsjbpm-integration-docs/html/ch01.html


Cheers,
Jervis

Thanks
Bobby


___
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] Guvnor - Operations with snapshots

2011-10-03 Thread jliu

On 2011/10/4 1:54, Demian Calcaprina wrote:
Hi everyone. I am using Guvnor 5.2, and I need to make some operations 
from my application.


Specifically, I need to make two operations remotely:
- List Snapshots, as it is possible to list packages.
- Create a new snapshot from a package.

Is this possible to make these operation through rest API?


Hi,

Start from 5.3, Guvnor Packages are fully versioned. I would recommend 
you to use a vesioned package instead of package snapshot. Package 
snapshot will be deprecated in the future.


Cheers,
Jervis

Thanks,

Demian




___
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] 5.3.0 CR1 has broken existing rules/flows

2011-10-03 Thread lhorton
This is very good info.  I have found those Drools ConsequenceExceptions a
real PITA to troubleshoot.  I wonder if the exception could be enhanced to
show this info so users don't have to debug it?  I mean, to have the
exception message show the true culprit rule name, or something useful like
that?

--
View this message in context: 
http://drools.46999.n3.nabble.com/5-3-0-CR1-has-broken-existing-rules-flows-tp3390922p3392014.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] pipeline API

2011-10-03 Thread Bobby Richards
looking for any documentation regarding the pipeline api.  Trying to get an
amqp queue set as an entry point

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


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-03 Thread Edson Tirelli
   I don't know all the details about this problem, but as far as I heard,
the leak was happening because jBPM was adding its listener to the kbase
and/or ksession and not removing it on disposals... so the easiest way to
get around the leak is to simply remove it yourself before disposing the
session.

   Whoever fixed the problem can probably give you details about how to do
that.

   Having said that, if you are using community version, I strongly
recommend you to move to 5.3 when it is released as it brings tons of fixes
and some good features. Older community versions are not maintained. If you
are a Red Hat subscriber, just open a ticket for the version you want to use
and they will provide you with patched binaries.

   Edson

2011/10/3 alopez 

> This memory leak is giving us a lot of problems... we need to iteratively
> test 400,000 items, one session for each. It was working fine with 5.1.1
> and
> now is failing.
>
> Thanks for the test case, is very simple to reproduce, but I tried running
> it with:
>
> 
>org.drools
>knowledge-api
>5.3.0.CR1
> 
> ... etc.
>
> And still fails, so I don't fully trust that this will be fixed on 5.3.0...
> do you have confirmation?
>
> I need to decide if I wait for 5.3 or if I advice to roll back to 5.1.1.
>
> Thanks
>
> Alejandro
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3391578.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] Memory leak in 5.2/5.3

2011-10-03 Thread alopez
This memory leak is giving us a lot of problems... we need to iteratively
test 400,000 items, one session for each. It was working fine with 5.1.1 and
now is failing. 

Thanks for the test case, is very simple to reproduce, but I tried running
it with:


org.drools
knowledge-api
5.3.0.CR1

... etc.

And still fails, so I don't fully trust that this will be fixed on 5.3.0...
do you have confirmation?

I need to decide if I wait for 5.3 or if I advice to roll back to 5.1.1.

Thanks

Alejandro

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3391578.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] 5.3.0 CR1 has broken existing rules/flows

2011-10-03 Thread Edson Tirelli
  One way of helping isolating the problem is to set a break point for a
NullPointerException. When the exception is raised do 2 things:

1. In the RuleTerminalNode where the NPE is generated, check the content of
the "rule" attribute. This will tell you the offending rule.

2. Check which reference is null in the offending line:

item.setSalience( rule.getSalience().getValue( tuple,
   this.rule,
   workingMemory
) );
 Probably "item" is null.

 After that, it should be easy to isolate and simplify the 2 rules that
are raising the problem. The one with the modify in the consequence (R1) and
the other one where the NPE is occurring (R2).

 Finally, if you use the audit log, you can see the scenario where it
happens. It is probably activating R2 and before firing it, triggering a
modify that maintains it active, or some variation in the scenario.

 Once you have this data, it will be possible for us to analyze the case
and fix the problem.

 Edson


2011/10/3 Jamie 

> I recently upgraded from 5.2.0 Final to 5.3.0 CR1 because I was
> experiencing
> memory leaks in 5.2.0 Final due to a known bug that was fixed in 5.3.0 CR1.
> I have a suite of FitNesse tests that exercise the majority of my rules and
> flows, and I can demonstrate that the memory leak is indeed fixed, but one
> of my tests is now failing.  If I revert back to 5.2.0 Final, all is well.
>
> I've been trying to determine the root cause for the past 3 days, but I'm
> not getting anywhere.  I suspect that it's related to an interaction
> between
> 2 rules, e.g. one rule modifies something that causes the second rule to
> fire, but the second rule chokes in the consequence when it tries to
> execute
> a modify() statement.  If I comment out the modify portion, the rule fires
> fine.
>
> I wish I could provide an example, but my implementation is too complex for
> that and I haven't been able to reproduce it in a stand-alone example.
>
> I know a stack trace probably won't tell you much, but I've included it
> below just in case.  If anyone has any ideas, I'd love to hear them.  If
> there's any additional information you think might help diagnose the
> problem, I'd be happy to provide it.
>
> Thanks,
> Jamie
>
> org.drools.runtime.rule.ConsequenceException: rule: Rule 022 - Load Buyer
> Activity
>
>at
>
> org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
>at
> org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
>at
> org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
>at
> org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
>at
>
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:708)
>at
>
> org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:672)
>at
>
> org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
>at
>
> com.llbean.fraud.rule.engine.DroolsRulesEngine.invokeRules(DroolsRulesEngine.java:119)
>at
>
> com.llbean.fraud.rule.engine.DroolsRulesEngine.invokeRules(DroolsRulesEngine.java:81)
>at
>
> com.llbean.fraud.fitnesse.fixtures.tests.TestFraudRules.execute(TestFraudRules.java:116)
>at fit.ColumnFixture.executeIfNeeded(ColumnFixture.java:57)
>at fit.ColumnFixture.check(ColumnFixture.java:46)
>at fit.Binding$QueryBinding.doCell(Binding.java:188)
>at fit.ColumnFixture.doCell(ColumnFixture.java:37)
>at fit.Fixture.doCells(Fixture.java:171)
>at fit.Fixture.doRow(Fixture.java:165)
>at fit.ColumnFixture.doRow(ColumnFixture.java:25)
>at fit.Fixture.doRows(Fixture.java:159)
>at fit.ColumnFixture.doRows(ColumnFixture.java:18)
>at fit.Fixture.doTable(Fixture.java:153)
>at fit.Fixture.interpretFollowingTables(Fixture.java:119)
>at fit.Fixture.interpretTables(Fixture.java:105)
>at fit.Fixture.doTables(Fixture.java:79)
>at
>
> com.llbean.test.fitnesse.servletrunner.server.LLBFitServer.process(LLBFitServer.java:120)
>at
>
> com.llbean.test.fitnesse.servletrunner.server.LLBFitServer.runTests(LLBFitServer.java:40)
>at
>
> com.llbean.test.fitnesse.servletrunner.servlet.FitServlet.service(FitServlet.java:32)
>at
>
> com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1530)
>at
>
> com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:829)
>at
>
> com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:458)
>at
>
> com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
>at
>
> com.ibm.ws.webcontainer.servlet.CacheServ

[rules-users] 5.3.0 CR1 has broken existing rules/flows

2011-10-03 Thread Jamie
I recently upgraded from 5.2.0 Final to 5.3.0 CR1 because I was experiencing
memory leaks in 5.2.0 Final due to a known bug that was fixed in 5.3.0 CR1. 
I have a suite of FitNesse tests that exercise the majority of my rules and
flows, and I can demonstrate that the memory leak is indeed fixed, but one
of my tests is now failing.  If I revert back to 5.2.0 Final, all is well. 

I've been trying to determine the root cause for the past 3 days, but I'm
not getting anywhere.  I suspect that it's related to an interaction between
2 rules, e.g. one rule modifies something that causes the second rule to
fire, but the second rule chokes in the consequence when it tries to execute
a modify() statement.  If I comment out the modify portion, the rule fires
fine.

I wish I could provide an example, but my implementation is too complex for
that and I haven't been able to reproduce it in a stand-alone example.

I know a stack trace probably won't tell you much, but I've included it
below just in case.  If anyone has any ideas, I'd love to hear them.  If
there's any additional information you think might help diagnose the
problem, I'd be happy to provide it.

Thanks,
Jamie

org.drools.runtime.rule.ConsequenceException: rule: Rule 022 - Load Buyer
Activity

at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at 
org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1251)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:708)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:672)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at
com.llbean.fraud.rule.engine.DroolsRulesEngine.invokeRules(DroolsRulesEngine.java:119)
at
com.llbean.fraud.rule.engine.DroolsRulesEngine.invokeRules(DroolsRulesEngine.java:81)
at
com.llbean.fraud.fitnesse.fixtures.tests.TestFraudRules.execute(TestFraudRules.java:116)
at fit.ColumnFixture.executeIfNeeded(ColumnFixture.java:57)
at fit.ColumnFixture.check(ColumnFixture.java:46)
at fit.Binding$QueryBinding.doCell(Binding.java:188)
at fit.ColumnFixture.doCell(ColumnFixture.java:37)
at fit.Fixture.doCells(Fixture.java:171)
at fit.Fixture.doRow(Fixture.java:165)
at fit.ColumnFixture.doRow(ColumnFixture.java:25)
at fit.Fixture.doRows(Fixture.java:159)
at fit.ColumnFixture.doRows(ColumnFixture.java:18)
at fit.Fixture.doTable(Fixture.java:153)
at fit.Fixture.interpretFollowingTables(Fixture.java:119)
at fit.Fixture.interpretTables(Fixture.java:105)
at fit.Fixture.doTables(Fixture.java:79)
at
com.llbean.test.fitnesse.servletrunner.server.LLBFitServer.process(LLBFitServer.java:120)
at
com.llbean.test.fitnesse.servletrunner.server.LLBFitServer.runTests(LLBFitServer.java:40)
at
com.llbean.test.fitnesse.servletrunner.servlet.FitServlet.service(FitServlet.java:32)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1530)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:829)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:458)
at
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:862)
at
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:178)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.

[rules-users] Guvnor - Operations with snapshots

2011-10-03 Thread Demian Calcaprina
Hi everyone. I am using Guvnor 5.2, and I need to make some operations from
my application.

Specifically, I need to make two operations remotely:
- List Snapshots, as it is possible to list packages.
- Create a new snapshot from a package.

Is this possible to make these operation through rest API?

Thanks,

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


Re: [rules-users] Is it possible to retrieve the collection of Conditions from DecisionTable?

2011-10-03 Thread Mark Proctor
On 03/10/2011 18:03, Wolfgang Laun wrote:
> A condition does not have a "name", as you write; values of the cells
> below a condition are (usually) literals.
>
> There is no API for extracting parts of a spreadsheet. You can look at
> the Drools source code (in the packages org.drools.decisiontable and
> .../parser) and write whatever you need - it is not too difficult.
You can also look at drools-verifier, as that shows ho to analyse 
resulting rule fragments.

Mark
>
> -W
>
>
> On 3 October 2011 17:05, RaviCKota  wrote:
>> Hi All, for suppose I have a DecisionTable like below
>>
>> CONDITION   ACTION
>> -
>> COND1 ACTION1
>> COND2 ACTION2
>> COND3 ACTION3
>> -
>>
>> This is just a representation of the DecisionTable. So I need to retrieve
>> all the conditions and store them into a Collection like Set. Does Drools
>> provide any such feature.
>>
>> We load the drools as below
>> PackageBuilder builder = new PackageBuilder();
>> builder.addPackageFromDrl(new StringReader(drl)); //drl is the filepath of
>> decisiontable excel
>>
>> // add the package to a rulebase (deploy the rule package).
>> RuleBase ruleBase = RuleBaseFactory.newRuleBase();
>> ruleBase.addPackage(builder.getPackage());
>>
>> I tried to look into api of RuleBase, tried to get the packages, Rules,
>> Consequence, etc etc, but could not find any method, that gets me the
>> condition name.
>>
>> When I tried to do
>> Package[] packages = rulebase.getPackages();
>>
>> for(Package pack : packages){
>> System.out.println("Package Name is : "+pack.getName());
>> Rule[] rules = pack.getRules();
>> for(Rule rule : rules){
>> System.out.println("Rule name is : "+rule.getName());
>>
>> All I get is some representation of each row, but I'm specifically looking
>> for the value of the first column (CONDITION) for each rule.
>>
>> Please offer some guidance here.
>>
>> --
>> View this message in context: 
>> http://drools.46999.n3.nabble.com/Is-it-possible-to-retrieve-the-collection-of-Conditions-from-DecisionTable-tp3390026p3390026.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 mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Is it possible to retrieve the collection of Conditions from DecisionTable?

2011-10-03 Thread Wolfgang Laun
A condition does not have a "name", as you write; values of the cells
below a condition are (usually) literals.

There is no API for extracting parts of a spreadsheet. You can look at
the Drools source code (in the packages org.drools.decisiontable and
.../parser) and write whatever you need - it is not too difficult.

-W


On 3 October 2011 17:05, RaviCKota  wrote:
> Hi All, for suppose I have a DecisionTable like below
>
> CONDITION               ACTION
> -
> COND1                     ACTION1
> COND2                     ACTION2
> COND3                     ACTION3
> -
>
> This is just a representation of the DecisionTable. So I need to retrieve
> all the conditions and store them into a Collection like Set. Does Drools
> provide any such feature.
>
> We load the drools as below
> PackageBuilder builder = new PackageBuilder();
> builder.addPackageFromDrl(new StringReader(drl)); //drl is the filepath of
> decisiontable excel
>
> // add the package to a rulebase (deploy the rule package).
> RuleBase ruleBase = RuleBaseFactory.newRuleBase();
> ruleBase.addPackage(builder.getPackage());
>
> I tried to look into api of RuleBase, tried to get the packages, Rules,
> Consequence, etc etc, but could not find any method, that gets me the
> condition name.
>
> When I tried to do
> Package[] packages = rulebase.getPackages();
>
> for(Package pack : packages){
> System.out.println("Package Name is : "+pack.getName());
> Rule[] rules = pack.getRules();
> for(Rule rule : rules){
> System.out.println("Rule name is : "+rule.getName());
>
> All I get is some representation of each row, but I'm specifically looking
> for the value of the first column (CONDITION) for each rule.
>
> Please offer some guidance here.
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Is-it-possible-to-retrieve-the-collection-of-Conditions-from-DecisionTable-tp3390026p3390026.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] Is it possible to retrieve the collection of Conditions from DecisionTable?

2011-10-03 Thread RaviCKota
Hi All, for suppose I have a DecisionTable like below

CONDITION   ACTION
-
COND1 ACTION1
COND2 ACTION2
COND3 ACTION3
-

This is just a representation of the DecisionTable. So I need to retrieve
all the conditions and store them into a Collection like Set. Does Drools
provide any such feature.

We load the drools as below
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new StringReader(drl)); //drl is the filepath of
decisiontable excel

// add the package to a rulebase (deploy the rule package).
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());

I tried to look into api of RuleBase, tried to get the packages, Rules,
Consequence, etc etc, but could not find any method, that gets me the
condition name.

When I tried to do 
Package[] packages = rulebase.getPackages();

for(Package pack : packages){
System.out.println("Package Name is : "+pack.getName());
Rule[] rules = pack.getRules();
for(Rule rule : rules){
System.out.println("Rule name is : "+rule.getName());

All I get is some representation of each row, but I'm specifically looking
for the value of the first column (CONDITION) for each rule. 

Please offer some guidance here.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Is-it-possible-to-retrieve-the-collection-of-Conditions-from-DecisionTable-tp3390026p3390026.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