SYNTAX

<Entity>.clone[<Expression1>,<Expression2>…]

Copies the specified Entity and its attribute values to a new Entity where Expressions (in the form attribute=value) override the corresponding cloned attribute values. The new Entity has no associations. Where an Entity specifies an Entity Identity, that identity is not copied to its clone entity. For each Entity in Collection, the operator creates a duplicate of Entity. The implementation is a shallow clone -- associations are not duplicated.

The Operators row in the table of Summary Table of Vocabulary Usage Restriction does not apply. Special exceptions: clone may only be used in Action Rows (section 5 in Sections of Rulesheet that correlate with usage restrictions).

Nested clone calls are not supported, such as E1.clone[assoc1 += E1.assoc1.clone[…]].

The following Rulesheet uses .clone to create a new Entity2 element when the value of qtyOrdered in Entity1 is greater than the qtyShipped value. An alias is not required by the .clone operator, because it is possible to create a new entity at the root level, without inserting it into a collection. 

A sample Ruletest provides two collections of Entity1. Input, Output, and Expected panels are as follows:

RULESHEET EXAMPLE: COLLECTION

The following Rulesheet uses .clone to create a new Entity2 element in collection1 when Entity1 has a non-zero qtyOrdered value.

A sample Ruletest provides three collections of Entity1. Input and Output panels are illustrated below: