Regarding BRMS
by Ashish Soni
Hi Mark ,
I am evaluating Drools BRMS for our upcoming projects and have below
questions it would be great if you can help ..
I have created a rules package using BRMS and then trying to execute rules
using below code can you please let me know how i can see the modified
object back.
The Rules is very simple as if the name of the customer is "Ashish' then set
the phone to some value as given in the rule .
public static void main(String[] args) {
Properties properties = new Properties();
try {
properties.load(new
FileInputStream("C:\\Dev\\MyTest\\src\\com\\mytest\\MyRules.properties"));
} catch (IOException e) {
}
RuleAgent ruleAgent = RuleAgent.newRuleAgent(properties);
RuleBase rb = ruleAgent.getRuleBase();
StatefulSession session = rb.newStatefulSession();
session.addEventListener( new DebugAgendaEventListener() );
session.addEventListener( new DebugWorkingMemoryEventListener() );
WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(
session );
Customer customer = new Customer();
customer.setName("Ashish");
logger.setFileName(
"C:\\Dev\\MyTest\\src\\com\\mytest\\helloworld.txt" );
session.insert(customer);
session.fireAllRules();
logger.writeToDisk();
session.dispose();
Properties File
newInstance=true
url=
http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/AshwinPK...
poll=30
name=MyConfig
Regards,
Ashish soni
17 years, 4 months
Build Packages For Deployment (Guvnor)
by Brad Hadfield
Hi,
I am unable to build packages using guvnor -
Caused by: java.lang.NullPointerException
at
org.drools.compiler.PackageBuilder.validateUniqueRuleNames(PackageBuilder.java:826)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:548)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:287)
Is there another method for creating deployable packages for loading by the
RuleAgent?
I'm using a Properties file stipulated directory (until Guvnor becomes a
little more stable).
Thanks
17 years, 4 months
Where the declare bugs on guvnor
by Héron Nicolas
Hello,
There is a project called guvnor on the JIRA site.
Where should we report guvnor issues : in the JRules or in the guvnor
project ?
17 years, 4 months
Reasoning over hierarchies.
by Faron Dutton
I know this has probably been asked before but I cannot find any mention of
it. How does one reason over a transitive (recursive) relation in Drools?
-----------------------------------------------------------
The classic example from Prolog:
-- The relation parent(P,C) says that P is a parent of C.
parent(P,C).
-- The predicate ancestor(A,B) implies that A is an ancestor
-- of B if A is a parent of B or A is a parent of C and C
-- is an ancestor of B.
ancestor(A,B) :- parent(A,B).
ancestor(A,B) :- parent(A,C), ancestor(C,B).
-- The query ancestor(bob,frank) asks if bob is an ancestor
-- of frank.
?- ancestor(bob,frank).
-----------------------------------------------------------
In Drools, I can find the parent using
query isParent(String a, String b)
p: Person(name = a)
c: Person(name = b, parent = p)
end
likewise, I can find the grandparent using
query isGrandparent(String a, String b)
g: Person(name = a)
p: Person(parent = g)
c: Person(name = b, parent = p)
end
I am unable to formulate the query isAncestor.
17 years, 4 months
using a dsl in multiple drl files
by Thierry B
Hello,
I try to use a dsl in several DRL rule files, but it doesn't work.
In my java class, I do that :
Reader source1 = new InputStreamReader(
DroolsTest.class.getResourceAsStream( "/Test1.drl" ) );
Reader source2 = new InputStreamReader(
DroolsTest.class.getResourceAsStream( "/Test2.drl" ) );
//optionally read in the DSL (if you are using it).
Reader dsl = new InputStreamReader( DroolsTest.class.getResourceAsStream(
"/Exemple.dsl" ) );
builder.addPackageFromDrl( source1, dsl );
builder.addPackageFromDrl( source2, dsl );
Is it possible to use a same dsl file in several drl files or I have to have
one dsl for one drl ?
Thanks :-)
--
View this message in context: http://www.nabble.com/using-a-dsl-in-multiple-drl-files-tp21584358p215843...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 4 months
how to get CashMemoDtl in my dsrl file.
by manyasri.m
Hi,
how to get CashMemoDtl in my dsrl file.once i am calling executeFormRules
than rules should be fired.
In this case i am getting CashMemoHdr details it's working fine.
problem is how to get CashMemoDtl in my rule file.
CashMemoHdr hdr = new CashMemoHdr();
hdr.setBillNo(123l);
Set<CashMemoDtl> cashMemoDtls = new HashSet<CashMemoDtl>();
CashMemoDtl dtl = new CashMemoDtl();
dtl.setQuantity(11l);
cashMemoDtls.add(dtl);
hdr.setCashMemoDtls(cashMemoDtls);
service.executeFormRules(hdr);
give me proper suggestion.ASAP.
Thanks,
-Manya
--
View this message in context: http://www.nabble.com/how-to-get-CashMemoDtl-in-my-dsrl-file.-tp21583114p...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 4 months
how to get CashMemoDtl in my dsrl file.
by manyasri.m
Hi,
how to get CashMemoDtl in my dsrl file.once i am calling executeFormRules
than rules should be fired.
In this case i am getting CashMemoHdr details it's working fine.
problem is how to get CashMemoDtl in my rule file.
CashMemoHdr hdr = new CashMemoHdr();
hdr.setBillNo(123l);
Set<CashMemoDtl> cashMemoDtls = new HashSet<CashMemoDtl>();
CashMemoDtl dtl = new CashMemoDtl();
dtl.setQuantity(11l);
cashMemoDtls.add(dtl);
hdr.setCashMemoDtls(cashMemoDtls);
service.executeFormRules(hdr);
give me proper suggestion.ASAP.
Thanks,
-Manya
--
View this message in context: http://www.nabble.com/how-to-get-CashMemoDtl-in-my-dsrl-file.-tp21583068p...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 4 months
KnowledgeBuilderConfiguration
by Steven Williams
Hi guys,
It's no biggy but I was wondering whether KnowledgeBuilderConfiguration will
get an addAccumulateFunction method, similar to PackageBuilderConfiguration?
In our project we use Spring to configure Drools, which means we have a
Map<String, Class> available for accumulate functions, so we could
previously do:
config.addAccumulateFunction(entry.getKey(), entry.getValue());
Now with KnowledgeBuilderConfiguration we had to change the Map to
Map<String, String> and do the following:
config.setProperty("drools.accumulate.function." + entry.getKey(),
entry.getValue());
which seems like a retrograde step.
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
steven.williams(a)objectconsulting.com.au
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference
17 years, 4 months