Bug 412397 - coll->xselect(item.attribute = aValue) returns empty set, when coll->exists(item.value.oclIsUndefined())
Summary: coll->xselect(item.attribute = aValue) returns empty set, when coll->exists(i...
Status: UNCONFIRMED
Alias: None
Product: QVTo
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-05 08:53 EDT by Rolf Theunissen CLA
Modified: 2013-08-26 03:27 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf Theunissen CLA 2013-07-05 08:53:00 EDT
In Kepler, for a collections with items that contain an attribute that for some of the items is undefined, xselect always returns an empty set when comparing on the attribute value:

coll->xselect(item.attribute = aValue)->size() = 0

In Juno, this statement returns all items that match the expression.

In Kepler and Juno, coll->selectOne(item.attribute = aValue) return one item (if the expression matches). The semantics of xselect and selectOne should be the same (modulo one item vs. a list of items)
Comment 1 Ed Willink CLA 2013-07-05 10:51:42 EDT
"undefined" was a vagueness in OCL 2.0 that was clarified to "null" or "invalid" in OCL 2.3. So your report about "undefined" is also vague.

Please provide a test case that demonstrates your concern.
Comment 2 Christopher Gerking CLA 2013-08-26 02:41:14 EDT
Can't reproduce on the following example. There are classes with and without a package in my test model. As expected, xselect returns only those with a package.

var classes : Set(EClass) = source.objects()[EClass];
var selection : Collection(EClass) = classes->xselect(c | c.ePackage != null );
Comment 3 Ed Willink CLA 2013-08-26 03:27:17 EDT
(In reply to comment #2)
> Can't reproduce on the following example.

The original report distinguished Juno/Kepler, but referred to 'undefined' values. Presumably 'null' values since collections containing invalid are invalid.

The classic OCL functionality re-used by QVTo has been very stable but not 100%. There are a few corner cases where the functionality was clearly wrong and easily fixed and so it has been corrected. This sounds like it could be one of them.

You might also want to see whether the setting of the "Implement lax null handling .." option has any effect.