Skip to main content



      Home
Home » Modeling » UML2 » Are UUIDs required by the UML2 implementation?
Are UUIDs required by the UML2 implementation? [message #477269] Fri, 18 April 2008 15:34 Go to next message
Eclipse UserFriend
I am trying to load a UML model that contains elements that do not have
UUIDs.

The UML metamodel extends EModelElement, which supports hierarchical URI
fragments. However, I find that references made using hierarchical URI
fragments within a UML model can't be resolved via
EModelElementImpl#eObjectForURIFragmentSegment because the UML elements
are not ENamedElements.

Is this a scenario that should work, or is it considered unsupported by
the UML2 implementation?

Thanks,
Linda
Re: Are UUIDs required by the UML2 implementation? [message #477270 is a reply to message #477269] Sat, 19 April 2008 08:18 Go to previous messageGo to next message
Eclipse UserFriend
This is a multi-part message in MIME format.
--------------060305090801050600060909
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Linda,

Given that NamedElementImpl overrides eURIFragmentSegment to produce a
specialized fragment path, it seems to me that this corresponding
override to decode that specialized syntax is missing from NamedElementImpl:

@Override
public EObject eObjectForURIFragmentSegment(String uriFragmentSegment)
{
if (uriFragmentSegment.length() > 0)
{
// Is the first character a special character, i.e., something
other than '@'?
//
char firstCharacter = uriFragmentSegment.charAt(0);
if (firstCharacter != '@' && firstCharacter != '%')
{
// Look for trailing count.
//
int index = uriFragmentSegment.lastIndexOf(".");
String name = index == -1 ? uriFragmentSegment :
uriFragmentSegment.substring(0, index);
int count = 0;
if (index != -1)
{
try
{
count =
Integer.parseInt(uriFragmentSegment.substring(index + 1));
}
catch (NumberFormatException exception)
{
// Interpret it as part of the name.
//
name = uriFragmentSegment;
}
}

name = URI.decode(name);

// Look for a matching named element.
//
for (Object object : eContents())
{
if (object instanceof NamedElement)
{
NamedElement namedElement = (NamedElement)object;
if (name.equals(namedElement.getName()) && count-- == 0)
{
return namedElement;
}
}
}

return null;
}
}

return super.eObjectForURIFragmentSegment(uriFragmentSegment);
}


Linda Damus wrote:
> I am trying to load a UML model that contains elements that do not
> have UUIDs.
>
> The UML metamodel extends EModelElement, which supports hierarchical
> URI fragments. However, I find that references made using
> hierarchical URI fragments within a UML model can't be resolved via
> EModelElementImpl#eObjectForURIFragmentSegment because the UML
> elements are not ENamedElements.
>
> Is this a scenario that should work, or is it considered unsupported
> by the UML2 implementation?
>
> Thanks,
> Linda


--------------060305090801050600060909
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Linda,<br>
<br>
Given that NamedElementImpl overrides eURIFragmentSegment to produce a
specialized fragment path, it seems to me that this corresponding
override to decode that specialized syntax is missing from
NamedElementImpl:<br>
<br>
<small>&nbsp;&nbsp;&nbsp; &nbsp; @Override<br>
&nbsp;&nbsp;&nbsp; &nbsp; public EObject eObjectForURIFragmentSegment(String
uriFragmentSegment)<br>
&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (uriFragmentSegment.length() &gt; 0)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Is the first character a special character, i.e.,
something other than '@'?<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char firstCharacter = uriFragmentSegment.charAt(0);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (firstCharacter != '@' &amp;&amp; firstCharacter != '%')<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Look for trailing count.<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int index = uriFragmentSegment.lastIndexOf(".");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String name = index == -1 ? uriFragmentSegment :
uriFragmentSegment.substring(0, index);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int count = 0;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (index != -1)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; count =
Integer.parseInt(uriFragmentSegment.substring(index + 1));<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (NumberFormatException exception)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; // Interpret it as part of the name.<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; //<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; name = uriFragmentSegment;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; name = URI.decode(name);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Look for a matching named element.<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (Object object : eContents())<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (object instanceof NamedElement)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; NamedElement namedElement = (NamedElement)object;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (name.equals(namedElement.getName()) &amp;&amp;
count-- == 0)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return namedElement;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; return null;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return super.eObjectForURIFragmentSegment(uriFragmentSegment);<br>
&nbsp;&nbsp;&nbsp; &nbsp; }</small><br>
<br>
<br>
Linda Damus wrote:
<blockquote cite="mid:fuat3p$4ov$1@build.eclipse.org" type="cite">I am
trying to load a UML model that contains elements that do not have
UUIDs.
<br>
<br>
The UML metamodel extends EModelElement, which supports hierarchical
URI fragments.&nbsp; However, I find that references made using hierarchical
URI fragments within a UML model can't be resolved via
EModelElementImpl#eObjectForURIFragmentSegment because the UML elements
are not ENamedElements.
<br>
<br>
Is this a scenario that should work, or is it considered unsupported by
the UML2 implementation?
<br>
<br>
Thanks,
<br>
Linda
<br>
</blockquote>
<br>
</body>
</html>

