Powered by SmartDoc

Constraint expression

Some element shown below can have elements that express these constraints.

Table 19.5.1[Elements of constraint] shows a list of constraints.

Elements of constraint
element function
attribute gets a value of a attribute
operation invokes a operation and gets a result
in gets a value of a parameter
out gets a value of a result
value specifies a value
verify verifies a XML document
and logical and
or logical or
not logical not
equal arithmetic equal (=)
plus arithmetic plus (+)
subtract arithmetic subtract (-)
times arithmethic times (*)
divide arithmethic divide (/)
lessThan arithmethic less than (<)
greaterThan arithmethic greater than (>)
lessEqualThan arithmethic less equal than (<=)
greaterEqualThan arithmethic greater equal than (>=)

attribute

An attribute element in the constraint expression means that there is a reference to the attribute of the interface.

Attributes which are able to used in the attribute element are shown in Table 19.5.1.1[attributes].

attributes
Name Required function
name yes an attribute name for the attribute
namespace no a namespace name for the attribute
path no a path expression for the value in the data of the object which is contained in the attribute
timing no always having the value "pre". It means that the value used in expression is the value fetched before method execution.

The content of the element is empty.

operation

An operation element in the constraint expression means an execute the operation of the interface and uses return value from it.

Attributes which are able to used in the operation element are shown in Table 19.5.2.1[attributes of operation element].

attributes of operation element
Name Required function
name yes an element name for the element
namespace no a namespace name for the element
path no a path expression for the value in the data of the object which is contained in the element

The content of the element is empty.

in

An in element in the constraint expression specifies a value of the parameter of the operation.

Attributes which are able to used in the in element are shown in Table 19.5.3.1[attributes of in].

attributes of in
Name Required function
name yes an input parameter name of the operation
path no a path expression for the value in the data of the object which is specified by the parameter
timing no always having the value "pre". It means that the value used in the expression is the value fetched before method execution.

The content of the element is empty.

out

A out element in the constraint expression specifies a value of the parameter of the operation.

Attributes which is able to used in the out element are shown in Table 19.5.4.1[attributes of out].

attributes of out
Name Required function
name no a result name of the operation
path no a path expression for the value in the data of the object which is specified by the result

The content of the element is empty.

value

A value element in the constraint expression specifies a concrete value immediately.

The value element has no attributes.

The content of the element is a concrete value.

verify(type)

A verify element in the constraint expression executes verification against a value in the element.

Attributes which is able to used in the verify element are shown in Table 19.5.6.1[attributes of verify].

attributes of verify
Name Required function
type yes a result name of the operation

The content of the element are shown below.

verify(label)

A verify element in the constraint expression executes verification against a content in the element.

Attributes which is able to used in the verify element are shown in Table 19.5.7.1[attributes of verify].

attributes of verify
Name Required function
label yes a result name of the operation

The content of the element are shown below.

and

A and element in the constraint expression executes "logical and" operation.

The and element has no attributes.

The content of the element are shown below.

or

A or element in the constraint expression executes "logical or" operation.

The or element has no attributes.

The content of the element are shown below.

not

A not element in the constraint expression executes "logical not" operation.

The not element has no attributes.

The content of the element are shown below.

equal

A equal element in the constraint expression executes "logical and arithmetic equal" operation.

The equal element has no attributes.

The content of the element are shown below.

plus

A plus element in the constraint expression executes "arithmetic plus" operation.

The plus element has no attributes.

The content of the element are shown below.

subtract

A subtract element in the constraint expression executes "arithmetic subtract" operation.

The subtract element has no attributes.

The content of the element are shown below.

times

A times element in the constraint expression executes "arithmetic times" operation.

The times element has no attributes.

The content of the element are shown below.

divide

A divide element in the constraint expression executes "arithmetic divide" operation.

The divide element has no attributes.

The content of the element are shown below.

lessThan

A lessThan element in the constraint expression executes "arithmetic lessThan" operation.

The lessThan element has no attributes.

The content of the element are shown below.

greaterThan

A greaterThan element in the constraint expression executes "arithmetic greaterThan" operation.

The greaterThan element has no attributes.

The content of the element are shown below.

lessEqualThan

A lessEqualThan element in the constraint expression executes "arithmetic lessEqualThan" operation.

The lessEqaulThan element has no attributes.

The content of the element are shown below.

greaterEqualThan

A greaterEqualThan element in the constraint expression executes "arithmetic greaterEqualThan" operation.

The greaterEqualThan element has no attributes.

The content of the element are shown below.

Example

List 19.5.20.1[grammarConstraint.rcdl] is a sample RCDL definition and List 19.5.20.2[grammarConstraint.rng] is a sample RELAX NG schema to be used in the sample RCDL definition.

grammarConstraint.rcdl
<component xmlns="http://www.relaxer.org/xmlns/cdl"
           namespace="http://example.com/account"
           name="backOffice">
  <interface namespace="http://example.com/account" name="accountManager">
<grammar namespace="http://example.com/account" \
    location="grammarConstraint.rng"/>
    <operation name="findAccount">
      <in name="accountNo" type="token"/>
      <out label="account"/>
    </operation>
  </interface>
</component>
grammarConstraint.rng
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
    <ref name="account"/>
  </start>
  <define name="account">
    <element name="account">
      <attribute name="accountNo">
        <data type="token"/>
      </attribute>
      <element name="balance">
        <data type="int"/>
      </element>
      <element name="owner">
        <data type="token"/>
      </element>
      <ref name="address"/>
      <zeroOrMore>
        <ref name="phone"/>
      </zeroOrMore>
    </element>
  </define>
  <define name="address">
    <element name="address">
      <attribute name="zip">
        <data type="token"/>
      </attribute>
      <text/>
    </element>
  </define>
  <define name="phone">
    <element name="phone">
      <attribute name="area">
        <data type="token"/>
      </attribute>
      <data type="token"/>
    </element>
  </define>
</grammar>