[rules-users] How to integrate Declarative Fact created using Guvnor in Java

IPatel ishita.patel at usbank.com
Wed Feb 27 17:36:27 EST 2013


Hi,

Basic questions on the facts that are created in Guvnor using New
Declaritive Model

I have the facts that are created in Guvnor which i dont have java classes
defined. I am refering to the tutorial provided on Chapter 5 The Fact Model
and in that it shows how to use the declarative facts from Java.

I am having hard time following the steps. So i am going to layout below to
see if my understanding is correct:
Step 1: // get a reference to a knowledge base with a declared type:
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();

Step 2:// get the declared FactType
FactType personType = kbase.getFactType( "PackageName",  "FactName" );

Step 3:// handle the type as necessary:
Not sure what this means

Step 4:// create instances:
Object bob = personType.newInstance(); 

Step5: // set attributes values
personType.set( bob,
                "name",
                "Bob" );
Step 6: // insert fact into a session
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

Step 7:ksession.insert( bob );
Step 8:ksession.fireAllRules();

I am able to understand Step 4 thru Step 8. I guess i am having trouble
understanding step 1 and Step 3.

Can someone please help me clarify or have example for me to refer.


                                       



--
View this message in context: http://drools.46999.n3.nabble.com/How-to-integrate-Declarative-Fact-created-using-Guvnor-in-Java-tp4022625.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list