]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Add ComplexTpye inheritance to SimpleType or literal type when necessary
authorMarko Luukkainen <marko.luukkainen@vtt.fi>
Tue, 9 May 2017 07:19:38 +0000 (10:19 +0300)
committerMarko Luukkainen <marko.luukkainen@vtt.fi>
Tue, 9 May 2017 07:19:38 +0000 (10:19 +0300)
Change-Id: I112f7277b34ce770e63fbd0bdb2bb0d417780f00

org.simantics.xml.sax/src/org/simantics/xml/sax/OntologyGenerator.java
org.simantics.xml.sax/src/org/simantics/xml/sax/SchemaConversionBase.java

index 64def5d59f223c601b6f8969b5b098dc5689ecc9..74bafb99758af243ac12f8f0997ad0c5559ca6f8 100644 (file)
@@ -411,7 +411,13 @@ public class OntologyGenerator implements SchemaConversionComponent {
 //             writer.println(name+ " <T "+baseType);
                
                // Type definition
+               if (inheritance.additionalClass != null) {
+               writer.println(name+ " <T " + inheritance.baseClass + " <T " + inheritance.additionalClass);
+           } else if (inheritance.atomicType != null){
+           writer.println(name+ " <T " + inheritance.baseClass + " <T " + inheritance.atomicType.l0Type);
+           } else {
                writer.println(name+ " <T " + inheritance.baseClass);
+               }
                writer.println(name + "_List <T XML.ElementList");
                
                // Access relations
index 863162c2ca873ad5d8180a69524fda1a22a73360..8a2785f18848b71d9df00e3cd8896ab4aac7ba11 100644 (file)
@@ -1359,6 +1359,7 @@ public final class SchemaConversionBase {
        
        public static class Inheritance {
                public String baseClass;
+               public String additionalClass;
                public InheritanceType type;
                public TypeEntry atomicType;
                
@@ -1454,6 +1455,9 @@ public final class SchemaConversionBase {
                                ExtensionType extensionType = simpleContent.getExtension();
                                if (extensionType != null) {
                                        type = extensionType.getBase();
+                                       SchemaObject simpleType = getSimpleType(type);
+                                       if (simpleType != null)
+                                               inheritance.additionalClass = getName(simpleType);
                                        getAtomicTypeInheritance(type, inheritance);
                                }
                        }