ocl newbie question [message #571092] |
Thu, 02 March 2006 20:29 |
Selcuk Aya Messages: 13 Registered: July 2009 |
Junior Member |
|
|
Hi,
I have been experimenting with emf's ocl and I have a related question.
I form the following expression:
exp = QueryFactory.eINSTANCE.createQuery(
"self.declaredFacets->asSet()->union(self.superTypes.declaredFacets)- >asSet())",
CorePackage.eINSTANCE.getPartyType());
PartyType is an EObject.It has supertypes of EObjects. It has an
eStructuralFeature declaredFacets. When I evaluate this expression on a
PartyType object which has two declared facets but no superType, I get an
"IllegalArgumentException: Illegal operation(null.union(null)".
When I change the expression to:
exp = QueryFactory.eINSTANCE.createQuery(
"self.declaredFacets->asSet()->union(self.superTypes->asSet()- >collect(p :
PartyType|p.declaredFacets)->asSet())",
CorePackage.eINSTANCE.getPartyType());
everything works fine. Do I have to use collect whenever an eStructural
feature (in this case superTypes) might return null, is this a bug or am I
doing something wrong?
I would appreciate any comments,
thanks,
Selcuk
|
|
|
Powered by
FUDForum. Page generated in 0.02882 seconds