Adding Rules and Packages to existing rule base (4.0.7)
by cfili
What is the proper way to add rules to existing packages that are already
part of a rule base?
When adding rules to the package directly, those rules are listed in the
rule base however they do not seem to be "active" and will never trigger. I
get the same results if I add rules to a package that was created by the
PackageBuilder but not part of an existing rule base. Allowing Drools to
"merge" the packages also seems to yield a similar result where the first
set of rules are active, but what was added later or merged will not be
active.
I know that this type of activity is supported I just want to make sure I do
it the right way.
Thanks.
--
View this message in context: http://www.nabble.com/Adding-Rules-and-Packages-to-existing-rule-base-%28...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 11 months
how to specify classpath dependencies in .drl files.
by Godmar Back
My question is how to manage a rule base that is composed from sets of
rules drawn from different sources.
Our goal is to supply sets of rules as .jar files - each .jar file
containing a related set of rules. For instance, consider an expert
system where different experts could export their expertise in such a
jar file. Such a .jar file would contain one or more .drl files and a
set of supporting .java classes. We'd like to be able to refer to
these .jar files using a URLClassLoader and/or JarURLConnection so
they can be referred to without a user having to download them prior
to starting their application.
Users should be able to combine those provided rules (that is, the
rules of those experts whose knowledge they wish to exploit) with
their own rules in their own .drl files.
My question is whether drools supports such a setup easily.
Specifically, is there a way for a user to import external .jar files
in their .drl files? A statement such as
use jar:http://expertbase.com/expert1/knowledge5.jar
which would instruct the rule compiler to load the classes from this
jar to its compile class path, and which would instruct the class
loader used to load the user's classes to delegate to the loader used
to load the jar file's classes? [Note that a given expert's knowledge
should only be loaded by one classloader.]
I browsed through the API and discovered that the package builder
configuration allows the specification of a class loader. Does this
mean the rule compiler will attempt to load related classes through
this loader as well? If so, it would need to use reflection to examine
those classes (which I'd find unlikely). If not, is there a way to
control the rule compiler's compiler classpath?
In our current prototype, we need to load everything through the
application classpath to avoid compile errors.
- Godmar
15 years, 11 months
Drools Workbench on Eclipse 3.4?
by Brian Sam-Bodden
Has anybody gotten the Drools Workbench working on Ganymede. I'm trying to
install on a fresh Ganymede install and getting all kinds of dependency
issues. I see the 5.0 version supports 3.4 but will it work with Drools
4.0.7?
16 years, 1 month
Independent rule evaluations
by Yuri
Considering that I have a set of rules that can be time consuming to assert is
there a way to separate them from other rules without having to resort to
multiple working memories?
I basically want to be able to assert facts and evalute a set of rules as fast
as I can before actually having the time consuming set of rules evaluate.
thanks,
16 years, 1 month
Nested Rules
by Vishal Deshmukh
Hi
I am using Drools 4.0.4 with Eclipse 3.2. I m much happy with the results. But now my application needs nested loops..
Can i write nested rules like
rule "rule 1 " // if condition of rule 1 is true then only execute rule 2 other wise skip it
when
condition is true
then
execute rule2
rule "rule 2 "
when
condition is true
then
action
rule "rule 3"
when
condition is true
then
action
Thanks and Rgards
Vishal
16 years, 1 month
RulesRepositoryException: Unable to checkin with Oracle DB (Works with MySQL)
by Barry K
I receive a RulesRepositoryException: Unable to checkin when trying to create
a rule using an oracle database. If I switch out my repository.xml and
connect to MySQL, then I can successfully create DRL rules. I was able to
create packages, fact models and categories in both. Only adding rules when
connected to Oracle throws the error. Anybody else seeing the same or have
a solution??
Thanks for any help,
Barry
Drools Version : 5.0 M2
Database : Oracle 10g
Fact Model is in rules, not jar (awesome feature!)
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public
abstract java.lang.String
org.drools.guvnor.client.rpc.RepositoryService.checkinVersion(org.drools.guvnor.client.rpc.RuleAsset)
throws com.google.gwt.user.client.rpc.SerializableException' threw an
unexpected exception: org.drools.repository.RulesRepositoryException: Unable
to checkin.
at
com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:360)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:546)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:164)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:86)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
at
org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Unknown Source)
Caused by: org.drools.repository.RulesRepositoryException: Unable to
checkin.
at org.drools.repository.VersionableItem.checkin(VersionableItem.java:522)
at
org.drools.guvnor.server.ServiceImplementation.checkinVersion(ServiceImplementation.java:597)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at
org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at
org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:39)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.security.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:138)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
at
org.drools.guvnor.server.ServiceImplementation_$$_javassist_6.checkinVersion(ServiceImplementation_$$_javassist_6.java)
at
org.drools.guvnor.server.RepositoryServiceServlet.checkinVersion(RepositoryServiceServlet.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:527)
... 27 more
Caused by: javax.jcr.RepositoryException: /: unable to update item.:
9ae431e9-b7fa-4db6-a170-37d6f1d69245: 9ae431e9-b7fa-4db6-a170-37d6f1d69245
at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1255)
at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:897)
at org.drools.repository.VersionableItem.checkin(VersionableItem.java:519)
... 53 more
Caused by: org.apache.jackrabbit.core.state.NoSuchItemStateException:
9ae431e9-b7fa-4db6-a170-37d6f1d69245
at
org.apache.jackrabbit.core.state.SharedItemStateManager.getNodeReferences(SharedItemStateManager.java:330)
at
org.apache.jackrabbit.core.state.SharedItemStateManager.updateReferences(SharedItemStateManager.java:1288)
at
org.apache.jackrabbit.core.state.SharedItemStateManager$Update.begin(SharedItemStateManager.java:551)
at
org.apache.jackrabbit.core.state.SharedItemStateManager.beginUpdate(SharedItemStateManager.java:843)
at
org.apache.jackrabbit.core.state.SharedItemStateManager.update(SharedItemStateManager.java:873)
at
org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:334)
at
org.apache.jackrabbit.core.state.XAItemStateManager.update(XAItemStateManager.java:337)
at
org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:310)
at
org.apache.jackrabbit.core.state.SessionItemStateManager.update(SessionItemStateManager.java:317)
at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1247)
... 55 more
REPOSITORY XML
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD
Jackrabbit 1.2//EN"
"http://jackrabbit.apache.org/dtd/repository-1.2.dtd">
<!-- Example Repository Configuration File -->
<Repository>
<!--
virtual file system where the repository stores global state
(e.g. registered namespaces, custom node types, etc.)
<FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
</FileSystem>
-->
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
</FileSystem>
<!--
security configuration
-->
<Security appName="Jackrabbit">
<!--
access manager:
class: FQN of class implementing the AccessManager interface
-->
<AccessManager
class="org.apache.jackrabbit.core.security.SimpleAccessManager">
<!-- -->
</AccessManager>
<LoginModule
class="org.apache.jackrabbit.core.security.SimpleLoginModule">
<!-- anonymous user name ('anonymous' is the default value) -->
<!--
default user name to be used instead of the anonymous user
when no login credentials are provided (unset by default)
-->
<!-- -->
</LoginModule>
</Security>
<!--
location of workspaces root directory and name of default workspace
-->
<Workspaces rootPath="${rep.home}/workspaces"
defaultWorkspace="RAILINC"/>
<!--
workspace configuration template:
used to create the initial workspace if there's no workspace yet
-->
<Workspace name="${wsp.name}">
<!--
virtual file system of the workspace:
class: FQN of class implementing the FileSystem interface
-->
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
</FileSystem>
<!--
persistence manager of the workspace:
class: FQN of class implementing the PersistenceManager
interface
-->
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.db.OraclePersistenceManager">
</PersistenceManager>
<!--
Search index and the file system it uses.
class: FQN of class implementing the QueryHandler interface
-->
<SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
</SearchIndex>
</Workspace>
<!--
Configures the versioning
-->
<Versioning rootPath="${rep.home}/version">
<!--
Configures the filesystem to use for versioning for the
respective
persistence manager
-->
<FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
</FileSystem>
<!--
Configures the persistence manager to be used for persisting
version state.
Please note that the current versioning implementation is based
on
a 'normal' persistence manager, but this could change in future
implementations.
-->
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.db.OraclePersistenceManager">
</PersistenceManager>
</Versioning>
<!--
Search index for content that is shared repository wide
(/jcr:system tree, contains mainly versions)
-->
<SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
</SearchIndex>
</Repository>
--
View this message in context: http://www.nabble.com/RulesRepositoryException%3A-Unable-to-checkin-with-...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 1 month
Loading rules
by Chris Chen
I have a simple beginners question about using rules.
Say that I have a set of rules that are static and exist in drl files
to deal with product pricing. But then I also have a set of dynamic
rules stored in the database for different promotions. Depending on
the promotion entered or selected, the dynamic rule is retrieved from
the promotion db row.
Based on this criteria, I have some quick questions that I hope
someone can help give me answers:
1) Is it good practice to be loading rules, add them to packages,
compile, and create the RuleBase for every incoming request? I take
it that's not a very efficient way to load the rules. It's probably
better to keep the compiled rule engine available and simply create
the RuleBase for every incoming request instead.
2) Would it be better then to create two rules engine - 1 for the
static drl files that do not change and one for the dynamic rules that
gets refreshed and loaded every time?
3) Another alternative is to load ALL the promotions rules in the DB
into one rule engine and make sure to check promotion codes on each
run. This seems to be efficient. however, how would I know when the
DB promotions have changed so that I can reload the rules? I can
think of a couple ways. One is to do periodic cache flushing which
will refresh the rules engine every once in a while. The other way is
to query modification dates and see if any promotions were modified
since the last time the rules engine was loaded. There could be a
third way, which combines the previous two ways together.
I'd like to know if there is some best practice when it comes to
dynamic rule reloading and what is an efficient and scalable way to do
this.
Thanks for any thoughts or suggestions!
-Chris
16 years, 1 month
EDT dependency -- transitive dependencies broken from 4.07 to 5?
by Andrew Waterman
Hi Everyone,
I've seen this issue in the archives, but I haven't seen anyone
address it in regards to an upgrade from 4.07 to 5MR2. Basically, I
have a set of java dialect "drl" files that compile properly in 4.07
and are usable, but when I simply modify my maven build to use the
5MR2 release, I get the following well-known error:
Caused by: java.lang.RuntimeException: The Eclipse JDT Core jar is not
in the classpath
at
org
.drools
.rule
.builder
.dialect
.java
.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:94)
at
org
.drools
.rule
.builder
.dialect
.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:55)
at
org
.drools
.compiler
.PackageBuilderConfiguration
.addDialect(PackageBuilderConfiguration.java:200)
... 30 more
This error seemed to go away when I moved from using my local build of
Drools to using the staged builds on snapshots.jboss.org, but has come
back to haunt me this morning.
Have the transitive dependencies changed in 5? Are there any Maven
specific work-around suggestions? Is this the expected behavior for 5?
best wishes,
Andrew
---------------------------------
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico
+52 1 967 103 3176
+1 510 342 5693
16 years, 1 month
Decision table functions
by Evelyne Lim Hwa Ling
Hi
I'm a newbie in Drools. I would like to know whether functions like
accumulate and exists can be applied to decision table. If yes, how to?
Where do we put the function name e.g exists i.e which cell or column?
Any example?
Thanks
Best Regards,
16 years, 1 month