Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » reference to attribute in tagged value(reference to attribute in tagged value)
reference to attribute in tagged value [message #1795853] Mon, 01 October 2018 12:03 Go to next message
Marcel Olij is currently offline Marcel OlijFriend
Messages: 5
Registered: February 2018
Junior Member
Hi,

I need to have a reference to an attribute (GUID ??) in a tagged value . An attribute of the model that is, not one of the profile itself.

Can this be done?? There seems to be not much detail about it in de UML specs.

Of so: is there an nice example of how to do this??

BR,

M.
Re: reference to attribute in tagged value [message #1795879 is a reply to message #1795853] Mon, 01 October 2018 16:33 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7677
Registered: July 2009
Senior Member
Hi

'reference to attribute' is a but ambiguous.

A reference to an attribute value is unlikely since attributes have DataType values such as an integer that are not sensibly referenceable; attribute values are copied between multiple users.

Perhaps you mean a reference to the attribute declaration in which case you are dealing with reflection that UML and OCL does not support. However UML depends on OCL and the OCL specification has a couple of loosely worded examples that imply that OCL does support reflection.

The Pivot OCL used by Papyrus does support reflection via the oclType() returning a pivot::Class analoguously to eClass(). With a reified metaclass you can navigate to locate an attribute of interest. You might therefore be able to implement a reference to an attribute declaration, but I suspect you will encounter many excitements and may eventually be blocked by the lack of an oclGet() counterpart to eGet().

I suggest you review what you are trying to do. Perhaps an enumeration might allow you to indicate which of a number of attributes is interesting?

Regards

Ed Willink
Re: reference to attribute in tagged value [message #1795900 is a reply to message #1795879] Tue, 02 October 2018 07:21 Go to previous messageGo to next message
Marcel Olij is currently offline Marcel OlijFriend
Messages: 5
Registered: February 2018
Junior Member
Ed,

You're right, I need the reference to the declaration.

I'm working with a combination of Eclipse and Sparx EA.
EA does allow attribute and object declaration references in tagged values. For what i've read so does MagicDraw. ( also complex structures for tagged values, another issue...)

I don't see much about this in the UML specs, so it's every tool for themselfes.

But I need it. Spilling the beans: I want to add information to a model in order to transform it into a higher level ontology. For this I need info like 'rdfs:subPropertyOf'. How would you suggest to represent this without altering the model itself??

Thanks,

BR,

M.
Re: reference to attribute in tagged value [message #1795905 is a reply to message #1795900] Tue, 02 October 2018 08:22 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7677
Registered: July 2009
Senior Member
Hi

I find tagged values confusing since IIRC they vanished in UML2.x. I think that they are just a confusing legacy term for a Stereotype Instance Slot Value.

IMHO the UML 1.x designers messed up big time when they failed to define a StereotypeInstance class, preferring to resort to XMI magic to workaround the deficiency. UML 2.x didn't dare to clean up.

Reflection is arguably not supported so you are combining two very suspect areas at once - good luck.

That said, if you are able to represent what you want with EA and can persist it as legal UML (or even sensibly extended UML), it would be interesting to review your UML file to see whether Eclipse UML2 and/or Papyrus is only a simple bug fix away from supporting your use case.

Regards

Ed Willink
Re: reference to attribute in tagged value [message #1795910 is a reply to message #1795900] Tue, 02 October 2018 09:10 Go to previous messageGo to next message
Marcel Olij is currently offline Marcel OlijFriend
Messages: 5
Registered: February 2018
Junior Member
Ed,

Agreed, it's messy. But still usable.
The attribute defenition reference is serialized like any other tagged-value / stereotype property in the XMI:
<ODMT:rdfsSubPropertyOf base_Property="EAID_DD128184_DEF9_499a_AC58_CA163C9CE857"
rdfsSubPropertyOf="EAID_FD12BF4D_C950_468b_93D7_A4CCED6D99E8"/>

Where the latter is the GUID for the attribute definition.
The profile description :
<packagedElement xmi:type="uml:Stereotype" xmi:id="rdfsSubPropertyOf" name="rdfsSubPropertyOf">
<ownedAttribute xmi:type="uml:Property" xmi:id="rdfsSubPropertyOf-base_Property" name="base_Property" association="Property_rdfsSubPropertyOf">
<type href="http://www.omg.org/spec/UML/20131001/UML.xmi#Property"/>
</ownedAttribute>
<ownedAttribute xmi:type="uml:Property" xmi:id="rdfsSubPropertyOf-rdfsSubPropertyOf" name="rdfsSubPropertyOf">
<type href="http://www.omg.org/spec/UML/20131001/UML.xmi#String"/>
</ownedAttribute>


So, there is no indication in the profile it is a GUID, just a String. Nasty.

Eclipse of course does not pick this up, formost because it is not in the profile on Eclipse side.

I use a stylesheet between EA and Eclipse to sort out some stuff ( and put the profile id's right ).
If I could somehow see in ATL ( used for the Transform for the moment, we will use QVTD in time) the String is suppost to be a GUID I'm saved!

BR,

M.
Re: reference to attribute in tagged value [message #1795913 is a reply to message #1795910] Tue, 02 October 2018 09:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7677
Registered: July 2009
Senior Member
Hi

While a GUID is just a string it is a very strongly defined string. For individual users, there should be no difference whether an xmi:id is an id, uuid, guid. It should reference an (at least locally) unique definition.

Can you please provide a complete small example, since from your example, it seems to me that base_Property="EAID_DD128184_DEF9_499a_AC58_CA163C9CE857" is a reference that should define how rdfsSubPropertyOf="EAID_FD12BF4D_C950_468b_93D7_A4CCED6D99E8" is interpreted. Without the rest of the example defining EAID_DD128184_DEF9_499a_AC58_CA163C9CE857 and EAID_FD12BF4D_C950_468b_93D7_A4CCED6D99E8, I cannot tell whether this is an EA extension or an Eclipse UML2 bug.

Regards

Ed Willink
Re: reference to attribute in tagged value [message #1795964 is a reply to message #1795913] Wed, 03 October 2018 08:38 Go to previous message
Marcel Olij is currently offline Marcel OlijFriend
Messages: 5
Registered: February 2018
Junior Member
Ed,

Found it. No bug and works briljant.
The 'trick' is make the UML metaclass Property the type of the Stereotype property. When applying this in a model you get a selection dialog for attributes.

So this is similar to the EA functionality.

Another briljant thing: when I get the value of the stereotype property in ATL, I actually get the UML-property-object.

Thanks,

BR,

M.


Previous Topic:How to get instance of stereotype as generated ecore class instance
Next Topic:XMI model versions
Goto Forum:
  


Current Time: Sun Oct 13 19:54:20 GMT 2024

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

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

Back to the top