Change order of columns in decision table
by jian zhi
Hi,
[GUVNOR-454] was fixed in Drools 5.1. It allows the user to change the order of the columns in the decision table(web-guided) from Guvnor. Does this function still exist in Drools 5.2? I couldn't find a way to do that.
Thanks,
Jian
13 years, 4 months
Condition syntax to access Map
by bolsover
I'm struggling with the syntax to access a mapped object - hoping that
someone can help with this..
I have the following condition in a rule:
$a : Answer(getAnswerData().get(0).getValue_str() == "Valves")
Answer is a pojo where answerData is a Map<Integer, AnswerData>
object.
AnswerData is also a pojo and has a String variable value_str.
Rule containing this condition complies but I get the following error when I
fireAllRules
[Error: null pointer or function not found: getValue_str]
[Near : {... getAnswerData().get(0).getValu ....}]
^
[Line: 1, Column: 1]
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:997)
The method getValue_str() does exist in AnswerData as does getAnswerData()
in Answer and there are not any null values.
I'm assuming that autoboxing will correctly interpret .get(0) as an Integer
object.
Any ideas??
--
View this message in context: http://drools.46999.n3.nabble.com/Condition-syntax-to-access-Map-tp320442...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
How to remove Drools 5 facts from a web service
by Matthew Erler
I have a web service in which I'm using a Drools 5 StatefulKnowledgeSession object. The object lives between web service method invocations. The first thing that the service method needs to do is clear out all the facts inserted during the last service method invocation. I use StatefulKnowledgeSession.insert(Object fact) to add facts and StatefulKnowledgeSession.getAgenda().clear() to clear out all facts. I don't think that .clear() is doing what I think it is because by using a println() statement inside my one and only rule's consequence I can see information from previous rules that should be gone. In fact, the rule's consequence is invoked multiple times and I don't know why. It's during those multiple invocations that the .println() shows me information about the current and previous facts. The only method to fix this that I've come up with is to delete and recreate StatefulKnowledgeSession every time the web service's service method
is invoked, but that feels like a poor work-around. Any direction on how to delete facts is greatly appreciated. Thank you.
13 years, 4 months
Rule Task
by S.M.H.Jamali
Hello All
I create a simple JBPM Process by Eclipse Plugin that starts with a Script Task and after Script Task i want to add a Rule Task. In fact i want to fire a rule in my process to make a decision on the Gate Way node. I use Guvnor and JBPM Console to run my processes and after designing the processes i upload them to Guvnor.
My problem is : when i create a new instance of my process (in jbpm console) , first Script Task run fine , but execution of the process stops at Rule Task and no rule fired ! Am i missing something ?
Any Help Appreciated
S.M.H.Jamali
13 years, 4 months
Stateful vs. Stateless Session Performance
by Ryan R.
I have a usecase where I want to apply rules to messages that are received
and processed one message at a time.
I am thinking the stateless session matches this usecase. I was surprised
though to notice that the stateless session seemed to perform upwards of 10x
slower!
I am including the below source which illustrates my usage. The DRL file
used simply has one rule that does a simple modification on two fields.
There is some test code above this stuff that just pushes messages into the
plugin.
I am also including VisualVM profiling results. The top results are for the
stateful while the bottom are for the stateless. It looks like the stateless
performance is dominated by calls to ReflectionInstantiator.newInstance()?
StatelessKnowledgeSession Code:
public class DataConditionPlugin implements Plugin {
final KnowledgeBuilder kbuilder;
final StatelessKnowledgeSession ksession;
public DataConditionPlugin(String drlFileName) {
kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
// this will parse and compile in one step
kbuilder.add(
ResourceFactory.newClassPathResource(drlFileName,
DataConditionPlugin.class),
ResourceType.DRL);
// Check the builder for errors
if (kbuilder.hasErrors()) {
System.out.println(kbuilder.getErrors().toString());
throw new RuntimeException("Unable to compile \""+drlFileName+"\".");
}
// get the compiled packages (which are serializable)
final Collection<KnowledgePackage> pkgs =
kbuilder.getKnowledgePackages();
// add the packages to a knowledgebase (deploy the knowledge packages).
final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(pkgs);
ksession = kbase.newStatelessKnowledgeSession();
}
@Override
public Object execute(Object message) {
ksession.execute(message);
return message;
}
}
StatefulKnowledgeSession Code:
public class DataConditionPlugin implements Plugin {
final KnowledgeBuilder kbuilder;
final StatefulKnowledgeSession ksession;
public DataConditionPlugin(String drlFileName) {
kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
// this will parse and compile in one step
kbuilder.add(
ResourceFactory.newClassPathResource(drlFileName,
DataConditionPlugin.class),
ResourceType.DRL);
// Check the builder for errors
if (kbuilder.hasErrors()) {
System.out.println(kbuilder.getErrors().toString());
throw new RuntimeException("Unable to compile \""+drlFileName+"\".");
}
// get the compiled packages (which are serializable)
final Collection<KnowledgePackage> pkgs =
kbuilder.getKnowledgePackages();
// add the packages to a knowledgebase (deploy the knowledge packages).
final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(pkgs);
ksession = kbase.newStatefulKnowledgeSession();
}
protected void finalize() throws Throwable {
ksession.dispose();
};
@Override
public Object execute(Object message) {
FactHandle factHandler = ksession.insert(message);
ksession.fireAllRules();
Object o = ksession.getObject(factHandler);
ksession.retract(factHandler);
return o;
}
}
http://drools.46999.n3.nabble.com/file/n3208057/Screenshot-Java_VisualVM.png
--
View this message in context: http://drools.46999.n3.nabble.com/Stateful-vs-Stateless-Session-Performan...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
error resolving class name on imported class when loading package
by lhorton
I am getting an error when the knowledge agent loads a pkg. The rules source
file contains an import for a class:
com.abclegal.domain.task.FileDocumentsWithCourtTask
and the RHS of a rule makes a cast using the class name without fully
qualifying it:
((FileDocumentsWithCourtTask)$step.getTask()).addDocument($doc);
I see the following error when the package is loaded by knowledge agent:
Error creating bean with name 'workflowKnowledgeAgent': Invocation of init
method failed; nested exception is [Error: unable to resolve method using
strict-mode: java.lang.Object.FileDocumentsWithCourtTask()]
[Near : {... ((FileDocumentsWithCourtTask)$st ....}]
note in the error that the FileDocumentsWithCourtTask is not being resolved
according to the import statement. The really odd thing about this is that
it doesn't get the error all the time. Sometimes the package is loaded
without error.
I can probably resolve this by fully-qualifying the class name within the
RHS, but you are not supposed to have to do that if you put the
fully-qualified name in the import of the rule.
Any clue why this error might happen?
--
View this message in context: http://drools.46999.n3.nabble.com/error-resolving-class-name-on-imported-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
Not able to get the knowledgeBase from web application
by 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
org.apache.tomcat.util.net.JIoEndpoint$Worker
.run(JIoEndpoint.java:447)
21:22:29,183 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662)
-------------
the code snippet for above exception
System.out.println("1");
// knowledge base configuration
KnowledgeBaseConfiguration kbaseConf = KnowledgeBaseFactory
.newKnowledgeBaseConfiguration();
System.out.println("2");
kbaseConf.setOption(EventProcessingOption.STREAM);
System.out.println("3");
// knowledge base
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConf);
System.out.println("4");
KnowledgeAgentConfiguration kagentConf = KnowledgeAgentFactory
.newKnowledgeAgentConfiguration();
System.out.println("5");
// enable incremental knowledge base build
kagentConf.setProperty("drools.agent.newInstance", "false");
System.out.println("6");
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(
"demoAgent", kbase, kagentConf);
System.out.println("7");
Resource changeset = null;
changeset =
ResourceFactory.newUrlResource("http://127.0.0.1:8080/guvnor/org.drools.guvnor.Guvnor/package/demo/LATEST...");
System.out.println("8");
System.out.println("kbase:"+kbase+" kagent: "+kagent);
*kagent.applyChangeSet(changeset);*
System.out.println("9");
System.out.println("kbase:"+kbase+" kagent: "+kagent);
kagent.dispose();
System.out.println("readKnowledgeBase() at end............");
------
changeset file content
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...'
>
<add>
<resource
source='http://127.0.0.1:8080/guvnor/org.drools.guvnor.Guvnor/package/demo/LATEST'
type='PKG' basicAuthentication='enabled' username='admin' password='admin'
/>
</add>
</change-set>
----------
I am able to get the knowledgebase using java application, but I am not able
to get the knowledgebase from web application.
please suggest me, what could be the reason for this and how to resolve
this.
--
View this message in context: http://drools.46999.n3.nabble.com/Not-able-to-get-the-knowledgeBase-from-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 4 months
Call for Demos: RuleML2011 - 5th InternationalRule Challenge
by Adrian Paschke
Latest News
====================================================================*
* RuleML2011@BRF - 5th International Rule Challenge *
* Nov 4th *
* Westin Diplomat, Ft Lauderdale, Florida *
* http://2011.ruleml.org/america/?page_id=126 *
====================================================================*
* Call for Demos - Submission Deadline - Sept. 2nd, 2011 *
* New categories in the Challenge with prestigious prizes *
* Demo papers published as CEUR proceedings *
* 15% RuleML2011@BRF Partner discounts - see registration page *
* http://2011.ruleml.org/america/ *
* http://www.businessrulesforum.com/register.php *
*********************************************************************
Overview and Aim
======================================================
The RuleML2011@BRF Challenge is one of the highlights at RuleML2011@BRF
Conference.The RuleML2011@BRF Challenge is dedicated to practical
experiences
with rule-oriented applications. In particular, submissions of benchmarks
/ evaluations, demos, case studies / use cases, experience reports, best
practice solutions (e.g. design patterns, reference architectures, models),
rule-based implementations / tools / applications, demonstrations of
engineering methods, implementations of rule standards (e.g. RuleML, RIF,
SBVR, PRR, rule-based Event Processing languages, BPMN+rules, BPEL+rules,
...), rules + industrial standards (e.g. XBRL, MISMO, Accord, ...), and
industrial problem statements are particularly encouraged.
Key themes of the RuleML2011@BRF Challenge include the following:
* Demos related to the RuleML2011@BRF Track Topics
* Extensions and implementations of rule standards: W3C RIF, RuleML,
SBVR, ...
* Editing environments and IDEs for Web rules
* Benchmarks and comparison results for rule engines
* Distributed rule bases and rule services
* Reports on industrial experience about rule systems
A dedicated track of RuleML2011@BRF Challenge will be focused on the theme:
**Combining Rules, Objects, and Ontologies: Implementations and
Applications**
- Loose/tight integrations of rules and knowledge bases
- Knowledge Modelling and Reasoning
- Real cases and practical experiences
Ideally, demos submitted to the Challenge track should tackle knowledge-rich
domain problems. The proposed solution should address such problem using a
combination of rule-based modelling and semantic knowledge-based modelling.
Solutions ranging from loosely coupled hybrid systems (i.e. where different
frameworks are put together), to unified homogeneous architectures (i.e.
where
a unified model / semantics, within a single framework, is proposed) will be
of great interest for the special track.
Prizes will be awarded to the two best applications from the main focus
theme
and for the all categories. All accepted demos will be presented in a
special
Challenge Session.
Submission
======================================================
The submission is composed of two parts:
- open-source or commercial demo
- demo papers describing research, implementation, and technical details of
your submission.
Submissions to the Rules Challenge 2011 consist of a demo paper of 4-8
pages,
describing the demo show case, and a link to the demo/show case, e.g. a
project site, an online demonstration, a presentation about the
demonstration,
or a download site for the demonstration.
Demo and papers submission website:
https://www.easychair.org/conferences/?conf=ruleml2011challenge
Please upload all demo papers submissions as PDF files in LNCS format
(http://www.springer.de/comp/lncs/authors.html).
To ensure high quality, submitted papers will be carefully peer-reviewed
according to the evaluation criteria indicated below.
To better disseminate your work, please also udpate your demo in the systems
submission website with a brief abstract presentation:
http://2011.ruleml.org/america/?page_id=184
Challenge Evaluation Criteria
======================================================
Submissions to the RuleML2011@BRF Challenge general Track will be evaluated
according to the following criteria:
- clear exposition of the objectives, outcomes, benefits for going beyond
the
state of the art in the application domain (25%)
- demos should demonstrate a good level of effectiveness to manage complex
rules according to statistical/analytical/benchmarking evaluations (25%)
- demos have to demonstrate the results with a concrete example balancing
conciseness and completeness (25%)
- demos should preferably (but not necessarily) be embedded into a web-based
or distributed environment (15%)
- demos should pay attention to end-user interactions, providing an adequate
and usable interface that favors a concrete usage of the application
(10%).
Submissions focused on this year's special theme (Knowledge-Based
Applications
combining Rules and Ontologies) should show the potential and benefits of
combining rule-based reasoning and taxonomic/frame/description-logic
reasoning
in a realistic application. Demos submitted to the Special Theme will be
evaluated according to the following criteria:
- papers should clearly expose the objectives, outcomes, benefits for going
beyond the state of the art in the application domain (20%)
- demos should demonstrate a good level of integration or interaction
between
rules and ontologies (40%)
- demos should demonstrate their results with a simple but meaningful case
study, balancing conciseness and completeness (20%)
- demos should preferably be deployed in a web-based or distributed
environment where multiple nodes exchange information (10%)
- demos should pay attention to end-user interactions, providing an adequate
and usable interface that favors a concrete usage of the application
(10%).
Proceedings
======================================================
Authors are invited to submit original contributions of practical relevance
and technical rigor in the field, benchmarks, evaluations, experience
reports
and show/use case demonstrations of effective, practical, deployable
rule-based technologies or applications in web-distributed environments.
Papers must be in English.
Accepted papers will be published as CEUR Workshop Proceedings.
Exhibition Room
======================================================
The RuleML2011@BRF Chairs are currently evaluating the possibility to have
an
exhibition space where to present the demo live to the participants
throughout
the Symposium.
More information will be released with the notification of acceptance of the
demo papers and demo systems.
Important Dates
======================================================
Submission deadline for demo papers and demo systems: Sept. 2nd, 2011
Notification of accepted demo papers and demo systems: Sept. 23rd, 2011
Camera ready papers: Sept. 30th, 2011
RuleML2011@BRF Challenge Chairs
======================================================
Stefano Bragaglia, University of Bologna, Italy
Marco Montali, KRDB, Free University of Bozen-Bolzano, Italy
Charles Petrie, Stanford University, USA
Mark Proctor, Red Hat, UK
13 years, 4 months
Query in stateless knowledge session returns no results
by Heijink, Hank
Hi all,
I'm new to Drools, so please excuse me if I'm asking about the obvious--it's certainly not obvious to me. The problem is this: I use a stateless knowledge session where a list of facts is inserted. The rules that fire create new facts, and after all the rules have fired, I'd like to obtain a list of all the facts (the old and the new). The best way seemed to use a query. I'm using Drools 5.1 on Linux.
This is part of my .drl file (without the imports):
rule "create badge"
when
Event ( eventType == EventType.SOME_EVENT_TYPE )
not BadgeState ( identifier == "badge" )
then
insert( new BadgeState("badge") );
end
query "all badges"
aBadge : BadgeState()
end
This is the Java code:
StatelessKnowledgeSession ksession = StatsKnowledgeBase.getKnowledgeBase().newStatelessKnowledgeSession();
// Create a list of share events
ArrayList<Event> events = new ArrayList<Event>();
Date now = new Date();
MobileDevice aDevice = new MobileDevice("uniqueId", "deviceType");
for (int i = 0; i < 5; i++) {
Event anEvent = new Event.Builder(now, aDevice, "aCustomer", EventType.SOME_EVENT_TYPE).build();
events.add(anEvent);
}
// Create the query for the badges
List<Command> commands = new ArrayList<Command>();
commands.add(CommandFactory.newInsertElements(events));
commands.add(CommandFactory.newQuery("all badges", "all badges"));
// Feed the events into Drools
KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
ExecutionResults results = ksession.execute( CommandFactory.newBatchExecution(commands) );
NativeQueryResults queryResults = (NativeQueryResults)results.getValue("all badges");
// At this point, queryResults is empty.
logger.close();
// Get a list of badges
List<BadgeState> badges = new ArrayList<BadgeState>();
for (Iterator<QueryResultsRow> i = queryResults.iterator(); i.hasNext(); ) {
QueryResultsRow result = i.next();
BadgeState obj = (BadgeState)result.get("aBadge");
badges.add(obj);
}
The logger shows me that the BadgeState object is created, but the query returns an empty list. I've searched the documentation, which suggests that I'm doing it right (http://drools.herod.net/drools-expert/html/ch03.html#d0e1956, example 3.37), the archives of this mailinglist, and the web, so far without success.
Clearly, I'm missing something, and I have the nagging feeling that it's something simple...
Any help is much appreciated!
Best,
Hank
13 years, 4 months