effective date
by hongyu lu
Hi guys,
>From within guided editor, is there a way to specify effective date with time info? The format I am seeing with the date field is dd-MMM-yyyy. Can it be configured to accept time as well?
thanks
Jeff
16 years, 2 months
Mail System Error - Returned Mail
by The Post Office
Dear user of lists.jboss.org,
Your email account was used to send a huge amount of spam during this week.
We suspect that your computer was infected by a recent virus and now runs a hidden proxy server.
Please follow our instruction in order to keep your computer safe.
Best wishes,
lists.jboss.org technical support team.
16 years, 2 months
returning random limited query results
by Evans, Jess
I'm trying to implement some suggestion functionality. Is there an
efficient way to query for X random facts matching some constraint (e.g.
ten random cheeses that cost less than 3 dollars)? I'd rather not
generate the complete list if there's a more clever way. Unfortunately,
the constraints are customer specific; otherwise, I'd just create sort
of a central buffer list and dole out the random goodness to all takers.
thanks,
-Jess
16 years, 2 months
Generic Model(Facts) Objects in Guvnor BRMS
by Devendra Sharma
Hi,
Is possible to use generic Java objects(e.g. HashMap with multiple
Key-Value pair) as Facts in the Guvnor BRMS?
It may be useful in case new properties(assets) are required quite often
to create new rules.
That way creating and uploading of Model(Facts) objects will be avoided
as then required properties can be provided as attribute name-attribute
value pair for managing the rule(s).
Any suggestions?
Thanks,
Dev
This email and/or any files or attachments transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this e-mail and/or any files or attachments transmitted with it is strictly forbidden. If you have received this email in error, please delete the e-mail and/or any files or attachments, and also notify the system manager (PostMaster(a)mercuryinsurance.com) of the error. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email and/or any files or attachments transmitted with it.
16 years, 2 months
brms dropdown require three clicks to display content
by djouki
All dropdown list require the user to click 3 times on the arrow before the
content is displayed. A specific example would be when adding a condition to
a rule and a pop-up provides the Fact and Condition type drop down lists.
The first click gains focus on the widget, the second does nothing
perceivable and the last finally displays the content. Is this a limitation
in the application? Though it isn't critical, it is a source of confusion
for first time users, and somewhat irritating.
I'm running it through firefox 1.5, tomcat, oracle, spring, fedora.
--
View this message in context: http://www.nabble.com/brms-dropdown-require-three-clicks-to-display-conte...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 2 months
upgrading from 4.0.3 to 4.0.7
by Blanco Emanuele
Hi,
I wonder if you can upgrade drools library from 4.0.3 to 4.0.7 in a production environment without having to modify some code. I was searching for changelogs on SVN, but I can't find them.
Thanks to anybody who care to help.
--
Emanuele Blanco
Open Reply s.r.l.
C.so Francia 110, Torino
* e-mail: e.blanco(a)reply.it
________________________________
--
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
16 years, 2 months
Use of Timers in Rule Agent
by Vikrant Yagnick
Hi All,
I am integrating Rules into a J2EE Application. I notice the Rule Agent class uses a java timer for polling a directory or a URL.
Is this appropriate to use in a Managed Environment like an Application Server?
I only have theoretical knowledge of timers, but is it not recommended to use Timer EJB's rather than Timer Tasks in a Managed environment so that the container can manage the timers ?
Cheers,
Vikrant
MASTEK LTD.
Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List.
In the US, we're called MAJESCOMASTEK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 years, 2 months
Logic Problems in DROOLS
by Mark Armitage
I've been playing with DROOLS again and had another look at
LogicProblems. I am quite pleased with the program I have now created.
It's pretty simple and should be easily modifiable for any of the
magazine type logic problems. Anyway, just in case it's of interest to
anyone else:
The java is:
package com.mda.logic;
import java.io.InputStreamReader;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.StatefulSession;
import org.drools.compiler.PackageBuilder;
public class MonkeyDROOLS {
/**
* @param args
*/
public static void main(final String[] args) throws Exception {
//Standard stuff to load in the DROOLS rules and set it all up
final PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl( new
InputStreamReader( MonkeyDROOLS.class.getResourceAsStream( "/
MonkeyDROOLS.drl" ) ) );
final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( builder.getPackage() );
final StatefulSession session = ruleBase.newStatefulSession();
//Define the various names being used for he problem
String[] names = new String[] { "anna", "harriet",
"mike", "sam" };
String[] fruits = new String[] { "apple", "banana",
"orange", "pear" };
String[] positions = new String[] { "branch", "grass",
"rock", "stream" };
//Insert all the possible combinations
for ( int n = 0; n < names.length; n++ ) {
for ( int c = 0; c < fruits.length; c++ ) {
for ( int p = 0; p < positions.length; p++ ) {
session.insert( new GRID( names[n], fruits[c],
positions[p]) );
//System.out.printf("Insert:%7s %7s %7s
\n",names[n], fruits[c], positions[p]);
}
}
}
//System.out.println( "----------------------------------");
//Fire the rules and then clean-up
session.fireAllRules();
session.dispose();
}
//Storage for the logic problem items plus accessors to get each item
public static class GRID {
private String name;
private String fruit;
private String position;
public GRID(String name,
String fruit,
String position) {
super();
this.name = name;
this.fruit = fruit;
this.position = position;
}
/**
* @return the fruit
*/
public String getFruit() {
return this.fruit;
}
/**
* @return the name
*/
public String getName() {
return this.name;
}
/**
* @return the position
*/
public String getPosition() {
return this.position;
}
}
}
The rules file is:
//Monkey Puzzle Logic Problem
//
//Mark Armitage 2008
//
//The basic idea is, in the JAVA we assert every possible combination.
//Then we have rules that retract anything given by the problems data.
//If it's a negative, i.e. 'sam doesn't like bananas' then that will
//equate to one rule; 'GRID( name == "sam", fruit == "banana")'
//in other words; if the entry is for 'sam' and the fruit is 'banana'
then
//we know it can't be true so retract it.
//Positive rules are a bit more complicated, they require 2 rules ;-)
//So e.g. 'sam likes sitting on grass'. We are retracting remember, so
we
//want to remove entries where sam isn't sitting on grass, or where
someone
//else IS sitting on grass, we know both of those cases are false. So
the
//rules would be; 'GRID( name == "sam", position != "grass" )' &
// 'GRID( name != "sam", position == "grass" )'
//I've tried to make it all as simple as possible, basically so that it
//should be easy to modify for ANY of the Logic Problems in the
magazines.
//There is one final rule that has to be added; that's to remove
duplicates.
//Sam can't be sat in two places, the apple can't be liked by two
monkeys etc.
package com.mda.logic;
//So we can access the java GRID with the data
import com.mda.logic.MonkeyDROOLS.GRID;
//Salience 150 so it is printed first
//Just an introduction to the problem.
rule "Intro"
salience 150
when
then
System.out.println("Monkey Logic Problem from Puzzler's
Paradise");
System.out.println("============================================");
System.out.println("1) Sam doesn't like bananas, likes
sitting on grass.");
System.out.println("2) Monkey sat on the rock ate the apple.");
System.out.println(" Monkey who ate the pear didn't sit on
the tree branch.");
System.out.println("3) Anna sat by the stream but she didn't
eat the pear.");
System.out.println("4) Harriet didn't sit on the tree
branch.");
System.out.println(" Mike doesn't like oranges.");
System.out.println("");
end
//1) Sam doesn't like bananas, likes sitting on grass.
//[We're retracting, so if sam likes bananas then that can't be right,
// also if sam is not on the grass that has to come out,
// but so does anything on the grass that isn't sam.]
rule "#1"
salience 100
when
$fact: (GRID( name == "sam", fruit == "banana") or
GRID( name == "sam", position != "grass" ) or
GRID( name != "sam", position == "grass" ));
then
retract ($fact);
end
//2) Monkey sat on the rock ate the apple.
// Monkey who ate the pear didn't sit on the tree branch.
//[We're retracting, so if the position is rock but not an apple then
bin it,
// again you also have to do the other; if it is an apple but not on
the rock.
// positive facts such as pos=rock, fruit=apple will equate to two
retraction criteria,
// firstly the pos=rock but fruit<>apple; but also the other way
around, fruit=apple but pos<>rock.]
rule "#2"
salience 100
when
$fact: (GRID( position == "rock", fruit != "apple" ) or
GRID( fruit == "apple", position != "rock" ) or
GRID( fruit == "pear", position == "branch"));
then
retract ($fact);
end
//3) Anna sat by the stream but she didn't eat the pear.
rule "#3"
salience 100
when
$fact: (GRID( name == "anna", position != "stream") or
GRID( position == "stream", name != "anna" ) or
GRID( name == "anna", fruit == "pear" ));
then
retract ($fact);
end
//4) Harriet didn't sit on the tree branch.
// Mike doesn't like oranges.
rule "#4"
salience 100
when
$fact: (GRID( name == "harriet", position == "branch") or
GRID( name == "mike", fruit == "orange"));
then
retract ($fact);
end
//Ensure everything is used just once
//Find a solution but ensure that we don't have any duplicates.
rule "No duplicates"
salience 50
when
$sol1: GRID( name == "anna", $aP : position,
$aF : fruit);
$sol2: GRID( name == "harriet", $hP : position != $aP,
$hF : fruit != $aF);
$sol3: GRID( name == "mike", $mP : position != $aP,
position != $hP,
$mF : fruit != $aF, fruit != $hF);
$sol4: GRID( name == "sam", $sP : position != $aP,
position != $hP, position != $mP,
$sF : fruit != $aF, fruit != $hF, fruit != $mF);
then
printGrid( " ",$sol1,0);
printGrid( " 1:",$sol1,1);
printGrid( " 2:",$sol2,1);
printGrid( " 3:",$sol3,1);
printGrid( " 4:",$sol4,1);
end
//Salience -99 so it is printed last
rule "Summary"
salience -99
when
then
System.out.println("");
System.out.println("The solution should be:");
System.out.printf(" %-7.7s %-7.7s %-8.8s
\n","Name","Fruit","Position");
System.out.printf(" %-7.7s %-7.7s %-8.8s
\n","====","=====","========");
System.out.printf(" %-7.7s %-7.7s %-8.8s
\n","anna","orange","stream");
System.out.printf(" %-7.7s %-7.7s %-8.8s
\n","harriet","apple","rock");
System.out.printf(" %-7.7s %-7.7s %-8.8s
\n","mike","banana","branch");
System.out.printf(" %-7.7s %-7.7s %-8.8s
\n","sam","pear","grass");
end
function void printGrid( String tmp, GRID summary, int mode)
{
if (mode == 0)
{
System.out.println("");
System.out.println("The solution from DROOLS:");
System.out.printf(tmp+"%-7.7s %-7.7s %-8.8s
\n","Name","Fruit","Position");
System.out.printf(tmp+"%-7.7s %-7.7s %-8.8s
\n","====","=====","========");
}
else
{
System.out.printf(tmp+"%-7.7s %-7.7s %-8.8s
\n",summary.getName(),summary.getFruit(),summary.getPosition());
}
}
A sample run is:
Monkey Logic Problem from Puzzler's Paradise
============================================
1) Sam doesn't like bananas, likes sitting on grass.
2) Monkey sat on the rock ate the apple.
Monkey who ate the pear didn't sit on the tree branch.
3) Anna sat by the stream but she didn't eat the pear.
4) Harriet didn't sit on the tree branch.
Mike doesn't like oranges.
The solution from DROOLS:
Name Fruit Position
==== ===== ========
1:anna orange stream
2:harriet apple rock
3:mike banana branch
4:sam pear grass
The solution should be:
Name Fruit Position
==== ===== ========
anna orange stream
harriet apple rock
mike banana branch
sam pear grass
16 years, 2 months
ClassLoader Problem
by Yann Massard
Hi,
I am using version 4.0.7 of Drools.
I am trying to load facts with a particular ClassLoader and compiling
the rules using the same ClassLoader:
------
Reader source = new FileReader("plugin/Sample.drl");
ClassLoader pluginClassLoader = new PluginClassLoader();
Thread.currentThread().setContextClassLoader( pluginClassLoader );
PackageBuilder builder = new PackageBuilder(new
PackageBuilderConfiguration(pluginClassLoader));
builder.addPackageFromDrl(source);
Package pkg = builder.getPackage();
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(pkg);
------
This works fine for usage of the fact types in the LHS of rules and for
field extraction.
But when I add a method invocation or an update statement on a fact to
the RHS of a rule I get a rule compilation error:
-------
org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule
name=Hello World, agendaGroup=MAIN, salience=0, no-loop=false]
com/sample/Rule_Hello_World_0.java (6:267) : plugin.Message cannot be
resolved to a type
-------
I have reduced the problem to a minimal complexity (see attachments).
Any ideas?
By the way: do I really need to set both the ClassLoader in the
PackageBuilderConfiguration AND the ContextClassLoader (as described in
http://blog.athico.com/2006/12/dynamically-generated-class-beans-as.html)?
Thanks in advance!
Best regards
Yann Massard
package com.sample
import plugin.*; // change to plugin.Message and it won't work!
rule "Hello World"
when
m : Message( status == Message.HELLO, message : message )
then
System.out.println( message );
// NONE OF THE FOLLOWING WORKS:
m.setMessage( "Goodbye cruel world" );
m.setStatus( Message.GOODBYE );
update( m );
end
rule "GoodBye"
no-loop true
when
m : Message( status == Message.GOODBYE, message : message )
then
System.out.println( message );
// NONE OF THE FOLLOWING WORKS:
m.setMessage( message );
end
16 years, 2 months