Skip to main content



      Home
Home » Modeling » Papyrus » Read Eclipse uml file in a standalone app(How can I write a standalone app that opens and manipulates a .uml file?)
Read Eclipse uml file in a standalone app [message #1837517] Mon, 01 February 2021 08:57 Go to next message
Eclipse UserFriend
I would like to programmatically open a .uml file (created by Papyrus) and extract information from the file (such as the presence of certain UML elements, their parent relationships, ...).

I also would like to do this in a standalone project, i.e. without the additional complexities of an Eclipse plug-in, if possible. Preferably with Maven, but if not possible (as suggested here), manually downloading some jar files and adding them to my classpath would be fine.

I only found old (4+ years old) tutorials on the web, which seem to suggest that one has to manually open Eclipse internals and hand pick a few jars from there (example here), hoping that the right ones will be included. Is there some easier or at least more officially supported way of proceeding?
Re: Read Eclipse uml file in a standalone app [message #1837520 is a reply to message #1837517] Mon, 01 February 2021 09:42 Go to previous messageGo to next message
Eclipse UserFriend
Hi

If you are a determined Java / maven programmer yes you probably have to hand pick the Jars. (Any you have to rework the hand pick every time you upgrade anything.)

But if you exploit the Eclipse plugin capabilities it will sort out the path for you, even if you only ever use it standalone. The test 'plugins' for many Eclipse Modeling Projects JUnit tests work this way.

Regards

Ed Willink
Re: Read Eclipse uml file in a standalone app [message #1837616 is a reply to message #1837520] Wed, 03 February 2021 03:56 Go to previous messageGo to next message
Eclipse UserFriend
I guess that unfortunately leaves me with imperfect options only... I will try to parse the file using standard XML libraries then, and delve into the Eclipse machinery if I absolutely need more power.

Thank you for the information!

[Updated on: Wed, 03 February 2021 03:57] by Moderator

Re: Read Eclipse uml file in a standalone app [message #1837630 is a reply to message #1837616] Wed, 03 February 2021 08:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi

UML does not use standard XML so you may well find that you have considerable trouble at least unless you gauarntee not to use Stereotypes.

I fear that you are creating a mountain of troubles by declining to spend an hour or two studying tutorials that demonstrate how easy the UML2 project makes it.

Regards

Ed Willink
Re: Read Eclipse uml file in a standalone app [message #1838420 is a reply to message #1837630] Wed, 24 February 2021 10:36 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for your warning about easiness of parsing a UML file. I am not sure I understand, however. As I understand, UML models and diagrams are supposedly defined in XML files. I realize that UML models compatibility is only a dream, with vendors implementations having subtle incompatible variations; but I thought that Eclipse would nevertheless store every UML related data in XML files. Indeed, opening a .uml file created with Papyrus reveals the following header.

<?xml version="1.0" encoding="UTF-8"?><uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" ...


It is my understanding that stereotypes are also saved in .uml files. Is this mistaken?

In any case, yes, I only have to deal (currently) with UML models with no extra stereotypes. But indeed, it would be nice to benefit from the power of a specific library to parse such models.

About your second point, I think, perhaps erroneously, that transforming my program into an Eclipse plugin will require to have a specific startup and distribution procedures (instead of distributing my program, as I am used to, with a starter script and .jar files for the dependencies). In other words, it will require Eclipse to "own" the startup process. In this case, the problem is not mainly that I have to spend "an hour or two" to learn the process! Is this mistaken?
Re: Read Eclipse uml file in a standalone app [message #1838424 is a reply to message #1838420] Wed, 24 February 2021 12:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi

I wrote that UML does not use standard XML, not that it does not use XML.

You are mistaken. You will not need any special start up or distribution procedures. Formulating your code as a plugin facilttes its use within Eclipse, but at worst gives you a couple of small files of bloat for other purposes.

Regards

Ed Willink
Re: Read Eclipse uml file in a standalone app [message #1838758 is a reply to message #1838424] Thu, 04 March 2021 10:42 Go to previous messageGo to next message
Eclipse UserFriend
Ed Willink wrote on Wed, 24 February 2021 12:46

I wrote that UML does not use standard XML, not that it does not use XML.

What difference do you see between standard XML and XML? As I understand words, XML is a standard.

Ed Willink wrote on Wed, 24 February 2021 12:46

You are mistaken. You will not need any special start up or distribution procedures. Formulating your code as a plugin facilttes its use within Eclipse, but at worst gives you a couple of small files of bloat for other purposes.

I am sorry for one more possibly naïve question, but I couldn't find doc about how to use an Eclipse plug-in in a standalone application, as I would like to do. I only find resources about how to write plug-ins (that possibly use other plug-ins) aiming at distributing them as Eclipse plug-ins, thus, using Eclipse start-up and distribution procedure (implying, among others, distributing the app as an RCP product). Such as this Vogella tutorial or the corresponding entry in Eclipse Help (which seems quite outdated).

Do you have some documentation suggestion for my use case?
Re: Read Eclipse uml file in a standalone app [message #1842220 is a reply to message #1838758] Sat, 12 June 2021 06:46 Go to previous messageGo to next message
Eclipse UserFriend
Check this project https://github.com/perelengo/uml-scripting-engine/blob/master/src/test/java/net/samsarasoftware/scripting/test/suite/StandardProfileApplicationTest.java
Re: Read Eclipse uml file in a standalone app [message #1842245 is a reply to message #1842220] Mon, 14 June 2021 06:18 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for providing help!

As I understand it, this requires to collect and maintain dependencies (ids and versions) "manually" from Eclipse files, in order to define the right dependencies in the pom.xml file. With the drawback, as warned here, that this may be quite tedious and is not automated.

It seems, from the discussion here, that it is possible to do otherwise, while keeping the application as a "normal" standalone application (as opposed to an Eclipse plug-in that requires Eclipse to own the launch process) but I absolutely ignore how, and in fact, doubt it is really possible. Any supplementary information about this would be most welcome.
Re: Read Eclipse uml file in a standalone app [message #1842248 is a reply to message #1842245] Mon, 14 June 2021 07:20 Go to previous messageGo to next message
Eclipse UserFriend
Hi

You can use Eclipse to gather dependencies for you.

If you configure your project as a plugin the MANIFEST.MF does it all free.

For standalone purposes if you arrange a launch of perhaps a JUnit test, there is a display command line option that shows the classpath used to run from Eclipse. This can be pasted to a non=Eclipse standalone.

Regards

Ed Willink

Re: Read Eclipse uml file in a standalone app [message #1842406 is a reply to message #1842248] Thu, 17 June 2021 16:43 Go to previous messageGo to next message
Eclipse UserFriend
You can usea mix of tycho maven plugin with the goal dependencoes:copy.
This reads the manifest. Mf and copies all dependencies to a directory.
This allows to create an easy classpath, but exporting the list to a pom is harder.
Re: Read Eclipse uml file in a standalone app [message #1843896 is a reply to message #1842406] Mon, 23 August 2021 10:20 Go to previous messageGo to next message
Eclipse UserFriend
Thanks again for the help.

It appears that managing dependencies automatically in a non Eclipse application is a difficult task. (I realize it can be eased by making first an Eclipse plugin project, for the sake of collecting dependencies, and running it again when they change and then reflect that manually in whatever dependency management system one uses, but that is not easy, compared to just adding a bunch of coordinates of a library you want to depend on in some configuration file, as Maven users expect.)

That task would be much alleviated if this Eclipse sub-project would comply with a de facto standard that by now probably more than 90% of Java developers use, namely, the Maven way; rather than trying to impose its own plugin mechanism that only the Eclipse developers use. The funny thing is that even the Eclipse ecosystem itself recognized (years ago) Maven as a de-facto standard and started releasing its artifacts as Maven plugins; and published guides to help other Eclipse projects proceed similarly.

Imagine if every enterprise developing Java libraries would invent its own management system, incompatible with others? This is precisely what standards try to avoid. And, IMHO, open-source developers (even more than other ones) should encompass standards.

I hope some serious considerations can be devoted again to publishing the artifacts related to Papyrus as Maven dependencies.
Re: Read Eclipse uml file in a standalone app [message #1843903 is a reply to message #1843896] Mon, 23 August 2021 13:03 Go to previous messageGo to next message
Eclipse UserFriend
Hi

You are mistaken in thinking that Eclipse supports Maven. I have been trying to make official OCL available in a Maven repofor years but the required support is just not there. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=525996

In the absence of support some no doubt well-meaning individuals have uploaded selected OCL versions to Maven ensuring that anyone using Maven gets the worst of both worlds. Stale code and then an Eclipse migration.

IMHO it would be a straightforward job for the EF to auto republish all Eclipse SimRel contributions that specify a Maven location in their *.aggrcon. It would then be a one minute edit for any project to have consistent Maven availability thereafter.

Regards

Ed Willink

Re: Read Eclipse uml file in a standalone app [message #1844099 is a reply to message #1843903] Wed, 01 September 2021 06:07 Go to previous messageGo to next message
Eclipse UserFriend
Thanks again for your attention. I thought the OCL project was not interested at all in Maven publication, not that it had tried but had faced difficulties.

When suggesting in my previous post that Eclipse embraces Maven, I meant it in the sense that at least some (I think, many) of its projects do release on Maven Central in an apparently automated and systematic way, e.g., SWT.

I have quickly skimmed over some discussions starting from the bug that you just mentioned. I may be missing something, but it seems to me that you are trying to publish to a Maven repository specific to Eclipse, whereas perhaps it would be simpler (and certainly more convenient for Maven users) to publish to Maven Central directly. Perhaps then the relevant documentation is Platform-releng/Publish To Maven Central?

I have unfortunately no time to really help you in that endeavor: not knowing the Eclipse publication ecosystem at all, it would require some important time investment that I do not currently have. But I can answer some specific questions related to the way Maven works, or provide pointers, if you are (or anyone is) interested. Perhaps these resources can be of help, in particular, the document about releasing to Maven Central.

[Updated on: Wed, 01 September 2021 06:07] by Moderator

Re: Read Eclipse uml file in a standalone app [message #1844107 is a reply to message #1844099] Wed, 01 September 2021 09:18 Go to previous messageGo to next message
Eclipse UserFriend
Hi

My (mis)understanding is that repo.eclipse.org was provided because Maven Central was not suitable for Eclipse publication. IIRC there is an incompatibility wrt when a version number changes; at the beginning or end of the development and wrt the lifecycle of milstone builds; Eclipse milestones may vanish shortly after a release.

I too do not have time to help myself. Far too many other much more important things to do. When someone gives me some plausible clues how an Eclipse project is made available, I may try again. So far I have burned time on two failures and am not well motivated to be a bleeding edge researcher on what should just be a matter of cloning what some other Eclipse project does. There is nothing pioneering about Eclipse OCL releng-wise.

(I would like to see a Bash script to which parameters can be passed by a standard Eclipse OCL build and which will run as a separate Jenkins Job to publish. Why is that so hard?)

Regards

Ed Willink
Re: Read Eclipse uml file in a standalone app [message #1844810 is a reply to message #1844107] Sun, 26 September 2021 13:49 Go to previous messageGo to next message
Eclipse UserFriend
Just updated the bug info, if you find is a good solution.
Re: Read Eclipse uml file in a standalone app [message #1844817 is a reply to message #1844810] Mon, 27 September 2021 01:55 Go to previous messageGo to next message
Eclipse UserFriend
More comments re Eclipse use in Maven on https://bugs.eclipse.org/bugs/show_bug.cgi?id=525996
Re: Read Eclipse uml file in a standalone app [message #1844821 is a reply to message #1844817] Mon, 27 September 2021 04:27 Go to previous messageGo to next message
Eclipse UserFriend
I wrote the full set of pom examples in the bg as a comment. Hope it helps.
On the other hand, to use maven projects with emf and being able to run standalone, or form inside eclipse, I had to tweak the emf mappings. Have allok at https://github.com/perelengo/uml-scripting-engine/blob/c772d3aaf2b4d7e4bcbfb3ac5133441517469cf8/src/main/java/net/samsarasoftware/scripting/ScriptingEngine.java#L272

It really helps, because maven in eclipse compiles to target/classes, so it has a special treatment.
Re: Read Eclipse uml file in a standalone app [message #1844944 is a reply to message #1844821] Thu, 30 September 2021 07:57 Go to previous message
Eclipse UserFriend
Thank you
Previous Topic:Papyrus Software Designer 5.2 Documentation gone?
Next Topic:How to create an element inside another, or set as child ?
Goto Forum:
  


Current Time: Fri Jul 18 00:37:38 EDT 2025

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

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

Back to the top