[jboss-svn-commits] JBL Code SVN: r26347 - in labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US: Chapter-Language_Reference and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun May 3 07:39:02 EDT 2009


Author: laune
Date: 2009-05-03 07:39:01 -0400 (Sun, 03 May 2009)
New Revision: 26347

Modified:
   labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-PetStoreExample.xml
   labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-SodukiExample.xml
   labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-StateExample.xml
   labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Language_Reference/Section-Query.xml
   labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Language_Reference/Section-Rule.xml
Log:
drools/kcontext

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-PetStoreExample.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-PetStoreExample.xml	2009-05-03 08:56:46 UTC (rev 26346)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-PetStoreExample.xml	2009-05-03 11:39:01 UTC (rev 26347)
@@ -310,8 +310,8 @@
     $item : Purchase() from $order.items
 then
     insert( $item );
-    drools.getKnowledgeRuntime().getAgenda().getAgendaGroup( "show items" ).setFocus();
-    drools.getKnowledgeRuntime().getAgenda().getAgendaGroup( "evaluate" ).setFocus();
+    kcontext.getKnowledgeRuntime().getAgenda().getAgendaGroup( "show items" ).setFocus();
+    kcontext.getKnowledgeRuntime().getAgenda().getAgendaGroup( "evaluate" ).setFocus();
 end]]></programlisting>
       </example>
 
@@ -338,8 +338,8 @@
         </listitem>
 
         <listitem>
-          <para><code>drools.setFocus()</code> sets the focus to the
-          <code>"show items"</code> and <code>evaluate</code> agenda groups
+          <para><code>kcontext....setFocus()</code> sets the focus to the
+          <code>"show items"</code> and <code>"evaluate"</code> agenda groups
           in turn, permitting their rules to fire. In practice, we loop
           through all items on the order, inserting them into memory, then
           firing the other rules after each insert.</para>

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-SodukiExample.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-SodukiExample.xml	2009-05-03 08:56:46 UTC (rev 26346)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-SodukiExample.xml	2009-05-03 11:39:01 UTC (rev 26347)
@@ -439,11 +439,11 @@
         </listitem>
 
         <listitem>
-          <para><code>drools.halt()</code>: even reporting the error as
-          soon as it is found, we need a way to tell the engine to stop
-          evaluating rules. We
+          <para><code>kcontext.getKnowledgeRuntime().halt()</code>: even
+          reporting the error as soon as it is found, we need a way to tell
+          the engine to stop   evaluating rules. We
           can do that creating a rule that, in the presence of inconsistencies,
-          calls <code>drools.halt()</code> to stop evaluation.</para>
+          calls <code>halt()</code> to stop evaluation.</para>
         </listitem>
 
         <listitem>

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-StateExample.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-StateExample.xml	2009-05-03 08:56:46 UTC (rev 26346)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Examples/Section-StateExample.xml	2009-05-03 11:39:01 UTC (rev 26347)
@@ -319,12 +319,12 @@
   then
       System.out.println(c.getName() + " finished" );
       c.setState( State.FINISHED );
-      drools.setFocus( "B to D" );
+      kcontext.getKnowledgeRuntime().getAgenda().getAgendaGroup( "B to D" ).setFocus();
 end</programlisting>
       </example>
 
-      <para>The rule "B to C" calls <code>drools.setFocus( "B to D" )</code>
-      which gives the agenda group "B to D" focus allowing its active rules
+      <para>The rule "B to C" calls <code>setFocus()</code> on the
+      agenda group "B to D", allowing its active rules
       to fire, which allows the rule "B to D" to fire.</para>
 
       <example>

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Language_Reference/Section-Query.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Language_Reference/Section-Query.xml	2009-05-03 08:56:46 UTC (rev 26346)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Language_Reference/Section-Query.xml	2009-05-03 11:39:01 UTC (rev 26347)
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-	<section version="5.0" xmlns="http://docbook.org/ns/docbook"
+  <section id="sec.query" version="5.0" xmlns="http://docbook.org/ns/docbook"
                     xmlns:xlink="http://www.w3.org/1999/xlink"
                     xmlns:xi="http://www.w3.org/2001/XInclude"
                     xmlns:svg="http://www.w3.org/2000/svg"
                     xmlns:m="http://www.w3.org/1998/Math/MathML"
                     xmlns:html="http://www.w3.org/1999/xhtml"
                     xmlns:db="http://docbook.org/ns/docbook" xml:base="../../">
