New in Drools: Updating facts retrieved in queries
by Manuel Ortiz
Hello everybody:
I have two question related to queries:
First one, the one in the subject, I have a query which retrieves facts
which have to be modified and updated in working memory. I've seen that
the StatefulKnowledgeSession.update() method has the fact handle as input.
Is it possible to set the fact handle to null? If it isn't, how can I get
the fact handle using the fact retrieved with the query?
Second one, related to writing, I though of parameterizing the query using
the fact pattern, something like this,
query "alarmExists" (AlarmFact key)
$alarm : AlarmFact(key1 == key.key1,
key2 == key.key2,
key3 == key.key3
)
end
but the rule compiler doesn't accept this sintax. Is it a requirement that
query parameters are basic java types or is there a way to write this query
using more complex Object parameters?
Thank you for your time.
Best Regards,
Manuel Ortiz.
14 years, 11 months
How to declare an array attribute within an object in a DRL file?
by fulton
I am currently using Drools Server to accept JSON-formatted insertion
messages from a PHP application. Within the DRL file, I am currently
declaring the insertion object (let's use Person, for example) using
"Declare", e.g.,
declare Person
name: String
address: AddressType
end
declare AddressType
...
end
My question is, how do you declare an array object (e.g., "Hobbies") that
can be nested within Person. I have scanned the Internet (once again!) for
longer than I care to admit and have found no examples for this simple
usage. I have unsuccessfully tried multiple variations in defining an
array, but have given up. My current intention is to avoid using externally
defined Java, if possible, and I would like to be able to define the
insertion object within the DRL to enable quick changes in the incoming JSON
format, if necessary (I know this might not be "best practice"!). Could
someone please provide me with a quick example.
Thanks! Fulton
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-declare-an-array-attribute-withi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Drools 5.1 on Websphere 7
by Yoann Charpiot
Hi,
I'm trying to validate that Drools (Expert and Guvnor) can be executed on
WAS 7 environnement but I miss information on that.
Do you have any documents that describes such possibilities?
Thanks you.
Yoann.
14 years, 11 months
How to implement custom editor for Drools Flow work definitions
by Jay
Hi fellas,
I'm trying to implement custom email node of Drools flow, to add
'attachment' property to email node.
I know how to implement defining custom work definitions, but I don't know
how to implement a custom editor for it.
Because I need a File Chooser(just like JFileChooser) for 'attachment' to
select file as attachment of email, so I want to implement a custom editor
for it.
I've created a editor using SWING and AWT, and re-define email work
definition, below info is a extract from it:
"customEditor" : "com.icil.booking.as.drools.model.EmailEditor".
But it's not work, no editor shown after db click the email node.
Could anyone help me with your good ideas? I'll very appreciate what you do
for me.
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-implement-custom-editor-for-Droo...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Drools - server requires proxy
by Sébastien Raickman
Hi guys,
I am trying to deploy drools-server 5.2.0.M1 on tomcat 7. It works good
when my proxy is set in catalina.sh, but for production environment, we
don't want that for security reasons.
In the case where no proxy is set, the server get stuck after this traces.
I have to kill it to stop it.
Do you know the reason why it requires an internet connection or a Proxy??
Thanks a lot,
Sebastien
10:37:42 CEST 2011]; root of context hierarchy
2011-04-28 10:37:42,299 INFO [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource [beans.xml]
2011-04-28 10:37:42,479 INFO [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource [knowledge-services.xml]
2011-04-28 10:37:42,666 INFO [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource [camel-server.xml]
2011-04-28 10:37:43,707 INFO [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource [META-INF/cxf/cxf.xml]
2011-04-28 10:37:43,760 INFO [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource
[META-INF/cxf/cxf-extension-jaxrs-binding.xml]
2011-04-28 10:37:43,905 INFO [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource [META-INF/cxf/cxf-extension-soap.xml]
2011-04-28 10:37:43,932 INFO [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource [META-INF/cxf/cxf-servlet.xml]
2011-04-28 10:37:44,156 INFO [CamelNamespaceHandler]
camel-osgi.jar/camel-spring-osgi.jar not detected in classpath
2011-04-28 10:37:45,606 INFO [XmlWebApplicationContext] Bean factory for
application context
[org.springframework.web.context.support.XmlWebApplicationContext@5e76f2e8]:
org.springframework.beans.factory.support.DefaultListableBeanFactory@25de152f
2011-04-28 10:37:45,819 INFO [XmlWebApplicationContext] *Bean 'cxf' is not
eligible for getting processed by all BeanPostProcessors (for example: not
eligible for auto-proxying)*
2011-04-28 10:37:46,029 INFO [DefaultListableBeanFactory] Pre-instantiating
singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@25de152f:
defining beans
[node1,kbase1,ksession1,cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.jaxrs.JAXRSBindingFactory,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,rsServer,soapServer,droolsPolicy,template,consumerTemplate,camel:beanPostProcessor,camel];
root of factory hierarchy
14 years, 11 months
Import Functions in Guvnor
by Pankaj Khattar
Can anybody share that how to import java function in the guvnor & use them
in writing rules in guvnor.
For example i have a drl file in which i have
import function com.alu.ae.ais.smp.fm.drools.service.Function.delayAlert;
in which 'Function' is the class & 'delayAlert' a method in the class, the
rule is as
rule "Delay Alert"
no-loop true
dialect "mvel"
lock-on-active
when
then
delayAlert(<method parameter>);
end
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Import-Functions-in-G...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
NullPointer after inserting fact in RHS
by dabar
I've been battling with drools and just wanting a second viewpoint. I'm
using drools 5.2.0 flow and rules.
I have a rule that inserts a new fact as part of the RHS of the rule and
then I'm getting a null pointer exception - stack below. I assume when the
fact is inserted all the rules are evaluated to build up the agenda.
I've debugged through drools code and found that in ClassFieldReader object1
is null and object2 is my new fact.
I'm interested in what a JoinNode represents as I think this is what is
being evaluated. I would guess its a join node in the flow but these don't
contain any rules so perhaps not.
Similar threads here suggest this is a fault in one of the rules but I have
about 100 rules so working out the culprit isn't straightforward.
What I really want to know is if there a way I can find out which rule is
being assessed for the agenda so I check that rule.
Caused by: java.lang.NullPointerException
at
org.drools.base.com.somecompany.prov.rulesbased.facts.ProvResponse1649170666$getMmlCommandUid.getIntValue(Unknown
Source)
at
org.drools.base.ClassFieldReader.getIntValue(ClassFieldReader.java:165)
at
org.drools.base.evaluators.EqualityEvaluatorsDefinition$IntegerEqualEvaluator.evaluate(EqualityEvaluatorsDefinition.java:1522)
at
org.drools.core.util.AbstractHashTable$SingleIndex.equal(AbstractHashTable.java:619)
at
org.drools.core.util.LeftTupleList.matches(LeftTupleList.java:190)
at
org.drools.core.util.LeftTupleIndexHashTable.getOrCreate(LeftTupleIndexHashTable.java:347)
at
org.drools.core.util.LeftTupleIndexHashTable.add(LeftTupleIndexHashTable.java:233)
at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:65)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:138)
at
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:148)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:378)
at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:190)
at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1183)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1085)
at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:889)
at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:238)
at
com.somecompany.rules.global.RulesUtils.insertFact(RulesUtils.java:159)
at
com.somecompany.rules.common.Rule_Common_HandleUnexpectedResponse___Mark_an_unexpected_response_as_handled_0.defaultConsequence(Rule_Common_HandleUnexpectedResponse___Mark_an_unexpected_response_as_handled_0.java:28)
--
View this message in context: http://drools.46999.n3.nabble.com/NullPointer-after-inserting-fact-in-RHS...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 11 months
Memory issue with drools (using 10000 rules)
by Shebs, Liron
Hello All,
I'm working at HP Software R&D and we are considering using drools in our product.
Benchmarking tests showed that running 10,000 rules consumes 382mb.
This is too high for our system requirements, and we would like to know how we can improve it.
Technical details:
- Drools version: 5.1 with default configuration.
- All rules look like this:
rule "status-Fixed-Open"
when
event : FieldChangedEvent(fieldName == "status", oldValue == "Fixed");
entity : Entity(entityType == "mock-entity");
eval(((String) entity.getFieldValue("status")).equals("Open"));
then
do Something...
end
- Loading code:
KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
for(all resources)
{
knowledgeBuilder.add(resource, ResourceType.DRL);
}
knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());
Any insights are most appreciated.
Thank You,
Liron, HP Software R&D
14 years, 11 months