Skip to content

Commit

Permalink
remove garbage section + remove all dead images
Browse files Browse the repository at this point in the history
  • Loading branch information
ge0ffrey committed Jun 20, 2011
1 parent 1b9543e commit e4ff32f
Show file tree
Hide file tree
Showing 31 changed files with 0 additions and 2,615 deletions.
Expand Up @@ -2217,249 +2217,4 @@ end</programlisting>
comparable to an object wrapper.</para>
</section>

<section>
<title>TODO REMOVE ME - Garbage can</title>

<para>The entity relationship diagram below provides an overview of the various parts that make up the pattern's
constraints and how they work together; each is then covered in more detail with railroad diagrams and
examples.</para>

<figure>
<title>Pattern Entity Relationship Diagram</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/patternER.png" format="PNG" role=""></imagedata>
</imageobject>
</mediaobject>
</figure>

<para>A constraint can be either a Field Constraint, Inline Eval, or a Constraint Group.</para>

<para></para>

<para>Constraints can be separated by the following symbols: '<literal>,</literal>', '<literal>&amp;&amp;</literal>'
or '<literal>||</literal>'.</para>

<figure>
<title>Constraints</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/constraints.png" format="PNG" role=""></imagedata>
</imageobject>
</mediaobject>
</figure>

<figure>
<title>Constraint</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/constraint.png" format="PNG" role=""></imagedata>
</imageobject>
</mediaobject>
</figure>

<figure>
<title>constraintGroup</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/constraintGroup.png" format="PNG" role=""></imagedata>
</imageobject>
</mediaobject>
</figure>

<para></para>

<section>
<title>Field Constraints</title>

<para>A Field constraint specifies a restriction to be used on a named field; the field name can have an optional
variable binding.</para>

<figure>
<title>fieldConstraint</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/fieldConstraint.png" format="PNG" role=""></imagedata>
</imageobject>
</mediaobject>
</figure>

<para>There are three types of restrictions: Single Value Restriction, Compound Value Restriction, and Multi
Restriction.</para>

<figure>
<title>restriction</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/restriction.png" format="PNG" role=""></imagedata>
</imageobject>
</mediaobject>
</figure>

<section>
<title>Values</title>

<para>The field constraints can take a number of values; including literal, qualifiedIdentifier (enum), variable
and returnValue.</para>

<figure>
<title>literal</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/literal.png" format="PNG"></imagedata>
</imageobject>
</mediaobject>
</figure>

<figure>
<title>qualifiedIdentifier</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/qualifiedIdentifier.png" format="PNG"></imagedata>
</imageobject>
</mediaobject>
</figure>

<figure>
<title>variable</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/identifier.png" format="PNG"></imagedata>
</imageobject>
</mediaobject>
</figure>

<figure>
<title>returnValue</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/returnValue.png" format="PNG"></imagedata>
</imageobject>
</mediaobject>
</figure>

<para>You can do checks against fields that are or may be null, using '==' and '!=' as you would expect, and the
literal <literal>null</literal> keyword, as in <code>Cheese(type != null)</code>, where the evaluator will not
throw an exception and return true if the value is null.</para>
</section>

<section>
<title>Single Value Restriction</title>

<figure>
<title>singleValueRestriction</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/singleValueRestriction.png" format="PNG"
role=""></imagedata>
</imageobject>
</mediaobject>
</figure>

<para>A Single Value Restriction is a binary relation, applying a binary operator to the field value and another
value, which may be a literal, a variable, a parenthesized expression ("return value"), or a qualified
identifier, i.e., an enum constant.</para>

<section>
<title>Literal Restrictions</title>

<para>Literal restrictions are the simplest form of restrictions and evaluate a field against a specified
literal, which may be numeric or a date, a string or a boolean.</para>

<figure>
<title>literalRestriction</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/literalRestriction.png" format="PNG"></imagedata>
</imageobject>
</mediaobject>
</figure>

<para>Literal Restrictions using the operator '==' provide for faster execution as we can index using hashing
to improve performance.</para>
</section>

<section>
<title>Bound Variable Restriction</title>

<figure>
<title>variableRestriction</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/variableRestriction.png" format="PNG"></imagedata>
</imageobject>
</mediaobject>
</figure>

<para>Variables can be bound to facts and their fields and then used in subsequent Field Constraints. A bound
variable is called a <indexterm>
<primary>declaration</primary>
</indexterm>Declaration. Valid operators are determined by the type of the field being constrained; coercion
will be attempted where possible. Bound Variable Restrictions using the operator '==' provide for very fast
execution as we can use hashing to improve performance.</para>

<example>
<title>Bound Field using the operator '=='</title>

<programlisting>Person( likes : favouriteCheese )
Cheese( type == likes )</programlisting>
</example>

<para>Here, <code>likes</code> is the variable that is bound in its declaration to the field
<code>favouriteCheese</code> of any matching Person instance. It is then used to constrain the type of Cheese
in the following pattern. Any valid Java variable name can be used, and it may be prefixed with a '$', which
you will often see used to help differentiate declarations from fields. The example below shows a declaration
for <code>$stilton</code>, bound to the object matching the first pattern and used with a
<code>contains</code> operator. - Note the optional use of '$'.</para>

<example>
<title>Bound Fact using 'contains' operator</title>

<programlisting>$stilton : Cheese( type == "stilton" )
Cheesery( cheeses contains $stilton )</programlisting>
</example>
</section>

<section>
<title>Return Value Restriction</title>

<figure>
<title>returnValueRestriction</title>

<mediaobject>
<imageobject>
<imagedata align="center" fileref="images/Chapter-Rule_Language/returnValueRestriction.png" format="PNG"></imagedata>
</imageobject>
</mediaobject>
</figure>

<para>A <indexterm>
<primary>Return Value</primary>
</indexterm>Return Value restriction is a parenthesized expression composed from literals, any valid Java
primitive or object, previously bound variables, function calls, and operators. Functions used in a Return
Value must return results that do not depend on time.</para>

<example>
<title>Return Value Restriction</title>

<programlisting>Person( girlAge : age, sex == "F" )
Person( age == ( girlAge + 2) ), sex == 'M' )</programlisting>
</example>
</section>
</section>
</section>
</section>
</section>
Binary file not shown.

This file was deleted.

Binary file not shown.

0 comments on commit e4ff32f

Please sign in to comment.