Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Importing SysML Programatically
Importing SysML Programatically [message #1420309] Tue, 09 September 2014 20:38 Go to next message
Andrew Gacek is currently offline Andrew GacekFriend
Messages: 32
Registered: October 2011
Member
I'm trying to use Papyrus to import a SysML file so that I can analyze / manipulate it using some Java code. That is, I want to go from a SysML file (exported in XMI format) to an EMF object. Here's the code I was using:

ResourceSetImpl set = new ResourceSetImpl();
URI uri = URI.createFileURI("c:/import.xml");
Resource res = set.getResource(uri, true);
System.out.println(res.getContents().get(0));


This fails with

org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.omg.org/spec/XMI/20110701' not found. (file:/c:/desktop/import.sysml, 3, 76)


My SysML mode is exported from Enterprise Architect and starts with

<?xml version="1.0" encoding="windows-1252"?>
<xmi:XMI xmlns:uml="http://www.omg.org/spec/UML/20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:thecustomprofile="http://www.sparxsystems.com/profiles/thecustomprofile/1.0" xmlns:AADL_Elements="http://www.sparxsystems.com/profiles/AADL_Elements/0.1" xmlns:SysML="http://www.omg.org/spec/SysML/20120322/SysML">
	<xmi:Documentation exporter="Enterprise Architect" exporterVersion="6.5"/>
	<uml:Model xmi:type="uml:Model" name="EA_Model">


Is this the type of thing that Papyrus can be used for (as a plug-in developer)? How do I address this error?

Thanks,
Andrew

[Updated on: Tue, 09 September 2014 20:38]

Report message to a moderator

Re: Importing SysML Programatically [message #1420616 is a reply to message #1420309] Wed, 10 September 2014 08:18 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 926
Registered: February 2011
Senior Member
Hi Andrew,

If you are in a pure-Java application, there are a few options you need to initialize manually before using EMF/UML. Papyrus itself doesn't support standalone Java applications, but UML2 does (And you only need the UML2 component to read this model programatically, so everything's fine).

This should help you: https://wiki.eclipse.org/MDT/UML2/FAQ#What.27s_required_to_load_a_UML_.28.uml.29_resource_from_a_standalone_application.3F

Regards,
Camille


Camille Letavernier
Re: Importing SysML Programatically [message #1420769 is a reply to message #1420616] Wed, 10 September 2014 12:58 Go to previous message
Andrew Gacek is currently offline Andrew GacekFriend
Messages: 32
Registered: October 2011
Member
Thanks Camille,

I'm actually running my code within an Eclipse plug-in so I believe all the registration and initialization is already done for me. But I tried it anyway and received the same error message. Any other thoughts or suggestions?

-Andrew
Previous Topic:Model Explorer Arrangement
Next Topic:Experiences with Diagram generation?
Goto Forum:
  


Current Time: Fri Jul 10 01:00:37 GMT 2020

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

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

Back to the top