[rules-users] display all rules name.

srinivasasanda srinivasasanda at gmail.com
Thu Dec 1 23:09:29 EST 2011


Hi All,
Thanks in advance, Please clear this problem.
Please sort out my problem. I am able to display the package
names(Specification and GeoArea) but i want to display no. of rules names
which are available under each package.
(Under Specification package i have 2 rules & GeoArea package i have 2
rules)
I am getting the output Rule names as HashCode.

Specification
   org.drools.definitions.rule.impl.RuleImpl at e483a8f
   org.drools.definitions.rule.impl.RuleImpl at 7d897ca2
GeoArea
   org.drools.definitions.rule.impl.RuleImpl at 9b82c6e5
   org.drools.definitions.rule.impl.RuleImpl at 5e6f671d

My Code is below:


KnowledgeBuilder kbuilder1 = KnowledgeBuilderFactory.newKnowledgeBuilder();
       
kbuilder1.add(ResourceFactory.newUrlResource("http://localhost:8082/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/package/Specification/LATEST"),ResourceType.PKG);          
       
kbuilder1.add(ResourceFactory.newUrlResource("http://localhost:8082/guvnor-5.2.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/package/GeoArea/LATEST"),ResourceType.PKG);
       
        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages(kbuilder1.getKnowledgePackages());
        for( KnowledgePackage kp : kbase.getKnowledgePackages() ){
       
        System.out.println("------------------->"+kp.getName());
            Collection c=kp.getRules();
           
        Iterator it=c.iterator();
            while(it.hasNext())
            {
            Object ruleName=it.next();
            System.out.println("-------------------->"+ruleName);
            }

Regards, 
Srinivasa

--
View this message in context: http://drools.46999.n3.nabble.com/display-all-rules-name-tp3553740p3553740.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list