From: <jbo...@li...> - 2006-05-31 19:33:14
|
Author: mar...@jb... Date: 2006-05-31 15:32:10 -0400 (Wed, 31 May 2006) New Revision: 4531 Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Agenda.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/AgendaEventListener.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/AgendaFilter.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Authoring.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Authoring.svg labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Copy of Section-What_is_a_Rule_Engine.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Inference_Engine.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Inference_Engine.svg labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Logical_Assertion.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Logical_Assertion.svg labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/PackageBuilder.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/PackageBuilderConfiguration.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/RuleBase.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/RuleBaseConfiguration.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/RuleBaseFactory.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Runtime.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Runtime.svg labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-The_Drools_Rule_Engine.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Stated_Assertion.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Stated_Assertion.svg labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Truth_Maintenance_System.drl.vsd labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Two_Phase.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Two_Phase.svg labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Two_Phase.vsd labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/WorkingMemory.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/WorkingMemoryEventListener.png labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/arch_overview.vsd Removed: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Agenda.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Event_Model.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Rule_Base.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Working_Memory.xml Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Examples/Section-Examples.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-Rules.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Section-What_is_a_Rule_Engine.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Overview.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Package.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Query.xml labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Language/Section-Rule.xml labs/jbossrules/trunk/documentation/manual/en/master.xml Log: -updated docs Modified: labs/jbossrules/trunk/documentation/manual/en/Chapter-Examples/Section-Examples.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Examples/Section-Examples.xml 2006-05-31 19:25:18 UTC (rev 4530) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Examples/Section-Examples.xml 2006-05-31 19:32:10 UTC (rev 4531) @@ -3,16 +3,20 @@ <title>Getting the examples</title> <para>Some examples are included as "integration tests" in the Drools source - code. On top of these, you can download the drools-examples module. This - module is always having more samples added to it by users. The example - project in eclipse requires that you have the plugin instilled: load up the - drools-examples project (it has an eclipse project already setup). The rules - all have example classes that execute the rules. If you want to try the - examples in another project (or another IDE) then you will need to setup the - dependencies by hand of course.</para> + code - specifically the drools-compiler module. On top of these, you can + download the drools-examples module; which is a self contained Eclipse + project. This module is always having more samples added to it by users. The + example project in eclipse requires that you have the plugin instilled: load + up the drools-examples project (it has an eclipse project already setup). + The rules all have example classes that execute the rules. If you want to + try the examples in another project (or another IDE) then you will need to + setup the dependencies by hand of course.</para> <para>The examples can be found at http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-examples/ (you can browse online, or use a subversion client and download the project into Eclipse</para> + + <para>Future documentation will include walk throughs for each of the + examples.</para> </section> \ No newline at end of file Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Agenda.png =================================================================== (Binary files differ) Property changes on: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Agenda.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/AgendaEventListener.png =================================================================== (Binary files differ) Property changes on: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/AgendaEventListener.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/AgendaFilter.png =================================================================== (Binary files differ) Property changes on: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/AgendaFilter.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Authoring.png =================================================================== (Binary files differ) Property changes on: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Authoring.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Authoring.svg =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Authoring.svg 2006-05-31 19:25:18 UTC (rev 4530) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Authoring.svg 2006-05-31 19:32:10 UTC (rev 4531) @@ -0,0 +1,145 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> +<!-- Generated by Microsoft Visio 11.0, SVG Export, v1.0 Authoring.svg Page-1 --> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="4.86755in" + height="4.12084in" viewBox="0 0 350.464 296.7" xml:space="preserve" color-interpolation-filters="sRGB" class="st8"> + <v:documentProperties v:langID="1033" v:metric="true" v:viewMarkup="false"/> + + <style type="text/css"> + <![CDATA[ + .st1 {fill:#e8eef7;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} + .st2 {fill:#000000;font-family:Arial;font-size:1.00001em} + .st3 {font-size:1em} + .st4 {fill:#ffffff;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} + .st5 {marker-end:url(#mrkr13-28);stroke:#4677bf;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} + .st6 {fill:#4677bf;fill-opacity:1;stroke:#4677bf;stroke-opacity:1;stroke-width:0.08695652173913} + .st7 {fill:none;stroke:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.72} + .st8 {fill:none;fill-rule:evenodd;font-size:12;overflow:visible;stroke-linecap:square;stroke-miterlimit:3} + ]]> + </style> + + <defs id="Markers"> + <g id="lend13"> + <path d="M 3 1 L 0 0 L 3 -1 L 3 1 " style="stroke:none"/> + </g> + <marker id="mrkr13-28" class="st6" v:arrowType="13" v:arrowSize="2" v:setback="34.5" refX="-34.5" orient="auto" + markerUnits="strokeWidth"> + <use xlink:href="#lend13" transform="scale(-11.5,-11.5) "/> + </marker> + </defs> + <g v:mID="0" v:index="1" v:groupContext="foregroundPage"> + <title>Page-1</title> + <v:pageProperties v:drawingScale="0.0393701" v:pageScale="0.0393701" v:drawingUnits="24" v:shadowOffsetX="8.50394" + v:shadowOffsetY="-8.50394"/> + <v:layer v:name="Connector" v:index="0"/> + <g id="shape1-1" v:mID="1" v:groupContext="shape" transform="translate(87.4444,-253.941)"> + <title>Rectangle</title> + <desc>Parser</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> + <v:textRect cx="42.5197" cy="275.441" width="85.04" height="42.5197"/> + <rect x="0" y="254.181" width="85.0394" height="42.5197" rx="5.66929" ry="5.66929" class="st1"/> + <text x="24.85" y="279.04" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Parser</text> </g> + <g id="shape5-4" v:mID="5" v:groupContext="shape" transform="translate(87.4444,-167.484)"> + <title>Rectangle.5</title> + <desc>(descr) Intermediate AST</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> + <v:textRect cx="42.5197" cy="275.441" width="85.04" height="42.5197"/> + <rect x="0" y="254.181" width="85.0394" height="42.5197" rx="5.66929" ry="5.66929" class="st1"/> + <text x="23.86" y="264.64" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>(descr)<v:newlineChar/><tspan + x="9.17" dy="1.2em" class="st3">Intermediate </tspan><tspan x="30.86" dy="1.2em" class="st3">AST</tspan></text> </g> + <g id="shape6-9" v:mID="6" v:groupContext="shape" transform="translate(4.39717,-163.705)"> + <title>Document</title> + <desc>xml drl</desc> + <v:userDefs> + <v:ud v:nameU="visDescription" v:val="VT4(Use to add a document or file to your system diagram.)"/> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(2,2,2,2)" v:tabSpace="42.5197"/> + <v:textRect cx="25.5118" cy="271.189" width="51.03" height="51.0236"/> + <path d="M34.02 228.67 L51.02 245.68 L34.02 245.68 L34.02 228.67 Z M0 228.67 L0 296.7 L51.02 296.7 L51.02 245.68 L34.02 + 245.68 L34.02 228.67 L0 228.67 Z" class="st4"/> + <text x="16.17" y="267.59" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>xml<v:newlineChar/><tspan + x="18.83" dy="1.2em" class="st3">drl</tspan></text> </g> + <g id="shape2-13" v:mID="2" v:groupContext="shape" transform="translate(9.49165,-0.24)"> + <title>Rectangle.2</title> + <desc>Package Builder</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197" v:verticalAlign="0"/> + <v:textRect cx="120.472" cy="236.464" width="240.95" height="120.472"/> + <rect x="0" y="176.228" width="240.945" height="120.472" rx="5.66929" ry="5.66929" class="st1"/> + <text x="4" y="191.03" class="st2" v:langID="2057"><v:paragraph/><v:tabList/>Package Builder</text> </g> + <g id="shape3-16" v:mID="3" v:groupContext="shape" transform="translate(151.799,-7.32661)"> + <title>Rectangle.3</title> + <desc>Code Generator</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> + <v:textRect cx="42.5197" cy="275.441" width="85.04" height="42.5197"/> + <rect x="0" y="254.181" width="85.0394" height="42.5197" rx="5.66929" ry="5.66929" class="st1"/> + <text x="28.18" y="271.84" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Code <tspan x="15.51" + dy="1.2em" class="st3">Generator</tspan></text> </g> + <g id="shape4-20" v:mID="4" v:groupContext="shape" transform="translate(151.799,-64.0195)"> + <title>Rectangle.4</title> + <desc>Compiler</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> + <v:textRect cx="42.5197" cy="275.441" width="85.04" height="42.5197"/> + <rect x="0" y="254.181" width="85.0394" height="42.5197" rx="5.66929" ry="5.66929" class="st1"/> + <text x="18.52" y="279.04" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Compiler</text> </g> + <g id="shape8-23" v:mID="8" v:groupContext="shape" v:layerMember="0" transform="translate(122.877,-167.484)"> + <title>Dynamic connector</title> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <path d="M7.09 296.7 L7.09 335.19" class="st5"/> + </g> + <g id="shape11-29" v:mID="11" v:groupContext="shape" v:layerMember="0" transform="translate(122.877,-253.941)"> + <title>Dynamic connector.11</title> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <path d="M7.09 296.7 L7.09 332.36" class="st5"/> + </g> + <g id="shape13-34" v:mID="13" v:groupContext="shape" transform="translate(0.72,-169.988)"> + <title>Sheet.13</title> + <rect x="0" y="280.7" width="104" height="16" rx="5.66929" ry="5.66929" class="st7"/> + </g> + <g id="shape7-36" v:mID="7" v:groupContext="shape" v:layerMember="0" transform="translate(29.909,-231.736)"> + <title>Dynamic connector.7</title> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <path d="M0 296.7 L0 258.91 A5.66929 5.66929 0 0 1 5.67 253.24 L49.26 253.24" class="st5"/> + </g> + <g id="shape9-41" v:mID="9" v:groupContext="shape" transform="translate(299.2,-26.4605)"> + <title>Document.9</title> + <desc>package</desc> + <v:userDefs> + <v:ud v:nameU="visDescription" v:val="VT4(Use to add a document or file to your system diagram.)"/> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(2,2,2,2)" v:tabSpace="42.5197"/> + <v:textRect cx="25.5118" cy="271.189" width="51.03" height="51.0236"/> + <path d="M34.02 228.67 L51.02 245.68 L34.02 245.68 L34.02 228.67 Z M0 228.67 L0 296.7 L51.02 296.7 L51.02 245.68 L34.02 + 245.68 L34.02 228.67 L0 228.67 Z" class="st4"/> + <text x="2.81" y="274.79" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>package</text> </g> + <g id="shape10-44" v:mID="10" v:groupContext="shape" v:layerMember="0" transform="translate(250.437,-53.3896)"> + <title>Dynamic connector.10</title> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <path d="M0 289.61 L40.48 289.61" class="st5"/> + </g> + </g> +</svg> Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Copy of Section-What_is_a_Rule_Engine.xml =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Copy of Section-What_is_a_Rule_Engine.xml 2006-05-31 19:25:18 UTC (rev 4530) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Copy of Section-What_is_a_Rule_Engine.xml 2006-05-31 19:32:10 UTC (rev 4531) @@ -0,0 +1,576 @@ +<?xml version="1.0" encoding="UTF-8"?> +<section> + <title>What is a Rule Engine</title> + + <section> + <title>Background</title> + + <para>Artificial Intelligence (A.I.) is a very broad research area that + focuses on "Making computers think like people" and includes disciplines + like Neural Networks, Genetic Algorithms, Decision Trees, Frame Systems + and Expert Systems. Knowledge representation is the area of A.I. concerned + with how knowledge is represented and manipulated. Expert Systems use + Knowledge representation to facilitate the codification of knowledge into + a knowledge base which can be used for reasoning - i.e. we can process + data with this knowledge base to infer conclusions. Expert Systems are + also known as Knowledge-based Systems and Knowledge-based Expert System + and are considered 'applied artificial intelligence'; the process of + developing with an Expert System is Knowledge Engineering. Drools is a + Rule Engine that uses the Rule Based approached to implement an Expert + System and is more correctly classified as a Production Rules + System.</para> + + <para>The brain of a Rule Based approach is the Inference Engine; the role + of the Inference Engine is to infer conclusions about facts, from the + rules. </para> + + <figure> + <title>Inference Engine</title> + + <mediaobject> + <imageobject> + <imagedata align="center" fileref="Rule_Engine.svg" format="SVG" /> + </imageobject> + + <imageobject> + <imagedata align="center" fileref="Inference_Engine.png" + format="PNG" /> + </imageobject> + </mediaobject> + </figure> + + <para>A Production Rule is a two-part structure using logic to express one + or more conditions which when met result in execution of actions.</para> + + <programlisting>if + <conditions> +then + <actions></programlisting> + + <para>This is achieved using First Order Logic, or predicate logic, which + extends Propositional Logic. <ulink + url="http://en.wikipedia.org/wiki/Emil_Leon_Post">Emil Leon Post</ulink> + was the first to develop an inference based system using symbols to + express logic - as a consequence of this he was able to prove that any + logical system (including mathematics) could be expressed with such a + system.</para> + + <para>A proposition is a statement that can be classified as true or + false. If the truth can be determined from statement alone it is said to + be a "closed statement". In programming terms this is an expression that + does not reference any variables:</para> + + <para>10 = = 2 * 5</para> + + <para>Expressions that evaluate against one or more variables, facts, are + "open statements", in that we cannot determine whether the statement is + true until we have a variable instance to evaluate against:</para> + + <para>Person.sex == "male"</para> + + <para>With SQL if we look at the conclusion's action as simply returning + the matched fact to the user:</para> + + <para>select * from People where People.sex == "male"</para> + + <para>For any rows, which represent our facts, that are returned we have + inferred that those facts are male people. The following diagram shows how + the above SQL statement and People table can be represented in terms of + the previous Inference Engine diagram.</para> + + <figure> + <title>SQL as a simplistic Inference Engine</title> + + <mediaobject> + <imageobject> + <imagedata align="center" fileref="Male_People.svg" format="SVG" /> + </imageobject> + + <imageobject> + <imagedata align="center" fileref="Male_People.png" format="PNG" /> + </imageobject> + </mediaobject> + </figure> + + <para>So in java we can say that a simple proposition is of the form + 'variable' 'operator' 'value' - where we often refer to 'value' as being a + literal value - a proposition can be thought as a field constraint. + Further to this propositions can be combined with conjuntive and + disjuntive connectives, which is the logic theorists way of saying + '&&' and '||'. The following shows two open propositional + statements connected together with a single disjunctive connective.</para> + + <programlisting>person.getEyeColor().equals("blue") || person.getEyeColor().equals("green") </programlisting> + + <para>However Propositional Logic is not Turing complete in that you are + limited to the problems you can define because it cannot express criteria + for the structure of data. First Order Logic (FOL), or Predicate Logic, + extends Propositional Logic with two new quantifier concepts to allow + expressions defining structure - specifically universal and existential + quantifiers. Universal quantifiers allow you to check that something is + true for everything. Existential quantifiers check for the existence of + something, in that it occurs at least once.</para> + + <para>Imagine we have two classes - Student and Module. Module represents + each of the courses the Student attended for that semester, referenced by + the List collection. At the end of the semester each Module has a score. + If the Student has a Module score below 40 then they will fail that + semester - the existential quantifier can be used used with the "less than + 40" open proposition to check for the existence of a Module that is true + for the specified criteria.</para> + + <programlisting>public class Student { + private String name; + private List modules; + + ... +}</programlisting> + + <programlisting>public Class Module { + private String name; + private String studentName; + private int score;</programlisting> + + <para>Java is Turing complete in that you can write code, among other + things, to iterate data structures to check for existence. The following + should return a List of students who have failed the semester.</para> + + <programlisting>List failedStudents = new ArrayList(); + +for ( Iterator studentIter = students.iterator(); studentIter.hasNext() { + Student student = ( Student ) studentIter.next(); + for ( Iterator it = student.getModules.iterator(); it.hasNext(); ) { + Module module = ( Module ) it.next(); + if ( module.getScore() < 40 ) { + failedStudents.add( student ) ; + break; + } + } +}</programlisting> + + <para>Early SQL implementations where not Turing complete as they did not + provide quantifiers to asses the structure of data. However modern SQL + engines allow nesting of SQL which can be combined with keywords like + 'exists' and 'in': The following query would return a set of Students who + have failed the semester.</para> + + <programlisting>select + * +from + Students s +where exists ( + select + * + from + Modules m + where + m.student_name = s.name and + m.score < 40 +)</programlisting> + + <para>So modern SQL engines confuse things even more, by showing some + capabilities to support First Order Logic - still one of the key + differentiators here is in the design approach to solving this problem; as + an Inference Engine can handle far more complex rules involving many facts + and quantifiers in a stateful manner which may not be possible to express + in SQL and if it was would likely bring an SQL Engine to its knees - where + as an Inference Engine's design approach caters for First Order Logic. + Further to this an Inference Engine is stateful and thus reacts to changes + in data, as part of a Productions Rules System, which enables the logical + relationships between the results of the actions inferred by the data and + rules - this is called Truth Maintenance - .A Query Engine simply returns + results, so it has no support for Truth Maintenance. For example the + "Honest Politician" example, which always ensures that hope and decomcracy + exists.</para> + + <programlisting>when + an honest Politician exists +then + logically assert Hope + +when + Hope exists +then + print "Hurrah!!! Democracy Lives" + +when + Hope does not exist +then + print "Democracy is Doomed" +</programlisting> + + <para></para> + + <para></para> + + <para>To help gain a better understanding we can build a simple linear + rule engine</para> + + <programlisting>// Interface for Production Rules +public interface Rule { + public void evaluate(Object[] objects); +} +</programlisting> + + <programlisting>public class LinearInferenceEngine { + Rules[] rules; + + public LinearInferenceEngine(Rule[] rules) { + this.rules = rules; + } + + public void evaluate(Object[] objects) { + for ( int i = 0; i < rules.length; i++ ) { + rules[i].evaluate( objects ); + } + } +}</programlisting> + + <programlisting>// The production rule - a simple proposition +public class FindMalePeople implements Rule { + public evaluate(Object[] objects) { + Person person = ( Person ) objects[i]; + if ( person.getSex().equals( "male" ) { + consequence( people[i] ); + } + } + + // The consequence + private void consequence(Person person) { + System.out.println(Person.getName() + " is male" ); + } +} +</programlisting> + + <programlisting>// The Facts +Person[] people = new Person[] { new Person("mark", "male"), new Person("bob", "male"), new Person("janet", "female") }; + +// The Production Rules +Rule rules[] = new Rule[] { new FindMalePeople() }; + +/ The Linear Inference Engine +LinearInferenceEngine engine = new LinearInferenceEngine( rules ); + +// Evaluate Facts against the Productions Rules using the Linear Inference Engine +for ( int i = 0; i < people.length; i++ ) { + engine.evaluate( new Object[] { people[i] } ); +}</programlisting> + + <para>However what differentiates a Rule Engine from SQL is its ability to + deal with First Order Logic and actions</para> + + <figure> + <title>Additional Reading</title> + + <itemizedlist> + <listitem> + <para>"Expert Systems - Principles and Programming" (2005) by Joseph + C. Giarratano, Gary D. Riley</para> + </listitem> + + <listitem> + <para>"Introduction to Expert Systems" (1999) by Peter + Jackson</para> + </listitem> + + <listitem> + <para>"Knowledge Representation and Reasing" (2004) by Ronald J. + Brachman, Hector J. Levesque</para> + </listitem> + </itemizedlist> + </figure> + + <para>A Rule Engine like Drools is centred around the concept of + logicproduction rules (IF conditions THEN actions). Emil Leon Post (<ulink + url="http://en.wikipedia.org/wiki/Emil_Leon_Post">http://en.wikipedia.org/wiki/Emil_Leon_Post)</ulink> + was the first to use production systems in logic - as a consequence of + this he was able to prove that any logical system (including mathematics) + could be written with production rules. Quite an amazing proof, this + essentially means that you can represent any system/problem with + production rules (back in the real world there are constraints of + processing power and efficiency of course !).</para> + + <para>You may also have heard of "Expert Systems" in the context of rule + engines. You can think of expert systems as a rule engine + the + codification of knowledge for a specific problem domain (+ a user + interface !). In that sense, Drools is a platform for expert systems. + Historically, rule engines popularity grew out of expert systems success + (for example, EMYCIN was one of the first "shells" for an expert system, + which was created from the MYCIN medical diagnosis expert system).</para> + </section> + + <section> + <title>Rules</title> + + <para>A <indexterm> + <primary>Rule</primary> + </indexterm>Rule is the codification of business knowledge. A Rule has + attributes, a Left Hand Side (LHS) and a Right Hand Side (RHS). Drools + allows the following attributes:</para> + + <itemizedlist> + <listitem> + <para>salience</para> + </listitem> + + <listitem> + <para>agenda-group</para> + </listitem> + + <listitem> + <para>no-loop</para> + </listitem> + + <listitem> + <para>auto-focus</para> + </listitem> + + <listitem> + <para>duration</para> + </listitem> + </itemizedlist> + + <programlisting>rule “<name>” + <attribute> <value> + when + <LHS> + then + <RHS> +end +</programlisting> + + <para>The LHS of the Rule consists of one or more Conditions. As the Rule + Engine is made aware of new data or changes to existing data it matches + the data against the Conditions, when all the Conditions are met and true + the RHS, and its actions, are executed; the RHS, called the <indexterm> + <primary>Consequence</primary> + </indexterm>Consequence. The LHS and the RHS is analogous to:</para> + + <programlisting>if ( <LHS> ) { + <RHS> +}</programlisting> + + <para>Rules are associated with a namespace via the + <literal>package</literal> keyword; other Rule Engines may call this a + <indexterm> + <primary>Rule Set</primary> + </indexterm>Rule Set. A Package declares imports, global variables, + functions and rules.</para> + + <programlisting>package com.sample + +import java.util.List +import com.sample.Cheese + +global List cheeses + +function void exampleFunction(Cheese cheese) { + System.out.println( cheese ); +} + +rule “A Cheesy Rule” + when + cheese : Cheese( type == "stilton" ) + then + exampleFunction( cheese ); + cheeses.add( cheese ); +end</programlisting> + + <para>The process of matching the new or existing modified data against + rules is called <indexterm> + <primary>Pattern Matching</primary> + </indexterm> Pattern Matching, the engine which does this matching is + the <indexterm> + <primary>Inference Engine</primary> + </indexterm>Inference Engine. The Rule's are referred to as the + <indexterm> + <primary>Production Memory</primary> + </indexterm>Production Memory and the data that the Inference Engine + matches against is the <indexterm> + <primary>WorkingMemory</primary> + </indexterm>Working Memory. the Agenda manages the execution of the + matched Rules. There are a number of algorithms used for Pattern Matching + by Inference Engines including:</para> + + <itemizedlist> + <listitem> + <para>Linear</para> + </listitem> + + <listitem> + <para>Rete</para> + </listitem> + + <listitem> + <para>Treat</para> + </listitem> + + <listitem> + <para>Leaps</para> + </listitem> + </itemizedlist> + + <para>Drools has implementations for both Rete and Leaps; Leaps is still + considered experiment. The Drools <indexterm> + <primary>Rete</primary> + </indexterm>Rete implementation is called ReteOO signifying that this + Drools has an enhanced and optimised implementation of the Rete algorithm. + Other Rete based engines also have marketting terms for their prioprietary + enhancements to Rete, like RetePlus and Rete III,</para> + + <figure> + <title>A Basic Rete network</title> + + <mediaobject> + <imageobject> + <imagedata align="center" fileref="Rule_Engine.svg" format="SVG" /> + </imageobject> + + <imageobject> + <imagedata align="center" fileref="Rule_Engine.png" format="PNG" /> + </imageobject> + </mediaobject> + </figure> + + <para>The LHS of a rule is made up of <indexterm> + <primary>Conditional Element</primary> + </indexterm>iConditional Elements and <indexterm> + <primary>Field Constraint</primary> + </indexterm>iField Constraints. The following example shows a <indexterm> + <primary>Literal Field Constraint</primary> + </indexterm>iLiteral Field Constraint used with a Cheese Fact; the + combination of Field Constraints on a Fact is known as a <indexterm> + <primary>Column</primary> + </indexterm>Column.</para> + + <programlisting>rule "Cheddar Cheese" + when + Cheese( type == "cheddar" ) + then + System.out.println( "cheddar" ); +end</programlisting> + + <para>The example above is similar to :</para> + + <programlisting>public void cheddarCheese(Cheese cheese) { + if ( cheese.getType().equals("cheddar") { + System.out.println( "cheddar" ); + } +}</programlisting> + + <para>Rule engines are a complete de-coupling of data from the logic. + Rules cannot be called directly as they are not methods or functions + instead Rules fire in response to changes in Working Memory's data, It may + help to think of this de-coupling as a specialised event sytem. The + Consequence is the Listener to the full matching of the LHS events.</para> + + <para>Rule Engines are much like a database where Rule's LHS define the + queries on the Working Memory. The previous rule can be expressed in + <indexterm> + <primary>SQL</primary> + </indexterm>SQL as:</para> + + <programlisting> select * from Cheese where type == "cheddar"</programlisting> + + <para>A <indexterm> + <primary>DataBase</primary> + </indexterm>Database executes SQL, on request, where as a Rule Engine + will process data against its rules, its Production Memory, as it's + asserted; this process is known as <indexterm> + <primary>Pattern Matching</primary> + </indexterm>Pattern Matching. When added to the Production Memory, + Rule's are decomposed into a graph using the <indexterm> + <primary>Rete</primary> + </indexterm>Rete algorithm. Rete is one of the standard Rule Engine + algorithms developed by <indexterm> + <primary>Charles Forgey</primary> + </indexterm>Charles Forgey in 1979 which is covered in greater detail in + a Rete Algorithm chapter.</para> + + <figure> + <title>A Basic Rete network</title> + + <mediaobject> + <imageobject> + <imagedata align="center" fileref="A_Basic_Rete_Network.svg" + format="SVG" /> + </imageobject> + + <imageobject> + <imagedata align="center" fileref="A_Basic_Rete_Network.png" + format="PNG" /> + </imageobject> + </mediaobject> + </figure> + + <para>Each Fact type in our Working Memory, such as <code>Cheese</code>, + is represented by an <indexterm> + <primary>Object Type</primary> + </indexterm>Object Type class, shown as the root node in our graph. When + Facts are asserted into the Working Memory the Rule Engine finds the + matching Object Type node and propagates the asserted Fact onto the next + node. The Object Type node maintains a memory of all matched Facts. in our + example the next node in the graph is a <indexterm> + <primary>Field Constraint</primary> + </indexterm>Field Constraint, <code>type == "cheddar", </code>its job is + to filter Facts using the given constraint; if the type of + <code>Cheese</code> is not "cheddar" the Fact progresses no further in the + network, if it is "cheddar" it is rememebered in the <indexterm> + <primary>Alpha Node</primary> + </indexterm>Alpha Node's memory and propagated onto the next node in the + network.. Alpha Node is classic Rete terminology for single input/single + output nodes, in that it receives a single Fact of a specified Object Type + and propates a single Fact of specified Object Type.</para> + + <para>At this point we have what is known as a <indexterm> + <primary>Partial Match</primary> + </indexterm>Partial Match, in that we have matched facts against some, + but not all, of the Rule's nodes. <indexterm> + <primary>Left Input Adapter Node</primary> + </indexterm>s will be explained later, suffice to say it always + propagetes onto the next node, in this case a <indexterm> + <primary>Terminal Node</primary> + </indexterm>Terminal Node. The Terminal Node is our end node, now we say + the Rule is Fully Matched and ready to fire.</para> + + <para>Earlier we mentioned that a Rule Engine is much like a Database, we + can prove this by using a <indexterm> + <primary>Query</primary> + </indexterm>Query construct. A Query is Rule with a special Terminal + node; instead of executing a Consequence the Terminal node stores matching + Facts in a list, which is returned as the result. Lets prove this</para> + + <programlisting>query "Find cheeses with a cost of 5" + Cheese( price == 5 ) +end</programlisting> + + <programlisting>// First create the facts +Cheese stilton = new Cheese("stilton", 8); // type, price +Cheese cheddar = new Cheese("cheddar", 5); // type, price +Cheese mozarella = new Cheese("mozarella", 5); // type, price + +// Now assert them into the Working Memory +workingMemory.assertObject( stilton ); +workingMemory.assertObject( cheddar ); +workingMemory.assertObject( mozarella ); + +List results = workingMemory.getQueryResults( "Find cheeses with a cost of 5" );</programlisting> + + <para>When we get the Query Results the List has a size of two and + references "cheddar" and "mozarella", as expected. If we had used a Rule + construct instead of a Query the Terminal Node's Consequence would have + attempted to fire twice, once for "cheddar" and once for + "mozarella".</para> + + <para>When a Rule is Fully Matched it does not fire immediately (in Rete, + but in Leaps it does !). Instead the Rule plus the matched Facts are + <indexterm> + <primary>Activated</primary> + </indexterm>Activated placed onto the <indexterm> + <primary>Agenda</primary> + </indexterm>Agenda; which is responsible for the scheduling and firing + <indexterm> + <primary>Activation</primary> + </indexterm>Activations.</para> + </section> +</section> \ No newline at end of file Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Inference_Engine.png =================================================================== (Binary files differ) Property changes on: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Inference_Engine.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Inference_Engine.svg =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Inference_Engine.svg 2006-05-31 19:25:18 UTC (rev 4530) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Inference_Engine.svg 2006-05-31 19:32:10 UTC (rev 4531) @@ -0,0 +1,165 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> +<!-- Generated by Microsoft Visio 11.0, SVG Export, v1.0 Inference_Engine.svg Page-1 --> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="6.52453in" + height="3.99817in" viewBox="0 0 469.766 287.869" xml:space="preserve" color-interpolation-filters="sRGB" class="st9"> + <v:documentProperties v:langID="1033" v:metric="true" v:viewMarkup="false"/> + + <style type="text/css"> + <![CDATA[ + .st1 {fill:#ffffff} + .st2 {stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.72} + .st3 {fill:#000000;font-family:Arial;font-size:1.66667em} + .st4 {fill:#ffffff;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} + .st5 {font-size:1em} + .st6 {marker-end:url(#mrkr13-23);stroke:#4677bf;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} + .st7 {fill:#4677bf;fill-opacity:1;stroke:#4677bf;stroke-opacity:1;stroke-width:0.08695652173913} + .st8 {marker-end:url(#mrkr4-34);stroke:#4677bf;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} + .st9 {fill:none;fill-rule:evenodd;font-size:12;overflow:visible;stroke-linecap:square;stroke-miterlimit:3} + ]]> + </style> + + <defs id="Markers"> + <g id="lend13"> + <path d="M 3 1 L 0 0 L 3 -1 L 3 1 " style="stroke:none"/> + </g> + <marker id="mrkr13-23" class="st7" v:arrowType="13" v:arrowSize="2" v:setback="34.5" refX="-34.5" orient="auto" + markerUnits="strokeWidth"> + <use xlink:href="#lend13" transform="scale(-11.5,-11.5) "/> + </marker> + <g id="lend4"> + <path d="M 2 1 L 0 0 L 2 -1 L 2 1 " style="stroke:none"/> + </g> + <marker id="mrkr4-34" class="st7" v:arrowType="4" v:arrowSize="2" v:setback="23" refX="-23" orient="auto" + markerUnits="strokeWidth"> + <use xlink:href="#lend4" transform="scale(-11.5,-11.5) "/> + </marker> + </defs> + <g v:mID="0" v:index="1" v:groupContext="foregroundPage"> + <title>Page-1</title> + <v:pageProperties v:drawingScale="0.0393701" v:pageScale="0.0393701" v:drawingUnits="24" v:shadowOffsetX="8.50394" + v:shadowOffsetY="-8.50394"/> + <v:layer v:name="Network" v:index="0"/> + <v:layer v:name="Connector" v:index="1"/> + <g id="shape12-1" v:mID="12" v:groupContext="shape" v:layerMember="0" transform="translate(0.72,-187.327)"> + <title>Datastore.12</title> + <desc>Rules</desc> + <v:custProps> + <v:cp v:nameU="Manufacturer" v:lbl="Manufacturer" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="ProductNumber" v:lbl="Product Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="PartNumber" v:lbl="Part Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="ProductDescription" v:lbl="Product Description" v:type="0" v:sortKey="1" v:invis="false" + v:ask="false" v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="AssetNumber" v:lbl="Asset Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="SerialNumber" v:lbl="Serial Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="Location" v:lbl="Location" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Building" v:lbl="Building" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Room" v:lbl="Room" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Department" v:lbl="Department" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + </v:custProps> + <v:userDefs> + <v:ud v:nameU="visDescription" + v:val="VT4(Use to add a a database, data source, or data storage device to your system diagram.)"/> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(0,0,0,0)" v:tabSpace="42.5197"/> + <v:textRect cx="49.9109" cy="244.196" width="99.83" height="62.3887"/> + <path d="M0 200.52 L0 275.39 A49.9109 12.4777 -180 1 0 99.82 275.39 L99.82 200.52 A49.9109 12.4777 -180 0 0 0 200.52 Z" + class="st1"/> + <path d="M0 200.52 L0 275.39 A49.9109 12.4777 -180 1 0 99.82 275.39 L99.82 200.52 A49.9109 12.4777 -180 0 0 0 200.52" + class="st2"/> + <path d="M0 200.52 A49.9109 12.4777 -180 1 0 99.82 200.52" class="st2"/> + <text x="24.33" y="250.2" class="st3" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Rules</text> </g> + <g id="shape13-6" v:mID="13" v:groupContext="shape" v:layerMember="0" transform="translate(369.224,-187.327)"> + <title>Datastore.13</title> + <desc>Facts</desc> + <v:custProps> + <v:cp v:nameU="Manufacturer" v:lbl="Manufacturer" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="ProductNumber" v:lbl="Product Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="PartNumber" v:lbl="Part Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="ProductDescription" v:lbl="Product Description" v:type="0" v:sortKey="1" v:invis="false" + v:ask="false" v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="AssetNumber" v:lbl="Asset Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="SerialNumber" v:lbl="Serial Number" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + <v:cp v:nameU="Location" v:lbl="Location" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Building" v:lbl="Building" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Room" v:lbl="Room" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" v:langID="1033" + v:val="VT4()"/> + <v:cp v:nameU="Department" v:lbl="Department" v:type="0" v:sortKey="1" v:invis="false" v:ask="false" + v:langID="1033" v:val="VT4()"/> + </v:custProps> + <v:userDefs> + <v:ud v:nameU="visDescription" + v:val="VT4(Use to add a a database, data source, or data storage device to your system diagram.)"/> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(0,0,0,0)" v:tabSpace="42.5197"/> + <v:textRect cx="49.9109" cy="244.196" width="99.83" height="62.3887"/> + <path d="M0 200.52 L0 275.39 A49.9109 12.4777 -180 1 0 99.82 275.39 L99.82 200.52 A49.9109 12.4777 -180 0 0 0 200.52 Z" + class="st1"/> + <path d="M0 200.52 L0 275.39 A49.9109 12.4777 -180 1 0 99.82 275.39 L99.82 200.52 A49.9109 12.4777 -180 0 0 0 200.52" + class="st2"/> + <path d="M0 200.52 A49.9109 12.4777 -180 1 0 99.82 200.52" class="st2"/> + <text x="25.45" y="250.2" class="st3" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Facts</text> </g> + <g id="shape15-11" v:mID="15" v:groupContext="shape" transform="translate(161.182,-138.464)"> + <title>Rectangle.18</title> + <desc>Inference Engine</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197" v:verticalAlign="0"/> + <v:textRect cx="73.7008" cy="259.522" width="147.41" height="56.6929"/> + <rect x="0" y="231.176" width="147.402" height="56.6929" class="st4"/> + <text x="32.01" y="253.18" class="st3" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Inference <tspan + x="42.56" dy="1.2em" class="st5">Engine</tspan></text> </g> + <g id="shape17-15" v:mID="17" v:groupContext="shape" transform="translate(164.017,-0.24)"> + <title>Rectangle.22</title> + <desc>Conclusions</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> + <v:textRect cx="70.8661" cy="262.357" width="141.74" height="51.0236"/> + <rect x="0" y="236.845" width="141.732" height="51.0236" class="st4"/> + <text x="16.4" y="268.36" class="st3" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Conclusions</text> </g> + <g id="shape18-18" v:mID="18" v:groupContext="shape" v:layerMember="1" transform="translate(100.542,-237.238)"> + <title>Dynamic connector.18</title> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <path d="M0 287.87 L10.63 287.87 A10.6299 10.6299 0 0 1 21.26 298.5 L21.26 338.61 A19.6902 19.6902 -180 0 0 40.95 358.3 + L52.36 358.3" class="st6"/> + </g> + <g id="shape19-24" v:mID="19" v:groupContext="shape" v:layerMember="1" transform="translate(369.224,-237.238)"> + <title>Dynamic connector.19</title> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <path d="M0 287.87 L-10.63 287.87 A10.6299 10.6299 -180 0 0 -21.26 298.5 L-21.26 338.61 A19.6902 19.6902 0 0 1 -40.95 + 358.3 L-52.36 358.3" class="st6"/> + </g> + <g id="shape14-29" v:mID="14" v:groupContext="shape" v:layerMember="1" transform="translate(227.796,-138.464)"> + <title>Dynamic connector.6</title> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <path d="M7.09 287.87 L7.09 369.55" class="st8"/> + </g> + </g> +</svg> Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Logical_Assertion.png =================================================================== (Binary files differ) Property changes on: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Logical_Assertion.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Logical_Assertion.svg =================================================================== --- labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Logical_Assertion.svg 2006-05-31 19:25:18 UTC (rev 4530) +++ labs/jbossrules/trunk/documentation/manual/en/Chapter-Rule_Engine/Logical_Assertion.svg 2006-05-31 19:32:10 UTC (rev 4531) @@ -0,0 +1,287 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> +<!-- Generated by Microsoft Visio 11.0, SVG Export, v1.0 Logical_Assertion.svg Page-1 --> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="6.5421in" + height="5.12478in" viewBox="0 0 471.031 368.984" xml:space="preserve" color-interpolation-filters="sRGB" class="st7"> + <v:documentProperties v:langID="1033" v:metric="true" v:viewMarkup="false"/> + + <style type="text/css"> + <![CDATA[ + .st1 {fill:#e8eef7;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} + .st2 {fill:#000000;font-family:Arial;font-size:0.666664em} + .st3 {font-size:1em} + .st4 {marker-end:url(#mrkr4-15);stroke:#4677bf;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} + .st5 {fill:#4677bf;fill-opacity:1;stroke:#4677bf;stroke-opacity:1;stroke-width:0.08695652173913} + .st6 {fill:#ffffff;stroke:none;stroke-linecap:butt;stroke-width:7.2} + .st7 {fill:none;fill-rule:evenodd;font-size:12;overflow:visible;stroke-linecap:square;stroke-miterlimit:3} + ]]> + </style> + + <defs id="Markers"> + <g id="lend4"> + <path d="M 2 1 L 0 0 L 2 -1 L 2 1 " style="stroke:none"/> + </g> + <marker id="mrkr4-15" class="st5" v:arrowType="4" v:arrowSize="2" v:setback="23" refX="-23" orient="auto" + markerUnits="strokeWidth"> + <use xlink:href="#lend4" transform="scale(-11.5,-11.5) "/> + </marker> + </defs> + <g v:mID="0" v:index="1" v:groupContext="foregroundPage"> + <title>Page-1</title> + <v:pageProperties v:drawingScale="0.0393701" v:pageScale="0.0393701" v:drawingUnits="24" v:shadowOffsetX="8.50394" + v:shadowOffsetY="-8.50394"/> + <v:layer v:name="Flowchart" v:index="0"/> + <v:layer v:name="Connector" v:index="1"/> + <g id="shape1-1" v:mID="1" v:groupContext="shape" v:layerMember="0" transform="translate(264.334,-241.185)"> + <title>Decision</title> + <desc>Does the Object already exist?</desc> + <v:custProps> + <v:cp v:nameU="Cost" v:lbl="Cost" v:type="7" v:format="@" v:langID="1033"/> + <v:cp v:nameU="Duration" v:lbl="Duration" v:type="2" v:langID="1033"/> + <v:cp v:nameU="Resources" v:lbl="Resources" v:langID="1033"/> + </v:custProps> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(2,2,2,2)" v:tabSpace="42.5197"/> + <v:textRect cx="38.9764" cy="333.551" width="64.97" height="53.1496"/> + <path d="M0 333.55 L38.98 298.12 L77.95 333.55 L38.98 368.98 L0 333.55 Z" class="st1"/> + <text x="10.29" y="331.15" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Does the Object <tspan + x="14.29" dy="1.2em" class="st3">already exist</tspan>?</text> </g> + <g id="shape2-5" v:mID="2" v:groupContext="shape" v:layerMember="0" transform="translate(264.334,-106.539)"> + <title>Decision.2</title> + <desc>Is the Object STATED or JUSTIFED?</desc> + <v:custProps> + <v:cp v:nameU="Cost" v:lbl="Cost" v:type="7" v:format="@" v:langID="1033"/> + <v:cp v:nameU="Duration" v:lbl="Duration" v:type="2" v:langID="1033"/> + <v:cp v:nameU="Resources" v:lbl="Resources" v:langID="1033"/> + </v:custProps> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(2,2,2,2)" v:tabSpace="42.5197"/> + <v:textRect cx="38.9764" cy="333.551" width="64.97" height="53.1496"/> + <path d="M0 333.55 L38.98 298.12 L77.95 333.55 L38.98 368.98 L0 333.55 Z" class="st1"/> + <text x="16.52" y="326.35" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Is the Object <tspan + x="18.52" dy="1.2em" class="st3">STATED or </tspan><tspan x="17.64" dy="1.2em" class="st3">JUSTIFED</tspan>?</text> </g> + <g id="shape3-10" v:mID="3" v:groupContext="shape" v:layerMember="1" transform="translate(296.224,-241.185)"> + <title>Dynamic connector</title> + <desc>yes</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> + <v:textRect cx="7.08661" cy="400.874" width="40" height="17.6036"/> + <path d="M7.09 368.98 L7.09 427.24" class="st4"/> + <rect v:rectContext="textBkgnd" x="0.486913" y="396.074" width="12.4494" height="9.59985" class="st6"/> + <text x="0.86" y="403.27" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>yes</text> </g> + <g id="shape5-18" v:mID="5" v:groupContext="shape" v:layerMember="0" transform="translate(399.925,-120.712)"> + <title>Process</title> + <desc>Can’t Justify a STATED fact, return existing FactHandle.</desc> + <v:custProps> + <v:cp v:nameU="Cost" v:lbl="Cost" v:type="7" v:format="@" v:langID="1033"/> + <v:cp v:nameU="Duration" v:lbl="Duration" v:type="2" v:langID="1033"/> + <v:cp v:nameU="Resources" v:lbl="Resources" v:langID="1033"/> + </v:custProps> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(2,2,2,2)" v:tabSpace="42.5197"/> + <v:textRect cx="35.4331" cy="347.724" width="70.87" height="42.5197"/> + <rect x="0" y="326.464" width="70.8661" height="42.5197" rx="5.66929" ry="5.66929" class="st1"/> + <text x="10.3" y="335.72" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Can’t Justify a <tspan + x="10.98" dy="1.2em" class="st3">STATED fact</tspan>, <tspan x="10.3" dy="1.2em" class="st3">return existing </tspan><tspan + x="13.86" dy="1.2em" class="st3">FactHandle</tspan>.</text> </g> + <g id="shape6-24" v:mID="6" v:groupContext="shape" v:layerMember="1" transform="translate(342.287,-134.886)"> + <title>Dynamic connector.6</title> + <desc>STATED</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> + <v:textRect cx="28.8189" cy="361.897" width="42.54" height="17.6036"/> + <path d="M0 361.9 L52.12 361.9" class="st4"/> + <rect v:rectContext="textBkgnd" x="12.6728" y="357.098" width="31.5582" height="9.59985" class="st6"/> + <text x="13.05" y="364.3" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>STATED</text> </g> + <g id="shape7-31" v:mID="7" v:groupContext="shape" v:layerMember="1" transform="translate(296.224,-106.539)"> + <title>Dynamic connector.7</title> + <desc>JUSTIFIED</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> + <v:textRect cx="7.08661" cy="400.874" width="51.43" height="17.6036"/> + <path d="M7.09 368.98 L7.09 427.24" class="st4"/> + <rect v:rectContext="textBkgnd" x="-13.5213" y="396.074" width="40.4451" height="9.59985" class="st6"/> + <text x="-13.15" y="403.27" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>JUSTIFIED</text> </g> + <g id="shape8-38" v:mID="8" v:groupContext="shape" v:layerMember="0" transform="translate(267.878,-0.24)"> + <title>Process.8</title> + <desc>Add additional justification and return existing FactHandle</desc> + <v:custProps> + <v:cp v:nameU="Cost" v:lbl="Cost" v:type="7" v:format="@" v:langID="1033"/> + <v:cp v:nameU="Duration" v:lbl="Duration" v:type="2" v:langID="1033"/> + <v:cp v:nameU="Resources" v:lbl="Resources" v:langID="1033"/> + </v:custProps> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(2,2,2,2)" v:tabSpace="42.5197"/> + <v:textRect cx="35.4331" cy="347.724" width="70.87" height="42.5197"/> + <rect x="0" y="326.464" width="70.8661" height="42.5197" rx="5.66929" ry="5.66929" class="st1"/> + <text x="10.07" y="335.72" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Add additional <tspan + x="7.85" dy="1.2em" class="st3">justification and </tspan><tspan x="10.3" dy="1.2em" class="st3">return existing </tspan><tspan + x="14.97" dy="1.2em" class="st3">FactHandle</tspan></text> </g> + <g id="shape4-44" v:mID="4" v:groupContext="shape" v:layerMember="0" transform="translate(128.744,-241.185)"> + <title>Decision.4</title> + <desc>Is there an existing Equal Object?</desc> + <v:custProps> + <v:cp v:nameU="Cost" v:lbl="Cost" v:type="7" v:format="@" v:langID="1033"/> + <v:cp v:nameU="Duration" v:lbl="Duration" v:type="2" v:langID="1033"/> + <v:cp v:nameU="Resources" v:lbl="Resources" v:langID="1033"/> + </v:custProps> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(2,2,2,2)" v:tabSpace="42.5197"/> + <v:textRect cx="38.9764" cy="333.551" width="64.97" height="53.1496"/> + <path d="M0 333.55 L38.98 298.12 L77.95 333.55 L38.98 368.98 L0 333.55 Z" class="st1"/> + <text x="20.07" y="326.35" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>Is there an <tspan + x="14.07" dy="1.2em" class="st3">existing Equal </tspan><tspan x="25.19" dy="1.2em" class="st3">Object</tspan>?</text> </g> + <g id="shape9-49" v:mID="9" v:groupContext="shape" v:layerMember="1" transform="translate(264.334,-269.531)"> + <title>Dynamic connector.9</title> + <desc>no</desc> + <v:userDefs> + <v:ud v:nameU="visVersion" v:val="VT0(11):26"/> + </v:userDefs> + <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> + <v:textRect cx="-28.8189" cy="361.897" width="40" height="17.6036"/> + <path d="M0 361.9 L-52.12 361.9" class="st4"/> + <rect v:rectContext="textBkgnd" x="-33.6429" y="357.098" width="8.89838" height="9.59985" class="st6"/> + <text x="-33.27" y="364.3" class="st2" v:langID="2057"><v:paragraph v:horizAlign="1"/><v:tabList/>no</text> </g> + <g id="shape10-56" v:mID="10" v:groupContext="shape" v:layerMember="1" transform="translate(160.634,-241.185)"> + <title>Dynamic connector.10</title> + <desc>yes</desc> + <v:userDefs> + <v:ud v:nameU="vi... [truncated message content] |