|
|
|
| Re: How to get "tagged values" from an attribute of class in UML2.0 [message #1064307 is a reply to message #1064213] |
Tue, 18 June 2013 11:26   |
Rafael Chaves Messages: 155 Registered: July 2009 |
Senior Member |
|
|
A stereotype application connects a stereotype to an element (and instance of the stereotype) and describes the values of the stereotype attributes in that instance. Tagged values are no longer supported in UML, and were replaced by stereotype attributes.
You query the values of the stereotype attributes in a particular stereotype application using Element#getValue(Stereotype, String attributeName). You determine whih stereotypes apply to an element using Element#getAppliedStereotypes(). You find out what attributes are available on the Stereotype using Stereotype#getOwnedAttributes(). You can also use UMLUtil.getTaggedValue(String stereotypeName, String attributeName) to get one particular value. There is a wealth of stereotype-related API in Element, Stereotype and UMLUtil, get familiar with them.
If #getAppliedStereotypes() returns an empty list and you are positive there are stereotypes applied to the element in question, you may be suffering of an unresolved profile reference in the model. Does yourPackage.getAppliedProfiles() return an empty list as well? Can you paste your model here?
[Updated on: Tue, 18 June 2013 11:29] Report message to a moderator
|
|
|
|
| Re: How to get "tagged values" from an attribute of class in UML2.0 [message #1065424 is a reply to message #1065294] |
Tue, 25 June 2013 12:18  |
Rafael Chaves Messages: 155 Registered: July 2009 |
Senior Member |
|
|
Keywords and stereotypes are unrelated features.
Try to reproduce the problem using a simpler model then, and post that one here. Or omit the guts of the model file and provide only the top elements. For instance, the root xmi:XMI element and all the profileApplication elements, like this:
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:kirra="models/kirra" xmlns:mdd_extensions="profiles/mdd_extensions" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xsi:schemaLocation="models/kirra platform:/plugin/com.abstratt.kirra.mdd.core/models/kirra.uml#_http2F2Fwww.eclipse.org2Fuml22F2.0.02FUML-kirra profiles/mdd_extensions pathmap://MDD_PROFILES/mdd_extensions.uml#_http2F2Fwww.eclipse.org2Fuml22F2.0.02FUML-mdd_extensions">
<uml:Package xmi:id="_0" name="shipit" URI="demo-cloudfier-examples-shipit/shipit">
<!-- ... model elements ... -->
<!-- profile applications -->
<profileApplication xmi:id="_profileApplication.0">
<eAnnotations xmi:id="_profileApplication.0-_http2F2Fwww.eclipse.org2Fuml22F2.0.02FUML" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="pathmap://MDD_PROFILES/mdd_extensions.uml#_http2F2Fwww.eclipse.org2Fuml22F2.0.02FUML-mdd_extensions"/>
</eAnnotations>
<appliedProfile href="pathmap://MDD_PROFILES/mdd_extensions.uml#_0"/>
</profileApplication>
<profileApplication xmi:id="_profileApplication.1">
<eAnnotations xmi:id="_profileApplication.1-_http2F2Fwww.eclipse.org2Fuml22F2.0.02FUML" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="platform:/plugin/com.abstratt.kirra.mdd.core/models/kirra.uml#_http2F2Fwww.eclipse.org2Fuml22F2.0.02FUML-kirra"/>
</eAnnotations>
<appliedProfile href="platform:/plugin/com.abstratt.kirra.mdd.core/models/kirra.uml#_0"/>
</profileApplication>
</uml:Package>
<!-- ... stereotype applications ... -->
</xmi:XMI>
I suspect getAppliedProfiles() is returning an empty list because of a model reference (URI) not being resolved, the #1 issue people struggle with in this forum.
|
|
|
Powered by
FUDForum. Page generated in 0.02992 seconds