]> gerrit.simantics Code Review - simantics/interop.git/blobdiff - org.simantics.xml.sax/src/org/simantics/xml/sax/ExporterGenerator.java
XML data based schema and ontology generation
[simantics/interop.git] / org.simantics.xml.sax / src / org / simantics / xml / sax / ExporterGenerator.java
index f538bcb42bae58e026e17978d0a5dd4e89945eff..5294e913fce5d13832c484467de8fbb3825489b1 100644 (file)
@@ -40,10 +40,9 @@ public class ExporterGenerator extends JavaGenerator{
 
        public void createParser() throws IOException {
                
-               String parserPackagePostfix = "_exp";
+
                String importerClassPostfix = "Exporter";
                String parserClassPostfix = "Writer";
-               elementPackageName = name+parserPackagePostfix;
                
                importParserDir= new File(converter.getParserDir().getAbsolutePath()+"/"+elementPackageName);
                if (!importParserDir.exists())
@@ -108,6 +107,11 @@ public class ExporterGenerator extends JavaGenerator{
                mainWriter.close();
        }
        
+       @Override
+       protected String getPackagePostFix() {
+               return "_exp";
+       }
+       
 //     @Override
 //     protected void handle(TopLevelAttribute topLevelAttribute) {
 //
@@ -428,13 +432,13 @@ public class ExporterGenerator extends JavaGenerator{
                String attrName;
                if (name != null) {
                        attrName = name;
-                       relationName = ontShort+"has"+name;
+                       relationName = ontShort+"has"+base.getName(attribute);
                        if (parent != null)
-                               relationName = ontShort+getName(parent)+"_has"+name;
+                               relationName = ontShort+getName(parent)+"_has"+base.getName(attribute);
                }
                else if (ref != null && parent != null) {
                        attrName = ref.getLocalPart();
-                       relationName = ontShort+getName(parent)+"_has"+ref.getLocalPart();
+                       relationName = ontShort+getName(parent)+"_has"+base.getName(ref);
                        
                        Attribute referred = base.getRefAttribute(ref);
                        if (referred != null) {
@@ -530,7 +534,7 @@ public class ExporterGenerator extends JavaGenerator{
                        FileWriter fw = getWriter(parent);
                        NamedAttributeGroup group = this.base.getAttributeGroup(attribute.getRef());
                        fw.writer.println(commentTag+"    AttributeGroup " + group.getName());
-                       SchemaObject obj = new SchemaObject(parent,attribute);
+                       SchemaObject obj = new SchemaObject(base,parent,attribute);
                        for (Annotated annotated : group.getAttributeOrAttributeGroup()) {
                                if (annotated instanceof Attribute) {
                                        //handle("AttributeGroups_"+group.getName(),(Attribute)annotated);