Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MDT (Model Development Tools) » [SOLVED] UML2API basics (getStereotype in standalone projects)
[SOLVED] UML2API basics [message #502693] 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().getExtensionToFactoryMap().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?

[Updated on: Thu, 10 December 2009 11:21]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:UML2API basics
Next Topic:Survey on the application of UML in the maintainence of legacy systems.
Goto Forum:
  


Current Time: Thu May 23 08:17:46 EDT 2013

Powered by FUDForum. Page generated in 0.01668 seconds