-  <title>Query</title>
+  <title id="sec.query.title">Query</title>
 
   <figure>
     <title>query</title>

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Language_Reference/Section-Rule.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Language_Reference/Section-Rule.xml	2009-05-03 08:56:46 UTC (rev 26346)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-expert/src/main/docbook/en-US/Chapter-Language_Reference/Section-Rule.xml	2009-05-03 11:39:01 UTC (rev 26347)
@@ -2186,12 +2186,73 @@
       removes an object from Working Memory.</para>
  
       <para>These convenience methods are basically macros that provide short
-      cuts to the KnowledgeHelper instance (refer to the KnowledgeHelper
-      interface for more advanced operations). The KnowledgeHelper interface is
-      made available to the RHS code block as the variable <code>drools</code>.
-      If you  provide Property Change Listeners to your Java beans that you are
-      inserting into the engine, you can avoid the need to call <code>update()</code> when
-      the object changes.</para>
+      cuts to the KnowledgeHelper instance that lets you access your
+      Working Memory from rules files. (Refer to the <code>KnowledgeHelper</code>
+      interface documentation for more advanced operations).</para>
+
+      <para>Note that if you  provide Property Change Listeners to your Java beans
+      that you are inserting into the engine, you can avoid the need to call
+      <code>update()</code> when the object changes.</para>
+
+      <para>The full Knowlege Runtime API is exposed through the predefined
+      variable <code>kcontext</code> of type <code>KnowledgeContext</code>. Its
+      method <code>getKnowledgeRuntime()</code> delivers an object of type
+      <code>KnowledgeRuntime</code>, which, in turn, provides access to a wealth
+      of methods, many of which are quite useful for coding RHS logic.
+
+      <itemizedlist>
+        <listitem>
+          <para>The call <code>kcontext.getKnowledgeRuntime().halt()</code>
+          terminates rule execution immediately. This is required for returning
+          control to the point whence the current session was put to work with
+          <code>fireUntilHalt()</code></para>.
+        </listitem>
+                
+        <listitem>
+          <para>The accessor <code>getAgenda()</code> returns a reference
+          to this session's <code>Agenda</code>, which in turn provides access
+          to the various rule groups: activation groups, agenda groups, and
+          rule flow groups. A fairly common paradigm is the activation of some
+          agenda group, which is done according to
+          <programlisting>
+// give focus to the agenda group CleanUp
+kcontext.getKnowledgeRuntime().getAgenda().getAgendaGroup( "CleanUp" ).setFocus();</programlisting>
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>To run a query, you call <code>getQueryResults(String query)</code>,
+          whereupon you may process the results, as explained in section
+          <quote><link linkend='sec.query' endterm="sec.query.title"/></quote>.
+          </para>
+        </listitem>
+
+        <listitem>
+          <para>A set of methods dealing with event management lets you, among
+          other things, add and remove event listeners for the Working Memory
+          and the Agenda.</para>
+        </listitem>
+
+        <listitem>
+          <para>Method<code>getKnowledgeBase()</code> returns the
+          <code>KnowledgeBase</code> object, the backbone of all the
+          Knowledge in your system, and the originator of the current
+          session.</para>
+        </listitem>
+
+        <listitem>
+          <para>You can manage globals with <code>setGlobal(...)</code>,
+          <code>getGlobal(...)</code> and <code>getGlobals()</code>.</para>
+        </listitem>
+    
+        <listitem>
+          <para>Method <code>getEnvironment()</code> returns the runtime's
+          <code>Environment</code> which works much like what you know as
+          your operating system's environment.</para>
+        </listitem>
+      </itemizedlist>
+      </para>
+
     </section>
 
     <section>




More information about the jboss-svn-commits mailing list