Re: [rules-users] TimerService vs TimeMachine and date-effective
by Mark Proctor
On 07/06/2011 21:35, David Goldstein wrote:
> Mark,
>
> Thanks. Based upon your discussion and the manuals, I was looking for
> the Quartz jars but haven't been seeing them. Are they bundled? From
> the org.drools.runtime I am wondering if I should be instead
> implemeting org,drools.runtime.Calendars?
Drools doesn't "use" quartz scheduler. What we do allow is a quartz
calender to be used. We have our own calendar interface, but provide an
adapter so our scheduler can work with a quartz calendar.
Mark
>
> By the way, often in Drools I see an API to get from a list or hashmap
> of something (e.g., calendars, working memories,
> workingmemoryinstances). However, if you have only one of the things
> (like one calendar or one session) what should I pass to the
> .get(<string>) method to access the one item?
>
> Also, the source code includes SCenarioRunner.java which seems to be
> no longer valid.
>
> Thanks.
>
> David
>
>
> On Mon, Jun 6, 2011 at 10:41 AM, Mark Proctor<mproctor(a)codehaus.org> wrote:
>> On 06/06/2011 15:32, drdaveg(a)gmail.com wrote:
>>> Mark,
>>>
>>> I thought I had submitted a follow-up to this, but perhaps not. I'm
>>> sending this to you instead of the list to avoid generating excess traffic.
>>>
>>> I looked at CR1 and am going to look at it's source today. But neither
>>> the examples in the Drools PDF or Quartz look compatible for a clock that
>>> would work with date-expires and date-effective of rules. Quartz looks
>>> great for rules, processes and events that run on heatbeats (e.g., a cron
>>> schedule) but it looks so foreign for use as a system clock I wonder if
>>> date-expires and date-effective have been tested with the clock? Might you
>>> have an example or JUnit for this setup?
>>>
>>> I will look for one in Guvnor's source code today, where rule testing with
>>> a simulated date should have a JUnit.
>> This is in Rule and shows how effective dating works.
>> Calendar now = Calendar.getInstance();
>> now.setTimeInMillis(
>> workingMemory.getSessionClock().getCurrentTime() );
>>
>> if ( this.dateEffective != null&& this.dateExpires != null ) {
>> return (now.after( this.dateEffective )&& now.before(
>> this.dateExpires ));
>> } else if ( this.dateEffective != null ) {
>> return (now.after( this.dateEffective ));
>> } else {
>> return (now.before( this.dateExpires ));
>> }
>>
>> Unit testing should use the Pseduo clock, for the session clock, where you
>> can manually set the time.
>>
>> Mark
>>> Thanks!
>>>
>>> David Goldstein
>>>
>>> <quote author='Mark Proctor'>
>>> On 01/06/2011 21:37, drdaveg wrote:
>>>> A common issue that I am looking into is setting the execution date to
>>>> test
>>>> future or legacy rules (i.e., with dates that are not the system date.)
>>>> A
>>>> number of users have posted about TimeMachine, TimeServices and the
>>>> perils
>>>> of setting the system date - but a JIRA lists TimeMachine as being remove
>>>> and TimeServices doesn't look like it has a setter for the execution
>>>> time.
>>>>
>>>> What is the API for simulating the date to be compared against effective
>>>> and
>>>> expiration dates of rules that can be used by stateful sessions?
>>> in upcoming drools 5.2, see CR1. TimeMachine was removed. Everything
>>> should now work around the session clock, where it can use the system
>>> clock or a pseudo clock.
>>>
>>> Mark
>>>> --
>>>> View this message in context:
>>>>
>>>> http://drools.46999.n3.nabble.com/TimerService-vs-TimeMachine-and-date-ef...
>>>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users(a)lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users(a)lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>> </quote>
>>> Quoted from:
>>>
>>> http://drools.46999.n3.nabble.com/TimerService-vs-TimeMachine-and-date-ef...
>>>
>>>
>>
>>
>
13 years, 5 months
Lazy (Just-In-Time) Loading of Facts
by danny.robinson
I'm new to Drools, and really need to know if the engine can support lazy
loading of fact objects using declared types. Maybe I'm coming at this
wrong, but I want to avoid retrieval for attributes that are not referenced
during rule execution, and only retrieve attributes as the first time they
are used in the current evaluation as some objects could come from database
or other systems.
In coding terms:
if x==false && y==true
then, I should never need to retrieve 'y'.
In addition, I cannot use pojo's at design time, as my data structures are
defined by the business and loaded at runtime, so I tried looking at
declared types, but I'm not certain these will support lazy loading.
Thanks,
Danny
--
View this message in context: http://drools.46999.n3.nabble.com/Lazy-Just-In-Time-Loading-of-Facts-tp30...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Out of Memory Exception While Running Rule
by Satyendra Sharma
I uploaded a decision table with 2200 rules in a package and when I tried to
build the package it throws Exception : "java.lang.OutOfMemoryError: PermGen
space"
while its working fine with 1200 rules.
Heap size is set to max 1536 (as JBoss in my pc is not accepting more than
that size).
Please let me know how I deal with this error at the time of building
package, as my requirement is to have around 13000 rules in a single
package.
-----
Satyendra Sharma
--
View this message in context: http://drools.46999.n3.nabble.com/Out-of-Memory-Exception-While-Running-R...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Need Drools 5.1 in .NET
by yashgt
Hi,
We are trying to use the Drools 5.1 engine in a .NET application and hence
have been trying to convert the JAR files to DLLs. We use IKVM 0.46.* for
the conversion.
We have added all the JARs from the drools 5.1 package to the CLASSPATH. We
run the command:
ikvmc -target:library drools-api-5.1.1.jar
The output we get is similar to:
Note IKVMC0002: output file is "drools-api-5.1.1.dll"
Warning IKVMC0100: class "org.quartz.Calendar" not found
Warning IKVMC0111: emitted java.lang.NoClassDefFoundError in
"org.drools.runtime
.help.QuartzHelper$QuartzCalendarAdapter.isTimeIncluded(J)Z"
Warning IKVMC0100: class "com.sun.tools.xjc.Options" not found
Warning IKVMC0105: unable to compile class
"org.drools.osgi.api.Activator$Drools
("org.quartz.Calendar")
Warning IKVMC0100: class "com.thoughtworks.xstream.XStream" not found
ServiceTracker"
(missing class "org.osgi.util.tracker.ServiceTrackerCustomizer")
Warning IKVMC0105: unable to compile class "org.drools.osgi.api.Activator"
(missing class "org.osgi.framework.BundleActivator")
Warning IKVMC0100: class "org.osgi.framework.BundleContext" not found
Warning IKVMC0100: class "org.osgi.framework.ServiceReference" not found
Warning IKVMC0100: class "org.drools.osgi.api.Activator" not found
Warning IKVMC0111: emitted java.lang.NoClassDefFoundError in
"org.drools.osgi.ap
i.Activator$BundleContextInstantiator.call()Ljava.lang.Object;"
("org.osgi.framework.BundleContext")
We have done the above process for all the JAR files in the drools folder.
The DLLs do get created and we are able to compile our .NET application to
use the classes. But during execution at:
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
We get the exception that says:
- IllegalArgumentException : Unable to instantiate service for Class
'org.drools.builder.KnowledgeBuilderFactoryService"
- ClassNotFoundException:
org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl
The jar files are already in the CLASSPATH when we run the .NET app .
I am not sure whether these errors are due to the Warnings we see during
conversion.
If anyone has been successful in obtaining a DLL from drools 5.1, kindly let
me know the steps.
Thanks and regards,
Yash
--
View this message in context: http://drools.46999.n3.nabble.com/Need-Drools-5-1-in-NET-tp3034264p303426...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Exception Handling in the rule
by sdinoo
Hi,
In my when clause I have an eval statement like this
eval((ClaimsHistoryHelper.getClaimDrug(drugRefNo)).getDrugName())
For some reason, there is no DrugRecord for the given drugRefNo and hence I
get javaNullPointer exceptions
I do want to rule to continue evaluation and not stop with the error and
hence I dont want to handle exception at fireAllRules catch block
How can I handle the exception in the DRL ?
--
View this message in context: http://drools.46999.n3.nabble.com/Exception-Handling-in-the-rule-tp303322...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months
Parent ClassLoader may not be null
by Abhay B. Chaware
Hi
I am writing a drools based app. I am getting this error when I create an instance of KnowledgeBuilder
at line,
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
Here is the error. Can anyone tell what does this error mean ?
java.lang.NullPointerException: Parent ClassLoader may not be null
at java.lang.ClassLoader.<init>(ClassLoader.java:239)
at java.lang.ClassLoader.<init>(ClassLoader.java:226)
at org.drools.util.CompositeClassLoader.<init>(CompositeClassLoader.java:38)
at org.drools.util.ClassLoaderUtil.getClassLoader(ClassLoaderUtil.java:27)
at org.drools.compiler.PackageBuilderConfiguration.setClassLoader(PackageBuilderConfiguration.java:333)
at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:165)
at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:159)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:210)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:143)
at Org.drools.builder.impl.KnowledgeBuilderFactoryServiceImpl.newKnowledgeBuilder(KnowledgeBuilderFactoryS
at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:47)
at com.ts.DBconnector.readKnowledgeBase(DBconnector.java:125)
I also tried adding this
Thread.currentThread().setContextClassLoader( this.getClass().getClassLoader() );
But am still getting the same error ... please help !
-abhay
13 years, 5 months
Compatibility of serialized KnowledgePackages?
by Ansgar Konermann
Hi all,
does anyone know if KnowledgePackages which have been compiled and
serialized using Drools 5.0.1 can be de-serialized with 5.1.1 or 5.2.0.CR1?
What about the other way round, serializing with a more recent version
and de-serializing with an older version?
Are there any obstacles here due to a change in internal representation
of KnowledgePackages between versions, or is the serialized format
"designed" to be an exchange format even between versions?
Kind regards
Ansgar
13 years, 5 months
OWL and drools expert
by clement.pernot
Hi,
I want to use drools expert with OWL files and embedded this with a program.
Is it possible? If yes, how it's possible? I have search and didn't find
something, if someone can help, I will be grateful.
I know that EulerGUI take OWL files and can compile with drools expert, but
I want to embedded drools expert and OWL files in a program and I think that
it's impossible to make this with EulerGUI.
I don't know if a solution exist for embedded drools expert and OWL files
but a search for it.
Best Regards,
Clément
--
View this message in context: http://drools.46999.n3.nabble.com/rules-users-OWL-and-drools-expert-tp302...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 5 months