Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MDT (Model Development Tools) » UML2API basics
UML2API basics [message #600580] Wed, 09 December 2009 08:17 Go to previous message
Stefan  is currently offline Stefan
Messages: 13
Registered: October 2009
Junior Member
Hi,

i am currently playing around with the uml2 implementation in the emf project.
as a starting point i have a UML-class-diagram with a UML-OWL-Profile applied. I am doing this according to the "Getting start with UML2" tutorial.

Now i load the UML-class-diagram like this (i am doing it in a stand alone application just for testing at the moment, later maybe in a eclipse-plugin):

ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
Map uriMap = resourceSet.getURIConverter().getURIMap();
URI uri = URI.createURI(" jar:file:/C:/eclipse/plugins/org.eclipse.uml2.uml.resources_ 3.0.0.v200906011111.jar!/ ");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").appendSegment(""));

URI modelFile = URI.createFileURI("src/m3o-profiled.uml");
URI profileFile = URI.createFileURI("src/OWL.profile.uml");
UMLResource modelResource = (UMLResource)resourceSet.getResource(modelFile, true);
UMLResource profileResource = (UMLResource)resourceSet.getResource(profileFile, true);


i can iterate over the Model and get any information i want, but i can get any profile information, e.g. using getAppliedStereotype on a Element. If i look into the .uml file of the Class-diagram i can find statements like this at the end.
<OWL:owlOntology xmi:id="_vjb6UOQPEd6IJsGhqErA_g" base_Package="_zJBy4OQNEd6IJsGhqErA_g"/>
and the urifragment in base_Package is corresponding to an element in my Class-diagram.

I know maybe i should do this in ATL. But i am quite good in java and have no idea of ATL so i want to try this in java.

Thx

Stefan

So what do i have to do to make getAppliedStereoType working?
 
Read Message
Read Message
Read Message
Read Message
Previous Topic:[SBVR] State of the project about a SBVR component for Eclipse
Next Topic:[SOLVED] UML2API basics
Goto Forum:
  


Current Time: Tue Jun 18 02:52:33 EDT 2013

Powered by FUDForum. Page generated in 0.02290 seconds