Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » problems in reading an uml/xmi file
problems in reading an uml/xmi file [message #627480] Wed, 08 April 2009 11:11
Nick Betteridge is currently offline Nick BetteridgeFriend
Messages: 6
Registered: July 2009
Junior Member
Been using the sdk for reading/writing my own uml models for quite a while
and love it! Spent the whole of yesterday trying to read an xmi file and
I've really hit a wall.

I'm doing this in standalone mode.

The uml xmi file is:

http://www.omg.org/spec/FUML/20080802/08-08-06.xmi

The first line defines the versions:

<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:uml="http://schema.omg.org/spec/UML/2.1.1"
xsi:schemaLocation="http://schema.omg.org/spec/UML/2.1.1
http://www.eclipse.org/uml2/2.1.0/UML"
xmi:id="_UlCZgHLxEd23psn_hP0YDw" name="fUML_Semantics">


... so I downloaded the eclipse uml 2.1.0 sdk and the emf
emf-sdo-runtime-2.3.0,jar and add all of the jars to the classpath.

rename 08-08-06.xmi to 08-08-06.uml

The java is :

ResourceSet RESOURCE_SET = new ResourceSetImpl();
RESOURCE_SET.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);
RESOURCE_SET.getResourceFactoryRegistry().getExtensionToFact oryMap().put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put(
UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
URI uri = getPathMapURI("profiles/UML2.profile.uml");
URIConverter.URI_MAP.put(URI.createURI(UMLResource.LIBRARIES _PATHMAP),
uri.appendSegment("libraries").appendSegment(""));
URIConverter.URI_MAP.put(URI.createURI(UMLResource.METAMODEL S_PATHMAP),
uri.appendSegment("metamodels").appendSegment(""));
URIConverter.URI_MAP.put(URI.createURI(UMLResource.PROFILES_ PATHMAP),
uri.appendSegment("profiles").appendSegment(""));

Resource resource =
RESOURCE_SET.getResource(modelLibFileURI.
appendSegment("08-08-06").
appendFileExtension(UMLResource.FILE_EXTENSION), true);

Model model = (Model)EcoreUtil.getObjectByType(resource.getContents(),
UMLPackage.Literals.PACKAGE);


when I do a list on model.allOwnedElements(), all I get is:

PackageImportImpl@12d96f2 (visibility: public)
PackageImpl@af993e (name: Semantics, visibility: <unset>) (visibility:
public)


.... all of the classes etc have just disappeared.

Does anyone know of a way forward?

Thanks

Nick
Previous Topic:Re: Problems when geting values from stereotypes
Next Topic:problems with pathmap
Goto Forum:
  


Current Time: Thu Apr 25 16:02:00 GMT 2024

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

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

Back to the top