Some element shown below can have elements that express these constraints.
Table 19.5.1[Elements of constraint] shows a list of constraints.
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 (>=) |
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].
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.
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].
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.
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].
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.
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].
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.
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.
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].
Name | Required | function |
---|---|---|
type | yes | a result name of the operation |
The content of the element are shown below.
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].
Name | Required | function |
---|---|---|
label | yes | a result name of the operation |
The content of the element are shown below.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
<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>
<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>