Self
All systems (RDBMS, XML and Java) allow the introduction of
relationships based on self.
Self's value lies in the way in can be used to modularise transforms
and encourage code re-use. If you find yourself trying to transform from
THIS
or to THAT then it is self that you need to be using.
Notes:
- Self is a reference to a the current instance in the source or target as
though it were another instance. ($instance is not; it is a reference to the
current transform handle and should only be used in the triangular problem.)
- Self use the key word
self::* as the relationship XPath even in
non-XML systems.
- To add a self relationship, right click on an element in the source or
target pane and select
Relationship | Add Self Relationship.
- Self is available on both target and source sides. (We suggest that you call
relationships based on self 'self'.)
- DO NOT write
self := self within a transform. It serves
no purpose and the special logic in use within self transforms will result in a
circular stack call and a corresponding stack overflow at run-time.
- There are no restrictions on the use of Self on the source a side.
- Using self on the target side requires a great deal of thought. Although
conceptually similar it is not recommended for non-expert users of the system.
This is because the system will construct a transform target in the first part
of the transform and then use the navigation by the self-relationship to revisit
that target node and add further properties. Nevertheless this feature is
invaluable in writing some types of transforms with a modular approach.
The correct use is to put self on one side and another element on the other
side. For example:
TRANSFORM X <- Y
Self := Z
will call
TRANSFORM X <- Z
TRANSFORM X <- Y
Z := Self
will call TRANSFORM Z <- Y
Additional Notes:
- The cascade target of a self transform (
TRANSFORM X <- Z in the
example above) must not try to identify X; this must have already happened in
the TRANSFORM X <- Y .This is a logical consequence of the re-use of X.
- The current release of Transformation Manager will issue a warning message for such
transform telling you it is not identified – this warning may be safely ignored.
If you want the transform X <- Z to be called under other circumstances then use:
