[rules-users] Using object.getter in Decision table

2011-10-04 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


Re: [rules-users] Using object.getter in Decision table

2011-10-04 Thread jilani
Thank You for your reply. 

I am trying to access all the facts through one fact, actually the scenario
is we have multiple screens in our application and each screen will have
multiple fields where we want to show/hide the screen/field based on data
provided in screens. 

So Instead of sending each screen data separate, We thought of sending the
parent object and inside the rules(i.e decision table) we want to access the
data of specific screen.

As mentioned by you, I am using the intermediate DRL output using below code
SpreadsheetCompiler sc = new SpreadsheetCompiler();
String drlstr = null;
try
{
drlstr =
sc.compile(ResourceFactory.newClassPathResource(decisionTableSheet,
this.getClass()).getInputStream(), InputType.XLS);
}

Here it is giving the rule parse exception and returning the package as
null.

Coming to DRL, I am facing difficulty in defining rules like scenarios as
below

- null check
- need to use java String methods like equals() and length()
- setting data in HashMap, ArrayList 

Actually I tried the above using a rule definition in Guvnor.

It would be helpful If you can provide me the URL or some information to
write rules using DRL.

My Development environment:
Drools 5.2
Eclipse with JBoss tools











--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-object-getter-in-Decision-table-tp3392337p3392506.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 object.getter in Decision table

2011-10-04 Thread jilani
Thomas,

The best place to start is the drools documentation
http://www.jboss.org/drools/documentation particularly the expert guide. 
This shows both drl and spreadsheet syntax and examples. 
- Yes. I have downloaded all the drools info from here. then I got one
expert pdf document in reference folder of final distribution. I think it is
the same in above URL.
Here as mentioned in the document I have defined rules in repository using
Guvnor and then tried to access the knowledgebase using knowledgeAgent,
which I failed to access from web application where as from console
application it is working. 

You are getting the exception because the first line of the condition should
just be an object restriction eg fact1 : DataObject() 
Your second line is then a restriction on that data object. 

- that means I can not get the child fact from a parent object as I tried.
As of now the only way is I need to insert the facts as and when rule needs
it and then retract that. Please correct me If I am missing anything in my
understanding.

What you send from your screen and what you insert into the working memory
doesn't have to be identical. 
Your screen may use a single object to relay the object but that doesn't
mean you can't explode it into separate facts as you insert it into your
working memory, but it depends on what you are trying to achieve - are these
just validation rules or are you going to be modifying the objects? 

I am modifying the object, so that based on that object state some
functionality has to be done in next layer. what I am trying to achieve is
generic rule util methods for my application to use these methods across
different method calls. 

Thank You
Jilani

--
View this message in context: 
http://drools.46999.n3.nabble.com/Using-object-getter-in-Decision-table-tp3392337p3392738.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] Not able to get the knowledgeBase from web application

2011-07-26 Thread jilani
Hi,

I am working with Drools 5.2.0 final and Guvnor also the same version. 
application server: GateIn-3.1.0-FINAL-jbossas

I have uploaded a java model and defined a rule using that model. I did
validation of the package and build also.

After that in my web application, when I am trying to access the
knowledgebase I am getting error in server console as mentioned below.

21:22:28,450 INFO  [STDOUT] 1
21:22:28,629 INFO  [STDOUT] 2
21:22:28,638 INFO  [STDOUT] 3
21:22:28,834 INFO  [STDOUT] 4
21:22:28,840 INFO  [STDOUT] 5
21:22:28,844 INFO  [STDOUT] 6
21:22:28,886 INFO  [STDOUT] 7
21:22:28,890 INFO  [STDOUT] 8
21:22:28,891 INFO  [STDOUT] kbase:org.drools.impl.KnowledgeBaseImpl@66c790c9
kag
ent: org.drools.agent.impl.KnowledgeAgentImpl@37f2b0d6
21:22:29,158 INFO  [STDOUT] INFO  26-07 21:22:29,157
(NilAuthenticator.java:auth
enticate:35) All users are guests.
21:22:29,163 INFO  [STDOUT] INFO  26-07 21:22:29,163
(RepositoryServlet.java:all
owUser:114)  null authenticated for rest api
21:22:29,164 INFO  [STDOUT] INFO  26-07 21:22:29,164
(PackageDeploymentServlet.j
ava:execute:141) PackageName: sam
21:22:29,164 INFO  [STDOUT] INFO  26-07 21:22:29,164
(PackageDeploymentServlet.j
ava:execute:142) PackageVersion: LATEST
21:22:29,165 INFO  [STDOUT] INFO  26-07 21:22:29,165
(PackageDeploymentServlet.j
ava:execute:143) PackageIsLatest: true
21:22:29,165 INFO  [STDOUT] INFO  26-07 21:22:29,165
(PackageDeploymentServlet.j
ava:execute:144) PackageIsSource: false
21:22:29,172 INFO  [STDOUT] error...
21:22:29,173 ERROR [STDERR] java.lang.NullPointerException
21:22:29,174 ERROR [STDERR] at
org.drools.agent.impl.KnowledgeAgentImpl.proc
essChangeSet(KnowledgeAgentImpl.java:223)
21:22:29,175 ERROR [STDERR] at
org.drools.agent.impl.KnowledgeAgentImpl.appl
yChangeSet(KnowledgeAgentImpl.java:189)
21:22:29,175 ERROR [STDERR] at
org.drools.agent.impl.KnowledgeAgentImpl.appl
yChangeSet(KnowledgeAgentImpl.java:174)
21:22:29,175 ERROR [STDERR] at
org.apache.jsp.index1_jsp._jspService(index1_
jsp.java:124)
21:22:29,175 ERROR [STDERR] at
org.apache.jasper.runtime.HttpJspBase.service
(HttpJspBase.java:70)
21:22:29,175 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:717)
21:22:29,176 ERROR [STDERR] at
org.apache.jasper.servlet.JspServletWrapper.s
ervice(JspServletWrapper.java:369)
21:22:29,176 ERROR [STDERR] at
org.apache.jasper.servlet.JspServlet.serviceJ
spFile(JspServlet.java:322)
21:22:29,176 ERROR [STDERR] at
org.apache.jasper.servlet.JspServlet.service(
JspServlet.java:249)
21:22:29,176 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:717)
21:22:29,176 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterCha
in.internalDoFilter(ApplicationFilterChain.java:290)
21:22:29,176 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterCha
in.doFilter(ApplicationFilterChain.java:206)
21:22:29,177 ERROR [STDERR] at
org.jboss.web.tomcat.filters.ReplyHeaderFilte
r.doFilter(ReplyHeaderFilter.java:96)
21:22:29,180 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterCha
in.internalDoFilter(ApplicationFilterChain.java:235)
21:22:29,180 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterCha
in.doFilter(ApplicationFilterChain.java:206)
21:22:29,180 ERROR [STDERR] at
org.apache.catalina.core.StandardWrapperValve
.invoke(StandardWrapperValve.java:235)
21:22:29,180 ERROR [STDERR] at
org.apache.catalina.core.StandardContextValve
.invoke(StandardContextValve.java:191)
21:22:29,180 ERROR [STDERR] at
org.jboss.web.tomcat.security.SecurityAssocia
tionValve.invoke(SecurityAssociationValve.java:190)
21:22:29,181 ERROR [STDERR] at
org.jboss.web.tomcat.security.JaccContextValv
e.invoke(JaccContextValve.java:92)
21:22:29,181 ERROR [STDERR] at
org.jboss.web.tomcat.security.SecurityContext
EstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
21:22:29,181 ERROR [STDERR] at
org.jboss.web.tomcat.security.SecurityContext
EstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
21:22:29,181 ERROR [STDERR] at
org.apache.catalina.core.StandardHostValve.in
voke(StandardHostValve.java:127)
21:22:29,181 ERROR [STDERR] at
org.apache.catalina.valves.ErrorReportValve.i
nvoke(ErrorReportValve.java:102)
21:22:29,182 ERROR [STDERR] at
org.jboss.web.tomcat.service.jca.CachedConnec
tionValve.invoke(CachedConnectionValve.java:158)
21:22:29,182 ERROR [STDERR] at
org.apache.catalina.core.StandardEngineValve.
invoke(StandardEngineValve.java:109)
21:22:29,182 ERROR [STDERR] at
org.apache.catalina.connector.CoyoteAdapter.s
ervice(CoyoteAdapter.java:330)
21:22:29,182 ERROR [STDERR] at
org.apache.coyote.http11.Http11Processor.proc
ess(Http11Processor.java:829)
21:22:29,182 ERROR [STDERR] at
org.apache.coyote.http11.Http11Protocol$Http1
1ConnectionHandler.process(Http11Protocol.java:598)
21:22:29,183 ERROR [STDERR] at