How to refer values from different sheets in drools decision table?
by Shrinath Managuli
Hi Drools,
Requires clarity on referring data in Drools Decision table,
Consider a IN case as like below,
[cid:image001.png@01CF7E9C.169B05D0]
Here the values for IN case are "F" and "M" are mapped from different sheet using the reference CONCATENATE("""", 'user-gender-datasheet'!C15, """, """, 'user-gender-datasheet'!C16, """"). When the values for IN grows, then Excel sheet references would be not maintainable.
Is there another approach available to map the values from different sheet in drools decision table?
-Shrinath
[Aspire Systems]
This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain proprietary, confidential, trade secret or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
10 years, 9 months
Does generated graph rules is build to respect a disjunctive normal form ?
by Mercier Jonathan
Hi,
We use Drools at this time to explore some possibilities. We have an old
system, clips based and with clips rules need to be wrote to a
disjunctive normal form because they are no internal processing to
transform user rule to a disjunctive normal form.
As Drools generate a graph (Phreak) i would like to know if this graph
try to represent rules as a disjunctive normal form ?
if not i would like to know if we should to use disjunctive normal form
to write rules ?
It seem disjunctive normal form could allow to do some concurrent
computation, i would like to know if drools will use this feature?
thanks
Regards
10 years, 9 months
"Cannot find KieModule" with kieServices.newKieContainer() with LATEST or RELEASE instead of explicit version number (eg: 0.0.1)
by Matteo Mortari
Hello,
in the hope this could save time if someone has been experiencing same
issue. Drools 6.0.1.Final
I had message "Cannot find KieModule" with kieServices.newKieContainer()
with LATEST or RELEASE , instead of explicit version number (eg: 0.0.1) on
a application where the KIE module Rule artifact project kjar has been
locally-installed from remote Maven repository, that is the right hand side
of this diagram:
http://docs.jboss.org/drools/release/6.0.1.Final/drools-docs/html_single/...
Meaning that before launching Application, I performed
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get
-Dartifact=com.acme:X:LATEST -DrepoUrl=
http://nexus-hostname/nexus/content/repositories/releases/
Then:
kieServices.newKieContainer() with LATEST,
kieServices.newKieContainer() with RELEASE,
failed with stack trace:
Exception in thread "main" java.lang.RuntimeException: Cannot find
KieModule: com.acme:X:RELEASE
at
org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:86)
at (...)
But kieServices.newKieContainer() with a fixed version, eg.: 0.0.2 did
indeed worked OK, if installed in the local .m2 repository.
To avoid this issue, I found only 3 possible workarounds
1 use mvn maven-dependency-plugin:go-offline but did not work all of the
time
2 manually ensure maven-metadata-local.xml file is generate in local .m2
repository
3 just download manually .jar and .pom of the remote maven repo, and then
install with mvn install:install-file
In this case, of workaround kieServices.newKieContainer() works OK with
all the version LATEST, RELEASE, and fixed version number.
Raise jira DROOLS-419 with more details and example projects, please don't
hate me if was just me missing something or not-Drools issue actually
=P
In my defense I had good intentions saving somebody's else time in case
same strange behavior, which is really strange because to me it worked only
with explicit fixed version number, and that was really bizarre ;)
Hope this helps,
Ciao
MM
10 years, 9 months
Re: [rules-users] Question about Fusion pseudoclock
by Wolfgang Laun
This is code that can be used to manipulate the pseudo-clock which is
just a pretty face without any works:
SessionPseudoClock clock;
private void advance( Date eventDate ){
long currentTime = clock.getCurrentTime();
long eventTime = eventDate.getTime();
clock.advanceTime( eventTime - currentTime, TimeUnit.MILLISECONDS );
}
Of course, you can use other ways to determine a number of
milliseconds for moving the hands of the pseudo-clock. If you use the
number of peas in a pot, it'll work just as well, although the data
might be closer to 1970.
-W
On 31/05/2014, Natalia Iglesias de Amunategui
<natalia.iglesias(a)casadearriba.net> wrote:
> Hello,
>
>
>
> I am implementing temporal rules using drools fusión 6.0.1 and the new KIE
> services api. I insert facts into the kie session that include some DATE
> fields which I later use in the rules. I also insert events using the
> pseudoclock, so I guess that means that the timestamp is kept in long
> format.
>
> The consequence is that my temporal rules do not fire at all! I have no
> @timestamp annotation in the declare of the event, so Drools internal clock
> should be used as timestamp.
>
>
>
> I have displayed the value of the pseudoclock getCurrentTime method, and
> the output shows a date of 1970:
>
>
>
>
>
>
>
> I need to understand why the clock.getTime returns dates of 1970, maybe
> when
> this is solved the rules will fire with the internal event timestamp.
>
>
>
> (After that I have tried every possible combination: creating a date or
> long
> field in the event fact representing the timestamp, converting long to date
> and viceversa, but nothing seems to work..).
>
>
>
> I enclose here the initialization that I do of the kieContainer and
> session:
>
>
>
>
>
> public static void main(final String[] args) {
>
> try {
>
>
>
> // load up the knowledge base
>
> KieServices ks = KieServices.Factory.get();
>
> KieContainer kContainer =
> ks.getKieClasspathContainer();
>
>
> System.out.println(kContainer.verify().getMessages().toString());
>
>
>
>
>
> // set stream mode as opposite to cloud mode
>
> KieBaseConfiguration kbconf =
> KieServices.Factory.get().newKieBaseConfiguration();
>
> kbconf.setOption(EventProcessingOption.STREAM );
>
>
>
> // set clock to pseudo clock to be able to advance it
> manually
>
> KieSessionConfiguration ksconf =
> KieServices.Factory.get().newKieSessionConfiguration();
>
> ksconf.setOption(ClockTypeOption.get("pseudo"));
>
>
>
>
>
> // returns ksession from kiecontainer as defined in the
> kmodule.xml file
>
> KieSession kSession =
> kContainer.newKieSession("VAPSession", ksconf);
>
>
>
>
>
> // Insert test patients and related classes, dates are
> in long format to match pseudoclock
>
> final Patient p1 = new Patient( "MrJones", 45, 1,
> true,false,false,35.0,
>
> 5000,"None","Localized
> Infiltrates","Yes","None","S.Aureus",245,false, false, 0,
>
> true,new
> SimpleDateFormat("yyyy-MM-dd").parse("2014-05-31").getTime(),"",
>
> new
> SimpleDateFormat("yyyy-MM-dd").parse("2014-05-31").getTime(),false,false,fal
> se,false);
>
> kSession.insert( p1 );
>
>
>
>
>
> // Insert test patients and related classes, dates are
> long format
>
>
>
> final Patient p2 = new Patient( "MissDaisy", 90, 1,
> true,false,true,37.0,
>
> 5000,"Purulent","Diffuse or Patchy
> Infiltrates","None","Heavy","S.Aureus",235,false, false, 0,
>
> true,new
> SimpleDateFormat("yyyy-MM-dd").parse("2014-05-31").getTime(),"",
>
> new
> SimpleDateFormat("yyyy-MM-dd").parse("2014-05-31").getTime(),false,false,tru
> e,false);
>
>
>
> kSession.insert( p2 );
>
>
>
> // define and get a reference to the entry point
>
> EntryPoint nursingStream = kSession.getEntryPoint(
> "NursingStream" );
>
>
>
> // define session clock
>
> SessionPseudoClock clock = kSession.getSessionClock();
>
>
>
> // insert events
>
> // then, while inserting events, advance the clock as
> necessary:
>
>
>
> clock.advanceTime(24, TimeUnit.HOURS);
>
> CPIScore cpiScore1 = new CPIScore(
> p1,"diagnosis",7,ToDate(clock.getCurrentTime()) );
>
> nursingStream.insert( cpiScore1 );
>
> System.out.println(cpiScore1.getcpiScoreDate());
>
>
>
> // day 2
>
> clock.advanceTime( 24, TimeUnit.HOURS );
>
> cpiScore1 = new CPIScore(
> p1,"follow-up",5,ToDate(clock.getCurrentTime()) );
>
> nursingStream.insert( cpiScore1 );
>
> System.out.println(cpiScore1.getcpiScoreDate());
>
>
>
> // day 3
>
> clock.advanceTime( 24, TimeUnit.HOURS );
>
> cpiScore1 = new CPIScore(
> p1,"follow-up",5,ToDate(clock.getCurrentTime()) );
>
> nursingStream.insert( cpiScore1 );
>
> System.out.println(cpiScore1.getcpiScoreDate());
>
>
>
>
>
> The fact classes have now long fields to represent Dates (I changed to see
> if that made a difference, it didn't). The event class has such a long
> field
> that can be defined as @timestamp but I rather prefer to use the internal
> event timestamp managed by Drools.
>
> So in my .DRL file I'd like to have:
>
>
>
> declare CPIScore
>
> @role(event)
>
> end
>
>
>
> In my rules I compare the patient hospitalization date (defined as Date and
> later as Long in the fact class) with a stream of events , and I expect
> drools to extract the correct timestamp from the event. This can't happen
> if
> 1970 is the pseudoclock date.
>
>
>
> Please advice as about how to proceed, I'm a bit lost at this point.
>
>
>
> Thanks in advance
>
> Natalia
>
>
>
>
>
> ---
> Este mensaje no contiene virus ni malware porque la protección de avast!
> Antivirus está activa.
> http://www.avast.com
>
10 years, 9 months