--------------060305090801050600060909--
Re: Are UUIDs required by the UML2 implementation? [message #477271 is a reply to message #477270] Sat, 19 April 2008 12:20 Go to previous messageGo to next message
Eclipse UserFriend
Thanks, Ed. Overriding the eObjectForURIFragmentSegment implementation
in NamedElementImpl does the trick! I've opened
https://bugs.eclipse.org/bugs/show_bug.cgi?id=227892.

Regards,
Linda

Ed Merks wrote:
> Linda,
>
> Given that NamedElementImpl overrides eURIFragmentSegment to produce a
> specialized fragment path, it seems to me that this corresponding
> override to decode that specialized syntax is missing from NamedElementImpl:
>
> @Override
> public EObject eObjectForURIFragmentSegment(String uriFragmentSegment)
> {
> if (uriFragmentSegment.length() > 0)
> {
> // Is the first character a special character, i.e., something
> other than '@'?
> //
> char firstCharacter = uriFragmentSegment.charAt(0);
> if (firstCharacter != '@' && firstCharacter != '%')
> {
> // Look for trailing count.
> //
> int index = uriFragmentSegment.lastIndexOf(".");
> String name = index == -1 ? uriFragmentSegment :
> uriFragmentSegment.substring(0, index);
> int count = 0;
> if (index != -1)
> {
> try
> {
> count =
> Integer.parseInt(uriFragmentSegment.substring(index + 1));
> }
> catch (NumberFormatException exception)
> {
> // Interpret it as part of the name.
> //
> name = uriFragmentSegment;
> }
> }
>
> name = URI.decode(name);
>
> // Look for a matching named element.
> //
> for (Object object : eContents())
> {
> if (object instanceof NamedElement)
> {
> NamedElement namedElement = (NamedElement)object;
> if (name.equals(namedElement.getName()) && count-- == 0)
> {
> return namedElement;
> }
> }
> }
>
> return null;
> }
> }
>
> return super.eObjectForURIFragmentSegment(uriFragmentSegment);
> }
>
>
> Linda Damus wrote:
>> I am trying to load a UML model that contains elements that do not
>> have UUIDs.
>>
>> The UML metamodel extends EModelElement, which supports hierarchical
>> URI fragments. However, I find that references made using
>> hierarchical URI fragments within a UML model can't be resolved via
>> EModelElementImpl#eObjectForURIFragmentSegment because the UML
>> elements are not ENamedElements.
>>
>> Is this a scenario that should work, or is it considered unsupported
>> by the UML2 implementation?
>>
>> Thanks,
>> Linda
>
Re: Are UUIDs required by the UML2 implementation? [message #477273 is a reply to message #477271] Mon, 21 April 2008 09:13 Go to previous message
Eclipse UserFriend
Linda, Ed, Thanks for the fix. I'll look into adding this.

Cheers,
- James.



"Linda Damus" <ldamus@ca.ibm.com> wrote in message
news:fud64g$8mf$1@build.eclipse.org...
> Thanks, Ed. Overriding the eObjectForURIFragmentSegment implementation in
> NamedElementImpl does the trick! I've opened
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=227892.
>
> Regards,
> Linda
>
> Ed Merks wrote:
>> Linda,
>>
>> Given that NamedElementImpl overrides eURIFragmentSegment to produce a
>> specialized fragment path, it seems to me that this corresponding
>> override to decode that specialized syntax is missing from
>> NamedElementImpl:
>>
>> @Override
>> public EObject eObjectForURIFragmentSegment(String
>> uriFragmentSegment)
>> {
>> if (uriFragmentSegment.length() > 0)
>> {
>> // Is the first character a special character, i.e., something
>> other than '@'?
>> //
>> char firstCharacter = uriFragmentSegment.charAt(0);
>> if (firstCharacter != '@' && firstCharacter != '%')
>> {
>> // Look for trailing count.
>> //
>> int index = uriFragmentSegment.lastIndexOf(".");
>> String name = index == -1 ? uriFragmentSegment :
>> uriFragmentSegment.substring(0, index);
>> int count = 0;
>> if (index != -1)
>> {
>> try
>> {
>> count =
>> Integer.parseInt(uriFragmentSegment.substring(index + 1));
>> }
>> catch (NumberFormatException exception)
>> {
>> // Interpret it as part of the name.
>> //
>> name = uriFragmentSegment;
>> }
>> }
>>
>> name = URI.decode(name);
>> // Look for a matching named element.
>> //
>> for (Object object : eContents())
>> {
>> if (object instanceof NamedElement)
>> {
>> NamedElement namedElement = (NamedElement)object;
>> if (name.equals(namedElement.getName()) && count-- ==
>> 0)
>> {
>> return namedElement;
>> }
>> }
>> }
>> return null;
>> }
>> }
>> return super.eObjectForURIFragmentSegment(uriFragmentSegment);
>> }
>>
>>
>> Linda Damus wrote:
>>> I am trying to load a UML model that contains elements that do not have
>>> UUIDs.
>>>
>>> The UML metamodel extends EModelElement, which supports hierarchical URI
>>> fragments. However, I find that references made using hierarchical URI
>>> fragments within a UML model can't be resolved via
>>> EModelElementImpl#eObjectForURIFragmentSegment because the UML elements
>>> are not ENamedElements.
>>>
>>> Is this a scenario that should work, or is it considered unsupported by
>>> the UML2 implementation?
>>>
>>> Thanks,
>>> Linda
>>
Re: Are UUIDs required by the UML2 implementation? [message #626427 is a reply to message #477269] Sat, 19 April 2008 08:18 Go to previous message
Eclipse UserFriend
This is a multi-part message in MIME format.
--------------060305090801050600060909
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Linda,

Given that NamedElementImpl overrides eURIFragmentSegment to produce a
specialized fragment path, it seems to me that this corresponding
override to decode that specialized syntax is missing from NamedElementImpl:

@Override
public EObject eObjectForURIFragmentSegment(String uriFragmentSegment)
{
if (uriFragmentSegment.length() > 0)
{
// Is the first character a special character, i.e., something
other than '@'?
//
char firstCharacter = uriFragmentSegment.charAt(0);
if (firstCharacter != '@' && firstCharacter != '%')
{
// Look for trailing count.
//
int index = uriFragmentSegment.lastIndexOf(".");
String name = index == -1 ? uriFragmentSegment :
uriFragmentSegment.substring(0, index);
int count = 0;
if (index != -1)
{
try
{
count =
Integer.parseInt(uriFragmentSegment.substring(index + 1));
}
catch (NumberFormatException exception)
{
// Interpret it as part of the name.
//
name = uriFragmentSegment;
}
}

name = URI.decode(name);

// Look for a matching named element.
//
for (Object object : eContents())
{
if (object instanceof NamedElement)
{
NamedElement namedElement = (NamedElement)object;
if (name.equals(namedElement.getName()) && count-- == 0)
{
return namedElement;
}
}
}

return null;
}
}

return super.eObjectForURIFragmentSegment(uriFragmentSegment);
}


Linda Damus wrote:
> I am trying to load a UML model that contains elements that do not
> have UUIDs.
>
> The UML metamodel extends EModelElement, which supports hierarchical
> URI fragments. However, I find that references made using
> hierarchical URI fragments within a UML model can't be resolved via
> EModelElementImpl#eObjectForURIFragmentSegment because the UML
> elements are not ENamedElements.
>
> Is this a scenario that should work, or is it considered unsupported
> by the UML2 implementation?
>
> Thanks,
> Linda


--------------060305090801050600060909
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Linda,<br>
<br>
Given that NamedElementImpl overrides eURIFragmentSegment to produce a
specialized fragment path, it seems to me that this corresponding
override to decode that specialized syntax is missing from
NamedElementImpl:<br>
<br>
<small>&nbsp;&nbsp;&nbsp; &nbsp; @Override<br>
&nbsp;&nbsp;&nbsp; &nbsp; public EObject eObjectForURIFragmentSegment(String
uriFragmentSegment)<br>
&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (uriFragmentSegment.length() &gt; 0)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Is the first character a special character, i.e.,
something other than '@'?<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char firstCharacter = uriFragmentSegment.charAt(0);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (firstCharacter != '@' &amp;&amp; firstCharacter != '%')<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Look for trailing count.<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int index = uriFragmentSegment.lastIndexOf(".");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String name = index == -1 ? uriFragmentSegment :
uriFragmentSegment.substring(0, index);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int count = 0;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (index != -1)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; count =
Integer.parseInt(uriFragmentSegment.substring(index + 1));<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (NumberFormatException exception)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; // Interpret it as part of the name.<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; //<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; name = uriFragmentSegment;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; name = URI.decode(name);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Look for a matching named element.<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (Object object : eContents())<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (object instanceof NamedElement)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; NamedElement namedElement = (NamedElement)object;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if (name.equals(namedElement.getName()) &amp;&amp;
count-- == 0)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return namedElement;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; return null;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return super.eObjectForURIFragmentSegment(uriFragmentSegment);<br>
&nbsp;&nbsp;&nbsp; &nbsp; }</small><br>
<br>
<br>
Linda Damus wrote:
<blockquote cite="mid:fuat3p$4ov$1@build.eclipse.org" type="cite">I am
trying to load a UML model that contains elements that do not have
UUIDs.
<br>
<br>
The UML metamodel extends EModelElement, which supports hierarchical
URI fragments.&nbsp; However, I find that references made using hierarchical
URI fragments within a UML model can't be resolved via
EModelElementImpl#eObjectForURIFragmentSegment because the UML elements
are not ENamedElements.
<br>
<br>
Is this a scenario that should work, or is it considered unsupported by
the UML2 implementation?
<br>
<br>
Thanks,
<br>
Linda
<br>
</blockquote>
<br>
</body>
</html>

--------------060305090801050600060909--
Re: Are UUIDs required by the UML2 implementation? [message #626428 is a reply to message #477270] Sat, 19 April 2008 12:20 Go to previous message
Eclipse UserFriend
Thanks, Ed. Overriding the eObjectForURIFragmentSegment implementation
in NamedElementImpl does the trick! I've opened
https://bugs.eclipse.org/bugs/show_bug.cgi?id=227892

Regards,
Linda

Ed Merks wrote:
> Linda,
>
> Given that NamedElementImpl overrides eURIFragmentSegment to produce a
> specialized fragment path, it seems to me that this corresponding
> override to decode that specialized syntax is missing from NamedElementImpl:
>
> @Override
> public EObject eObjectForURIFragmentSegment(String uriFragmentSegment)
> {
> if (uriFragmentSegment.length() > 0)
> {
> // Is the first character a special character, i.e., something
> other than '@'?
> //
> char firstCharacter = uriFragmentSegment.charAt(0);
> if (firstCharacter != '@' && firstCharacter != '%')
> {
> // Look for trailing count.
> //
> int index = uriFragmentSegment.lastIndexOf(".");
> String name = index == -1 ? uriFragmentSegment :
> uriFragmentSegment.substring(0, index);
> int count = 0;
> if (index != -1)
> {
> try
> {
> count =
> Integer.parseInt(uriFragmentSegment.substring(index + 1));
> }
> catch (NumberFormatException exception)
> {
> // Interpret it as part of the name.
> //
> name = uriFragmentSegment;
> }
> }
>
> name = URI.decode(name);
>
> // Look for a matching named element.
> //
> for (Object object : eContents())
> {
> if (object instanceof NamedElement)
> {
> NamedElement namedElement = (NamedElement)object;
> if (name.equals(namedElement.getName()) && count-- == 0)
> {
> return namedElement;
> }
> }
> }
>
> return null;
> }
> }
>
> return super.eObjectForURIFragmentSegment(uriFragmentSegment);
> }
>
>
> Linda Damus wrote:
>> I am trying to load a UML model that contains elements that do not
>> have UUIDs.
>>
>> The UML metamodel extends EModelElement, which supports hierarchical
>> URI fragments. However, I find that references made using
>> hierarchical URI fragments within a UML model can't be resolved via
>> EModelElementImpl#eObjectForURIFragmentSegment because the UML
>> elements are not ENamedElements.
>>
>> Is this a scenario that should work, or is it considered unsupported
>> by the UML2 implementation?
>>
>> Thanks,
>> Linda
>
Re: Are UUIDs required by the UML2 implementation? [message #626431 is a reply to message #477271] Mon, 21 April 2008 09:13 Go to previous message
Eclipse UserFriend
Linda, Ed, Thanks for the fix. I'll look into adding this.

Cheers,
- James.



"Linda Damus" <ldamus@ca.ibm.com> wrote in message
news:fud64g$8mf$1@build.eclipse.org...
> Thanks, Ed. Overriding the eObjectForURIFragmentSegment implementation in
> NamedElementImpl does the trick! I've opened
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=227892
>
> Regards,
> Linda
>
> Ed Merks wrote:
>> Linda,
>>
>> Given that NamedElementImpl overrides eURIFragmentSegment to produce a
>> specialized fragment path, it seems to me that this corresponding
>> override to decode that specialized syntax is missing from
>> NamedElementImpl:
>>
>> @Override
>> public EObject eObjectForURIFragmentSegment(String
>> uriFragmentSegment)
>> {
>> if (uriFragmentSegment.length() > 0)
>> {
>> // Is the first character a special character, i.e., something
>> other than '@'?
>> //
>> char firstCharacter = uriFragmentSegment.charAt(0);
>> if (firstCharacter != '@' && firstCharacter != '%')
>> {
>> // Look for trailing count.
>> //
>> int index = uriFragmentSegment.lastIndexOf(".");
>> String name = index == -1 ? uriFragmentSegment :
>> uriFragmentSegment.substring(0, index);
>> int count = 0;
>> if (index != -1)
>> {
>> try
>> {
>> count =
>> Integer.parseInt(uriFragmentSegment.substring(index + 1));
>> }
>> catch (NumberFormatException exception)
>> {
>> // Interpret it as part of the name.
>> //
>> name = uriFragmentSegment;
>> }
>> }
>>
>> name = URI.decode(name);
>> // Look for a matching named element.
>> //
>> for (Object object : eContents())
>> {
>> if (object instanceof NamedElement)
>> {
>> NamedElement namedElement = (NamedElement)object;
>> if (name.equals(namedElement.getName()) && count-- ==
>> 0)
>> {
>> return namedElement;
>> }
>> }
>> }
>> return null;
>> }
>> }
>> return super.eObjectForURIFragmentSegment(uriFragmentSegment);
>> }
>>
>>
>> Linda Damus wrote:
>>> I am trying to load a UML model that contains elements that do not have
>>> UUIDs.
>>>
>>> The UML metamodel extends EModelElement, which supports hierarchical URI
>>> fragments. However, I find that references made using hierarchical URI
>>> fragments within a UML model can't be resolved via
>>> EModelElementImpl#eObjectForURIFragmentSegment because the UML elements
>>> are not ENamedElements.
>>>
>>> Is this a scenario that should work, or is it considered unsupported by
>>> the UML2 implementation?
>>>
>>> Thanks,
>>> Linda
>>
Previous Topic:[Announce] MDT UML2 2.2.0 I200804200420 is available
Next Topic:comptability with enterprise architect
Goto Forum:
  


Current Time: Sat Aug 30 20:41:42 EDT 2025

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

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

Back to the top