]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Import and export of modules that have no dependencies to other modules
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 5 May 2011 11:04:45 +0000 (11:04 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 5 May 2011 11:04:45 +0000 (11:04 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@20778 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/FunctionLibraries.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ExportModuleHandler.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ImportFunctionLibrary.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ImportModuleHandler.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java

index 83a652e35b8d044c577ecc6ce1172a89da8dd79b..cb2355362de8dd34bd2a966c027c3ca635341aed 100644 (file)
                </visibleWhen>\r
             </command>\r
             <command\r
-                  commandId="org.simantics.sysdyn.ui.importModuleLibrary"\r
-                  label="Module library"\r
+                  commandId="org.simantics.sysdyn.ui.importModule"\r
+                  label="Module"\r
                   style="push">\r
                <visibleWhen\r
                      checkEnabled="true">\r
                </visibleWhen>\r
             </command>\r
             <command\r
-                  commandId="org.simantics.sysdyn.ui.exportModuleLibrary"\r
-                  label="Module library"\r
+                  commandId="org.simantics.sysdyn.ui.exportModule"\r
+                  label="Module"\r
                   style="push">\r
                <visibleWhen\r
                      checkEnabled="true">\r
             id="org.simantics.sysdyn.ui.exportFunctionLibrary"\r
             name="Export Function Library">\r
       </command>\r
+      <command\r
+            id="org.simantics.sysdyn.ui.importModule"\r
+            name="Import Module">\r
+      </command>\r
+      <command\r
+            id="org.simantics.sysdyn.ui.exportModule"\r
+            name="Export Module">\r
+      </command>\r
    </extension>\r
    <extension\r
          point="org.eclipse.ui.handlers">\r
             </with>\r
          </activeWhen>\r
       </handler>\r
+      <handler\r
+            class="org.simantics.sysdyn.ui.handlers.ImportModuleHandler"\r
+            commandId="org.simantics.sysdyn.ui.importModule">\r
+         <activeWhen>\r
+            <with\r
+                  variable="selection">\r
+               <or>\r
+                  <test\r
+                        args="org.simantics.sysdyn.ui.browser.nodes.ModulesNode"\r
+                        property="org.simantics.sysdyn.ui.nodeClass">\r
+                  </test>\r
+               </or>\r
+            </with>\r
+         </activeWhen>\r
+      </handler>\r
+      <handler\r
+            class="org.simantics.sysdyn.ui.handlers.ExportModuleHandler"\r
+            commandId="org.simantics.sysdyn.ui.exportModule">\r
+         <activeWhen>\r
+            <with\r
+                  variable="selection">\r
+               <or>\r
+                  <test\r
+                        args="org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode"\r
+                        property="org.simantics.sysdyn.ui.nodeClass">\r
+                  </test>\r
+               </or>\r
+            </with>\r
+         </activeWhen>\r
+      </handler>\r
    </extension>\r
    <extension\r
          point="org.simantics.browsing.ui.common.viewpointContributionBinding">\r
index cf4b0ce8fcce8c7065a4f7ebdd8275a8424e8e94..754510d60e2155a3a1b71853a8a359afdd668e55 100644 (file)
@@ -44,8 +44,8 @@ public class FunctionLibraries  extends ViewpointContributor<FunctionsFolder> {
         }\r
         \r
         // Find model function libraries\r
-        for(Resource modelLibrary : graph.syncRequest(new ObjectsWithType(functionsFolder.data, l0.ConsistsOf, sr.SysdynModelicaFunctionLibrary))) {\r
-               new FunctionLibraryNode<Resource>(modelLibrary);\r
+        for(Resource functionLibrary : graph.syncRequest(new ObjectsWithType(functionsFolder.data, l0.ConsistsOf, sr.SysdynModelicaFunctionLibrary))) {\r
+               result.add(new FunctionLibraryNode<Resource>(functionLibrary));\r
         }       \r
         \r
         Resource sysdyn = graph.getPossibleResource("http://www.simantics.org/Sysdyn-1.0");\r
index 96caea962d42ef166e0e3920fd2b1dfe78bb6c01..4b5aac4819960cb4760c42a7294353ed7b3c5de0 100644 (file)
@@ -146,7 +146,9 @@ public class InputFactory extends SysdynElementFactory {
                                                parent = ((ChildVariable)v).getParent(graph);\r
                                        if(parent != null && !(parent instanceof RunVariable) && !(parent instanceof ConfigurationVariable)) {\r
                                                String parentURI = parent.getURI(graph);\r
-                                               moduleName = (String) graph.getPossibleRelatedValue(graph.getResource(parentURI), l0.HasName);\r
+                                               Resource p = graph.getPossibleResource(parentURI);\r
+                                               if(p != null)\r
+                                                       moduleName = (String) graph.getPossibleRelatedValue(p, l0.HasName);\r
                                        }\r
                                        break;\r
                                }\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ExportModuleHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ExportModuleHandler.java
new file mode 100644 (file)
index 0000000..17b5bd0
--- /dev/null
@@ -0,0 +1,244 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.handlers;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.core.runtime.Platform;\r
+import org.eclipse.jface.viewers.ISelection;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.FileDialog;\r
+import org.eclipse.swt.widgets.MessageBox;\r
+import org.eclipse.swt.widgets.Shell;\r
+import org.eclipse.ui.handlers.HandlerUtil;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.databoard.Files;\r
+import org.simantics.databoard.binding.error.RuntimeBindingConstructionException;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.primitiverequest.PossibleRelatedValue;\r
+import org.simantics.db.common.request.ObjectsWithType;\r
+import org.simantics.db.common.request.ReadRequest;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.util.TransferableGraphRequest2;\r
+import org.simantics.db.request.Read;\r
+import org.simantics.graph.representation.TransferableGraph1;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.modeling.ModelingResources;\r
+import org.simantics.structural.stubs.StructuralResource2;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.ui.utils.ResourceAdaptionUtils;\r
+import org.simantics.utils.datastructures.Pair;\r
+\r
+public class ExportModuleHandler  extends AbstractHandler {\r
+\r
+       /**\r
+        * Temporary exception. At this phase, the system will not support exporting modules\r
+        * that depend on other modules. \r
+        * \r
+        * @author TLTEEMU\r
+        *\r
+        */\r
+       class ContainsDependenciesException extends DatabaseException {\r
+               private static final long serialVersionUID = -1533706136673146020L;\r
+               \r
+               private Collection<String> dependencies;\r
+               \r
+               ContainsDependenciesException(Collection<String> dependencies) {\r
+                       this.dependencies = dependencies;\r
+               }\r
+               \r
+               public Collection<String> getDependencies() {\r
+                       return this.dependencies;\r
+               }\r
+               \r
+       }\r
+       \r
+       @Override\r
+       public Object execute(ExecutionEvent event) throws ExecutionException {\r
+\r
+        ISelection sel = HandlerUtil.getCurrentSelection(event);\r
+        final Resource modulesymbol = ResourceAdaptionUtils.toSingleResource(sel);\r
+        if(modulesymbol == null) return null;\r
+               \r
+               String name = null;\r
+               try {\r
+                       name = SimanticsUI.getSession().syncRequest(new Read<String>() {\r
+\r
+                               @Override\r
+                               public String perform(ReadGraph graph) throws DatabaseException {\r
+                                       ModelingResources mr = ModelingResources.getInstance(graph);\r
+                                       StructuralResource2 sr2 = StructuralResource2.getInstance(graph);\r
+                                       SysdynResource sr = SysdynResource.getInstance(graph);\r
+                                       Layer0 l0 = Layer0.getInstance(graph);\r
+                                       \r
+                                       Resource component = graph.getPossibleObject(modulesymbol, mr.SymbolToComponentType);\r
+                                       if (component == null || !graph.hasStatement(component, Layer0.getInstance(graph).PartOf))\r
+                                               return null;\r
+                                       \r
+                                       Resource configuration = graph.getPossibleObject(component, sr2.IsDefinedBy);\r
+                                       if (configuration == null)\r
+                                               return null;\r
+                                       \r
+                                       ArrayList<String> dependencies = null;\r
+                                       for(Resource r : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Module))) {\r
+                                               if(dependencies == null)\r
+                                                       dependencies = new ArrayList<String>();\r
+                                               String name = NameUtils.getSafeName(graph, r);\r
+                                               String instanceOf = NameUtils.getSafeName(graph, graph.getSingleObject(r, l0.InstanceOf));\r
+                                               dependencies.add(name + " : " + instanceOf);\r
+                                       }\r
+                                       if(dependencies != null && !dependencies.isEmpty())\r
+                                               throw new ContainsDependenciesException(dependencies);\r
+                                       \r
+                                       String name = graph.getPossibleRelatedValue(component, l0.HasName, Bindings.STRING);\r
+                                       return name;\r
+                                       \r
+                               }\r
+                               \r
+                       });\r
+               } catch (ContainsDependenciesException e1) {\r
+                       Shell shell = HandlerUtil.getActiveShellChecked(event);\r
+                       MessageBox mb = new MessageBox(shell, SWT.OK);\r
+                       StringBuilder sb = new StringBuilder();\r
+                       sb.append("This version does not support exporting modules with other module instances.\n\n");\r
+                       sb.append("Dependencies:\n");\r
+                       for(String s : e1.getDependencies())\r
+                               sb.append("    " + s + "\n");\r
+                       mb.setMessage(sb.toString());\r
+                       mb.setText("Module contains dependencies.");\r
+                       mb.open();\r
+                       return null;\r
+               } catch (DatabaseException e1) {\r
+                       e1.printStackTrace();\r
+               }\r
+               if(name == null) return null;\r
+               \r
+               Shell shell = HandlerUtil.getActiveShellChecked(event);\r
+               FileDialog fd = new FileDialog(shell, SWT.SAVE);\r
+               fd.setText("Export..");\r
+               fd.setFileName(name);\r
+               fd.setFilterPath(Platform.getLocation().toOSString());\r
+               String[] filterExt = {"*.tg"};\r
+               fd.setFilterExtensions(filterExt);\r
+               final String selected = fd.open();\r
+               if(selected == null) return null;\r
+               \r
+               \r
+               SimanticsUI.getSession().asyncRequest(new ReadRequest() {\r
+                       \r
+                       @Override\r
+                       public void run(ReadGraph graph) throws DatabaseException {\r
+                               Layer0 l0 = Layer0.getInstance(graph);\r
+                               ModelingResources mr = ModelingResources.getInstance(graph);\r
+\r
+                               final Resource component = graph.getPossibleObject(modulesymbol, mr.SymbolToComponentType);\r
+                               if (component == null || !graph.hasStatement(component, Layer0.getInstance(graph).PartOf))\r
+                                       return;\r
+                               String name = graph.syncRequest(new PossibleRelatedValue<String>(component, l0.HasName, Bindings.STRING ));\r
+                               final ArrayList<Pair<Resource, String>> roots = new ArrayList<Pair<Resource, String>>();\r
+                               roots.add(Pair.make(component, name));\r
+\r
+                               graph.asyncRequest(new WriteRequest() {\r
+\r
+                                       @Override\r
+                                       public void perform(WriteGraph graph) throws DatabaseException {\r
+                                               Layer0 l0 = Layer0.getInstance(graph);\r
+                                               StructuralResource2 sr2 = StructuralResource2.getInstance(graph);\r
+\r
+                                               Resource configuration = graph.getPossibleObject(component, sr2.IsDefinedBy);\r
+                                               if (!graph.hasStatement(configuration, l0.PartOf, component)&& \r
+                                                               !graph.hasStatement(modulesymbol, l0.PartOf, component)) {\r
+                                                       // Make sure that configuration and symbol are included.\r
+                                                       // In old versions, they were attached to model, not to module.\r
+                                                       Resource previousPartof = graph.getSingleObject(configuration, l0.PartOf);\r
+\r
+                                                       graph.deny(configuration, l0.PartOf);\r
+                                                       graph.deny(modulesymbol, l0.PartOf);\r
+                                                       graph.claim(configuration, l0.PartOf, l0.ConsistsOf, component);\r
+                                                       graph.claim(modulesymbol, l0.PartOf, l0.ConsistsOf, component);\r
+\r
+                                                       export(graph, selected, roots, component);\r
+\r
+                                                       graph.deny(configuration, l0.PartOf);\r
+                                                       graph.deny(modulesymbol, l0.PartOf);\r
+                                                       graph.claim(configuration, l0.PartOf, l0.ConsistsOf, previousPartof);\r
+                                                       graph.claim(modulesymbol, l0.PartOf, l0.ConsistsOf, previousPartof);\r
+                                               } else {\r
+                                                       // Normal export\r
+                                                       export(graph, selected, roots, component);\r
+                                               }\r
+                                       }\r
+                               });\r
+\r
+                       }\r
+               });\r
+\r
+               return null;\r
+       }\r
+       \r
+       /**\r
+        * Export module (without dependencies to other modules) and write it to file. \r
+        * Disable existing enumeration replacement for during export.  \r
+        *  \r
+        * @param graph WriteGraph\r
+        * @param path Path for the exported file\r
+        * @param roots\r
+        * @param component Module\r
+        */\r
+       private void export(WriteGraph graph, String path, ArrayList<Pair<Resource, String>> roots, Resource component) {\r
+               \r
+               // FIXME: Enumeration replacement handling like this is not suitable.\r
+               try {\r
+                       Layer0 l0 = Layer0.getInstance(graph);\r
+                       SysdynResource sr = SysdynResource.getInstance(graph);\r
+                       StructuralResource2 sr2 = StructuralResource2.getInstance(graph);\r
+\r
+                       Resource configuration = graph.getPossibleObject(component, sr2.IsDefinedBy);\r
+                       ArrayList<Pair<Resource, Resource>> replacements = new ArrayList<Pair<Resource, Resource>>();\r
+\r
+                       for(Resource enumeration : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Enumeration))) {\r
+                               if(graph.hasStatement(enumeration, sr.ReplacedEnumeration_Inverse)) {\r
+                                       for(Resource replacement : graph.getObjects(enumeration, sr.ReplacedEnumeration_Inverse)) {\r
+                                               replacements.add(new Pair<Resource, Resource>(enumeration, replacement));\r
+                                       }\r
+                               }\r
+                       }\r
+                       \r
+                       for(Pair<Resource,Resource> replacement : replacements)\r
+                               graph.deny(replacement.first, sr.ReplacedEnumeration_Inverse, replacement.second);\r
+                       \r
+                       TransferableGraph1 tg = graph.syncRequest(new TransferableGraphRequest2(roots, component));\r
+                       Files.createFile(new File(path), Bindings.getBindingUnchecked(TransferableGraph1.class), tg);\r
+                       \r
+                       for(Pair<Resource,Resource> replacement : replacements)\r
+                               graph.claim(replacement.first, sr.ReplacedEnumeration_Inverse, replacement.second);\r
+\r
+               } catch (RuntimeBindingConstructionException e) {\r
+                       e.printStackTrace();\r
+               } catch (IOException e) {\r
+                       e.printStackTrace();\r
+               } catch (DatabaseException e) {\r
+                       e.printStackTrace();\r
+               }\r
+       }\r
+}
\ No newline at end of file
index bf16f6c9c20b9ebd6f44fcae801f14b9d3d15a07..3193d41635a1d6c0ba4c21d333f6b8b0d76ee2e8 100644 (file)
@@ -43,19 +43,24 @@ import org.simantics.layer0.Layer0;
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.manager.FunctionUtils;\r
+import org.simantics.sysdyn.ui.browser.nodes.FunctionsFolder;\r
 import org.simantics.ui.SimanticsUI;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
 import org.simantics.ui.utils.ResourceAdaptionUtils;\r
 \r
 public class ImportFunctionLibrary  extends AbstractHandler {\r
 \r
        @Override\r
        public Object execute(ExecutionEvent event) throws ExecutionException {\r
-               Resource project = SimanticsUI.getProject().get();\r
-               if(project == null) return null;\r
-\r
         ISelection sel = HandlerUtil.getCurrentSelection(event);\r
-        final Resource functionLibrary = ResourceAdaptionUtils.toSingleResource(sel);\r
-        if(functionLibrary == null) return null;\r
+        Resource r = ResourceAdaptionUtils.toSingleResource(sel);\r
+        if(r == null) {\r
+               FunctionsFolder mn = AdaptionUtils.adaptToSingle(sel, FunctionsFolder.class);\r
+               r = mn.data;\r
+        }\r
+        if(r == null) return null;\r
+        \r
+        final Resource functionLibrary = r;\r
         \r
                Shell shell = HandlerUtil.getActiveShellChecked(event);\r
                FileDialog fd = new FileDialog(shell, SWT.OPEN);\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ImportModuleHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ImportModuleHandler.java
new file mode 100644 (file)
index 0000000..c973385
--- /dev/null
@@ -0,0 +1,82 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.handlers;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.core.runtime.Platform;\r
+import org.eclipse.jface.viewers.ISelection;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.FileDialog;\r
+import org.eclipse.swt.widgets.Shell;\r
+import org.eclipse.ui.handlers.HandlerUtil;\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.databoard.Files;\r
+import org.simantics.databoard.binding.error.RuntimeBindingConstructionException;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.layer0.adapter.impl.DefaultPasteHandler;\r
+import org.simantics.db.layer0.adapter.impl.DefaultPasteImportAdvisor;\r
+import org.simantics.graph.db.MissingDependencyException;\r
+import org.simantics.graph.representation.TransferableGraph1;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+\r
+public class ImportModuleHandler extends AbstractHandler {\r
+\r
+       @Override\r
+       public Object execute(ExecutionEvent event) throws ExecutionException {\r
+        ISelection sel = HandlerUtil.getCurrentSelection(event);\r
+        \r
+        @SuppressWarnings("unchecked")\r
+               AbstractNode<Resource> node = AdaptionUtils.adaptToSingle(sel, AbstractNode.class);\r
+        if (node == null)\r
+            return null;\r
+\r
+        final Resource model = node.data;\r
+        \r
+               Shell shell = HandlerUtil.getActiveShellChecked(event);\r
+               FileDialog fd = new FileDialog(shell, SWT.OPEN);\r
+               fd.setText("Import Module");\r
+               fd.setFilterPath(Platform.getLocation().toOSString());\r
+               String[] filterExt = {"*.tg"};\r
+               fd.setFilterExtensions(filterExt);\r
+               String selected = fd.open();\r
+               if(selected == null) return null;\r
+\r
+               TransferableGraph1 tg = null;\r
+               try {\r
+                       tg = (TransferableGraph1)Files.readFile(new File(selected), Bindings.getBindingUnchecked(TransferableGraph1.class));\r
+               } catch (RuntimeBindingConstructionException e) {\r
+                       e.printStackTrace();\r
+               } catch (IOException e) {\r
+                       e.printStackTrace();\r
+               }\r
+               if(tg == null) return null;\r
+\r
+               \r
+               DefaultPasteImportAdvisor ia = new DefaultPasteImportAdvisor(model);\r
+               try {\r
+                       DefaultPasteHandler.defaultExecute(tg, model, ia);\r
+               } catch (MissingDependencyException e) {\r
+                       e.printStackTrace();\r
+               } catch (Exception e) {\r
+                       e.printStackTrace();\r
+               }\r
+               \r
+               return null;\r
+       }\r
+\r
+}\r
index 5f8a66fb69640a73eb5afaad6df3edd551ed4c67..a6c4e6c04e6aa7593c070de33397bd5ab1829fc3 100644 (file)
@@ -68,7 +68,7 @@ public class NewModuleNodeHandler extends AbstractHandler {
                 Resource configuration = GraphUtils.create2(g, \r
                         sr.Configuration,\r
                         l0.HasName, name + "Configuration",\r
-                        l0.PartOf, model);\r
+                        l0.PartOf, moduleType);\r
                 \r
                 g.claim(moduleType, sr2.IsDefinedBy , configuration);\r
                 \r
@@ -92,10 +92,10 @@ public class NewModuleNodeHandler extends AbstractHandler {
                 \r
                 Resource moduleSymbol = g.newResource();\r
                 g.claimLiteral(moduleSymbol, l0.HasName, name + " Symbol");\r
-                g.claimLiteral(moduleSymbol, l0.HasLabel, name);\r
+                g.claimLiteral(moduleSymbol, l0.HasLabel, name + " Symbol");\r
                 g.claim(moduleSymbol, l0.Inherits, sr.ModuleSymbol);\r
                 g.claim(moduleSymbol, mr.SymbolToComponentType, moduleType);\r
-                g.claim(moduleSymbol, l0.PartOf, model);\r
+                g.claim(moduleSymbol, l0.PartOf, moduleType);\r
                 \r
                 Resource terminal = g.newResource();\r
                 g.claim(terminal, l0.InstanceOf, sr.SysdynTerminal);\r
index 02fa9e8d008b394295187597b9d888565a6f4dd0..d04bc24041924c55caf9f63f00f4d90c2f4f3e8b 100644 (file)
@@ -52,7 +52,7 @@ public class Module implements IElement {
     /**\r
      * Returns the declaration of a module with possible redeclared enumerations\r
      * \r
-     * Module m(redeclare type E1 = enumeration(i1, i2, i3), redeclare type E2 = enumeration(i4, i5, i6));\r
+     * Module m(redeclared.size = enumeration.size, redeclared.elements = enumeration.elements);\r
      * \r
      * @return Declaration of a module instance\r
      */\r