Re: [rules-users] Loop Drools on Multi Element
by FrankVhh
Hi,
See forall element in Drools manual:
5.8.3.6.1. Conditional Element forall
It does exactly what you describe. For the record, you may want to insert
all your line items separately to working memory.
Kind regards,
Frank
aliosha79 wrote
>
> Hi,
> i'm Alessio and i'm new in this forum. I'm learning to use drool in this
> period and i'm facing a problem.
> Briefly:
> 1- i have an xml document with a repeated element i.e.:
> <order>
> <orderLine>
> <lineItem>
> <name>item1</name>
> <quantity>35</quantity>
> </lineItem>
> <orderline>
> <orderLine>
> <lineItem>
> <name>item2</name>
> <quantity>65</quantity>
> </lineItem>
> <orderline>
> <orderLine>
> <lineItem>
> <name>item3</name>
> <quantity>52</quantity>
> </lineItem>
> <orderline>
> <priority>Normal</priority>
> </order>
>
> 2- i marshalled it in a java class named "OrderType" using jaxb library
> 3- then i want to apply a rule stating: /IF EVERY LINEITEM QUANTITY IS
> GREATER THAN 2
> THEN SET PRIORITY TO HIGH/
>
> i can access every single order line Element using this rule:
>
> when
> $Order : OrderType($Order.OrderLine[0].LineItem.Quantity.Value > 2)
> then
> $Order.getUBLRuleEnginePriority().setValue("High");
>
> $Order.addApplyedRule("hpRule");
> end
>
> But how can i cycle on each of them writing the rule at point 3?
> Thanks a lot.
> Aliosha
>
--
View this message in context: http://drools.46999.n3.nabble.com/Loop-Drools-on-Multi-Element-tp3761638p...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years
Session persistence
by Alberto R. Galdo
Hi,
We are using Drools Expert, Fusion, Flow, etc... to build a complex
event processing system and one of our main constraints is to be fault
tolerant. As such, we are using an StatefulKnowledgeSession and our system
involves processes, sets of rules, events, accumulators, ... . What we need
is to be able to reconstruct a KnowledgeSession in a given state and all
our changes in the knowledgesession need to be persisted at the very moment
a change is detected.
The documentation is sparse in this point (
http://docs.jboss.org/drools/release/5.4.0.Beta2/drools-expert-docs/html/...)
and what we've seen so far is that our rules are persisted but no
traces
of facts or events ... This would be unaceptable for our product. We need
to be able to stop our service at any time and restore the knowledge
session at any time as it was at the moment of the previous stop.
We have previous experience with JBPM 3 using a persistent storage to be
fault tolerant and it works like a charm, we can see our processes,
process instances, timers, etc... .
Can we get a *full* KnowledgeSession persistence service for Drools?
Greets,
14 years
Guvnor - verify that external RDBMS is being used to store rules
by Kevin Kelleher
Hi,
I configured an external RDBMS (Oracle) as the data store for Guvnor ( on
tomcat 6.0.35) - new repository.xml etc.
Thinks look good .. guvnor launched ok ... entered & validated rules etc ...
Now I want to verify that the rules are stored on the db. ( VERSIONING_*
files etc) as opposed to the default flat files under the tomcat install
dir.
Basically I'm not sure of the best way to do this. The db tables contain
blobs so wont "see" anything there!
Using Guvnor, I edited a test. This updated data in the datastore directory
(C:\apache-tomcat-6.0.35\bin\repository\repository\datastore). Is this
correct behaviour?
If the external DB is used, on tomcat startup, is a "copy" of everything
sent to bin/repository?
I deleted the repository dir under tomcat bin & restarted tomcat. I hoped
that the repository would be rebuilt from the db tables data but this did
not happen.
So can anyone advise?
thanks in advance,
Kevin
--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-verify-that-external-RDBMS-is-be...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years
Drools : Guvnor issue on tomcat when attempting to use Oracle DB as rule store
by Kevin Kelleher
Hi,
First time post on drools ...
I installed Guvnor 5.3.0 on tomcat 6.0.35. When I used the default
(Jackrabbit) datastore all worked fine.
I next went about trying to change guvnor to use an external RDBMS (Oracle
10g) . I generated a new repository.xml . As per reference manual I used the
Repository Configuration Manager to generate a new repository.xml file.
However on startup with new repository.xml file, I get the following errors
( console, localhost & catalina).
Can anyone shed some light ?
thanks in advance,
Kevin
###### console - start ######################
17-Feb-2012 17:14:20 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal
performanc
e in production environments was not found on the java.library.path:
C:\Progra~2
\Java\JDK15~1.0_0\bin;.;C:\windows\system32;C:\windows;C:\oracle\product\10.2.0\
client_1\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\
System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI
Technologies\ATI.ACE
\Core-Static;C:\Progra~2\Java\JDK15~1.0_0\bin;C:\apache-ant-1.7.0\bin
17-Feb-2012 17:14:20 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
17-Feb-2012 17:14:20 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 267 ms
17-Feb-2012 17:14:20 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
17-Feb-2012 17:14:20 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
17-Feb-2012 17:14:20 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
17-Feb-2012 17:14:20 org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
17-Feb-2012 17:14:20 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive guvnor.war
INFO 17-02 17:14:23,713 (RulesRepositoryConfigurator.java:getInstance:46)
Creating an instance of the RulesRepositoryConfigurator.
17-Feb-2012 17:14:24 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
17-Feb-2012 17:14:24 org.apache.catalina.core.StandardContext start
SEVERE: Context [/guvnor] startup failed due to previous errors
INFO 17-02 17:14:24,681 (LoggingHelper.java:info:49) Removing
listeners....
Removing all listeners...
Listeners removed...
INFO 17-02 17:14:24,681 (LoggingHelper.java:info:49) Shutting down
repositor
y....
INFO 17-02 17:14:24,681 (RulesRepositoryConfigurator.java:shutdown:172)
SHUTDOWN RULES CONFIG
17-Feb-2012 17:14:24 org.apache.catalina.loader.WebappClassLoader
clearReference
sThreads
SEVERE: The web application [/guvnor] appears to have started a thread named
[Ti
mer-0] but has failed to stop it. This is very likely to create a memory
leak.
17-Feb-2012 17:14:25 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
17-Feb-2012 17:14:25 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
17-Feb-2012 17:14:25 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
17-Feb-2012 17:14:25 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
17-Feb-2012 17:14:25 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
17-Feb-2012 17:14:25 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/0 config=null
17-Feb-2012 17:14:25 org.apache.catalina.startup.Catalina start
INFO: Server startup in 4457 ms
###### console - end ######################
###### localhost log -start ####################
17-Feb-2012 17:14:12 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
17-Feb-2012 17:14:12 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
17-Feb-2012 17:14:24 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of
class org.jboss.seam.servlet.SeamListener
org.jboss.seam.InstantiationException: Could not instantiate Seam component:
repositoryConfiguration
at org.jboss.seam.Component.newInstance(Component.java:2170)
at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
at
org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:143)
at org.jboss.seam.init.Initialization.init(Initialization.java:744)
at
org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.RuntimeException: exception invoking: create
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:154)
at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
at org.jboss.seam.Component.callCreateMethod(Component.java:2198)
at org.jboss.seam.Component.newInstance(Component.java:2158)
... 29 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at
org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at
org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at
org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
at
org.drools.guvnor.server.repository.RepositoryStartupService_$$_javassist_seam_0.create(RepositoryStartupService_$$_javassist_seam_0.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
... 32 more
Caused by: java.lang.OutOfMemoryError: Java heap space
###### localhost log -start ####################
###### catalina log ##########################
17-Feb-2012 16:27:52 org.apache.catalina.session.StandardManager start
SEVERE: Exception loading sessions from persistent storage
java.io.WriteAbortedException: writing aborted;
java.io.NotSerializableException:
org.drools.guvnor.server.security.rules.PackageNameTypeConverter
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1309)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at java.util.HashMap.readObject(HashMap.java:1067)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at java.util.ArrayList.readObject(ArrayList.java:591)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at
org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1509)
at
org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:998)
at
org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:394)
at
org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
at
org.apache.catalina.session.StandardManager.start(StandardManager.java:648)
at
org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:446)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4631)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.io.NotSerializableException:
org.drools.guvnor.server.security.rules.PackageNameTypeConverter
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at java.util.HashMap.writeObject(HashMap.java:1039)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at java.util.ArrayList.writeObject(ArrayList.java:569)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at
org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1585)
at
org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1015)
at
org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:528)
at
org.apache.catalina.session.StandardManager.unload(StandardManager.java:469)
at
org.apache.catalina.session.StandardManager.stop(StandardManager.java:678)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4882)
at
org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:936)
at
org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1359)
at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1330)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:326)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1110)
at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:468)
at org.apache.catalina.core.StandardService.stop(StandardService.java:604)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:788)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:662)
at org.apache.catalina.startup.Catalina.start(Catalina.java:629)
... 6 more
17-Feb-2012 16:27:55 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
#################################################
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Guvnor-issue-on-tomcat-when-atte...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years
Does Drools work with Set datatype?
by aitchnyu
I wanted faster (and cleaner) code for intersections and membership checks in
my Drools Planner 5.4 program, so (AFAIK) Set datatype can do it faster.
Can Drools work equally well with Set as with List datatype? I want to use
the `contains` and `memberOf` operations, but I dont care for index access
(set[n])
*Background*: I am developing a timetabling application in Drools Planner.
Each teacher has a list (set!) of periods he may teach. I want to find
intersecting periods between all teachers; so that I can create swap moves.
Drools now has to handle Set datatype instead of List.
--
View this message in context: http://drools.46999.n3.nabble.com/Does-Drools-work-with-Set-datatype-tp37...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years
Not possible to directly access the property
by bradypt
I'm a Drools novice but am doing a regular refactor which is causing a
problem for our existing rulebase.
Before my refactor, I had an interface Itinerary that had a getRules()
method. getRules() returned a simple POJO that had a getDestination method.
My Drools rule looked like:
rule "NZSF Accommodation - With infants" salience 101
activation-group "NZSF Accommodation"
when
itinerary : Itinerary( rules.destination memberOf
travelServicesFeatures.accommodationDestinations )
eval(isOnlineBookingAllowed(itinerary) == false)
then
TravelService travelService = addTravelService(travelServices,
TravelService.Type.ACCOMMODATION);
travelService.appendVariant(ResourceType.TEXT, "phone");
travelService.setNull(ResourceType.URL, true);
Airport destination = itinerary.getRules().getDestination();
travelService.setArguments(ResourceType.TEXT, new
ResourceRefImpl("City." + destination.getCode()));
end
All was working fine.
My refactor is simply to move Rules.getDestination() to the Itinerary
interface so I changed my rule to:
rule "NZSF Accommodation - With infants" salience 101
activation-group "NZSF Accommodation"
when
itinerary : Itinerary( destination memberOf
travelServicesFeatures.accommodationDestinations )
eval(isOnlineBookingAllowed(itinerary) == false)
then ...
Now I get:
java.lang.RuntimeException: Errors in rules: Not possible to directly access
the property 'accommodationDestinations' of declaration
'travelServicesFeatures' since it is not a pattern : [Rule name='NZSF
Accommodation - With infants']
Unable to create restriction '[QualifiedIndentifierRestr: memberOf
travelServicesFeatures.accommodationDestinations ]' for field 'destination'
in the rule 'NZSF Accommodation - With infants' : [Rule name='NZSF
Accommodation - With infants']
Any help greatly appreciated!
--
View this message in context: http://drools.46999.n3.nabble.com/Not-possible-to-directly-access-the-pro...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years
Drools Basic Example
by pprabhu59
Hello All,
I just followed JBPM installation steps from JBoss Org, just created a new
drools project.
When i try to run it has a java application i am getting the following
error.
Checked the forums but unable to get concrete solution.
Build groovy files option has not been set one way or the other: use
'options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,
CompilerOptions.ENABLED);'
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Plugin
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at
org.eclipse.jdt.internal.compiler.Compiler.initializeParser(Compiler.java:737)
at org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:294)
at org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:159)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:356)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:49)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:368)
at
org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:53)
at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:70)
at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:844)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:801)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:385)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:563)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:35)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:46)
at com.sample.DroolsTest.main(DroolsTest.java:23)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 27 more
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Basic-Example-tp3759765p3759765....
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years
Re: [rules-users] Using an OWL Ontology in drools - advice
by Anton Hughes
>
>
> Hi Anton,
> I'm (un)officially in charge of the topic. Right now I have identified the
> following topics/tasks, feel free to ask for more details on any one of
> them:
>
> 1) Use the ontology to create a fact model to write rules with : I'm
> perfecting the tool even now, in a few days the alpha version will be
> available for testing.
> It's meant to be pretty flexible, support many persistency techniques,
> provide convenience methods and will be integrated with the recent
> "traiting" (dynamic typing) technique.
> It makes some (reasonable) assumptions on the ontology, and would need use
> cases and consolidations.
>
> 1b) Once the fact model is there, we'd have to instantiate the individuals
> in the ontology as facts
> 1c) We have a side project to make this compatible with guvnor, to edit
> "semantically constrained" rules.
>
> 2) Use the definitions in the ontology to create classification rules.
> Would
> be "rule-style", in close world assumptions. My feeling is that it would
> create an execution framework for a SPIN-like language (or, if you prefer,
> a
> DRL version of the SPIN framework).
> I haven't started it yet, but could be done in a relatively few days
>
> 3) Use the definitions in the ontology to create a rule-based,
> object-oriented semantic reasoner. A proof of concept for a fuzzy semantic
> reasoner exists, but that definitely is on the TODO list. Help, as always,
> is appreciated :)
> This would be a necessary complement to the fact model, to ensure it's kept
> consistent with the ontology.
>
>
> Hi Davide
Thanks, the work youre doing sounds really exciting and promising!
I would very much like to follow your progress, and, if I can, help out.
What is the best way to follow the progress of this project?
Kind regards,
Anton
14 years