6.0 issue with remote jars and dynamic modules
by Mark Proctor
There is problem, fixed in master, for remote jars. The KieRepository currently, when using kie-ci, doesn’t obey the settings.xml active profiles. This means it is not recognising the remote configured repositories.
While this is fixed, and we’ll have binaries out in about 2 weeks, it means for now KieRepository can only resolve jars already in the local m2_repo.
Mark
12 years, 3 months
Insert to non-existing entry point causing NPE in drools server?
by dunnlow
I am sending events to drools integration server (5.5). I have a good number
of rules so I am looking at using entry points to speed things up. My
client app will send to an entry point based on the value of one of the
event attributes. While I will typically know all possible attributes, I
may occasionally get an event that has an attribute value that I have 1) not
foreseen, and/or 2) don't need any rules for. Whenever I insert an event to
an endpoint however for which I have no rules, I get a nullpointerexception
from the drools server.
Is there a way to handle this? I am considering having my client app do a
lookup in the ksession (which is persisted to a db) to determine all of the
entry points and then, if the event attribute received isn't one of them,
send to the DEFAULT entry point. Is there an easier way?
Here's a sample use case: I have am receiving events based on automobile
models. I have rules for Ford models at the Ford entry point and Honda
models at the Honda entry point. I don't care about a car if it's a Toyota,
so I have no rules (/entry points) for them. However, all events go to the
rule engine. If I send the Toyota event to the drools server, I get an
internal server error from the drools server.
Any thoughts?
Thank you,
-J
--
View this message in context: http://drools.46999.n3.nabble.com/Insert-to-non-existing-entry-point-caus...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Drools 6.0.0: Please clarify: rdrl vs rdslr and what you can do with each
by SrjTx
Drools 6.0.0
I have searched doc and google, but have not found what I am looking for -
if you have link that would be great too.
I am creating my first .dsl file and using them in a guided rule. I notice
that when you select this, the file extension is rdslr versus rdrl. Also,
you can access any .dsl (that is in the project? directory? - not clear
where all it searches)
I also notice that you can add "regular" rule parts just like a rdrl file,
but they are prefixed with a >
My question is, if you wanted, could you write only rdslr files and do
everything you could in a rdrl even if you didn't use any dsl?
Rephrased, is rdrl a subset of rdslr functionality?
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-0-0-Please-clarify-rdrl-vs-rds...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Stateless session commands and ExecutionResults (5.5.0.Final)
by Stephen Masters
Hi folks,
Can anyone explain how stateless session execution results should work? Working through the docs and tracing the code, it’s getting a bit confusing.
Firstly, according to the user manual, one should be able to insert a list of facts as a Command, and get an instance of ExecutionResults back, which can then be queried. Here’s the example code:
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
Command cmd = CommandFactory.newInsertElements( Arrays.asList( Object[] {
new Cheese( "stilton" ),
new Cheese( "brie" ),
new Cheese( "cheddar" ),
});
ExecutionResults bresults = ksession.execute( cmd );
That doesn’t compile, so I fixed it as follows:
Command cmd = CommandFactory.newInsertElements( Arrays.asList(
new Cheese( "stilton" ),
new Cheese( "brie" ),
new Cheese( "cheddar" )
));
ExecutionResults bresults = ksession.execute( cmd );
This does now compile, but running it throws a ClassCastException:
java.lang.ClassCastException: java.util.ArrayList cannot be cast to org.drools.runtime.ExecutionResults
Taking a look through the Drools code, it would appear that Command has a generic type, which in the case of an InsertElementsCommand is:
GenericCommand<Collection<FactHandle>>
In turn, the execute command in StatelessKnowledgeSessionImpl casts its result to that generic type:
public <T> T execute(Command<T> command) {
Object o = ((GenericCommand) command).execute( context );
...
return (T) o;
So the ClassCastException is because the execute method returns an ArrayList of FactHandle instead of an ExecutionResults.
I’m assuming that I must have got the wrong end of the stick somewhere, so what should I be doing to get an ExecutionResults from a stateless session, which I can then query?
Cheers,
Steve
12 years, 3 months
Accessing items in a list
by mkhan
Hi,
I am new to doorls so please can you help me.
I am trying to access an ietm from a list in a rule like ...
$data: List(this != null, size > 9) from accumulate(
$obj1 : FwVehicle(
notchCodingWire1 != null,
lineVoltage != null
)
over window:time(10s)
from entry-point "DataStream",
collectList($obj1)
)
$first : $data.get(0)
but i get an error ...
[ERR 102] Line 164:19 mismatched input '0' expecting ')' in rule "test1" in
pattern $data.get
Does anyone have any ideas what I am doing wrong please?
--
View this message in context: http://drools.46999.n3.nabble.com/Accessing-items-in-a-list-tp4027194.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Prevent re-evaluation of events in stream mode
by sumantp
Hi,
I've written a simple rule to illustrate the issue I'm running into.
Transaction events representing amounts deposited into a bank account are
inserted sequentially. The goal is to detect a transaction that is higher
than the average from a rolling window. What I'm expecting is that only the
most recent insertion is compared with the average from the window. However,
I'm observing that all previous events in the window are re-evaluated each
time a new event is inserted. So events that previously were below the
average (at that point in time) may now be above the average since
subsequent events brought the average down. I don't want those transactions
to be re-evaluated.
Here's my rule:
declare Transaction
@role(event)
end
rule "Higher than average amount"
when
$transaction : Transaction($account : getAccount(), $amount : getAmount())
Number($avg : doubleValue, $amount > $avg) from
accumulate(Transaction(getAccount() == $account, $amt : getAmount()) over
window:length(100), average($amt))
then
System.out.println("\t***ALERT***: Higher than average transaction amount
(Average = " + $avg + "): " + $transaction.toString());
end
Here's a snippet from my Java class:
public static final void main(String[] args) {
try {
// Load the knowledge base
KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieSession kSession = kContainer.newKieSession("ksession-rules");
// Insert events
List<Transaction> list = getEvents();
for (Transaction event : list) {
printEvent(event);
kSession.insert(event);
kSession.fireAllRules();
}
} catch (Throwable t) {
t.printStackTrace();
}
}
private static List<Transaction> getEvents() {
List<Transaction> list = new Vector<Transaction>();
list.add(new Transaction(1, 600));
list.add(new Transaction(1, 600));
list.add(new Transaction(1, 800)); // This should trigger an alert
list.add(new Transaction(1, 100)); // This should NOT re-evaluate previous
transactions
return list;
}
This is my kmodule.xml:
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="rules" eventProcessingMode="stream" packages="rules">
<ksession name="ksession-rules"/>
</kbase>
</kmodule>
I'm using 6.0.0.Final.
Any help is appreciated!
--
View this message in context: http://drools.46999.n3.nabble.com/Prevent-re-evaluation-of-events-in-stre...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
Fwd: Gradle/SBT example for Drools6
by Diego Alvarez Zuluaga
Hi
Anyone has a working gradle/sbt configuration for Drools6?
I tried a lot to convert the "bom" unsuccessfully :(
This is not supported by gradle or SBT:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-bom</artifactId>
<type>pom</type>
<version>6.0.0.Final</version>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
--
Diego Alvarez Zuluaga
http://d1egoaz.com/
12 years, 3 months
Optaplanner (V6.0.0) / Vehicle Routing / Speed of a Vehicle
by Suleyman Demirel
Hello everyone,
I have just found out about optaplanner and have been testing the vehicle
routing problem on the examples provided. I am not able to see how we can
change the speed of a vehicle using the data files provided. If my
calculations are not wrong, the current assumption looks like a vehicle's
speed is 30 kmh (or miles per hour, whichever is assumed to be used).
Does anyone know how that can be modified? Thanks.
--
Suleyman Demirel
12 years, 3 months