Apache commons sandbox dependencies
by Dale Wyttenbach
Hi,
I grabbed drools build 3895 and am trying to work it into our local
environment.
I see that drools-workitems has a dependency on an unreleased Apache project
(commons-finder)
which in turn has a dependency on another unreleased Apache project
(commons-cli 2.x)
The commons-finder dependency looks like it is limited to a single class
named FinderWorkItemHandler.
If it becomes necessary to roll our own version of drools that doesn't
depend on commons-finder,
can we safely prune FinderWorkItemHandler and not have any ill effects?
Thanks.
15 years, 11 months
how to create a list obj for a rule using 'memberOf'
by eyal edri
Hi,
sorry for the newbi question, i'm just starting to find my way in Drools.
i want to write a rule that filters URLs with a certain suffix (e.g. jpg,
gif, css, etc...).
i read about global vars and other variables and i'm not sure what to do.
i need to create a List with all the suffixes i want to filter, should i
create it inside FileType?
can you help?
Eyal.
-------------------------------------------
here's why i had so far:
the .drl file:
*package com.test.drools*
* *
*import com.test.drools.Facts.FileType;*
*
*
* *
*rule "Filter File Types"*
* *
* **when*
* $fileTypes : ??? *
* **FileType( type memberOf $fileTypes )*
* **then*
* **System.out.println("ALLOW");*
*end*
here's FileType:
package com.commtouch.drools;
import java.net.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Facts {
// return a file type of a url
public static class FileType {
private String type = "html";
public FileType (URL url) {
// get the path from the url
//TODO: use parser to do it?
String path = url.getPath();
if (path != null) {
// define regex to extract file from path
Pattern fileRegex = Pattern.compile("([^/]+)$");
Matcher fileMatcher = fileRegex.matcher(path);
// get regex capure $1 (filename)
String file = null;
while (fileMatcher.find())
file = fileMatcher.group(1);
String suffix = null;
if (file != null)
{
//try to extract suffix from file
Pattern suffixRegex = Pattern.compile("\\.([^\\.]+)$");
Matcher suffixMatcher = suffixRegex.matcher(file);
while (suffixMatcher.find())
suffix = suffixMatcher.group(1);
//verify that the suffix is a valid suffix
if (suffix != null && (suffix.length()> 1 && suffix.length() < 6))
setType(suffix);
}
}
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
}
}
--
Eyal Edri
15 years, 11 months
Mavenizing a new drools project
by eyal edri
Hi,
I've created the HelloWorld drools sample project and i want to turn it into
a maven project.
i know i can create and empty maven project and copy all sources from the
drools project to it,
but how do i handle the dependant jars (drools runtime?)
is there a guide of how to mavenize your drools projects?
--
Eyal Edri
15 years, 11 months
FIXED: Mavenizing a new drools project
by eyal edri
OK,
I found 2 missing jars from the maven dependencies that appeared in the
drools project,
and apparantly are mandatory:
jxl.jar
xstream.jar
both were available via the maven2 repo.
Eyal.
On Mon, May 10, 2010 at 2:21 PM, eyal edri <eyal.edri(a)gmail.com> wrote:
> I'm still having problem unfortunately.. :(
>
> i get a strange error that i didn't got before turning to maven:
>
> when running:
>
> *kbuilder.add(ResourceFactory.newClassPathResource("src/main/rules/sample.drl"),
> ResourceType.DRL);*
>
> this errors occurs:
> java.lang.RuntimeException: java.io.FileNotFoundException:
> 'src/main/rules/sample.drl' cannot be opened because it does not exist
> at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:559)
> at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
> at com.commtouch.drools.DroolsTest.readKnowledgeBase(DroolsTest.java:42)
> at com.commtouch.drools.DroolsTest.main(DroolsTest.java:25)
> Caused by: java.io.FileNotFoundException: 'src/main/rules/sample.drl'
> cannot be opened because it does not exist
> at
> org.drools.io.impl.ClassPathResource.getInputStream(ClassPathResource.java:104)
> at
> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:287)
> at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
> ... 3 more
>
> i see a difference between the .classpth and .project files in both
> projects (Drools project vs Maven Project).
> could this be the reason?
>
> Eyal.
>
> On Mon, May 10, 2010 at 12:20 PM, eyal edri <eyal.edri(a)gmail.com> wrote:
>
>> OK, the eclipse maven plugin added those deps type as 'pom' instead of
>> 'jar',
>> so the drools jars weren't included.
>>
>> fixed that.
>>
>> thanks.
>>
>>
>> On Mon, May 10, 2010 at 11:25 AM, eyal edri <eyal.edri(a)gmail.com> wrote:
>>
>>> OK, Still got problems.
>>>
>>> i've created a maven project, and all looks good in compile time (with
>>> all the org.drools dep below).
>>>
>>> but i think i still missing a 'runtime' dependency, cause when i try to
>>> run the Hello World example, i get this error:
>>>
>>> [the src line is this:
>>> KnowledgeBuilder kbuilder =
>>> KnowledgeBuilderFactory.newKnowledgeBuilder();]
>>>
>>> org.drools.ProviderInitializationException: Provider
>>> org.drools.builder.impl.KnowledgeBuilderProviderImpl could not be set.
>>> at
>>> org.drools.builder.KnowledgeBuilderFactory.loadProvider(KnowledgeBuilderFactory.java:111)
>>> at
>>> org.drools.builder.KnowledgeBuilderFactory.getKnowledgeBuilderProvider(KnowledgeBuilderFactory.java:101)
>>> at
>>> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:29)
>>> at
>>> com.commtouch.drools.DroolsTest.readKnowledgeBase(DroolsTest.java:38)
>>> at com.commtouch.drools.DroolsTest.main(DroolsTest.java:24)
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.drools.builder.impl.KnowledgeBuilderProviderImpl
>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>> at java.lang.Class.forName0(Native Method)
>>> at java.lang.Class.forName(Class.java:169)
>>> at
>>> org.drools.builder.KnowledgeBuilderFactory.loadProvider(KnowledgeBuilderFactory.java:108)
>>> am i missing org.drools.builder? (i didn't see it in the maven repo..)
>>>
>>> On Sun, May 9, 2010 at 3:35 PM, Salaboy <salaboy(a)gmail.com> wrote:
>>>
>>>> I always prefer to create the maven projects from the scratch. You
>>>> only need to add the following deps (groupid and artifactid)
>>>>
>>>> org.drools
>>>> drools-api
>>>>
>>>> org.drools
>>>> drools-core
>>>>
>>>> org.drools
>>>> drools-compiler
>>>>
>>>> You probably need to add the jboss repository as well in order to get
>>>> this deps
>>>>
>>>> Repository.jboss.org/maven2
>>>>
>>>>
>>>> - Ing. Mauricio Salatino -
>>>>
>>>> On May 9, 2010, at 5:01, eyal edri <eyal.edri(a)gmail.com> wrote:
>>>>
>>>> > Hi,
>>>> >
>>>> > I've created the HelloWorld drools sample project and i want to turn
>>>> > it into a maven project.
>>>> >
>>>> > i know i can create and empty maven project and copy all sources
>>>> > from the drools project to it,
>>>> > but how do i handle the dependant jars (drools runtime?)
>>>> >
>>>> > is there a guide of how to mavenize your drools projects?
>>>> >
>>>> > --
>>>> > Eyal Edri
>>>> > _______________________________________________
>>>> > rules-users mailing list
>>>> > rules-users(a)lists.jboss.org
>>>> > https://lists.jboss.org/mailman/listinfo/rules-users
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users(a)lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>
>>>
>>>
>>> --
>>> Eyal Edri
>>>
>>
>>
>>
>> --
>> Eyal Edri
>>
>
>
>
> --
> Eyal Edri
>
--
Eyal Edri
15 years, 11 months
Insert Fact Speed bottleneck
by djb
Hi Drools team,
I wrote a Drools application for my company, which evaluates clinical claim
processing rules. That is, it checks current medical claims against the
patient's historical claims.
It appears that 95% of the run time is dedicated to inserting facts, which
is presumably when it propagates through the RETE graph, since firing the
rules takes no time.
But it seems like it's not fast enough. I made a rule template, which by
trial and error of moving the conditions around, is optimised. I'm
averaging 310ms, and need it to be under 170ms for it to be viable.
Is there any not-too-technical guide to optimisation somewhere? (alpha and
beta-nodes scare me a bit).
Regards,
Daniel
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Insert-Fact-Speed-bot...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 11 months
Drools Server Problem java.lang.String cannot be cast to [B
by Seltir
Hello All.
I have a problem using Drools Server with example domain.
During sending Rest Request to Drools Server I have an exception:
15:45:56,578 ERROR [STDERR] 2010-05-05 15:45:56
org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
INFO: Application
{http://service.server.drools.org/}knowledgeService#{http://service.server.drools.org/}execute
has thrown exception, unwinding now: org.drools.CheckedDroolsException:
java.lang.String cannot be cast to [B
Could anybody tell me what could couse this ? Somebody had this problem?
Im running Drools Server on Jboss 5.0.0 with test drools server domain added
to the libs.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Server-Problem...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 11 months
creating custom flow components for the eclipse gui
by Geir Gullestad Pettersen
Hi,
I'm considering Drools Flow for our application which currently runs a
proprietary flow engine. This flow engine wires the nodes/tasks in the flow
using spring xml which essentially lets our customers build custom flows
which executes pojos which implement a predefined interface. It does however
lack any GUI for editing the flow, and that is my reason for considering
Drools Flow.
I have skimmed through the documentation and found many examples on how to
buld flows using the Drools components, yet I am wondering how to create
custom gui flow components for our java pojos - is that possible? Any
documentations/examples I can look at?
Thanks.
Geir Pettersen
15 years, 11 months
Drools Classloader Leak?
by malkhafaji
Hello,
I noticed (using JConsole) that my application keeps loading more and more
classes. I have over 105K classes loaded! I did a lot of debugging and
isolation until I found the line that brings the number of classes loaded
from 20K to 105K. It is this line:
this.knowledgeBase.addKnowledgePackages(packages);
packages is an array list of 8 DRLs that are compiled successfully. I am
calling the line above exactly 99 times. However, I do have 99 instances of
this.knowledgeBase. So, I have a total of 99 instances of "knowledgeBase",
and each instance is called once (line above) with 8 successfully compiled
DRLs.
I am starting to think that each instance of a KnowledgeBase somehow uses
its own Classloader? Do I need to manually get the current application
Classloader and pass it on to each instance of KnowledgeBase to ensure that
no classes are loaded more than once? Is this a leak in the Classloader that
comes inside the KnowledgeBase.addKnowledgePackage method? I did post
somewhere else about delays on the line above, and no wonder it sometimes
takes a couple of seconds to execute that line (the largest rules file I
have is 150 KB with no more than 100 rules) if it creates a new Classloader
and loads the same loaded classes AGAIN. Any insights on this?
P.S. I did a search on the forum and couldn't find anything related to this.
If you have better searching skills and found a post in that regards, please
kindly point me to it. This is a very important issue as we are going to a
live production environment in 3 weeks and I am not too happy with the
performance, specifically around the line above.
Thank you, and have a great weekend.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Classloader-Le...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 11 months
compilation problem
by Puneet duggal
Friends i am getting this error when i am preparing the package in the
business rules.
Error 500:
org/eclipse/jdt/internal/compiler/CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
why i am getting this error ?
15 years, 11 months
facts hierarchy
by Giovanni Motta
Hi all, i have a question concerning facts hierarchy, i'm looking for some
hint as i suppose the same problem could have been faced by someone on the
list.
I try to eplain with an example:
- Suppose to have a tree of facts, each object representing an UI widget.
<root>
<A id="1">
<B />
</A>
<A id="2">
<B />
</A>
</root>
- The individual elements A(1), B, A(2), B are mapped to facts, that are
inserted in a KnowledgeStatefulSession
- A rule exists that states that when an object A is selected, the B object
is automatically selected
- An event occurs that causes selection of node A(1)
The expected result is, obviously, that only the B element that is
descendant of A(1) must be automatically selected
I'm trying a way to express the 'descendant' relationship in LHS construct.
The rule will look like:
rule "A requires B"
when
$fact1: NodeFact(id == "A", selected == true)
$fact2: NodeFact(id == "B", selected == false, this DESCENDANT-OF $fact1)
then
$fact2.setSelected(true);
end
What is, in your opinion, the best way to handle this situation? What should
replace the fake "DESCENDANT-OF" match?
Do i need to use a function that returns the list of descendant nodes of
$fact1 and then match $fact2 against that?
Will this be fast when dealing with large trees?
Any suggestion will be appreciated, thank you.
Giovanni
15 years, 11 months