isl / x3ml

X3ML Engine supports the data transformation which is part of the data provisioning and aggregation process.
Apache License 2.0
19 stars 7 forks source link

UriOrUUID generator reports error when an element is missing #72

Closed ymark closed 7 years ago

ymark commented 7 years ago

When using the URIorUUID generator, if an element is missing (i.e. if it points to an attribute) then instead of generating a UUID it reports an error message.

ymark commented 7 years ago

The following situation reports exactly the problem. Assuming that we have the following XML input:

    <COIN>
        <ID/>
    </COIN>
    <COIN>
        <ID>http://1</ID>
    </COIN>

and the X3ML mappings contain the following:

<domain>
      <source_node>//COIN</source_node>
      <target_node>
             <entity>
                     <type>crm:E22_Man-Made_Object</type>
                     <instance_generator name="URIorUUID">
                <arg name="text">ID/text()</arg>
              </instance_generator>
             </entity>
      </target_node>
</domain>

In this case the engine should create TWO instaces of the crm:E22_Man-Made_Object class;

We should also note that the same should occur if the ID element was missing. This is due to the fact that the source_node is COIN (that exists twice), however the corresponding value to be used by the instance generator is missing, therefore instead of the URI, a UUID should be generated.

ymark commented 7 years ago

The issue has been resolved. Furthermore the documentation of the corresponding generator has been updated to better clarify its usage.

The updated functionality will be made available in the forthcoming release (1.7.5)