FURCAS-dev/FURCAS — Issue #126: Mapping incomplete for multi-value features
Author: StephanErb
Created: 2011-12-06 21:56:19+00:00
State: open
Labels: Mapping Language

I will make an example: Consider a multi-value feature of type string in which we store `first`, `second` and `third`.

We can parse/pretty print this and get three corresponding tokens. All three tokens contain the same sequence element but no information to which particular string they belong. We basically don't know that the first token corresponds to `first`, the second to `second` and so on.

This issue is complicated by the fact that the feature may be unordered. After saving and reloading our resource, the feature may contain `second`, `third` and `first`. We therefore can't rely on any ordering information when trying to perform the matching of tokens and model elements.

I came across this problem when I short pretty printed a complete textblocks model. The short pretty printer uses the following code and therefore fails:

private String handlePropertyElement(Property se, LexedToken token) {
...
Object propertyValue = null;
try {
propertyValue = investigator.get(contextObject, se.getPropertyReference().getStrucfeature().getName());
if (propertyValue instanceof Collection && ((Collection) propertyValue).size() > 0) {
propertyValue = ((Collection) propertyValue).iterator().next();
}
} catch (ModelAdapterException e) {
// element does not have such a property
}

So, do we need to extend our usage of the referencedElements relation?