Unable to find pom.properties
by kmansoor
I'm experiencing a most unusual issue: file.isDirectory() is returning a
false on 'maven' as in:
\work\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dcwebcv\META-INF\maven
KieBuilderImpl.recurseToPomProperties:
public static File recurseToPomProperties(File file) {
if( file.isDirectory() ) {
for ( java.io.File child : file.listFiles() ) {
if ( child.isDirectory() ) {
File returnedFile = recurseToPomProperties( child );
if ( returnedFile != null ) {
return returnedFile;
}
} else if ( child.getName().endsWith( "pom.properties" ) ) {
return child;
}
}
}
return null;
}
I stepped through the code and found file.isDirectory() returning false. I
have verified the directory 'maven' has sub-directories following the
$groupId/$artifactId convention. The $artifactId directory does contain
pom.properties and pom.xml.
My environment:
Eclipse Kepler SR1
Drools: 6.0.1
Relevant pom.xml
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${kie.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
<version>${kie.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
<version>${kie.version}</version>
<exclusions>
<exclusion>
<artifactId>el-api</artifactId>
<groupId>javax.el</groupId>
</exclusion>
</exclusions>
</dependency>
This same exact setup on a colleague's machine works fine, when stepping
through the above code file.isDirectory() returned a true on 'maven' and
pom.properties was found (recursively).
Any pointers will be highly appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Unable-to-find-pom-properties-tp4028307...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
problem with drools
by Sandhya Sree
hi,
im new to drools..im trying to create a project as follows. i have a class
called Monitor which monitors a folder and creates two lists called
fileOld( which is the list of filenames in that folder at time t1) and
fileNew(which is the list of filenames in that folder at time t2). i have
another class called FileData which contains two members fileOld and
fileNew (list of strings) with getters,setters and constructor. fileOld and
fileNew from Monitor Class are passed to FileData class.
now i have to compare these two lists in a rule file and if they are not
equal i have to print the lists of files added/ deleted. how to do this in
drools.
here is my rule file:
rule "files are equal"
when
FileData(fileOld == fileNew)
then
System.out.println("files are equal");
end
rule "files not equal"
when
not FileData(fileOld == fileNew)
then
System.out.println("files are not equal");
difference(FileData.getFileOld(),FileData.getFileNew());
end
function void difference(List fileOld, List fileNew)
{
ArrayList<String> add = new ArrayList<String>(fileNew);
add.removeAll(fileOld);
System.out.println("files Added: " + add);
ArrayList<String> remove = new ArrayList<String>(fileOld);
remove.removeAll(fileNew);
System.out.println("files Removed: " + remove);
}
but this displays the following error...
Rule Compilation error : [Rule name='files not equal']
Cannot make a static reference to the non-static method getFileOld() from
the type FileData
Cannot make a static reference to the non-static method getFileNew() from
the type FileData
what can be done??
10 years, 9 months
Spring and Drools
by Stephen Masters
Hi folks,
This may well be rather premature, but I have been knocking up a little example project to demo a web application built with Spring 4 and Drools 6. Notably, *not* using the Drools Spring componentry because I prefer to roll my own Spring components. It gives me a lot of freedom to make things work how I like. I mention this, as there seem to be a lot of folks on this list with problems relating to getting their Drools Spring XML config working, and I wanted to show how easy it is to roll your own. There’s really not much code involved.
To try it out:
git clone git@github.com:gratiartis/qzr.git
cd qzr
mvn clean install
cd qzr-web
mvn tomcat7:run
And open: http://localhost:9090/
It seems to work fine on OSX and Windows 7. Hopefully it works for other platforms too.
As I mention, this may be somewhat premature, because the application is very much a work in progress (likely to be refactored lots!) and doesn’t do a lot yet. It creates a KieSession attached to the HTTP session of each user, so that users can have a chatty relationship with the rules engine. There is a web page which uses JavaScript to call a REST API to get data such as “questions”, which have been inferred in the rules engine. The idea being to have a conversation whereby the rules engine asks a question and the user’s response will be inserted as a knew ‘known’ fact. The rules are fired again to determine what is now known and what additional questions should be asked.
I have plenty of vague ideas relating to future functionality, so I’ll be beavering away at it. However, if anybody has thoughts on functionality which would be worth demoing, then feel free to fire your thoughts in my direction and I’ll see what I can do. If anybody looks closely enough to spot any bugs, then feel free to mention them (I think you can raise issues on the GitHub project), although there’s a pretty good chance that they’re just incomplete functionality.
Hopefully it’s useful to someone. Enjoy!
Steve
10 years, 9 months
Knowledge base cache
by Raja Sekhar
Hi,
During processing a 100 thousand facts read from a database. We are
measuring performance by using java's time.Some times i see a sudden rise
in the times.
It is a good solution to cache the knowledgebase.I am using
the StatefulKnowledgeSession.
Regards,
Raja Sekhar Amirapu
------------------------------------------------------
10 years, 9 months
Drools 6.x and Maven
by mattmadhavan
Hello,
I am having a hard time building any Drools 6.x examples! Maven just would
not resolve any Drools 6.x dependencies. For example I am getting the
following error when I tried to build a sample
Are the Drools 6.x artifacts present in the Maven public repo? DO I need ton
add any Drools specific repository in my repositories path?
Please note that I have no problem with Maven and Drools 5.5.0
Thanks in advance!
Matt'M
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-x-and-Maven-tp4028312.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
Nested negation constraints behavior change from Drools 5.x to 6.x
by mikerod
With both Drools v5.5.0.Final and v5.6.0.Final I observe a different behavior
than in both v6.0.0.Final and v6.0.1.Final.
in certain rules with negation wrapped around nested constraints.
I have tried to make the simplest rules to demonstrate the situation.
With a kb consisting of the following rules, which I have comments on that
describe what I've
found with the situation:
```
// Enabling this rule, makes "negation_over_nested" and
// "negation_distributed_partially_sharing" fire;
// without it they do not.
//
// I think this is due to some shared structure
// in the underlying subnetwork (I believe this is referred to as a
"segment").
// Perhaps it makes them "linked" in when otherwise they are being missed.
/** *This is commented out, uncommenting causes different firing of other
rules*
rule shared_conjunct
when
(not (String() and Integer()))
then
System.out.println("shared_conjunct");
end
*/
// Won't fire with no wm facts UNLESS
// it shares (I think) a node/subnetwork/segment with constraints
// in a rule like "rule shared_conjunct" that DOES fire
rule negation_over_nested
when
not ( (String() and Integer())
or
(String() and Integer()))
then
System.out.println("negation_over_nested");
end
// Won't fire with no wm facts
rule negation_distributed_partially_no_sharing
when
(not (String() and Long()))
and
(not (String() and Long()))
then
System.out.println("negation_distributed_partially_no_sharing");
end
// Same situation as "negation_over_nested"
rule negation_distributed_partially_sharing
when
(not (String() and Integer()))
and
(not (String() and Integer()))
then
System.out.println("negation_distributed_partially_sharing");
end
// DOES fire with no wm inserts.
// DOES NOT need "shared_conjunct" to work
rule negation_distributed_fully
when
((not String()) or (not Integer()))
and
((not String()) or (not Integer()))
then
System.out.println("negation_distributed_fully");
end
```
---
This is the only 2 rules in the kb. Running a session, with no facts
inserted and then firing all rules.
---
Drools v5.x output
with "shared_conjuct" rule uncommented:
```
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_partially_no_sharing
negation_distributed_partially_sharing
negation_over_nested
shared_conjunct
fired: 8
time elapsed: 0.0
done
```
with "shared_conjuct" rule commented out:
```
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_partially_no_sharing
negation_distributed_partially_sharing
negation_over_nested
fired: 7
time elapsed: 0.0010
done
```
---
Drools v6.x output:
with "shared_conjuct" rule uncommented:
```
shared_conjunct
negation_over_nested
negation_distributed_partially_sharing
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
fired: 7
time elapsed: 0.0
done
```
with "shared_conjuct" rule commented out:
```
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
negation_distributed_fully
fired: 4
time elapsed: 0.0
done
```
I do note in the v6.x output, "negation_distributed_partially_no_sharing"
never fires, since it is specifically not sharing any
negated conjunt with the other rules. This seems to correlate with whether
or not these rules fire.
Also, I realize my terminology is slightly off. I think this is an issue
with rules having shared "segments", where
one of these segments that is shared is the negation subnetwork introduced
in "shared_conjunct".
I also note that "negation_distributed_fully" always fires, independent of
any potential "segment" sharing.
As I mentioned in a comment on "shared_conjuct", I'm thinking this relates
to the newer PHREAK algorithm vs the original ReteOO.
Is this expected? Is there something incorrect about the structure of the
negation rules?
Perhaps I have stumbled upon a defect?
I have not had time to do any sort of deeper debugging into the issue, if I
find out more info, I'll post it up here.
p.s. I know the types are not meaningful, this is just an example to show
the difference. I hope it accomplishes this goal.
--
View this message in context: http://drools.46999.n3.nabble.com/Nested-negation-constraints-behavior-ch...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
Drools 6.0.1 with Spring - Custom Operator - Spring configuration for custom operators
by mattmadhavan
Hello,
I have defined a Drools custom operator which works great in Drools 5.4.0
and I am able to configure it to configure itvia spring Spring as follows.
<bean id=<b>"inListED"
class="org.facs.ncdb.drools.utils.InListEvaluatorDefinition" */>
<drools:kbase id="breastMeasureKBase">
<drools:resources>
<drools:resource type="DRL"
source="classpath:rules/mastrt_sequential_test.drl"/>
</drools:resources>
<*drools:configuration>
<drools:evaluators>
<drools:evaluator name="inlist" ref="inListED" />
</drools:evaluators>
</drools:configuration>*
</drools:kbase>
I am trying to do the same in Drools 6.x! How do I accomplish this? I cannot
find any documentation.
<bean id="inListED"
class="org.facs.ncdb.drools.utils.InListEvaluatorDefinition" />
<kie:kmodule id="measure">
<kie:kbase name="MASTRT" packages="MASTRT">
<kie:ksession name="breastMeasureKSession" type="stateless">
<kie:configuration>
* <drools:evaluators>
<drools:evaluator name="inlist" ref="inListED" />
</drools:evaluators>
* </kie:configuration>
</kie:ksession>/>
</drools:kbase>
</kie:kmodule>
I need to replace the *<drools:evaluator> *tag for drools 6.x?
Any ideas how to configure Drools Custom operator using Spring?
I appreciate in advance!
Thanks
Matt'M
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-0-1-with-Spring-Custom-Operato...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
@key declarations for a type - What's under the hood?
by profversaggi
Is there any way to interrogate exactly, as in get a printed representation
of what goes on under the hood for one of these type of declarations ?
As an example: (as per the docs) for a declared type like the following:
declare Person
*firstName : String @key*
*lastName : String @key*
age : int
end
The compiler will implicitly generate 3 constructors: one without
parameters,
one with the @key fields, and one with all fields.
Person() // parameterless constructor
Person( String firstName, String lastName )
Person( String firstName, String lastName, int age )
...creating an instance using the @key constructor
/Person person = new Person( "John", "Doe" );/
****************
So lets say I do the following:
declare Here
location: String @key
end
I understand that it does the above, but it *also* lets me do this as well:
* Here here = new Here("kitchen");
System.out.println( here );
System.out.println( here.getLocation(); );
$lh : Here (location == "kitchen")
System.out.println( "You are in the " + $lh.getLocation() );*
And get ...
*Here( location=kitchen )
kitchen
You are in the kitchen*
... from various rules I've created ... so there is a lot going on under the
hood, I just want to get a complete inventory of what that is and how I
inspect it for more complex type declarations.
Any ideas?
-matt
--
View this message in context: http://drools.46999.n3.nabble.com/key-declarations-for-a-type-What-s-unde...
Sent from the Drools: User forum mailing list archive at Nabble.com.
10 years, 9 months
StatefulKnowledgeSession
by Raja Sekhar
Hi,
How do cache the StatefulKnowledgeSession, instead of creating a new
session every time.
Using storm for data extraction and calling the rules to process them
--
Raja Sekhar Amirapu
------------------------------------------------------
"If any anyone can do it, i can do it. If no one else can do it, i must do
it"
10 years, 9 months