Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » GMT (Generative Modeling Technologies) » [MOFScript] undefined properties
[MOFScript] undefined properties [message #377488] Fri, 11 May 2007 10:31 Go to next message
Andy Carpenter is currently offline Andy CarpenterFriend
Messages: 145
Registered: July 2009
Senior Member
I have an input meta model for which one of the classes
has a property that does not required a value. Thus, I
want to make the generation of the output conditional
on whether or not a value is defined in the input model.

i.e something along the lines

if (self.p.oclIsDefined()) {
self.p.name
}

However, it appears that oclIsDefined is not among
the ocl functions defined in MOFScript. How is this
situation handled in MOFScript?

thanks
Andy.

--
-- ------------------------------------------------------------ -------------
Dr Andy Carpenter
School of Computer Science,
University of Manchester, Manchester M13 9PL, UK
Email: Andy.Carpenter@manchester.ac.uk
Tel: +44 161 275 6168
Fax: +44 161 275 6280
Re: [MOFScript] undefined properties [message #377491 is a reply to message #377488] Fri, 11 May 2007 11:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eric.vepa.gmail.com

Hi Andy,

I am not using MOFScript but in ATL you can use the function
oclIsUndefined().

Your code may look like (do not forget the "not") :

if (not self.p.oclIsUndefined()) {
self.p.name
)

Andy Carpenter wrote:
> I have an input meta model for which one of the classes
> has a property that does not required a value. Thus, I
> want to make the generation of the output conditional
> on whether or not a value is defined in the input model.
>
> i.e something along the lines
>
> if (self.p.oclIsDefined()) {
> self.p.name
> }
>
> However, it appears that oclIsDefined is not among
> the ocl functions defined in MOFScript. How is this
> situation handled in MOFScript?
>
> thanks
> Andy.
>


--
Éric Vépa
Re: [MOFScript] undefined properties [message #377493 is a reply to message #377488] Fri, 11 May 2007 13:02 Go to previous messageGo to next message
Gøran K. Olsen is currently offline Gøran K. OlsenFriend
Messages: 184
Registered: July 2009
Senior Member
Hello Andy,

I am not quite sure if I understand you correctly, but this might work

if (self.p != null) {
self.p.name
}

or try to print the property that does not have a value, and see what you
get,
or always use a defalult value in your model that you can check for.

/G
Re: [MOFScript] undefined properties [message #377495 is a reply to message #377493] Mon, 14 May 2007 07:28 Go to previous message
Andy Carpenter is currently offline Andy CarpenterFriend
Messages: 145
Registered: July 2009
Senior Member
G
Re: [MOFScript] undefined properties [message #596155 is a reply to message #377488] Fri, 11 May 2007 11:42 Go to previous message
Eclipse UserFriend
Originally posted by: eric.vepa.gmail.com

Hi Andy,

I am not using MOFScript but in ATL you can use the function
oclIsUndefined().

Your code may look like (do not forget the "not") :

if (not self.p.oclIsUndefined()) {
self.p.name
)

Andy Carpenter wrote:
> I have an input meta model for which one of the classes
> has a property that does not required a value. Thus, I
> want to make the generation of the output conditional
> on whether or not a value is defined in the input model.
>
> i.e something along the lines
>
> if (self.p.oclIsDefined()) {
> self.p.name
> }
>
> However, it appears that oclIsDefined is not among
> the ocl functions defined in MOFScript. How is this
> situation handled in MOFScript?
>
> thanks
> Andy.
>


--
Éric Vépa
Re: [MOFScript] undefined properties [message #596162 is a reply to message #377488] Fri, 11 May 2007 13:02 Go to previous message
Gøran K. Olsen is currently offline Gøran K. OlsenFriend
Messages: 184
Registered: July 2009
Senior Member
Hello Andy,

I am not quite sure if I understand you correctly, but this might work

if (self.p != null) {
self.p.name
}

or try to print the property that does not have a value, and see what you
get,
or always use a defalult value in your model that you can check for.

/G
Re: [MOFScript] undefined properties [message #596170 is a reply to message #377493] Mon, 14 May 2007 07:28 Go to previous message
Andy Carpenter is currently offline Andy CarpenterFriend
Messages: 145
Registered: July 2009
Senior Member
G
Previous Topic:[MOFScript] undefined properties
Next Topic:[MOFScript] objectsOfType
Goto Forum:
  


Current Time: Wed Apr 24 16:48:32 GMT 2024

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

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

Back to the top