Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » ocl newbie question
ocl newbie question [message #571092] Thu, 02 March 2006 20:29
Selcuk Aya is currently offline Selcuk AyaFriend
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
Previous Topic:[Announce] EMFT TRANSACTION 1.0.0M5a is available
Next Topic:ocl newbie question
Goto Forum:
  


Current Time: Mon Sep 26 10:58:38 GMT 2022

Powered by FUDForum. Page generated in 0.01765 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top