plantuml / plantuml

Generate diagrams from textual description
https://plantuml.com
Other
9.73k stars 881 forks source link

Packages/Namespaces lost after after xmi imported from ArgoUML, Umbrello5, Visual Paradigm #1294

Closed daniel-santos closed 1 year ago

daniel-santos commented 1 year ago

I've tried everything I can think of and I can't get my package hierarchy (and the classes the belong to them) to import correctly.

@startuml
package a {
    class SomeClass {
    }
}

package a.b {
    interface I1 {
        + Get(bits uint) uint
    }
    class c1 implements I1 {
        + Get(bits uint) uint
    }
    interface I2 extends I1 {
        + Put(data uint)
    }
    class c2 extends c1 implements I2 {
        + Put(data uint)
    }
}
@enduml

If I generate with -xmi:argo I only get SomeClass in the root package. If I generate with -xmi, I'll get all of the classes in the root package. Results vary from one tool to the other. In Visual Paradigm all of my classes appear in the root package. In Umbrello5, I have duplicate classes that have to be renamed (I think when I had the "class x extends y" as separate lines?), but also all in the root package.

I have not been successful at getting any xmi to import into eclipse Papyrus -- I get exceptions.

arnaudroques commented 1 year ago

Yes, this XMI export is a nightmare :-)

It would really help if you edit manually edit the XMI files generated and post them here, so that we can modify our code to generate the very same XMI files.

Does it sound feasible for you ?

daniel-santos commented 1 year ago

I don't know what syntax these bastard programs want. :( I read that XMI supports application-specific extensions, so I'm not yet sure what the correct, generic format is yet. I will experiment while frequently cursing and and see if I can come up with something. I have the xsd as well, but I can't find any fucking examples from OMG.

daniel-santos commented 1 year ago

Here's the exported .xmi from ArgoUML after fixing the model. ArgoClassDiagram simpler-pkg.argo.xmi.txt

daniel-santos commented 1 year ago

Here's Umbrello. This seems to be a problematic program (GUI quirks and crashes). It's save files are .xmi, so this will contain the diagram as well (which we can excise). simple.umbrello.xmi.txt

arnaudroques commented 1 year ago

Ok, thanks for the files. Let's start with Argo We have (manually!) edited the file: argo001.xmi.txt Can you check that it is still working?

daniel-santos commented 1 year ago

Can you check that it is still working? @arnaudroques Yup! Still working!

I kind of screwed myself on a project, so if I can get this to work tonight then my bacon will have been saved!

daniel-santos commented 1 year ago

My email is daniel.santos@pobox.com and I'm dansan on irc.libera.chat. Although rusty now, I've got 10 years of Java experience and I'll be your slave for a day if you can help me get this working, lol!

I'm trying to process the xsd try to figure out the default values of all these properties that are being (mostly needlessly) set, but I suppose that's less important.

Frankly, argo's xmi isn't even legal XML!

arnaudroques commented 1 year ago

I kind of screwed myself on a project, so if I can get this to work tonight then my bacon will have been saved!

Sorry about that... however, we really need few days to make it works, so it won't be for tonight :-(

daniel-santos commented 1 year ago

OK, here's the simplified version without setting any parameters to their default values: argo002.xmi.txt

Sorry about that... however, we really need few days to make it works, so it won't be for tonight :-( OK, then I'll see if I can cough up a patch.

daniel-santos commented 1 year ago

This also works on Visual Paradigm and Umbrello, except that Umbrello doesn't support "realization" (class implements an interface) so it drops those associations. So I'm going to see if I can shove this into the abstract XMI implementation, even if it isn't perfect.

EDIT: My code is Go and uses generics, but I'm going to ignore template parameters for now.

daniel-santos commented 1 year ago

Damnit! I stepped in poo again. I have a patch set, but I built it off of master, but master is broken and I apparently used very new features that aren't in the last release (Quark) oops. I need a hierarchical view and that's what it seemed like the Quark provided, but I suppose I can build one as well. As soon as it's close to working or tested, I'll post it.

daniel-santos commented 1 year ago

Hello @arnaudroques ! Could you kindly take a look at this patch and help me understand why it's blowing up with UnsupportedOperationException: XMI_STANDARD? I'm running with -v -xmi -nbthread=1 -failfast simple.puml using the same puml above. Thank you!

daniel-santos commented 1 year ago

Oh, holy fuck! I just needed to add ./skin and ./themes to my classpath and now I'm able to debug and trace into my code. Separately, when my code crashes, something is eating that exception and giving up on the XMI rendering code without telling me the exception.

arnaudroques commented 1 year ago

For us, your first example is now working with last snapshot.

Here is the generated file: out40.xmi.txt

So this issue will be close. There must be some other issues with XMI, so please open new issues with simple examples: it's the best way to fix all these! Thanks!