Agenda-group ignored when set in decision table
by Evert Penninckx
Hi
I'm trying to add rules in a decision table to an agenda group. When firing
the rules, these rules do not respect the grouping and are added to the MAIN
group.
In the DT, I add a first column under the RuleTable row with header
"AGENDA-GROUP" (thus, left of the first CONDITION column). Then, I put the
agenda group name for each row with values.
When I generate the source of this DT in guvnor, the agenda-group tag is not
present, either.
Bug? Or bad syntax?
Evert
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Agenda-group-ignored-...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 4 months
Rewriting rules
by jwillans2
Hello,
We have a rule set that need to be rewritten before being loaded into the
knowledge base. The rewrite can only be determined by data known at
runtime. Currently we can achieve this by performing string subsitutions on
the rules, however I'd like to explore more efficient (and less clumsy) ways
of doing this.
It looks like rule templates could be a less error-prone way of achieving
the same end through the use of place holders, but it still requires for the
resultant rule strings to be recompiled. I was wondering whether it is
practical to store the rules in compiled form, and then perform the
rewriting on the loaded data structures? Any suggestions and/or experience
of techniques would be very welcome.
Thanks,
James
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rewriting-rules-tp245...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 4 months
how to check if a global has been declared in a rule
by gs76pl
hi,
is it possible to check if a rule has been defined with a global as below?
global MyObject obj;
rule
when
then
Basically, i'm running below code:
ksession = kbase.newStatefulKnowledgeSession();
ksession.setGlobal("obj", new MyObject());
but if a rule doesn't have global definition my code throws an exception.
What i'd like to do is something like
ksession.getGlobal('"obj") or ksession.checkGlobalExist('"obj").
Unfortunately the first method doesn't work as it doesn't check if a global
has been declared in a rule
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/how-to-check-if-a-glo...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 4 months
Rules Integration.
by Luciano A. Andrade
Hello, I am starting to learn Drools Guvnor, I manage to make some
very basic samples, but I need to integrate it with a PHP application,
the integration, is to be something like this:
"A Page is created" when the page is created, rules should run a
complete the business logic. very basic example.
after looking around i found this resources:
http://blog.athico.com/2008/05/rest-api.html as i am understand it i
can create the rules and packages but since i dont expect to manage
the rules from the PHP app, is not uselfull.
Now i think that what i am looking for is this
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-integrati...
since the other examples i found that run some rules are from java
code.
I am currently using the Drools Guvnor Standalone 5.1, "Standalone
Guvnor with JBoss AS" , the problem is that i don't know how to use
the mvt files
http://fisheye.jboss.org/browse/JBossRules/trunk/drools-camel/src/test/re...
http://fisheye.jboss.org/browse/JBossRules/trunk/drools-camel/src/test/re...
http://fisheye.jboss.org/browse/JBossRules/trunk/drools-camel/src/test/re...
now poking around the configuration files i found the url
http://localhot:8080/drools-guvnor/org.drools.guvnor.Guvnor/guvnorAPI
but i could not found any reference to it or how to useit.
Please, any pointer will be apreciated.
Thank.
15 years, 4 months
Instructions for upgrading designer.war?
by Han Ming Low
Hi,
I understand that the designer.war is a project by intalio.
When looking at the source for the war at
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/contrib/designer/desi...,
I saw the changes to be made to make it compatible with Drools.
I think I can do some of the steps like
1) changing the web.xml to use tomcat instead of jetty
2) added slf4j library
3) move lib/bpmn2 library to web-inf/lib
4) changes to oryx.js that involve
- commenting out the header
- commenting out the log
- change the repository url from "/designer/uuidRepository?uuid="+ uuid to
"/drools-guvnor/org.drools.guvnor.Guvnor/guvnorAPI?action=load&uuid="+ uuid
However, I'm not sure what is the BPMN2 import/export classes to replace in
WEB-INF/classes
Can someone could tell me which are the classes?
I can also help to update the designer. :)
Thanks.
Han Ming
15 years, 4 months
How to write a rule that fires when it matches against specific facts in working memory.
by groovenarula
Hello,
I have a fact called 'Option' :
public class Option {
private String code;
private Item item;
public String getCode() {
return code;
}
public void setCode(String optionCode) {
this.code = optionCode;
}
At any point in time, the working memory can have several Option instances
with different code values. My rules need to fire specifically when the
working memory contains a specific set of options. e.g. Rule 1 should fire
if and only if the working memory contains 2 option instances one with code
"P1" and the other with "P2" (order should not matter).
I tried to use 'forall' as follows :
rule "Matched Options"
when
forall (
Option ( code == "P1" || code == "P2" )
)
then
//insert( new IsPriced( i ) );
System.out.println ( "Priced using G/S ");
end
However, the rule above never fires. Maybe I should be taking a different
approach. I'm still learning through how to create rules. So any
help/suggestions on how to tackle the above will be appreciated.
Thanks
Gurvinder
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-to-write-a-rule-t...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 4 months
Drools Server 5.1.1 - Something wrong with the XStream Marshaller
by OlliSee
Its impossible to add an "out-identifier" (which is pretty bad). The JSON
Marshaller works fine, though.
Can I get a clean implementation somewhere?
Exception:
Exception in thread "main" java.lang.NullPointerException
at
com.thoughtworks.xstream.io.xml.PrettyPrintWriter.writeText(PrettyPrintWriter.java:203)
at
com.thoughtworks.xstream.io.xml.PrettyPrintWriter.writeAttributeValue(PrettyPrintWriter.java:195)
at
com.thoughtworks.xstream.io.xml.PrettyPrintWriter.addAttribute(PrettyPrintWriter.java:190)
at
com.thoughtworks.xstream.io.WriterWrapper.addAttribute(WriterWrapper.java:41)
at
org.drools.runtime.help.impl.XStreamXML$InsertConverter.marshal(XStreamXML.java:119)
at
com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78)
at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63)
at
com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
at
com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:55)
at
com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78)
at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63)
at
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:115)
at
com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129)
at
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:100)
at
com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:58)
at
com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:68)
at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78)
at
com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63)
at
com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:98)
at
com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:38)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:837)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:826)
at com.thoughtworks.xstream.XStream.toXML(XStream.java:801)
at com.thoughtworks.xstream.XStream.toXML(XStream.java:789)
at olli.Main.main(Main.java:58)
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Server-5-1-1-S...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 4 months
"from" facts - working memory
by jwillans2
Hello,
My understanding was that facts evaluated using the "from" statement were
not really facts and therefore were not stored in WM, therefore in:
$event1Provider : Event1Provider()
Event1(..) from $event1Provider.evaluate()
the value of $event1Provider.evaluate() will get gc'ed (providing no other
object has a handle to it). However I read in the forum topic "Why Using
"from" Always Return A New Fact?" a post by Edson Tirelli which seemed to
indicate that fact handles are created for values returned from the "from"
statement, are these stored in WM? Do these values explicitly need to be
retracted to avoid them accumulating in WM? Or is it the case that previous
values are automatically retracted on recalls to ".evaluate" if they are
!equals?
Thanks,
James
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/from-facts-working-me...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 4 months
Isn't it possible to mock a global with e.g. Mockito or EasyMock
by dhermanns
Hi everybody,
i'm trying to mock a global using Mockito but Drools is always complaining:
Caused by: java.lang.ClassCastException:
de.lvm.verteilung.monitoring.VerteilungServicesMonitoringMBean$$EnhancerByMockitoWithCGLIB$$df2ff492
incompatible with
de.lvm.vorverteilung.monitoring.VorverteilungServicesMonitoringMBean
at
ServiceProzesse.Verteilung.Vertreterregeln.Rule_Vertretung_nach_Endnummer_0DefaultConsequenceInvoker.evaluate(Rule_Vertretung_nach_Endnummer_0DefaultConsequenceInvoker.java:22)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:917)
... 31 more
It seems that it has problems with the created subclass from Mockito. I get
the same
ClassCastException when trying this with EasyMock.
Here is my Unit-Test:
KnowledgeBase knowledgeBase = createKnowledgeBase();
StatelessKnowledgeSession ksession =
knowledgeBase.newStatelessKnowledgeSession();
VerteilungServicesMonitoringMBean monitoring =
mock(VerteilungServicesMonitoringMBean.class);
Arbeitsanstoss arbeitsanstoss = new ArbeitsanstossImpl();
arbeitsanstoss.setBenutzerId("m500516");
VerteilSperreController verteilSperreService =
mock(VerteilSperreController.class);
when(verteilSperreService.istVerteilSperreAktiv("m500516",
Ausgangskanal.LAS_BRIEFKASTEN)).thenReturn(true);
ksession.setGlobal("monitoring", monitoring);
ksession.setGlobal("verteilSperreService", verteilSperreService);
ksession.execute(arbeitsanstoss);
And my drl:
package ServiceProzesse.Verteilung.Vertreterregeln
import de.lvm.vorverteilung.services.types.SystemseitigerAnstoss;
import de.lvm.vorverteilung.services.types.Arbeitsanstoss;
import de.lvm.vorverteilung.monitoring.VorverteilungServicesMonitoringMBean;
import de.lvm.verteilung.sperre.VerteilSperreController;
import de.lvm.verteilung.sperre.Ausgangskanal;
global VorverteilungServicesMonitoringMBean monitoring;
global VerteilSperreController verteilSperreService;
rule "Vertretung nach Endnummer"
when
$a : Arbeitsanstoss()
eval( verteilSperreService.istVerteilSperreAktiv($a.getBenutzerId(),
Ausgangskanal.LAS_BRIEFKASTEN) )
then
monitoring.log("Vertretung nach Endnummer");
System.out.println("hello2");
end
Any ideas?
Thanks in advance,
Dirk
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Isn-t-it-possible-to-...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 4 months
On demand events
by James Willans
Hello,
I'm a new user of Drools and have experimented with the basics. I am
interested in processing events and have had success when defining rules
of the type:
rule "example"
when
Event1(..) from entry-point Event1Store
Event2(..) from entry-point Event2Store
then
System.out.println("Fired!");
end
Where events of type Event1 and Event2 are continually injected into
entry-points within the working memory.
The events I have in mind are formed from data that sit in data stores
that are expensive to access and I would like to explore strategies for
minimising access to these. In the above example, I assume that if
Drools does not match the pattern Event1(..) then it will not try and
match the pattern Event2(..), in which case it would not be necessary to
construct facts/events which may match the Event2(..) pattern.
I understand that the 'from' statement can be used to evaluate facts
that are not in working memory, on this basis I have defined proxy
objects that are inserted into working memory which are then evaluated
for the actual data from the database on demand:
1 rule "example"
2 when
3 $event1Provider : Event1Provider()
4 Event1(..) from $event1Provider.evaluate()
5 $event2Provider : Event2Provider()
6 Event2(..) from $event2Provider.evaluate()
7 then
8 System.out.println("Fired!");
9 end
On the basis that if line 4 fails to match, then line 5 and 6 will not
get evaluated therefore avoiding accessing the database describing the
Event2 fact/event. I think that this works - but only once, since it
looks like the system is treating these as facts, that don't expire,
rather than events. Is it the case that the 'from' statement cannot be
used for events in this way? If not, what approach should be taken to
addressing the problem I am trying to solve?
Any direction would be much appreciated.
James
15 years, 4 months