Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Resolving unqualified names
Resolving unqualified names [message #477205] Tue, 08 April 2008 08:12 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Hey,

Suppose I have the following Namespace/Package structure:

|-p
|-School
|-q
|-Teacher
|-talk()

Inside the talk() Operation, according to the specs, I can refer to School unqualified,
since School is in an enclosing Namespace of Teacher. I tried to resolve the School element by
querying q.members, but that doesn't find it. Reading the specs again, I understand why.

So I guess I need to manually walk up the Namespace Onion, and query each Namespaces members :-P to resolve that name? I couldn't find an API call that
already does that?

Felix
Re: Resolving unqualified names [message #477208 is a reply to message #477205] Tue, 08 April 2008 11:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Felix,

If you are trying to use unqualified references to School in some OCL
pre/post-condition constraint in the talk() operation context, then that
should work as you expect. MDT OCL knows the onion. :-)

Perhaps your situation doesn't involve OCL, but in implementing this
capability, we found that we needed to do it just as you suggest.

Cheers,

Christian


Felix Dorner wrote:

> Hey,
>
> Suppose I have the following Namespace/Package structure:
>
> |-p
> |-School
> |-q
> |-Teacher
> |-talk()
>
> Inside the talk() Operation, according to the specs, I can refer to School
> unqualified, since School is in an enclosing Namespace of Teacher. I tried
> to resolve the School element by querying q.members, but that doesn't find
> it. Reading the specs again, I understand why.
>
> So I guess I need to manually walk up the Namespace Onion, and query each
> Namespaces members :-P to resolve that name? I couldn't find an API call
> that already does that?
>
> Felix
Re: Resolving unqualified names [message #477211 is a reply to message #477208] Tue, 08 April 2008 15:10 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Christian W. Damus wrote:
> Hi, Felix,
>
> If you are trying to use unqualified references to School in some OCL
> pre/post-condition constraint in the talk() operation context, then that
> should work as you expect. MDT OCL knows the onion. :-)

Hey Christian,

I am not really writing OCL expressions, but something very similar.
I create a language for specifying operation semantics, including side effects,
that's where I need to resolve unqualified names. I actually like the idea to be
able to use Elements further up with their unqualified names without having to import
them manually... I really see the parallelism between OCL and what I do. I initially
had the idea to simply extend the ocl expression parser but I was to frightened.
Now I need to do all the parsing myself :( but at least I know where I am..


Felix
Re: Resolving unqualified names [message #626365 is a reply to message #477205] Tue, 08 April 2008 11:58 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Felix,

If you are trying to use unqualified references to School in some OCL
pre/post-condition constraint in the talk() operation context, then that
should work as you expect. MDT OCL knows the onion. :-)

Perhaps your situation doesn't involve OCL, but in implementing this
capability, we found that we needed to do it just as you suggest.

Cheers,

Christian


Felix Dorner wrote:

> Hey,
>
> Suppose I have the following Namespace/Package structure:
>
> |-p
> |-School
> |-q
> |-Teacher
> |-talk()
>
> Inside the talk() Operation, according to the specs, I can refer to School
> unqualified, since School is in an enclosing Namespace of Teacher. I tried
> to resolve the School element by querying q.members, but that doesn't find
> it. Reading the specs again, I understand why.
>
> So I guess I need to manually walk up the Namespace Onion, and query each
> Namespaces members :-P to resolve that name? I couldn't find an API call
> that already does that?
>
> Felix
Re: Resolving unqualified names [message #626368 is a reply to message #477208] Tue, 08 April 2008 15:10 Go to previous message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Christian W. Damus wrote:
> Hi, Felix,
>
> If you are trying to use unqualified references to School in some OCL
> pre/post-condition constraint in the talk() operation context, then that
> should work as you expect. MDT OCL knows the onion. :-)

Hey Christian,

I am not really writing OCL expressions, but something very similar.
I create a language for specifying operation semantics, including side effects,
that's where I need to resolve unqualified names. I actually like the idea to be
able to use Elements further up with their unqualified names without having to import
them manually... I really see the parallelism between OCL and what I do. I initially
had the idea to simply extend the ocl expression parser but I was to frightened.
Now I need to do all the parsing myself :( but at least I know where I am..


Felix
Previous Topic:Types that are not Classifiers
Next Topic:profile from two meta-model
Goto Forum:
  


Current Time: Wed Apr 24 17:19:03 GMT 2024

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

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

Back to the top