Page last modified 16:09, 17 Feb 2016 by Jussi

6. Relationships Redirected from User guide for OCL rules in XMLdation environment/6. Relationships

    Table of contents
    No headers

    Mapping validation can be used for checking that data has travelled correctly from source to target. Mapping validation takes a source file and a target file as input and compares values and structures in them according to mapping rules.

    In the picture below we have a source file structure on the left side and a target file structure on the right. The data from the highlighted fields of the source file should travel to the highlighted fields of the target file.

    elements to be mapped.png


    To be able to create a validation rule we need to create a relationship which can be used when writing rules between files. For this particular example we want to create a relationship between Header element of the source file and OriginalMessages of the target.

    relationship to be created.png


    The relationship takes the following information:



    Context 1


    Context 1 name


    Context 2


    Context 2 name



    SourceHeader.Id = TargetOriginalMessages.OriginalHeaderId


    After the relationship is created a “virtual element” is created to both to the source and to the target. You can move from source to the target and vice versa by using the name of this virtual element which is defined in the relationship.

    It kind of looks like in the picture below.  You could for example check if the value of the OriginalControlSum element in the target message matches with the value of ControlSum element in the source file.

    Context: OriginalMessageType1

    OCL rule: self.SourceHeader.ControlSum = self.OriginalControlSum