Rule storage
by FrankVhh
Hi all,
This may be a stupid question, but is there a way to see your Guvnor-rules
outside Guvnor in some kind of readable file?
I noticed jackrabbit is used as a repository, so I would like to have a look
in there, but I am not able to find it in the expanded guvnor.war folder.
The version I am using is Guvnor 5.1.1, with standard configuration.
A look in the Guvnor documentation did not help me out. Feel free to burn me
if I missed it :-)
Thanks and regards,
Frank
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rule-storage-tp274251...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 3 months
StatefulKnowledgeSession, serialization and FactHandle question
by Laird Nelson
Hello; I'm using Drools 5.2.0-SNAPSHOT.
I have a StatefulKnowledgeSession spawned from a KnowledgeBase whose
KnowledgeBaseConfiguration is set up to use equality, not identity for (as I
understand it) testing to see whether a fact is in the base or not.
I have this verified with a (nasty) assert statement (I didn't see any other
way to get the KnowledgeBaseConfiguration out, which looks like an API
omission to me):
assert ((InternalRuleBase)((
KnowledgeBaseImpl)sks.getKnowledgeBase()).getRuleBase()).getConfiguration().getAssertBehaviour().equals(AssertBehaviour.EQUALITY);
OK, so the internal knowledge base is using equality.
I stick some facts in via insert. Then I serialize the session using all
the right classes from org.drools.marshalling. I choose the full
serialization mode.
As I understand it, this means that the knowledge base and the facts will
all be serialized. I am aware of the fact that all facts will get new
identities.
At some point in the future, I deserialize the session (successfully).
When I take the same object that I inserted, and call
statefulSession.getFactHandle(myObject), I get null back.
This is despite the fact that my object has an equals() method, and that the
equals() method is heavily unit tested (and simple).
That is, despite the fact that the KnowledgeBase is confirmed to use
equality, not identity, there does not seem to be a way to test if the
session contains a particular fact. It's like identity is still being used.
Am I overlooking something obvious?
Thanks,
Laird
15 years, 3 months
Ask for help on rule authoring
by Benson Fung
Hi,
I got the following rule problem.
The rule is like :
1. | rule "Rule1"
2. | dialect "mvel"
3. | when
4. | ad : ApplicationData( age == "null" , age.size() == 0)
5. | then
6. | ad.setReturnMsg( "age should not be null or empty" );
7. | end
where setReturnMsg is a method of ApplicationData Fact();
However, I got the validation error :
[Rule1] [ERR 101] Line 4:49 no viable alternative at input ')' in rule
"Rule1" in pattern ApplicationData
[Rule1] [ERR 102] Line 4:51 mismatched input '==' expecting ')' in
rule "Rule1" in pattern ApplicationData
Please help what the problem is.
Thanks
15 years, 3 months
Drools Dyanmic Class creation Problem
by saurabh maheshwari
Hi sir ,
I am facing one issue regarding dyamic class cretion and inserting it's
object into drools memory.
i have created a dyanmic class test and loads it like that
MyClassLoader clr =new
MyClassLoader(Obj.getClass().getClassLoader());
Obj.clazz= clr.loadClass("test");
//Drools Configuration
KnowledgeBuilderConfiguration kbc =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null,clazz.getClassLoader());
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);
String path = System.getProperty("user.dir");
StringBuilder drlFile = new StringBuilder(path);
drlFile.append(System.getProperty("file.separator")).append("myRule.drl");
kbuilder.add(ResourceFactory.newFileResource(drlFile.toString()),
ResourceType.DRL);
if (kbuilder.hasErrors())
{
System.out.println(kbuilder.getErrors());
return;
}
KnowledgeBaseConfiguration kbaseConfig
=KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null,
clazz.getClassLoader());
kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig);
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
ksession = kbase.newStatefulKnowledgeSession();
Now my drl file is like that
package dyanmicclass;
dialect "java"
rule mytest1
when
$tx : test($pp : name )
then
globalArrayList.add($tx);
System.out.println($tx );
end
this is giving me a error
KnowledgeBuilder created.
Unable to generate rule invoker. : [Rule name='mytest1']
dyanmicclass/Rule_mytest1_0DefaultConsequenceInvoker.java (22:886) :
test cannot be resolved to a type
dyanmicclass/Rule_mytest1_0DefaultConsequenceInvoker.java (22:898) :
test cannot be resolved to a type
Rule Compilation error : [Rule name='mytest1']
dyanmicclass/Rule_mytest1_0.java (6:214) : txn cannot be resolved to
a type
but while i am doing like that
dialect "java"
rule mytest1
when
$tx : test($pp : name )
then
System.out.println($pp );
end
it gives no error .
I am not able to find the cause of the problem .
am i wrong in any configuaration.
Thanks
Saurabh
15 years, 3 months
accumulate min over java.util.Date
by jkrupka
Should I be able to do an accumulate min over java.util.Date objects? Like
this:
$minDate : Date() from accumulate(MyFact ($startDate : startDate),
min($startDate))
I would have thought so, but when I try it, I'm getting:
Caused by: java.lang.ClassCastException: java.util.Date cannot be cast to
java.lang.Number
at
org.drools.base.accumulators.MinAccumulateFunction.accumulate(MinAccumulateFunction.java:76)
If it should work, then it's possible I'm doing something else wrong, but
everything looks correct to me. I can always work around it by getting the
milliseconds from the Date object and doing the min over that... it's just
not as clean looking.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/accumulate-min-over-j...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 4 months
[Drools Interest] Dynamic rule loading from DB
by bilasini sahoo
Hi All,
I am new to this Drool rule ingine use.
Normal drl is working for me.
But mu requirement is i need to configure all the rules in Data base and
from there i need to inject to the Rule engine.This is beacuse Rules can be
configured any point of time.
Please let me know if is there any special foemat of rule configuration is
required so that creating rule file would be easier
currently i have configured as
(Company=CCC && Organisation=OOO and Dept=HR) OR (Country=UK)
(Company=CCC && Organisation=OOO )and (Dept=HR OR Country=UK)
please advice. I am stuck with this proble since 2days
Thanks,
Bilasini
15 years, 4 months
Attempted JIRA on BPMN2 issue in Eclipse
by drdaveg
I tried to submit this to https://issues.jboss.org/secure/, but my password
reset, while successful doesn't let me in to submit a JIRA.
On the stable (M1?) version of 5.2 I encounter the following exception.
- Create a BPMN2 diagram with a nest subprocess that has a rule task with
ruleflow-group specified (or not)
- Save it
- Reopen it
Dialog box in Eclipse:
Could not read RuleFlow file
An exception occurred while reading in the RuleFlow XML: the prefix "G" for
attribute "g:ruleFlowGroup" associated with the element type
"businessRuleTask" is not bound. See the error log for more details.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Attempted-JIRA-on-BPM...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 4 months
execute Rules selectively
by Benson Fung
Hi,
I have setup about 10 rules in the rulebase. Can you tell me how I
can execute more than one specific rule at the same time? Please help
Thanks
Benson
15 years, 4 months