Cover Pages Logo SEARCH
Advanced Search
ABOUT
Site Map
CP RSS Channel
Contact Us
Sponsoring CP
About Our Sponsors

NEWS
Cover Stories
Articles & Papers
Press Releases

CORE STANDARDS
XML
SGML
Schemas
XSL/XSLT/XPath
XLink
XML Query
CSS
SVG

TECHNOLOGY REPORTS
XML Applications
General Apps
Government Apps
Academic Apps

EVENTS
LIBRARY
Introductions
FAQs
Bibliography
Technology and Society
Semantics
Tech Topics
Software
Related Standards
Historic

ILOG Simple Rules DTD


<!-- ILOG Simple Rules DTD -->
<?xml version="1.0" encoding="ISO-8859-1"?>


<!--
   A constant expression has a required type (enumerated) and
   a value (cdata). The DTD provides the common types that
   exist in the programming languages. The notations allowed
   for specifying the literal values (for instance hexadecimal
   numbers or special characters) are the same as for the Java
   programming language.
-->

<!ELEMENT constant EMPTY>
<!ATTLIST constant
   type (string | boolean | byte | short | char | long
          | int | float | double | null) #REQUIRED 
   value CDATA #REQUIRED>


<!--
   Defines an assignable entity. An assignable entity is a variable
   or a field. An assignable entity has a value and can change values
   using assignments. As an assignable entity is also a value, it
   can appear in an expressison.
-->

<!ENTITY % assignable "(variable | field)">


<!--
   A variable has simply a name. A variable is created using "bind"
   or as the object variable of a simple condition. A variable is
   an "assignable" and can change values using "assignment".
-->

<!ELEMENT variable EMPTY>
<!ATTLIST variable
   name NMTOKEN #REQUIRED>


<!--
   A field value. A field value operates on an object (an expression)
   and a field name. If the object is not specified, it is set to
   be the current default object. In a simple condition or a not
   condition, the default object is the one currently matched by the
   condition. For "assert" and "modify", the default object is the
   target of the assertion or the modification.
-->

<!ELEMENT field (%expression;)?>
<!ATTLIST field
   name NMTOKEN #REQUIRED>


<!--
   Defines the expressions of the language. An expression can be
   an assignable (variable or field), a constant (a literal), an
   arithmetic expression or a boolean expression (a test).
-->

<!ENTITY % expression
  "(%assignable; | constant | unaryExp | binaryExp | naryExp)">


<!--
   Defines the unary expressions. A unary expression acts on a 
   single argument. The operator is specified using an enumerated
   type (the "operator" attribute). Note: the traditional
   signs like +, -, ! can not be part of enumerations. This
   justifies that we use symbolic names for operators.
-->

<!ELEMENT unaryExp (%expression;)>
<!ATTLIST unaryExp operator (plus | minus | not) #REQUIRED>


<!--
   Defines the binary expressions. A binary expression acts on two
   arguments. As for unary operators, binary operators are
   specified using enumerated symbolic names which correspond
   respectively to the following signs: ==, !=, <, <=, >, >=
-->

<!ELEMENT binaryExp (%expression;,%expression;)>
<!ATTLIST binaryExp
   operator (eq | neq | lt | lte | gt | gte) #REQUIRED>


<!--
   A N-ary expression acts on N expressions. The number of expressions
   must be at least two. The operators are specified using symbolic
   names. Those names correspond to these signs:
      +, -, *, /, %, &&, ||
-->

<!ELEMENT naryExp (%expression;)+>
<!ATTLIST naryExp
   operator (add | subtract | multiply | divide |
             remainder | and | or) #REQUIRED>


<!--
   An assignment. This uses two expressions: a first expression
   (an "assignable") which will be assigned the value of a second
   expression.
-->

<!ELEMENT assignment (%assignable;,%expression;)>



<!--
   A variable binding declares a variable and sets it to some
   initial value. A variable can change values by "assignment".
-->

<!ELEMENT bind (%expression;) >
<!ATTLIST bind
   name NMTOKEN #REQUIRED>



<!--
   The ruleset is composed of a list of rules. A ruleset has a name
   (optional). The ruleset is the root element of an XML document.
-->

<!ELEMENT ruleset (rule*)>

<!ATTLIST ruleset
   name NMTOKEN #IMPLIED>



<!--
   A rule has a name (required), a priority (optional), a condition
   part and an action part. The priority is an expression.
   There must be at least a condition and the action part can be empty.
-->

<!ELEMENT rule ( priority?, conditionPart, actionPart ) >
<!ATTLIST rule
   name NMTOKEN #REQUIRED>

<!ELEMENT priority (%expression;)>
<!ELEMENT conditionPart (%condition;)+>
<!ELEMENT actionPart (%action;)* >


<!--
   A condition is either a simple condition or a not condition.
   These conditions differ by the fact that a simple condition match
   an object which can be bound to a variable, while the not condition
   does not match any object.
-->
<!ENTITY % condition "(simpleCondition | notCondition)">



<!--
   Defines the possible actions allowed in the rule action part.
   This includes variable declarations and assignments, as well as
   the traditional assert, retract and modify statements of rule
   languages.
-->

<!ENTITY % action "(assignment | bind | assert | assertobj
                    | modify | retract)">



<!--
   A simple condition has a class name (required), a variable
   name (optional) to which the object is bound. The body of the
   condition is composed of test expressions. Under the scope
   of a simple condition, the default object is the one tested
   by this condition.
-->

<!ELEMENT simpleCondition (%expression;)*>
<!ATTLIST simpleCondition
   className CDATA #REQUIRED
   objectVariable NMTOKEN #IMPLIED>



<!--
   A not condition has a class name (required). The body of the
   condition may contain the same test expressions as for
   the simple condition. A not condition can not be bound to
   a variable. Under the scope of a not condition, the default
   object is the one tested by this condition.
-->

<!ELEMENT notCondition (%expression;)*>
<!ATTLIST notCondition
   className CDATA #REQUIRED>



<!--
   The assert action. This action requires a class name and may
   specify field assignment statements. An instance of the class
   is created, the statements (assignments) are executed, and the
   object is then added to the working memory. Under the scope of
   an assert, the default object is the one currently asserted.
-->

<!ELEMENT assert (assignment | bind)* >
<!ATTLIST assert
   className CDATA #REQUIRED>



<!--
   Another assert action. This action asserts an object computed from
   an expression. It differs from the previous "assert" by the fact
   that the object may be already created and returned as the value
   of the expression.
-->

<!ELEMENT assertobj (%expression;)>



<!--
   The retract action. This action removes an object from the working
   memory. The variable represents an object previously bound from
   the condition part.
-->

<!ELEMENT retract (variable)>



<!--
   The modify action. The action modifies an object of the working
   memory. The object is identified by a variable. The block of
   statements the the same as for the assert action. Under the scope
   of a modify, the default object is the one currently modified.
-->

<!ELEMENT modify (variable, (assignment | bind)+)>




Prepared by Robin Cover for The XML Cover Pages archive. See (1) DTD text format and (2) the main entry "Simple Rule Markup Language (SRML)."


Globe Image

Document URL: http://xml.coverpages.org/SRML-simpleRules-dtd.html