Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumshow to get object instead of the auto-generated code from the value of XMIReferenceAttribute in uml
https://www.eclipse.org/forums/index.php/mv/msg/262030/756524/#msg_756524
My Profile is shown as Picture.1. There are two Stereotypes in my Profile. The first stereotype named "A" is extended from UML::Class. The second stereotype named "B" is extended from uml:DataType. The stereotype "A" has a stereotypeProperty named tag, which type is testProfile::B.
Then I create an uml model, which is shown in Picture.2. There is a class named "class1" with stereotype "A" applied and a datyType named "datatype1" with stereotype "B" appied in my uml model. As "class1" apply stereotype "A", it has an stereotypeProperty named "Tag". I choose <<B>><DataType>datatype1 as the value of stereotypeProperty "tag". The uml model file is as follow.
I traverse the uml model to transporm it into txt file with specific format. By traverse over uml::model.packagedElement I reached <<A>><class>class1. Then traverse over class1.stereotypeProperties I reached its stereotypeProperty with name "tag". Now I want to get the value of stereotypeProperty "tag", <<B>><DataType>datatype1, and put the text "datatype1" into my txt file, but there is a problem which troubled me. When i pass the value of stereotypeProperty "tag"(abbreviated as sp1.value) into my rule function, only the parameter with type of emf::EObject can accept sp1.value, when i print out sp1.value in my rule function, I got "org.elipse .emf.ecore.impl.DynamicEObjectImple @ 101051u(eClass:org.eclipse.emf.ecore.impl.EClassImpl @ ca1a93(name:B)(instanceClassName:null)(abstract:false,interface:false))". Then I print out sp1.value.xmi_id, I got " _bHBrcA6NEeGw4Yx38G5qQg", which is the xmi_id of an testProfile:B node in my uml model file.
Then by traverse over uml::model.packagedElement I can reach <<B>><DataType>datatype1 and can get its name "datatype1" and its xmi_id is " _ZU4YYA6NEeGw4Yx38G5qQg". Then traverse over <<B>><DataType>datatype1.stereotypeProperties I reached its stereotypeProperty with name "base_DatyType". the value of stereotypeProperty "base_DatyType"(abbreviated as sp2.value) is "org.eclipse.uml2.uml.internal.impl.DataTypeImpl @ 196c8c2 (name: datatype1, visibility: <unset>) (isLeaf: false, visibility: public, isAbstract: false)", sp2.value.xmi_id is " _ZU4YYA6NEeGw4Yx38G5qQg".
My question is how can i get the DatyType name "datatype1" from the value of XMIReferenceAttribute, "sp1", or when i has "_bHBrcA6NEeGw4Yx38G5qQg", how can i get "datatype1" or "_ZU4YYA6NEeGw4Yx38G5qQg" from it. As I make sp1.value as an EObject, it only have three property, "resource","uri","xmi_id",all of can not slove my problem.]]>binghu794489812011-11-14T08:18:00-00:00