Book a Demo

Author Topic: simpleType in imported XSD and Automation Interface  (Read 6115 times)

gerardop

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
simpleType in imported XSD and Automation Interface
« on: February 06, 2016, 04:09:49 am »
Hello,

I am using the automation interface to transform a UML model into IDL. See https://github.com/rticommunity/idl4-enterprise-architect
The problem is that the UML models I use have been imported from XSD using the "code engineering -> Import XSD" feature.

When I do this I am unable to determine the "base" type for the imported xsd:simpleType
In other words, assume the following XSD:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"   xmlns="ExampleNS" targetNamespace="ExampleNS"
   elementFormDefault="qualified" xml:lang="en">

   <xsd:simpleType name="footprintType">
      <xsd:restriction base="xsd:double">
         <xsd:minInclusive value="0" />
      </xsd:restriction>
   </xsd:simpleType>
</xsd:schema>

When this is imported into UML I cannot find how to determine that the simpleType "footprintType" is actually a restriction of "xsd:double"
The footprintType itself ends up being a Class. I tried to look at all the TaggedValues, Properties, Relations, BaseClasses, Attributes and I do not find the "xsd:double" anywhere.

I also tried to export the Model to the normative XMI and I also do not see the information of the fact that the footprintType" is a restriction of "xsd:double"

Does anybody know how to get this information?

Thanks!!

Gerardo

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: simpleType in imported XSD and Automation Interface
« Reply #1 on: February 06, 2016, 04:39:11 am »
Gerardo,

Just a hunch, have you tried replacing xsd: by xs:?
I think that is the way EA might recognize it.

Geert

gerardop

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: simpleType in imported XSD and Automation Interface
« Reply #2 on: February 06, 2016, 05:59:57 am »
Hello Geert,

Thank you for the suggestion. I tried replacing "xsd:" with "xs:" in the input document but unfortunately it made no difference.

It seems like the import process does recognize the base type...
Another interesting bit of information is that if I right-click on the class "footprintType" class and select "Advanced -> Parent"   I get a popup in which has a "Type Details" section showing "double" as a "Generalizes" relationship. However using the automation interface the value of "ParentID" is zero so I cannot access this "parent" information.

Regards,

Gerardo

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: simpleType in imported XSD and Automation Interface
« Reply #3 on: February 06, 2016, 06:44:21 am »
Ah, now I get it.
The parentID is the id of the element owning this element (as in nested in the parent).
So it makes sense that that would be 0.

Try looking in the element.Genlinks field.

I use that in a script that does some post processing after an MDA transform to XSD

Code: [Select]
function fixXSDsimpleType(element)
'find the element it was transformed from
dim sourceElement as EA.Element
dim sqlFindSource
dim sourceElements
sqlFindSource = "select o.[Object_ID] from  t_object o " & _
"inner join t_xref x on x.[Supplier] = o.[ea_guid] " & _
"where x.TYPE = 'Transformation' " & _
"and x.[Client] =  '" & element.ElementGUID & "'"
set sourceElements = getElementsFromQuery(sqlFindSource)
if sourceElements.Count > 0 then
set sourceElement = sourceElements(0)
'copy the tagged values
copyTaggedValues sourceElement, element
'determine the "parent" type
dim baseClass as EA.Element
dim baseXSDType
baseXSDType = "string" 'default
for each baseClass in sourceElement.BaseClasses
if Ubound(Filter(XSDBaseTypes, baseClass.Name )) > -1 then
'found the base class
baseXSDType = baseClass.Name
end if
next
'set the base type
element.Genlinks = "Parent=" & baseXSDType & ";"
element.Update
end if
end function

Geert

gerardop

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: simpleType in imported XSD and Automation Interface
« Reply #4 on: February 06, 2016, 08:43:17 am »
Hello Geert,

You are right the parent information is in the element.Genlinks field!

Thank you for all the help!!

Gerardo