Open bencoman opened 5 years ago
I got a bit further by forcing the encoding...
OPUmlClassEditorPlugin>>importToPackage: aPackage
FDOpenFileDialog new
whenSelected: [ :file | |model xmi|
xmi := file fullName asFileReference binaryReadStreamDo: [ :in |
| bytes encoder |
bytes := in upToEnd.
encoder := ZnCharacterEncoder newForEncoding: 'cp1252'.
encoder decodeBytes: bytes ].
model := OPUMLXMIReader read: xmi.
but it would be great if that could be determined dynamically from the first line of the file <?xml version="1.0" encoding="windows-1252"?>
Could you please upload the file again or send it to me via mail? It seems that GitHub messed up the upload.
This upload seems to have worked... iec61970cim17v23a_iec61968cim13v12_iec62325cim03v14.zip
There seems to be several issues so far that I need to address.. (this is more of a todo list for me)
encoding XMLDOMParser handles this automatically internally, but I need to pass a binary read stream, instead of the (default) text stream.
Security limit This can be configured globally and locally... e.g.
XMLParserLimits defaultReadLimit: file size
"or"
dom := (XMLDOMParser on: stream) usesNamespaces: false; documentReadLimit: stream size; parseDocument.
For some reason (EA's backwards compatibility maybe?) EA represents an unlimited upper value of a property (attribute) as an Integer
with value n
. However the spec states that it should be UnlimitedNatural
with value *
... but this is easy to modify for me.
<upperValue xmi:type="uml:LiteralInteger" xmi:id="EAID_LI000782__826C_44f6_8B37_E168629E4395" value="n"/>
A harder problem is InstanceSpecification (see chapter 9.8 of UML 2.5 specs). For some reason the element contains ownedAtribute
as children, however this is not a valid element; instead it should be represented as Slots... so I don't know why EA generates this
<packagedElement xmi:type="uml:InstanceSpecification" xmi:id="EAID_B2E53EF1_F2BE_4b05_BAC3_A0BB508D4AAD" name="4" visibility="public">
<ownedAttribute xmi:type="uml:Property" xmi:id="EAID_dst82C702_0877_488d_BB29_24487D9DB406" visibility="public" association="EAID_3482C702_0877_488d_BB29_24487D9DB406" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="true" isDerivedUnion="false" aggregation="none">
<type xmi:idref="EAID_FFC2FB67_AF8D_4efe_8844_F10C6AD3122D"/>
</ownedAttribute>
<ownedAttribute xmi:type="uml:Property" xmi:id="EAID_dst7CC185_CF5A_49d2_A179_0DE8B4C703A7" name="TargetObject" visibility="public" association="EAID_F37CC185_CF5A_49d2_A179_0DE8B4C703A7" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="true" isDerivedUnion="false" aggregation="none">
<type xmi:idref="EAID_C5C1CA1E_0CAE_4f31_882A_AFAC16DE86A0"/>
</ownedAttribute>
<ownedAttribute xmi:type="uml:Property" xmi:id="EAID_dst088919_EB57_4f4c_8DE4_ADB900406DC6" visibility="public" association="EAID_F9088919_EB57_4f4c_8DE4_ADB900406DC6" isStatic="false" isReadOnly="false" isDerived="false" isOrdered="false" isUnique="true" isDerivedUnion="false" aggregation="none">
<type xmi:idref="EAID_11777CB9_3BCA_45c7_BC26_F8F1AF933702"/>
</ownedAttribute>
</packagedElement>
The model contains four or five profiles... I do support Profiles to some extent, however the Profile elements must be actually implemented as Pharo classes... I have generator for that, but I encountered some issues with primitive types, and it needs to be more easily available.
I will be looking at these issues over the next week or so. All except #4 are fairly straight-forward, but #4 I am not quite clear yet as to why is EA doing that... if you could look into that, that would be great.
Big thanks for having a look at this Peter.
Now I'm not at all familiar with XMI and well out of my depth here, but after floundering around for a few hours the following seemed interesting...
https://www.sparxsystems.com.au/bin/UML2SuperStructure.pdf
7.7 Kernel – the Instances Diagram ... Figure 18 ... InstanceSpecification ... {subsets ownedElement}
7.7.2 Slot (from Kernel) ... Associations ... value : InstanceSpecification [*] ... The value or values corresponding to the defining feature for the owning instance specification. This is an ordered association. Subsets Element::ownedElement.
http://cobweb.cs.uga.edu/~kochut/teaching/x050/UML-2.5.pdf
7 Common Structure ... 7.2 Root ... 7.2.2 Abstract Syntax ... Figure 7.1 ...ownedElement
7.2.3 Semantics ... 7.2.3.1 Elements ... Every Element has the inherent capability of owning other Elements
9.9.20 Slot [Class] ... 9.9.20.3 Generalizations ... Element
9.8 Instances .. Figure 9.27 ... Slot shown inheriting from Element ... {subsets ownedElement}
I don't quite grok the meaning of the term "subsets" is used here.
It tastes a bit like "inheritance" or "overrides".
hi peter, was that information sufficient, or do you need more? Or should I try other options? The source EA file is Microsoft Access format and a few few years ago I managed to open it directly a grok the raw tables.
Howdy,
I'm having trouble loading the attached XMI into OpenPlonk. It was exported from Enterprise Architect like this...![194220_orig](https://user-images.githubusercontent.com/1713447/48615533-21889700-e9cc-11e8-9af0-8ff89e2e2f5c.png)
Any interest to help get it working? i.e. is it a good use case for you? (if not, thats cool, just close this ticket) [EDIT: Deleted failed upload link.]
Background info... https://sparxsystems.com/enterprise_architect_user_guide/14.0/model_publishing/importexport.html https://sparxsystems.com/enterprise_architect_user_guide/14.0/model_publishing/limitationxmi.html