Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Change namespace in XMI output(How do you use the sysml namespace)
Change namespace in XMI output [message #1855405] Wed, 12 October 2022 14:06 Go to next message
Frank Conover is currently offline Frank ConoverFriend
Messages: 20
Registered: October 2022
Junior Member
Hi,

I am exporting my SysML model as XMI.

xmiResourceImpl.getContents().add(model);
xmiResourceImpl.doSave(outputStream, saveOptions);


The UML namespace in my XMI output is simply: xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"

The SysML namespace is not so simple.

I have a Block in my model and all of this is added to the header:
xmlns:Blocks="http://www.eclipse.org/papyrus/sysml/1.4/SysML/Blocks" xsi:schemaLocation="http://www.eclipse.org/papyrus/sysml/1.4/SysML/Blocks http://www.eclipse.org/papyrus/sysml/1.4/SysML#//blocks"

And the Blocks at the bottom of the file are added like:
<Blocks:Block xmi:id="_2_j24EmTEe2zmcjQHqpcuA" base_Class="_2_iBsEmTEe2zmcjQHqpcuA"/>

I will be having FlowPort and other sysml components in the model and would rather not have the header line continue to grow.

I would just like the namespace to be sysml. Something like
xmlns:sysml = "http://www.omg.org/spec/SysML/20100301/SysML-profile" or
xmlns:sysml="http://www.eclipse.org/.../SysML"

and the Blocks at the bottom to look like
<sysml:Block xmi:id="_2_j24EmTEe2zmcjQHqpcuA" base_Class="_2_iBsEmTEe2zmcjQHqpcuA"/>

Is there an Option for that?

[Updated on: Wed, 12 October 2022 14:24]

Report message to a moderator

Re: Change namespace in XMI output [message #1855422 is a reply to message #1855405] Thu, 13 October 2022 11:58 Go to previous messageGo to next message
Vincent Lorenzo is currently offline Vincent LorenzoFriend
Messages: 247
Registered: June 2010
Location: Paris Saclay, France
Senior Member
Hello,
I think there is no option for that, it is the expected Ecore/UML2 behavior.
/Vincent
Re: Change namespace in XMI output [message #1855423 is a reply to message #1855422] Thu, 13 October 2022 12:30 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

XML is not really intended for human consumption, so optimizing it to be more aesthetic is liable to be a waste of time, particularly if the optimization breaks other tools.

The changes you suggest are only a few tens of bytes, so the saving in file size is trivial for any non-trivial model.

If you really want different namespaces, you should develop and install models with those namespaces.

Regards

Ed Willink
Re: Change namespace in XMI output [message #1855427 is a reply to message #1855423] Thu, 13 October 2022 13:58 Go to previous messageGo to next message
Frank Conover is currently offline Frank ConoverFriend
Messages: 20
Registered: October 2022
Junior Member
Hi, thank you for your replies.

I left out that I am exchanging data with a few other programs / dev groups and they are all using sysml as the namespace. I was just tryin to be consistent and match the examples on the OMG site.
If it becomes an issue I may just have to modify the output myself.

Thanks again for your responses.
Re: Change namespace in XMI output [message #1855431 is a reply to message #1855427] Thu, 13 October 2022 18:51 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Ok. I see now. You are in a mess caused by the inadequate tool compliance / standardisation for SysML

I recommend that you first study all the different SysML dialects that you need and the necessary inter-conversions. It may well be that the interconversions can be a simple regex zap via a sed script, else an XML2XML read-write that could be implemented by standalone EMF-Java.

To avoid the inconvenience of a conversion between tools, you may be able to embed the conversions within your tools. Eclipse, as an Open source tool, is very amenable to tweaked loaders and savers and it seems that your scenario may justify some dirty tricks such as zapping the Package or Resourcei just before saving. As you have discovered, there are many tweaks that can affect Eclipse loading; so many, that it can be difficult to find the combination that works. For really expert EMF practitioners, there are all sorts of things that can be achieved by ExtendedMetaData.

Remember that when conversions are needed between N dialects, you may need (N-1)*(N-1) direct conversion tools, whereas if you identify a normalized SysML intermediate that all conversions go through, you only need 2*N converters. As soon as N gets larger than 3 the normalized approach pays off. (And it really pays off when you need yet another dialect.)

Regards

Ed Willink

[Updated on: Thu, 13 October 2022 19:02]

Report message to a moderator

Previous Topic:Where is SysMLResourcesUtil.init
Next Topic:Invalid symbol in creating contracts
Goto Forum:
  


Current Time: Fri Mar 29 01:00:10 GMT 2024

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

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

Back to the top