Sightings - Drools needs your help
by Mark Proctor
I want to revive the old Drools 2.x testimoney page, I'm hoping that
two years on and with a vastly bigger community we can get a lot more
references this time :)
There are two types of references. The official one which is handled via
our marketting department and involves formal agreements between RedHat
and the client - for obvious reasons these are time consuming to do and
hard to get people to agree too. The other side is simply a page that
has anything from a simple list of "users" or "integrators" listing
company names, to optional inclusions of logos and even small summary
sentences or large case studies - nothing is too small or too big :)
So this is what I have so far:
http://labs.jboss.com/drools/sightings.html
We can't do this without you and it really is important for helping the
adoption and growth of the software, lack of known users is often a
blocker for large corporation adoption. So please if you can help, speak
to your manager, and email me letting us know.
Mark
16 years, 12 months
add/remove rules dynamically at runtime?
by Guardian
Hello,
is it possible to add/remove rules dynamically at runtime? So that no
deploying or server reboot is necessary.
If it is possible, where is some documentation or examples about it?
Thx very much
16 years, 12 months
How does no-loop work?
by Srinath Perera
Hi All;
I was trying to use no-loop to avoid rule being triggered recursively.
However for following rule, when there are more than one one object of
type DataProduct, no-loop attribute has no effect.
rule "Collect"
no-loop true
when
q: Query();
buffer : java.util.Vector();
d: DataProduct();
then
q.addDataProduct(d);
update(q);
end
But on the other hand when there are only one object of type DataProduct
in the system, the no-loop works. Is this expected behavior or have I
uncovered a bug?
Thanks
Srinath
16 years, 12 months
Turning a non-statefull accumulate into a statefull insertLogical
by Geoffrey De Smet
Hi,
In my statefull working memory on which I fireAllRules over a 1000 timse
per second, I have rule which hurts performance because it gets
backwards chained (which is bad in my use case):
// More seating required during a period in a room than available
// in that room.
rule "roomCapacityTooSmall" // TODO improve performance, as it takes 50%
of the performance
when
$period : Period();
$room : Room($capacity : capacity);
$totalStudentListSize : Number(intValue > $capacity)
from accumulate(
Exam(period == $period, room == $room,
$studentListSize : topicStudentListSize),
sum($studentListSize)
);
then
insertLogical(new IntConstraintOccurrence(
"roomCapacityTooSmall", ConstraintType.NEGATIVE_HARD,
$period, $room));
end
In an effort to turn this into a statefull insertLogical,
I 've tried this:
// More seating required during a period in a room than available
// in that room.
rule "existExamSeating"
when
$period : Period();
$room : Room();
exists Exam(period == $period, room == $room);
not ExamSeating(period == $period, room == $room);
then
insertLogical(new ExamSeating($period, $room));
end
rule "addExamToExamSeating"
when
$exam : Exam($period : period, $room : room);
$examSeating : ExamSeating(period == $period, room == $room,
examSet not contains $exam);
then
$examSeating.getExamSet().add($exam);
update($examSeating);
end
rule "removeExamFromExamSeatingPeriod"
when
$exam : Exam($period : period, $room : room);
$examSeating : ExamSeating(examSet contains $exam,
period != $period);
then
$examSeating.getExamSet().remove($exam);
update($examSeating);
end
rule "removeExamFromExamSeatingRoom"
when
$exam : Exam($period : period, $room : room);
$examSeating : ExamSeating(examSet contains $exam,
room != room);
then
$examSeating.getExamSet().remove($exam);
update($examSeating);
end
rule "roomCapacityTooSmall"
when
$examSeating : ExamSeating(studentSize > roomCapacity, $period
: period, $room : room);
then
insertLogical(new IntConstraintOccurrence(
"roomCapacityTooSmall", ConstraintType.NEGATIVE_HARD,
$period, $room));
end
However, this turns out to be so slow it's at least 100 times slower
(and probably a lot more as I had no time to let the benchmark finish).
What could explain this?
Is "exists" or "contains" backwards chained?
Am I missing something?
Thanks for any and all help.
--
With kind regards,
Geoffrey De Smet
16 years, 12 months
Uploading the fact model to the DRools BRMS
by Akila Geethal
When I upload a jar file to the DRools BRMS it does not get uploaded. When i
try to get the clsses by the import statements it says the class cannot be
found. Are there any special way of making the jar?Should that fact
modelapplication include special libraries or etc....
16 years, 12 months
Sentence and sub-sentences in DSL...
by mmquelo massi
Another doubt on DSLs...
I know that we must specify most restrictive expressions first and less
restrictive expressions then...
But...
Look at the following .dsl defs:
[consequence][]Do this with a customer of New York =<ACTION1>
[consequence][]Do this with a customer=<ACTION2>
In Eclipse, when a press CTRL+SPACE I just get a list with only the 1st
sentence!
Why???
Massi
16 years, 12 months
DSL Editor in Eclipse Drools Plug-in...
by mmquelo massi
Hi Guys,
As far as I know the drools parser will parse the .dsl file content starting
from the 1st line going toward the last one.
So the order we follow to specify the "Language expression" does matter!
The problem is that the DSL Editor in eclipse does not allow us to rank the
dsl sentences we define.
It just fill the .dsl file following the insertion order. Once we have
defined a new sentence
we can't do anything to change the order. If we want to change the order we
have to
open "manually" the file and manage ourselves the .dsl content.
Is there any workaround to this?
Will u fix it?
Massi
16 years, 12 months
Re: [ccapi] Trying out the new TradeSystem...onCandle isnt being called
by Henry Canterburry
Mike,
Yup...I saw earlier that start had become final so I changed it to setup
and terminate which you commented should be extended. I also removed the
@Start annotation and are not observing any duplicate activation.
I'll remove my broker setter too.
As I was mentioning to Eric earlier, I would really like to see some
interfaces for TradeSystem....not just a base class. Maybe the number of
interfaces prior to the last refactoring was a bit excessive, but having
no interfaces I don't think is a good idea.
I just migrated to using the SeriesSourceToIterator... data util but
that seems not to have fixed my earlier problem of onCandle not being
called. Didn't see this functionality so I wrote that iterator. There is
so much functionality lying around AQ that I have no clue what it really
does.
As to my trade system...you can essentially ignore any of the engine
stuff...I think it would be a perfectly valid test if you simply
commented out anything rule engine related in that system class and put
in sysouts instead. I actually tried that already to see if any of the
engine setup was causing the problem but I observe the same behavior
when the class essentially does nothing. The onCandle method is still
not being called. I was looking at all the different java contexts in
the samples but couldn't figure out what would make a difference. Would
it matter how I load the system? I use the SpringContextBuilder.build
and pass a factory file and then call start on the context.
HC
Mike Kroutikov wrote:
> Its most likely a context problem... I will get to it shortly. If you
> can provide a simpler reproduction, that would be helpful (i.e. maybe
> SampleTradeSystem with just few changes?).
>
> Please, update from the head: TradeSystemBase has been changed
> slightly: rename your start()/stop() to onStart()/onStop().
>
> minor thing: you can just use brokerService from the base class, no
> need to request it second time... unless you need it as a setter
> elsewhere....
>
> And be careful with @Start annotation: AQ context will execute *all*
> methods annotated with @Start, even if one routes control to another.
> So when you switch to "onStart()", make sure you do not annotate it.
>
> Thanks for using this, and especially for the choice to live
> dangerously! You comments, feedback, and contributions are very needed.
>
> -Mike
>
> On Jan 18, 2008 10:24 PM, Henry Canterburry < canterburry(a)gmail.com
> <mailto:canterburry@gmail.com>> wrote:
>
> Mike...yes...I do live dangerously but it's because I see all the
> good
> things you guys are cranking out and I don't want to miss out on the
> latest. I am seeing however how it causes me headaches tho :-)
>
> Yes, I am using the TradeSystemBase from simple and I primarily
> based my
> strategy off of SampleTradeSystem:
>
> @TradeSystem
> public class RuleBaseTradeSystem extends TradeSystemBase {
>
> private String[] ruleFiles;
> private String[] flowFiles;
> private StatefulEngine engine;
> private String description;
> private String name;
> private String flowID;
>
> private Account account;
> @Inject
> private IStoreService storeService;
>
> private IBroker broker;
>
> @Inject(name="broker")
> public void setBroker(IBroker broker) {
> this.broker = broker;
> }
>
> @Start
> public void start() throws Exception {
>
> log.info ("start(): RuleBaseTradeSystem started...");
>
> subscribeToCandleStream(
> new InstrumentSpecification(new Symbol("^GSPC")),
> TimeFrame.TIMEFRAME_1_DAY );
>
> DecisionRequest request = new DecisionRequest();
> request.addRequestObject("account", account);
> request.addRequestObject("orders", new
> NamedCollection<Order>("orders"));
> request.addRequestObject("constraints", new
> NamedCollection<OrderConstraint>("constraints"));
> request.setRuleflowID(this.flowID);
>
> DecisionResponse response = engine.execute(request);
> }
>
> public void setAccount(Account account) {
> this.account = account;
> }
>
> public RuleBaseTradeSystem(String name,
> String description,
> String[] ruleFiles) throws Exception {
>
> this.name <http://this.name> = name;
> this.description = description;
> this.ruleFiles = ruleFiles;
> this.engine =
> RuleServiceFactory.getInstance ().newStatefulEngine(ruleFiles);
> }
>
> public RuleBaseTradeSystem(String name,
> String description,
> String[] ruleFiles,
> String[] ruleFlowFiles,
> String flowID) throws Exception {
>
> this.name <http://this.name> = name;
> this.description = description;
> this.ruleFiles = ruleFiles;
> this.flowFiles = ruleFlowFiles;
> this.engine =
> RuleServiceFactory.getInstance().newStatefulEngine(ruleFiles,
> ruleFlowFiles);
> this.flowID = flowID;
> }
>
> public String getDescription() {
> return description;
> }
>
> public String getName() {
> return name;
> }
>
>
> @Override
> public void onCandle(Candle candle) throws Exception {
> this.engine.onCandle(candle);
> }
>
>
> @Override
> public void onQuote(Quote quote) throws Exception {
> this.engine.onQuote(quote);
> }
>
>
>
> @Override
> public void stop() {
> super.stop();
> destroy();
> }
>
> public void destroy(){
> this.engine.destroy ();
> this.engine = null;
> }
>
>
>
> }
>
> Mike Kroutikov wrote:
> > Henry, you like to live dangerously :). This stuff is 1 day old. Not
> > even discussed/approved.
> >
> > Are you using base class for your TS? If yes, which one? Did you
> just
> > re-worked "SampleTradeSystem" ?
> >
> > -Mike
> >
> > On Jan 18, 2008 4:04 PM, Henry Canterburry <
> canterburry(a)gmail.com <mailto:canterburry@gmail.com>
> > <mailto:canterburry@gmail.com <mailto:canterburry@gmail.com>>>
> wrote:
> >
> > I have refactored my working back testing strategy into the new
> > HEAD TradeSystem implementation. I looked at the
> SampleTradeSystem
> > and configuration to derive this.
> >
> > I have created a new DaoCandleIteratatorSource to pull
> quotes from
> > the DB and "stream" them. This seems to be working, I see data
> > being passed from my tables when I debug. The @Start method
> in my
> > strategy is called, however, the onCandle method in my strategy
> > isn't being called at all even though the context iterates
> over my
> > DaoCandeIteratorSource and pulls Candles.
> >
> > I do have this statement in my start():
> >
> > subscribeToCandleStream(
> > new InstrumentSpecification(new
> Symbol("^GSPC")),
> > TimeFrame.TIMEFRAME_1_DAY);
> >
> > Any ideas?
> >
> > Thanks
> > HC
> >
> > Here is my configuration file (I also have a stand alone
> strategy
> > config file with just my strategy defined in it):
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
> > " http://www.springframework.org/dtd/spring-beans-2.0.dtd"
> > <http://www.springframework.org/dtd/spring-beans-2.0.dtd >>
> > <beans>
> >
> >
> > <bean id="broker"
> class="org.activequant.broker2.MockBroker" />
> > <bean id="reportingService"
> > class="
> org.activequant.container.report.MockReportingService" />
> > <bean id="storeService"
> > class="org.activequant.util.store.MockStore" />
> >
> > <!-- DATA ACCESS -->
> > <bean
> >
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
> > <property name="locations">
> > <list>
> >
> > <value>classpath:data/database/database.properties</value>
> >
> >
> <value>classpath:application/backtest/exits/config.properties</value>
> > </list>
> > </property>
> > </bean>
> > <import
> resource="classpath:dao/hibernate/dao-hibernate.xml"/>
> > <bean id="candleSeriesSource"
> >
> class="org.activequant.data.retrieval.integration.series.DaoCandleIteratorSource">
> > <constructor-arg ref="candleDao"/>
> > </bean>
> > <!-- DATA ACCESS END -->
> >
> > <bean id="default"
> > class="org.activequant.container.context.DefaultBeanList">
> > <constructor-arg ref="broker" />
> > </bean>
> >
> > <!-- REPLAY -->
> > <bean id="replayService"
> > class="org.activequant.data.util.MarketDataReplayService" >
> > <property name="candleSeriesDataSource"
> > ref="candleSeriesSource" />
> > <property name="startTimeStamp" value="20071205"/>
> > <property name="endTimeStamp" value="20071211"/>
> > </bean>
> > <bean id="runner"
> > class="org.activequant.container.context.BacktestRunner">
> > <constructor-arg ref="replayService" />
> > </bean>
> > <!-- REPLAY END -->
> >
> > <!-- ACCOUNT -->
> > <bean id="accountDao"
> > class="org.activequant.dao.mock.MockAccountDao " />
> > <bean id="accountLookup"
> > class="org.activequant.util.spring.AccountLookup">
> > <property name="accountDao" ref="accountDao"/>
> > <property name="accountId" value="1"/>
> > </bean>
> > <!-- ACCOUNT END -->
> >
> > <bean id="replayService.candleSubscriptionSource "
> >
> class="org.springframework.beans.factory.config.PropertyPathFactoryBean"/>
> > </beans>
> >
> > _______________________________________________
> > ccapi mailing list
> > ccapi(a)activestocks.de <mailto:ccapi@activestocks.de>
> <mailto:ccapi@activestocks.de <mailto:ccapi@activestocks.de>>
> > http://activestocks.de/cgi-bin/mailman/listinfo/ccapi
> >
> >
>
>
16 years, 12 months
Rules Pattern Map['key'] does not work in trunk
by Philokratis
Hi guys,
I have the following rule that does not give the expected result,
I have succesfully tried to bind the map[key] to a variable but again '=='
does not work as expected.
Is there any error in the rule or the way Map is used ?
Thanks
*
rule* "report3"
*when
*
MyContainer( map['test1'] == "test1" )
*then
*
System.out.println( drools.getRule());
*end*
*MyContainer definition is *
*public* *class* MyContainer
*implements*
*Serializable {*
*private Map<String, String> map;
*
*public* Map<String, String> getMap() {
*return* *this*.map;
}
*public* *void* setMap(Map<String, String> map) {
*this*.map = map;
}
}
16 years, 12 months