Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trouble loading Power System Common Information Model exported from EnterpriseArchitect #1

Open
bencoman opened this issue Nov 16, 2018 · 6 comments

Comments

@bencoman
Copy link

bencoman commented Nov 16, 2018

Howdy,

I'm having trouble loading the attached XMI into OpenPlonk. It was exported from Enterprise Architect like this...
194220_orig

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

@bencoman
Copy link
Author

bencoman commented Nov 16, 2018

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

@peteruhnak
Copy link
Member

Could you please upload the file again or send it to me via mail? It seems that GitHub messed up the upload.

@bencoman
Copy link
Author

This upload seems to have worked...
iec61970cim17v23a_iec61968cim13v12_iec62325cim03v14.zip

@peteruhnak
Copy link
Member

There seems to be several issues so far that I need to address.. (this is more of a todo list for me)

  1. encoding
    XMLDOMParser handles this automatically internally, but I need to pass a binary read stream, instead of the (default) text stream.

  2. 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.
  1. Incorrect representation of upper value

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"/>
  1. Incorrect representation of InstanceSpecification

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>
  1. Profiles

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.

@bencoman
Copy link
Author

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}
    instancespecification-ownedelement

I don't quite grok the meaning of the term "subsets" is used here.
It tastes a bit like "inheritance" or "overrides".

@bencoman
Copy link
Author

bencoman commented Dec 3, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants