[JBoss JIRA] Created: (JBRULES-1908) updated Drools docs content from SOA 4.2.CP03 Rules Guide
by Darrin Mison (JIRA)
updated Drools docs content from SOA 4.2.CP03 Rules Guide
---------------------------------------------------------
Key: JBRULES-1908
URL: https://jira.jboss.org/jira/browse/JBRULES-1908
Project: JBoss Drools
Issue Type: Task
Security Level: Public (Everyone can see)
Components: drools-docs-expert
Reporter: Darrin Mison
Assignee: Mark Proctor
I revised the language of the "Insertion" section while fixing a couple of reported grammatical errors for the 4.2.CP03 SOA Rules Guide.
The original language is the same in: http://anonsvn.jboss.org/repos/labs/labs/jbossrules/soa_tags/4.3.0.FP01_B... , so these changes would also apply to the most recent docs.
Updated content below, the section ids are different but you get the idea ;-)
<section id="sect-JBoss_Rules_Reference_Manual-WorkingMemory_and_StatefulStateless_Sessions-Insertion">
<title>Insertion</title>
<para>
<firstterm>Insertion</firstterm> is the act of telling the WorkingMemory about the facts.
</para>
<important>
<para>
In many Expert Systems the term used for this concept is
<firstterm>assert</firstterm> or <firstterm>assertion</firstterm>.
However as the keyword <methodname>assert</methodname> is already used
in many languages, Drools uses the keyword & term <methodname>insert</methodname>.
You will often encounter these terms used interchangably in discussion of
Rules Engines.
</para>
</important>
<para>
When inserted, the rule is examined for matches against the rules. The work
of determining what rules to fire is done during insertion, but no rules are
executed at this time. The rules are executed when
<methodname>fireAllRules()</methodname> is called, and it should only be called
after you have inserted all your facts.
</para>
<para>
It is a common misconception that rule matching occurs when
<methodname>fireAllRules()</methodname> is called.
</para>
<para>
When an Object is inserted it returns a FactHandle. This FactHandle is the
token used to represent your inserted Object inside the WorkingMemory, it is
also how you will interact with the Working Memory when you wish to retract
or modify an object.
</para>
<programlisting language="java">Cheese stilton = new Cheese("stilton");
FactHandle stiltonHandle = session.insert( stilton );</programlisting>
<para>
As mentioned in
<xref linkend="sect-JBoss_Rules_Reference_Manual-The_Drools_Rule_Engine-RuleBase" />
a Working Memory can operate in two assertions modes: <firstterm>equality</firstterm>
and <firstterm>identity</firstterm>. Identity is the default mode. The assertion
mode determines how the Working Memory stores the facts and how it compares the
newly inserted fact to previously inserted ones. If the Working Memory
determines the fact to "be the same" as an already inserted one it will ignore
the new fact and return the FactHandle for the previously inserted one.
</para>
<variablelist>
<varlistentry>
<term>Identity</term>
<listitem>
<para>
Identity Mode uses an <classname>IdentityHashMap</classname>to store all
asserted Objects. New facts being inserted are compared to existing facts
"by reference". A new FactHandle will be returned if the object being
inserted is not a reference to an object that has been inserted previously.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Equality</term>
<listitem>
<para>
Equality Mode uses a <classname>HashMap</classname> to store all asserted
Objects. New facts being inserted are compared to existing facts "by value".
A new FactHandle will be returned if the content of the object is not
identical to that of a previously inserted object.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 4 months
[JBoss JIRA] Created: (JBRULES-1457) please support containment test for map keys
by Godmar Back (JIRA)
please support containment test for map keys
--------------------------------------------
Key: JBRULES-1457
URL: http://jira.jboss.com/jira/browse/JBRULES-1457
Project: JBoss Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: Drl Parser/Builder
Affects Versions: 4.0.4
Environment: any
Reporter: Godmar Back
Using MVEL as the language for clauses, there is no way to test whether a map's key contain a value.
For instance:
rule "number 1"
when
e : S(map.keySet() contains "x")
then
System.out.println("rule number 1");
end
leads to a syntax error because Drool's parser does not allow function calls ("keySet())" in clauses.
On the other hand, MVEL (according to Mike Brocks, please read http://jira.codehaus.org/browse/MVEL-53 ) does not provide an operator to test containment in a map's set (or values). He said he's considering adding a shortcut such as .keys and .values in 2.0 and recommended I open a Drools JIRA issue.
Please provide a way to test for membership in a map's key and value set.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months