-
Notifications
You must be signed in to change notification settings - Fork 44
Description
Describe the bug
When evaluating a property relation (here specifically Regex Analysis) on a multi-valued property (here XSD 0..n), with a the target being a single-valued property (here XSD 0..1), the evaluation appears to only be performed against the first source value.
To Reproduce
The attachment aaa-tn-ln-sample.zip contains an alignment with a single type relation Retype between AX_FlaecheGemischterNutzung and LN_Forstwirtschaft. This contains two Regex Analysis property mappings from zeigtAufExternes/AA_Fachdatenverbindung/fachdatenobjekt/AA_Fachdatenobjekt/name to art, whereby zeigtAufExternes has cardinality 0..n and art cardinality 0..1. The aim of these mappings is that if the source object contains an AA_Fachdatenverbindung with a particular value then an appropriate value may be assigned to art - i.e. a classification performed on substring matches of the source value.
This alignment was used to transform the GML contained in source.zip. This contains two AX_FlaecheGemischterNutzung features, both of which have two zeigtAufExternes/AA_Fachdatenverbindung. In the first object (DEMVAL0300bebrte) the relevant AA_Fachdatenverbindung is the first of these, in the second object (DEMVAL7600fucDbr) the second.
The result of this transformation is in transformed.zip: Here it can be seen that the feature derived from DEMVAL0300bebrte has art set to 6200 from the Regex Analysis mapping, whereas DEMVN17600fucDbr has no art set, despite also having a matching AA_Fachdatenverbindung.
source-fdv-reversed.zip contains exactly the same two features, but in each case the order of AA_Fachdatenverbindung are reversed compared to the previous example. As can be seen in the result of the transformation transformed-fdv-reversed.zip the resulting art properties are also reversed - the feature derived from DEMVN17600fucDbr now has art set to 6200 whereas the feature derived from DEMVAL0300bebrte has no art set.
Expected behavior
The ordering of the property values in the source should only be relevant in the case that multiple possible values for the target result from the transformation: Here it would be expected/acceptable that (in respect to any priorities defined for the individual property relations if more than one is present for a given target property), the resulting value is derived from the first matching property value in the source. In the case that the evaluation of the source property values only results in a single target property value then the order of the source property values should be irrelevant.
In other words, in the current case the Regex Analysis should be tested against all source property values present within the source feature until either a match is found (with resulting derived value assigned to the target property) or all source property values have been tested: Currently it appears that only the first source property value is evaluated.
Additional context
Note that if an index context is used then it would of course be correct to evaluate against only a single source value - that is however not the case in this example, and since the ordering of the source property values is arbitrary then an index context would be inappropriate.