UML parsing with CMOF/moddle

I’m looking into using the packages you’ve made to explore a simple UML editor. Is this the right track? I can use the CMOF parser to process the UML spec in XMI form into a moddle JSON? And then use the moddle-xml to process a generic XML UML document from another package to be able to query it?

Could be that I’m approaching it completely wrong, but trying to parse the XMI files from leads to errors in the cmof parser.

The cmof-parser project hasn’t been tested with any other specifications than BPMN and DMN. What errors are you getting?

UML.xmi errors on:
[parser] href not found {
name: ‘redefinedProperty’,
attributes: { ‘xmi:idref’: ‘IntervalConstraint-specification’ },
isSelfClosing: true

UMLDI.xmi errors on:
[parser] generalization not found {
name: ‘generalization’,
attributes: {
‘xmi:type’: ‘uml:Generalization’,
‘xmi:id’: ‘UMLDiagram-_generalization.0’
isSelfClosing: false

I’m also not entirely sure what the logic is behind the prefixNamespaces, have been looking at the DMN-moddle and BPMN-moddle, but I don’t know, I’m new to XMI. Not really sure which xmi’s you are all supposed to include in the generation of schema’s. I’ve been trying the DC and DI and PrimitiveTypes.xmi as well and those parse without errors. I left out the transforms for now, but there seems to be quite some adjustments on all the files after parsing by cmof-parser.

StandardProfile.xmi also errors:
[parser] parent not found {
name: ‘packagedElement’,
attributes: {
‘xmi:type’: ‘uml:Extension’,
‘xmi:id’: ‘Abstraction_Derive’,
name: ‘Abstraction_Derive’,
memberEnd: ‘Abstraction_Derive-extension_Derive Derive-base_Abstraction’
isSelfClosing: false

I’ve been tinkering a bit, also trying to parse a UML class model and found a couple of things:

  • XMI UML has a standard by OMG, but it seems not all vendors exactly adhere to it in exactly the same way. As an example, enterprise architect makes it’s Packages like:
    <packagedElement xmi:type="uml:Package"/>
    while the BPMN and DMN and also OMG’s XMI example use:
    <uml:Package xmi:type="uml:Package"/>
    So in the CMOF parser, a package is only considered if the name contains prefix:Package, which only works for BPMN and DMN. Is this a mistake on EA’s part or a too strict interpretation of the parser?

  • Does it dereference the xmi:idref fields?