From: lehtonen Date: Wed, 1 Feb 2012 17:23:09 +0000 (+0000) Subject: Merged changes from trunks to stable branch until r24045. This covers the 2012-1 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=870373918582610f4c99bb1d807a26e26824390d;p=simantics%2Fsysdyn.git Merged changes from trunks to stable branch until r24045. This covers the 2012-1 sprint and a few extra changes. For issues closed in the 2012-1 sprint, see https://www.simantics.org/redmine/projects/simantics-platform/versions/161. fixes #3161 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/branches@24127 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/stable/org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java b/stable/org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java index fb5d4309..d77b4379 100644 --- a/stable/org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java +++ b/stable/org.simantics.modelica/src/org/simantics/modelica/ModelicaManager.java @@ -105,7 +105,7 @@ public class ModelicaManager { if(entry != null) { URL fileURL = FileLocator.toFileURL(entry); File root = new File( URLDecoder.decode(fileURL.getPath(), "UTF-8") ); - File f = new File(root, "OpenModelica1.7.0"); + File f = new File(root, "OpenModelica1.8.0"); return f; } } @@ -122,7 +122,7 @@ public class ModelicaManager { case SUN: return new File("/usr/bin/omc"); case WINDOWS: - return new File("c:/OpenModelica1.7.0"); + return new File("c:/OpenModelica1.8.0"); default: throw new UnsatisfiedLinkError("Unsupported operating system: " + os); } @@ -239,6 +239,9 @@ public class ModelicaManager { if(inits.containsKey("tolerance")) { s.print(",tolerance="+inits.get("tolerance")); } + if(inits.containsKey("numberOfIntervals")) { + s.print(",numberOfIntervals="+inits.get("numberOfIntervals")); + } s.print(");\n"); s.println("getErrorString();"); s.close(); @@ -282,10 +285,13 @@ public class ModelicaManager { Map env = processBuilder.environment(); env.put("OPENMODELICAHOME", openModelicaHome.getAbsolutePath()); - env.put("OPENMODELICALIBRARY", openModelicaHome.getAbsolutePath() + "\\lib\\omlibrary"); - env.put("OMPATH", openModelicaHome.getAbsolutePath() + "\\bin"); - env.put("MINGW", openModelicaHome.getAbsolutePath() + "\\MinGW"); - env.put("PATH", env.get("PATH") + System.getProperty("path.separator") + openModelicaHome.getAbsolutePath() + "\\MinGW\\lib"); + env.put("OPENMODELICALIBRARY", new File(openModelicaHome, "lib\\omlibrary").getAbsolutePath()); + env.put("OMPATH", new File(openModelicaHome, "bin").getAbsolutePath()); + env.put("MINGW", new File(openModelicaHome, "MinGW").getAbsolutePath()); + env.put("PATH", env.get("PATH") + + System.getProperty("path.separator") + new File(openModelicaHome, "bin").getAbsolutePath() + + System.getProperty("path.separator") + new File(openModelicaHome, "MinGW\\lib").getAbsolutePath() + + System.getProperty("path.separator") + new File(openModelicaHome, "MinGW\\bin").getAbsolutePath()); // Start the building process Process process = processBuilder.start(); @@ -332,12 +338,14 @@ public class ModelicaManager { Map env = processBuilder.environment(); File openModelicaHome = getModelicaHome(); env.put("OPENMODELICAHOME", openModelicaHome.getAbsolutePath()); - env.put("OPENMODELICALIBRARY", openModelicaHome.getAbsolutePath() + "\\lib\\omlibrary\\msl31"); + env.put("OPENMODELICALIBRARY", openModelicaHome.getAbsolutePath() + "\\lib\\omlibrary"); env.put("OMPATH", openModelicaHome.getAbsolutePath() + "\\bin"); env.put("MINGW", openModelicaHome.getAbsolutePath() + "\\MinGW"); - env.put("PATH", env.get("PATH") + System.getProperty("path.separator") + openModelicaHome.getAbsolutePath() + "\\bin" - + System.getProperty("path.separator") + openModelicaHome.getAbsolutePath() + "\\MinGW\\lib"); - + env.put("PATH", env.get("PATH") + + System.getProperty("path.separator") + openModelicaHome.getAbsolutePath() + "\\bin" + + System.getProperty("path.separator") + openModelicaHome.getAbsolutePath() + "\\MinGW\\lib" + + System.getProperty("path.separator") + openModelicaHome.getAbsolutePath() + "\\MinGW\\bin"); + // Simulate model Process process = processBuilder.start(); diff --git a/stable/org.simantics.sysdyn.ontology/graph.tg b/stable/org.simantics.sysdyn.ontology/graph.tg index 2e39e029..00e94b3e 100644 Binary files a/stable/org.simantics.sysdyn.ontology/graph.tg and b/stable/org.simantics.sysdyn.ontology/graph.tg differ diff --git a/stable/org.simantics.sysdyn.ontology/graph/ChartViewpoints.pgraph b/stable/org.simantics.sysdyn.ontology/graph/ChartViewpoints.pgraph index 44b844d0..a0d99b4b 100644 --- a/stable/org.simantics.sysdyn.ontology/graph/ChartViewpoints.pgraph +++ b/stable/org.simantics.sysdyn.ontology/graph/ChartViewpoints.pgraph @@ -73,8 +73,8 @@ BSBC BSBC @VP.customLabelDecorationRule JFREE.Series BSBC.SeriesLabelDecorationRule -//BSBC -// @VP.dropActionContribution JFREE.Series BSAC.Actions.SeriesDropAction 1.0 +BSBC + @VP.dropActionContribution JFREE.Series BSAC.Actions.SeriesDropAction 1.0 BSBC VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution @@ -82,7 +82,7 @@ BSBC VP.VisualsContribution.HasRule VP.PassThruSorterRule BSAC.Actions : L0.Library -//BSAC.Actions.SeriesDropAction : ACT.DropAction +BSAC.Actions.SeriesDropAction : ACT.DropAction /////////////////////////////////////////////// @@ -105,8 +105,8 @@ PSBC PSBC @VP.customLabelDecorationRule JFREE.Series PSBC.SeriesLabelDecorationRule -//PSBC -// @VP.dropActionContribution JFREE.Series PSAC.Actions.SeriesDropAction 1.0 +PSBC + @VP.dropActionContribution JFREE.Series PSAC.Actions.SeriesDropAction 1.0 PSBC VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution @@ -114,4 +114,4 @@ PSBC VP.VisualsContribution.HasRule VP.PassThruSorterRule PSAC.Actions : L0.Library -//PSAC.Actions.SeriesDropAction : ACT.DropAction +PSAC.Actions.SeriesDropAction : ACT.DropAction diff --git a/stable/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph b/stable/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph index 6b850bd2..803aea05 100644 --- a/stable/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph +++ b/stable/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph @@ -30,27 +30,14 @@ SYSDYN.SharedModuleOntolofgy -- SYSDYN.SysdynModel.startTime --> L0.Double -- SYSDYN.SysdynModel.stopTime --> L0.Double -- SYSDYN.SysdynModel.outputInterval --> L0.Double -- SYSDYN.SysdynModel.tolerance --> L0.Double -- SYSDYN.SysdynModel.solver --> L0.String -- SYSDYN.Variable.type --> L0.String -- SYSDYN.Variable.expressions --> SYSDYN.Expressions -- SYSDYN.Variable.arrayIndexes --> SYSDYN.ArrayIndexes -- SYSDYN.Variable.unit --> L0.String -- SYSDYN.Variable.isTailOf --> STR.Connection -- SYSDYN.Variable.isHeadOf --> STR.Connection -- SYSDYN.IndependentVariable.unit --> L0.String -- SYSDYN.IndependentVariable.rangeStart --> L0.Double -- SYSDYN.IndependentVariable.rangeEnd --> L0.Double -- SYSDYN.IndependentVariable.rangeStep --> L0.Double -- SYSDYN.IndependentVariable.activeExpression --> SYSDYN.Expression -- SYSDYN.Input.defaultInputValue --> L0.Double -- SYSDYN.Enumeration.enumerationIndexes --> SYSDYN.EnumerationIndexes -- SYSDYN.Enumeration.isReplaceable --> L0.Boolean -- SYSDYN.Module.redeclaration --> SYSDYN.Redeclaration -- SYSDYN.Dependency.angle --> L0.Double -- SYSDYN.Dependency.refersTo --> SYSDYN.Variable -- SYSDYN.Expression.equation --> L0.String -- SYSDYN.Expression.arrayRange --> L0.String -- SYSDYN.DelayExpression.expression --> L0.String -- SYSDYN.DelayExpression.order --> L0.Integer -- SYSDYN.DelayExpression.delayTime --> L0.String -- SYSDYN.DelayExpression.initialValue --> L0.String -- SYSDYN.DelayExpression.expression --> L0.String -- SYSDYN.DelayExpression.order --> L0.Integer -- SYSDYN.DelayExpression.delayTime --> L0.String -- SYSDYN.DelayExpression.initialValue --> L0.String -- SYSDYN.StockExpression.initialEquation --> L0.String -- SYSDYN.LookupExpression.lookup --> L0.String -- SYSDYN.WithLookupExpression.expression --> L0.String -- SYSDYN.WithLookupExpression.lookup --> L0.String -- SYSDYN.WithLookupExpression.minX --> L0.Double -- SYSDYN.WithLookupExpression.maxX --> L0.Double -- SYSDYN.WithLookupExpression.minY --> L0.Double -- SYSDYN.WithLookupExpression.maxY --> L0.Double -- SYSDYN.EnumerationIndex.showEnumerationIndexInCharts --> L0.Boolean -- SYSDYN.Redeclaration.replacedEnumeration --> SYSDYN.Enumeration -- SYSDYN.Redeclaration.replacingEnumeration --> SYSDYN.Enumeration -- SYSDYN.SysdynModelicaFunction.modelicaFunctionCode --> L0.String -- SYSDYN.ExternalFunctionFile.externalFile --> L0.ByteArray -- SYSDYN.Experiment.result --> SYSDYN.Result -- SYSDYN.Result.parameterFile --> L0.String -- SYSDYN.Result.resultFile --> L0.String -- SYSDYN.Result.showResult --> SYSDYN.Result -- SYSDYN.ValveSymbol.orientation --> SYSDYN.Orientation -- SYSDYN.ValveSymbol.textLocation --> SYSDYN.Location -- SYSDYN.DependencyConnection.polarity --> L0.String -- SYSDYN.DependencyConnection.polarityLocation --> L0.String : SYSDYN.SysdynMod FL.xidz : SYSDYN.SysdynModelicaFunction L0.HasDescription "X if divided by zero" - SYSDYN.HasModelicaFunctionCode """ input Real a; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real a; input Real b; input Real x; output Real z; @@ -19,7 +19,7 @@ algorithm FL.zidz : SYSDYN.SysdynModelicaFunction L0.HasDescription "Zero if divided by zero" - SYSDYN.HasModelicaFunctionCode """ input Real a; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real a; input Real b; output Real z; algorithm @@ -27,7 +27,7 @@ algorithm FL.interpolate : SYSDYN.SysdynModelicaFunction L0.HasDescription "Interpolate function for two-dimensional table" - SYSDYN.HasModelicaFunctionCode """ input Real u "input value (first column of table)"; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real u "input value (first column of table)"; input Real table[:, :] "table to be interpolated"; output Real y "interpolated input value (icol column of table)"; algorithm @@ -36,7 +36,7 @@ algorithm FL.interpolateFull : SYSDYN.SysdynModelicaFunction L0.HasDescription "The full interpolate function" - SYSDYN.HasModelicaFunctionCode """ input Real u "input value (first column of table)"; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real u "input value (first column of table)"; input Real table[:, :] "table to be interpolated"; input Integer icol "column of table to be interpolated"; output Real y "interpolated input value (icol column of table)"; diff --git a/stable/org.simantics.sysdyn.ontology/graph/Sysdyn_ModelBrowser_Viewpoint.pgraph b/stable/org.simantics.sysdyn.ontology/graph/Sysdyn_ModelBrowser_Viewpoint.pgraph index a5129dc0..29442e80 100644 --- a/stable/org.simantics.sysdyn.ontology/graph/Sysdyn_ModelBrowser_Viewpoint.pgraph +++ b/stable/org.simantics.sysdyn.ontology/graph/Sysdyn_ModelBrowser_Viewpoint.pgraph @@ -24,6 +24,9 @@ SBC.ModuleContentChildRule : VP.ChildRule SBC.ModuleTypeLabelRule : VP.LabelRule MBC + @VP.relationChildRuleWithFolder SIMU.Model L0.ConsistsOf SIMU.Experiment + SBC.ExperimentsFolder : VP.ResourceNodeType + //@VP.relationChildRule SIMU.Experiment L0.ConsistsOf SIMU.Run // Function libraries // Functions folder @VP.relationChildRuleWithFolder MOD.StructuralModel L0.ConsistsOf SYSDYN.SysdynModelicaFunction @@ -55,6 +58,8 @@ MBC // Labels MBC + @VP.constantLabelRule SBC.ExperimentsFolder "Experiments" + @VP.customLabelRule SIMU.Run PROJECT.ProjectBrowseContext.RunLabelRule @VP.constantLabelRule SBC.FunctionsFolder "Functions" @VP.constantLabelRule SBC.SharedFunctionsFolder "Shared Functions" @VP.constantLabelRule SBC.ModulesFolder "Modules" @@ -64,6 +69,7 @@ MBC // Images MBC + @VP.constantImageRule SBC.ExperimentsFolder PROJECT.ProjectBrowseContext.Images.Folder @VP.constantImageRule SBC.FunctionsFolder SILK.folder @VP.constantImageRule SBC.SharedFunctionsFolder SILK.folder @VP.constantImageRule SYSDYN.SysdynModelicaFunction SILK.brick diff --git a/stable/org.simantics.sysdyn.ontology/graph/VensimFunctions.pgraph b/stable/org.simantics.sysdyn.ontology/graph/VensimFunctions.pgraph index 08e4cc5a..ee392f50 100644 --- a/stable/org.simantics.sysdyn.ontology/graph/VensimFunctions.pgraph +++ b/stable/org.simantics.sysdyn.ontology/graph/VensimFunctions.pgraph @@ -9,7 +9,7 @@ VF.DELAYFIXED : SYSDYN.SysdynModelicaFunction L0.HasDescription """DELAY FIXED( inputVar , dtime , init ) -> delay(inputVar, dtime) init -value is ignored.""" - SYSDYN.HasModelicaFunctionCode """ input Real inputVar; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real inputVar; input Real dtime; input Real init; input Real t = time; @@ -23,7 +23,7 @@ algorithm VF.IFTHENELSE : SYSDYN.SysdynModelicaFunction L0.HasDescription """IF THEN ELSE( cond , ontrue , onfalse ) -> if cond then ontrue else onfalse""" - SYSDYN.HasModelicaFunctionCode """ input Boolean cond; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Boolean cond; input Real ontrue; input Real onfalse; output Real z; @@ -33,7 +33,7 @@ algorithm VF.MAX : SYSDYN.SysdynModelicaFunction L0.HasDescription """MAX(a, b) Returns the larger of a and b.""" - SYSDYN.HasModelicaFunctionCode """ input Real a; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real a; input Real b; output Real z; algorithm @@ -42,7 +42,7 @@ algorithm VF.MIN : SYSDYN.SysdynModelicaFunction L0.HasDescription """MIN(a, b) Returns the smaller of a and b.""" - SYSDYN.HasModelicaFunctionCode """ input Real a; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real a; input Real b; output Real z; algorithm @@ -51,7 +51,7 @@ algorithm VF.XIDZ : SYSDYN.SysdynModelicaFunction L0.HasDescription """XIDZ(a, b, x) x if divided by zero, a/b otherwise.""" - SYSDYN.HasModelicaFunctionCode """ input Real a; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real a; input Real b; input Real x; output Real z; @@ -61,7 +61,7 @@ algorithm VF.ZIDZ : SYSDYN.SysdynModelicaFunction L0.HasDescription """XIDZ(a, b) Zero if divided by zero, a/b otherwise.""" - SYSDYN.HasModelicaFunctionCode """ input Real a; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real a; input Real b; output Real z; algorithm @@ -70,7 +70,7 @@ algorithm VF.ABS : SYSDYN.SysdynModelicaFunction L0.HasDescription """ABS(x) Returns the absolute value of x.""" - SYSDYN.HasModelicaFunctionCode """ input Real x; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real x; output Real z; algorithm z := abs(x);""" @@ -78,7 +78,7 @@ algorithm VF.SQRT : SYSDYN.SysdynModelicaFunction L0.HasDescription """SQRT(x) Returns the square root of x.""" - SYSDYN.HasModelicaFunctionCode """ input Real x; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real x; output Real z; algorithm z := sqrt(x);""" @@ -86,7 +86,7 @@ algorithm VF.MODULO : SYSDYN.SysdynModelicaFunction L0.HasDescription """MODULO(a, b) Returns the remainder when a is divided by b. """ - SYSDYN.HasModelicaFunctionCode """ input Real a; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real a; input Real b; output Real z; algorithm @@ -95,7 +95,7 @@ algorithm VF.PULSE : SYSDYN.SysdynModelicaFunction L0.HasDescription """PULSE(start, width) Returns 1.0 starting at time start and lasting for interval width. 0.0 is returned at other times.""" - SYSDYN.HasModelicaFunctionCode """ input Real start; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real start; input Real width; input Real t = time; output Real z; @@ -105,7 +105,7 @@ algorithm VF.RAMP : SYSDYN.SysdynModelicaFunction L0.HasDescription """RAMP(slope, startTime, endTime) Returns 0 until the start time and then slopes upward until end time and then holds constant.""" - SYSDYN.HasModelicaFunctionCode """ input Real slope; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real slope; input Real startTime; input Real endTime; input Real t = time; @@ -123,7 +123,7 @@ algorithm VF.STEP : SYSDYN.SysdynModelicaFunction L0.HasDescription """STEP(height, stepTime) Returns 0.0 until the step time and then returns height.""" - SYSDYN.HasModelicaFunctionCode """ input Real height; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real height; input Real stepTime; input Real t = time; output Real z; @@ -135,7 +135,7 @@ algorithm VF.EXP : SYSDYN.SysdynModelicaFunction L0.HasDescription """ """ - SYSDYN.HasModelicaFunctionCode """ input Real x; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real x; output Real z; algorithm z := exp(x);""" @@ -143,7 +143,7 @@ algorithm VF.SIN : SYSDYN.SysdynModelicaFunction L0.HasDescription """SIN(x) Returns the sine of x.""" - SYSDYN.HasModelicaFunctionCode """ input Real x; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real x; output Real z; algorithm z := sin(x);""" @@ -151,7 +151,7 @@ algorithm VF.SINH : SYSDYN.SysdynModelicaFunction L0.HasDescription """SINH(x) Returns the hyperbolic sine of x.""" - SYSDYN.HasModelicaFunctionCode """ input Real x; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real x; output Real z; algorithm z := sinh(x);""" @@ -159,7 +159,7 @@ algorithm VF.COS : SYSDYN.SysdynModelicaFunction L0.HasDescription """COS(x) Returns the cosine of x.""" - SYSDYN.HasModelicaFunctionCode """ input Real x; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real x; output Real z; algorithm z := cos(x);""" @@ -167,7 +167,7 @@ algorithm VF.COSH : SYSDYN.SysdynModelicaFunction L0.HasDescription """COSH(x) Returns the hyperbolic cosine of x.""" - SYSDYN.HasModelicaFunctionCode """ input Real x; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real x; output Real z; algorithm z := cosh(x);""" @@ -175,7 +175,7 @@ algorithm VF.TAN : SYSDYN.SysdynModelicaFunction L0.HasDescription """TAN(x) Returns the tangent of x.""" - SYSDYN.HasModelicaFunctionCode """ input Real x; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real x; output Real z; algorithm z := tan(x);""" @@ -183,7 +183,7 @@ algorithm VF.TANH : SYSDYN.SysdynModelicaFunction L0.HasDescription """TANH(x) Returns the hyperbolic tangent of x.""" - SYSDYN.HasModelicaFunctionCode """ input Real x; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real x; output Real z; algorithm z := tanh(x);""" @@ -192,7 +192,7 @@ VF.LN : SYSDYN.SysdynModelicaFunction L0.HasDescription """LN(x) Returns the natural logarithm of x. In modelica log(x) is the natural logarighm and log10(x) is base 10 logarighm.""" - SYSDYN.HasModelicaFunctionCode """ input Real x; + SYSDYN.SysdynModelicaFunction.modelicaFunctionCode """ input Real x; output Real z; algorithm z := log(x);""" diff --git a/stable/org.simantics.sysdyn.ontology/graph/WorkModel.pgraph b/stable/org.simantics.sysdyn.ontology/graph/WorkModel.pgraph index e74c5e93..aa22c018 100644 --- a/stable/org.simantics.sysdyn.ontology/graph/WorkModel.pgraph +++ b/stable/org.simantics.sysdyn.ontology/graph/WorkModel.pgraph @@ -30,7 +30,7 @@ WM.dependency : L0.Template @L0.tag TAGS.AdminIsVisible @L0.tag TAGS.AdminIsFocusable STR.HasConnectionType SYSDYN.SysdynConnectionType - SYSDYN.angle %angle + SYSDYN.Dependency.angle %angle DIA.HasArrowConnector _ : DIA.Connector SYSDYN.HasHeadTerminal %head DIA.AreConnected _ : DIA.Connector @@ -62,7 +62,7 @@ WM.conf_dependency_ref : L0.Template @L0.tag MOD.Mapped SYSDYN.HasHead %head SYSDYN.HasTail %tail - SYSDYN.RefersTo %ref + SYSDYN.Dependency.refersTo %ref @@ -87,8 +87,8 @@ WM.WorkforceSymbol - none 0 fill 1 + none 0 fill 1 \ No newline at end of file diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewEnumerationAction.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewEnumerationAction.java index 4ac2459d..8984a09b 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewEnumerationAction.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewEnumerationAction.java @@ -56,7 +56,7 @@ public class NewEnumerationAction implements ActionFactory{ GraphUtils.create2(g, sr.Enumeration, l0.HasName, name, - sr.HasEnumerationIndexes, enumerationIndexes, + sr.Enumeration_enumerationIndexes, enumerationIndexes, l0.PartOf, configuration); } }); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewFunctionAction.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewFunctionAction.java index e52c0e9a..506f7bcc 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewFunctionAction.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewFunctionAction.java @@ -46,7 +46,7 @@ public class NewFunctionAction implements ActionFactory{ GraphUtils.create2(g, sr.SysdynModelicaFunction, l0.HasName, name, l0.HasDescription, "", - sr.HasModelicaFunctionCode, "", + sr.SysdynModelicaFunction_modelicaFunctionCode, "", l0.PartOf, library); FunctionUtils.updateFunctionFileForLibrary(g, library); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewModuleTypeAction.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewModuleTypeAction.java index 0670d0d4..0f8234e2 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewModuleTypeAction.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/NewModuleTypeAction.java @@ -9,6 +9,7 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.ActionFactory; import org.simantics.db.layer0.adapter.Template; import org.simantics.diagram.stubs.DiagramResource; +import org.simantics.diagram.synchronization.graph.DiagramGraphUtil; import org.simantics.layer0.Layer0; import org.simantics.layer0.utils.direct.GraphUtils; import org.simantics.modeling.ModelingResources; @@ -82,20 +83,11 @@ public class NewModuleTypeAction implements ActionFactory{ Resource terminal = g.newResource(); g.claim(terminal, l0.InstanceOf, sr.SysdynTerminal); - Resource connectionVariable = g.newResource(); - g.claim(connectionVariable, l0.InstanceOf, sr2.ConnectionVariable); - g.claim(connectionVariable, sr2.Binds, sr.IsHeadOfTerminal); - g.claim(connectionVariable, sr2.IsParameterOf, moduleSymbol); - g.claim(terminal, dr.HasConnectionVariable, connectionVariable); - + DiagramGraphUtil.addConnectionPoint(g, moduleSymbol, terminal, sr.IsHeadOfTerminal); Resource terminal2 = g.newResource(); g.claim(terminal2, l0.InstanceOf, sr.SysdynTerminal); - Resource connectionVariable2 = g.newResource(); - g.claim(connectionVariable2, l0.InstanceOf, sr2.ConnectionVariable); - g.claim(connectionVariable2, sr2.Binds, sr.IsTailOfTerminal); - g.claim(connectionVariable2, sr2.IsParameterOf, moduleSymbol); - g.claim(terminal2, dr.HasConnectionVariable, connectionVariable2); + DiagramGraphUtil.addConnectionPoint(g, moduleSymbol, terminal2, sr.IsTailOfTerminal); g.claim(moduleSymbol, sr2.IsDefinedBy, OrderedSetUtils.create(g, sr2.Composite, terminal, terminal2)); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResult.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResult.java index c95383a5..40bcbe6e 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResult.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResult.java @@ -34,8 +34,8 @@ public class SimulationResult extends ViewpointContributor { public Collection getContribution(ReadGraph graph, ExperimentNode experiment) throws DatabaseException { ArrayList> result = new ArrayList>(); SysdynResource sr = SysdynResource.getInstance(graph); - for(final Resource r : graph.syncRequest(new ObjectsWithType(experiment.data, sr.HasResult, sr.Result))) { - String resultPath = (String)graph.getPossibleRelatedValue(r, sr.HasResultFile); + for(final Resource r : graph.syncRequest(new ObjectsWithType(experiment.data, sr.Experiment_result, sr.Result))) { + String resultPath = (String)graph.getPossibleRelatedValue(r, sr.Result_resultFile); File file = new File(resultPath); if(file.exists()) { try { @@ -50,7 +50,7 @@ public class SimulationResult extends ViewpointContributor { public void perform(WriteGraph graph) throws DatabaseException { Layer0 l0 = Layer0.getInstance(graph); graph.deny(r, l0.PartOf); - graph.deny(r, graph.getInverse(SysdynResource.getInstance(graph).HasResult)); + graph.deny(r, graph.getInverse(SysdynResource.getInstance(graph).Experiment_result)); } }); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultDecorator.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultDecorator.java index c35120a3..f3abbfa7 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultDecorator.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultDecorator.java @@ -24,7 +24,7 @@ public class SimulationResultDecorator extends LabelDecoratorContributor implements IDeletabl @Override public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException { SysdynResource sr = SysdynResource.getInstance(graph); - for(Resource redeclaration : graph.getObjects(data, sr.ReplacedEnumeration_Inverse)) { - graph.deny(redeclaration, sr.HasRedeclaration_Inverse); + for(Resource redeclaration : graph.getObjects(data, sr.Redeclaration_replacedEnumeration_Inverse)) { + graph.deny(redeclaration, sr.Module_redeclaration_Inverse); } - for(Resource redeclaration : graph.getObjects(data, sr.ReplacingEnumeration_Inverse)) { - graph.deny(redeclaration, sr.HasRedeclaration_Inverse); + for(Resource redeclaration : graph.getObjects(data, sr.Redeclaration_replacedEnumeration_Inverse)) { + graph.deny(redeclaration, sr.Module_redeclaration_Inverse); } for(Resource list : OrderedSetUtils.getOwnerLists(graph, data, sr.ArrayIndexes)) { diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ExperimentNode.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ExperimentNode.java index 9bc33413..d272900f 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ExperimentNode.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ExperimentNode.java @@ -73,7 +73,7 @@ public class ExperimentNode extends AbstractNode implements IDoubleCli SimanticsUI.getSession().syncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException { - Collection results = graph.getObjects(data, SysdynResource.getInstance(graph).HasResult); + Collection results = graph.getObjects(data, SysdynResource.getInstance(graph).Experiment_result); if(results != null) for(Resource result : results) SimulationResultNode.unlinkResult(graph, result); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SimulationResultNode.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SimulationResultNode.java index d21f18b1..768b591e 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SimulationResultNode.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SimulationResultNode.java @@ -75,7 +75,7 @@ public class SimulationResultNode extends AbstractNode implements IDo public static void deleteResultFiles(WriteGraph graph, Resource result) throws DatabaseException { String path; - path = graph.getPossibleRelatedValue(result, SysdynResource.getInstance(graph).HasResultFile); + path = graph.getPossibleRelatedValue(result, SysdynResource.getInstance(graph).Result_resultFile); if(path != null) { File file = new File(path); file.delete(); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/dependencies/CreateDependencyGraph.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/dependencies/CreateDependencyGraph.java index b48de97d..586117b0 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/dependencies/CreateDependencyGraph.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/dependencies/CreateDependencyGraph.java @@ -117,12 +117,12 @@ public class CreateDependencyGraph implements Read { Collection dependants; if(isInverted) - dependants = getDependants(g, graph, r, sr.IsTailOf, sr.HasHead, sr.Dependency); + dependants = getDependants(g, graph, r, sr.Variable_isTailOf, sr.HasHead, sr.Dependency); else { - dependants = getDependants(g, graph, r, sr.IsHeadOf, sr.HasTail, sr.Dependency); + dependants = getDependants(g, graph, r, sr.Variable_isHeadOf, sr.HasTail, sr.Dependency); if (g.isInstanceOf(r, sr.Stock)) { - dependants.addAll(getDependants(g, graph, r, sr.IsTailOf, sr.HasHead, sr.Flow)); - dependants.addAll(getDependants(g, graph, r, sr.IsHeadOf, sr.HasTail, sr.Flow)); + dependants.addAll(getDependants(g, graph, r, sr.Variable_isTailOf, sr.HasHead, sr.Flow)); + dependants.addAll(getDependants(g, graph, r, sr.Variable_isHeadOf, sr.HasTail, sr.Flow)); } } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynConnectionAdvisor.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynConnectionAdvisor.java index e21d6abb..dbabc430 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynConnectionAdvisor.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynConnectionAdvisor.java @@ -88,8 +88,7 @@ public class SysdynConnectionAdvisor implements IConnectionAdvisor { Resource terminal2 = ((ResourceTerminal) term2).getResource(); SysdynResource sr = SysdynResource.getInstance(g); - Resource connectionVariable = g.getPossibleObject(terminal2, dr.HasConnectionVariable); - if(!g.hasStatement(connectionVariable, str2.Binds, sr.IsHeadOfTerminal)) { + if(!g.hasStatement(terminal2, dr.HasConnectionPoint, sr.IsHeadOfTerminal)) { return null; } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java index f3151bd9..58021f22 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java @@ -114,9 +114,9 @@ public class InputFactory extends SysdynElementFactory { String referenceName = ""; component = graph.getPossibleObject(element, mr.ElementToComponent); if(component != null) - dependency = graph.getPossibleObject(component, sr.IsHeadOf); + dependency = graph.getPossibleObject(component, sr.Variable_isHeadOf); if(dependency != null) { - refersTo = graph.getPossibleObject(dependency, sr.RefersTo); + refersTo = graph.getPossibleObject(dependency, sr.Dependency_refersTo); if(refersTo != null) { referenceName = (String) graph.getPossibleRelatedValue(refersTo, l0.HasName); module = graph.getPossibleObject(dependency, sr.HasTail); @@ -136,8 +136,8 @@ public class InputFactory extends SysdynElementFactory { module = ((ChildVariable)v).getRepresents(graph); } if(module != null) - for(Resource dep : graph.getObjects(module, sr.IsHeadOf)) { - Resource reference = graph.getPossibleObject(dep, sr.RefersTo); + for(Resource dep : graph.getObjects(module, sr.Variable_isHeadOf)) { + Resource reference = graph.getPossibleObject(dep, sr.Dependency_refersTo); if(reference!= null && reference.equals(component)) { refersTo = graph.getSingleObject(dep, sr.HasTail); referenceName = (String) graph.getPossibleRelatedValue(refersTo, l0.HasName); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ValveFactory.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ValveFactory.java index 28314a22..50642b2e 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ValveFactory.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ValveFactory.java @@ -94,7 +94,7 @@ public class ValveFactory extends SysdynElementFactory { SysdynResource sr = SysdynResource.getInstance(graph); - Resource orientation = graph.getPossibleObject(element, sr.HasValveOrientation); + Resource orientation = graph.getPossibleObject(element, sr.ValveSymbol_orientation); String orientationText; if(orientation != null && sr.Vertical.equals(orientation)) { @@ -104,7 +104,7 @@ public class ValveFactory extends SysdynElementFactory { } SysdynElementUtils.setOrientation(e, orientationText); - Resource location = graph.getPossibleObject(element, sr.HasTextLocation); + Resource location = graph.getPossibleObject(element, sr.ValveSymbol_textLocation); String locationText; if(location == null || sr.Bottom.equals(location)) { locationText = "Bottom"; diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/RouteFlowConnectionFactory.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/RouteFlowConnectionFactory.java index 9a2691f2..70d1ad55 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/RouteFlowConnectionFactory.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/RouteFlowConnectionFactory.java @@ -252,7 +252,7 @@ public class RouteFlowConnectionFactory extends SyncElementFactory { // Valve behaves differently. Allowed directions depend on the orientation of the valve if(te.getElementClass().containsClass(ValveSceneGraph.class)) { SysdynResource sr = SysdynResource.getInstance(graph); - if(graph.hasStatement(terminalElement, sr.HasValveOrientation, sr.Vertical)) { + if(graph.hasStatement(terminalElement, sr.ValveSymbol_orientation, sr.Vertical)) { allowedDirections = 10; // Directions up and down (1010) } else { allowedDirections = 5; // Directions left and right (0101) diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleResultActivation.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleResultActivation.java index 5eaa2d73..024c6cbc 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleResultActivation.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleResultActivation.java @@ -47,10 +47,10 @@ public class ToggleResultActivation extends AbstractHandler { SysdynResource sr = SysdynResource.getInstance(graph); for(Resource r : resources) { if(graph.isInstanceOf(r, sr.Result)) { - if (graph.hasStatement(r, sr.ShowResult)) { - graph.denyStatement(r, sr.ShowResult, r); + if (graph.hasStatement(r, sr.Result_showResult)) { + graph.denyStatement(r, sr.Result_showResult, r); } else { - graph.claim(r, sr.ShowResult, r); + graph.claim(r, sr.Result_showResult, r); } } } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportExternalFunctionFilesHandler.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportExternalFunctionFilesHandler.java index 53b012c5..fe9d1934 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportExternalFunctionFilesHandler.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportExternalFunctionFilesHandler.java @@ -81,7 +81,7 @@ public class ExportExternalFunctionFilesHandler extends AbstractHandler { try { String name = NameUtils.getSafeName(graph, r); FileOutputStream fos = new FileOutputStream(dir + "\\" + name); - byte[] fileBArray = graph.getPossibleRelatedValue(r, sr.HasExternalFile, Bindings.BYTE_ARRAY); + byte[] fileBArray = graph.getPossibleRelatedValue(r, sr.ExternalFunctionFile_externalFile, Bindings.BYTE_ARRAY); fos.write(fileBArray); fos.close(); } catch (IOException e) { diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java index ab804371..7b12325e 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java @@ -235,21 +235,21 @@ public class ExportModuleHandler extends AbstractHandler { ArrayList> replacements = new ArrayList>(); for(Resource enumeration : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Enumeration))) { - if(graph.hasStatement(enumeration, sr.ReplacedEnumeration_Inverse)) { - for(Resource replacement : graph.getObjects(enumeration, sr.ReplacedEnumeration_Inverse)) { + if(graph.hasStatement(enumeration, sr.Redeclaration_replacedEnumeration_Inverse)) { + for(Resource replacement : graph.getObjects(enumeration, sr.Redeclaration_replacedEnumeration_Inverse)) { replacements.add(new Pair(enumeration, replacement)); } } } for(Pair replacement : replacements) - graph.deny(replacement.first, sr.ReplacedEnumeration_Inverse, replacement.second); + graph.deny(replacement.first, sr.Redeclaration_replacedEnumeration_Inverse, replacement.second); TransferableGraph1 tg = graph.syncRequest(new TransferableGraphRequest2(roots, component)); Files.createFile(new File(path), Bindings.getBindingUnchecked(TransferableGraph1.class), tg); for(Pair replacement : replacements) - graph.claim(replacement.first, sr.ReplacedEnumeration_Inverse, replacement.second); + graph.claim(replacement.first, sr.Redeclaration_replacedEnumeration_Inverse, replacement.second); } catch (RuntimeBindingConstructionException e) { e.printStackTrace(); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportExternalFunctionFilesHandler.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportExternalFunctionFilesHandler.java index f0052c6d..05b63a2b 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportExternalFunctionFilesHandler.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportExternalFunctionFilesHandler.java @@ -108,7 +108,7 @@ public class ImportExternalFunctionFilesHandler extends AbstractHandler { byte[] fileBArray = new byte[(int)file.length()]; FileInputStream fis = new FileInputStream(file); fis.read(fileBArray); - graph.claimLiteral(externalFile, sr.HasExternalFile, fileBArray, Bindings.BYTE_ARRAY); + graph.claimLiteral(externalFile, sr.ExternalFunctionFile_externalFile, fileBArray, Bindings.BYTE_ARRAY); FunctionUtils.createExternalFunctionFile(graph, externalFile); } catch (IOException e) { diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewEnumerationNodeHandler.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewEnumerationNodeHandler.java index fbd774ff..e0e60a14 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewEnumerationNodeHandler.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewEnumerationNodeHandler.java @@ -76,7 +76,7 @@ public class NewEnumerationNodeHandler extends AbstractHandler { GraphUtils.create2(g, sr.Enumeration, l0.HasName, name, - sr.HasEnumerationIndexes, enumerationIndexes, + sr.Enumeration_enumerationIndexes, enumerationIndexes, l0.PartOf, configuration); } }); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewFunctionHandler.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewFunctionHandler.java index a9a970db..1cf45f03 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewFunctionHandler.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewFunctionHandler.java @@ -75,7 +75,7 @@ public class NewFunctionHandler extends AbstractHandler { GraphUtils.create2(g, sr.SysdynModelicaFunction, l0.HasName, name, l0.HasDescription, "", - sr.HasModelicaFunctionCode, "", + sr.SysdynModelicaFunction_modelicaFunctionCode, "", l0.PartOf, library); FunctionUtils.updateFunctionFileForLibrary(g, library); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewModuleNodeHandler.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewModuleNodeHandler.java index 9c2e98e4..4c16319b 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewModuleNodeHandler.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewModuleNodeHandler.java @@ -24,6 +24,7 @@ import org.simantics.db.common.utils.OrderedSetUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.Template; import org.simantics.diagram.stubs.DiagramResource; +import org.simantics.diagram.synchronization.graph.DiagramGraphUtil; import org.simantics.layer0.Layer0; import org.simantics.layer0.utils.direct.GraphUtils; import org.simantics.modeling.ModelingResources; @@ -130,21 +131,12 @@ public class NewModuleNodeHandler extends AbstractHandler { Resource terminal = g.newResource(); g.claim(terminal, l0.InstanceOf, sr.SysdynTerminal); - Resource connectionVariable = g.newResource(); - g.claim(connectionVariable, l0.InstanceOf, sr2.ConnectionVariable); - g.claim(connectionVariable, sr2.Binds, sr.IsHeadOfTerminal); - g.claim(connectionVariable, sr2.IsParameterOf, moduleSymbol); - g.claim(terminal, dr.HasConnectionVariable, connectionVariable); - + DiagramGraphUtil.addConnectionPoint(g, moduleSymbol, terminal, sr.IsHeadOfTerminal); Resource terminal2 = g.newResource(); g.claim(terminal2, l0.InstanceOf, sr.SysdynTerminal); - Resource connectionVariable2 = g.newResource(); - g.claim(connectionVariable2, l0.InstanceOf, sr2.ConnectionVariable); - g.claim(connectionVariable2, sr2.Binds, sr.IsTailOfTerminal); - g.claim(connectionVariable2, sr2.IsParameterOf, moduleSymbol); - g.claim(terminal2, dr.HasConnectionVariable, connectionVariable2); - + DiagramGraphUtil.addConnectionPoint(g, moduleSymbol, terminal2, sr.IsTailOfTerminal); + g.claim(moduleSymbol, sr2.IsDefinedBy, OrderedSetUtils.create(g, sr2.Composite, terminal, terminal2)); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewXYLineChartHandler.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewXYLineChartHandler.java index 98c94da8..c2aac244 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewXYLineChartHandler.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewXYLineChartHandler.java @@ -78,7 +78,8 @@ public class NewXYLineChartHandler extends AbstractHandler { Resource domainAxis = GraphUtils.create2(g, jfree.NumberAxis, l0.HasName, "NumberAxis" + UUID.randomUUID().toString()); Resource rangeAxis = GraphUtils.create2(g, jfree.NumberAxis, - l0.HasName, "NumberAxis" + UUID.randomUUID().toString()); + l0.HasName, "NumberAxis" + UUID.randomUUID().toString(), + l0.HasLabel, "Y-axis"); Resource renderer = GraphUtils.create2(g, jfree.XYLineRenderer); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/menu/PlaybackSliderContribution.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/menu/PlaybackSliderContribution.java index f16927eb..aae0b0ef 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/menu/PlaybackSliderContribution.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/menu/PlaybackSliderContribution.java @@ -69,9 +69,9 @@ public class PlaybackSliderContribution extends ToolBarContributionItem { Double[] numbers = new Double[3]; Resource model = spe.getModel(); SysdynResource sr = SysdynResource.getInstance(graph); - numbers[0] = graph.getRelatedValue(model, sr.HasStartTime); - numbers[1] = graph.getRelatedValue(model, sr.HasStopTime); - numbers[2] = graph.getPossibleRelatedValue(model, sr.HasOutputInterval); + numbers[0] = graph.getRelatedValue(model, sr.SysdynModel_startTime); + numbers[1] = graph.getRelatedValue(model, sr.SysdynModel_stopTime); + numbers[2] = graph.getPossibleRelatedValue(model, sr.SysdynModel_outputInterval); return numbers; } }); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java index fb9fff65..d871355a 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java @@ -232,8 +232,8 @@ public class SysdynProject extends AbstractProjectFeature { if(graph.isInstanceOf(model, sr.SysdynModel)){ for(Resource experiment : graph.getObjects(model, l0.ConsistsOf)) { if(graph.isInstanceOf(experiment, SIMU.Experiment)) { - for(Resource result : graph.getObjects(experiment, sr.HasResult)) { - String resultFile = (String)graph.getPossibleRelatedValue(result, sr.HasResultFile); + for(Resource result : graph.getObjects(experiment, sr.Experiment_result)) { + String resultFile = (String)graph.getPossibleRelatedValue(result, sr.Result_resultFile); if(result != null) resultPaths.put(resultFile, result); } } @@ -272,7 +272,7 @@ public class SysdynProject extends AbstractProjectFeature { for(String key : resultPaths.keySet()) { Resource result = resultPaths.get(key); graph.deny(result, l0.PartOf); - graph.deny(result, graph.getInverse(SysdynResource.getInstance(graph).HasResult)); + graph.deny(result, graph.getInverse(SysdynResource.getInstance(graph).Experiment_result)); } } }) ; diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayIndexesTab.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayIndexesTab.java index 0939900e..004b8c1d 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayIndexesTab.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayIndexesTab.java @@ -83,10 +83,10 @@ public class ArrayIndexesTab extends LabelPropertyTabContributor implements Widg public void apply(WriteGraph graph, Resource input) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - Resource arrayIndexes = graph.getPossibleObject(input, sr.HasArrayIndexes); + Resource arrayIndexes = graph.getPossibleObject(input, sr.Variable_arrayIndexes); if(arrayIndexes == null) { arrayIndexes = OrderedSetUtils.create(graph, sr.ArrayIndexes); - graph.claim(input, sr.HasArrayIndexes, arrayIndexes); + graph.claim(input, sr.Variable_arrayIndexes, arrayIndexes); } OrderedSetUtils.addAll(graph, arrayIndexes, enumerationResources); } @@ -135,7 +135,7 @@ public class ArrayIndexesTab extends LabelPropertyTabContributor implements Widg throws DatabaseException { if(enumerationResources != null && enumerationResources.size() == 1) { SysdynResource sr = SysdynResource.getInstance(graph); - Resource arrayIndexes = graph.getPossibleObject(input, sr.HasArrayIndexes); + Resource arrayIndexes = graph.getPossibleObject(input, sr.Variable_arrayIndexes); if(arrayIndexes == null) return; @@ -167,7 +167,7 @@ public class ArrayIndexesTab extends LabelPropertyTabContributor implements Widg throws DatabaseException { if(enumerationResources != null && enumerationResources.size() == 1) { SysdynResource sr = SysdynResource.getInstance(graph); - Resource arrayIndexes = graph.getPossibleObject(input, sr.HasArrayIndexes); + Resource arrayIndexes = graph.getPossibleObject(input, sr.Variable_arrayIndexes); if(arrayIndexes == null) return; Resource enumeration = enumerationResources.get(0); @@ -197,7 +197,7 @@ public class ArrayIndexesTab extends LabelPropertyTabContributor implements Widg throws DatabaseException { if(enumerationResources != null && enumerationResources.size() == 1) { SysdynResource sr = SysdynResource.getInstance(graph); - Resource arrayIndexes = graph.getPossibleObject(input, sr.HasArrayIndexes); + Resource arrayIndexes = graph.getPossibleObject(input, sr.Variable_arrayIndexes); if(arrayIndexes == null) return; diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ConfigurationTab.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ConfigurationTab.java index 8ad18ac6..a67546b1 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ConfigurationTab.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ConfigurationTab.java @@ -86,8 +86,8 @@ public class ConfigurationTab extends LabelPropertyTabContributor { label.setText("Start time"); TrackedText startTime = new TrackedText(composite, support, SWT.BORDER | SWT.RIGHT); - startTime.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasStartTime)); - startTime.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasStartTime)); + startTime.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.SysdynModel_startTime)); + startTime.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.SysdynModel_startTime)); startTime.setInputValidator(new DoubleValidator()); GridDataFactory.fillDefaults().hint(200, SWT.DEFAULT).applyTo(startTime.getWidget()); @@ -95,8 +95,8 @@ public class ConfigurationTab extends LabelPropertyTabContributor { label.setText("Stop time"); TrackedText stopTime = new TrackedText(composite, support, SWT.BORDER | SWT.RIGHT); - stopTime.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasStopTime)); - stopTime.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasStopTime)); + stopTime.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.SysdynModel_stopTime)); + stopTime.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.SysdynModel_stopTime)); stopTime.setInputValidator(new DoubleValidator()); GridDataFactory.fillDefaults().hint(200, SWT.DEFAULT).applyTo(stopTime.getWidget()); @@ -104,8 +104,8 @@ public class ConfigurationTab extends LabelPropertyTabContributor { label.setText("Step length\n(empty = default)"); TrackedText outputInterval = new TrackedText(composite, support, SWT.BORDER | SWT.RIGHT); - outputInterval.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasOutputInterval)); - outputInterval.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasOutputInterval)); + outputInterval.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.SysdynModel_outputInterval)); + outputInterval.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.SysdynModel_outputInterval)); outputInterval.setInputValidator(new DoubleValidator()); GridDataFactory.fillDefaults().hint(200, SWT.DEFAULT).applyTo(outputInterval.getWidget()); @@ -133,7 +133,7 @@ public class ConfigurationTab extends LabelPropertyTabContributor { @Override public String perform(ReadGraph graph, final Resource input) throws DatabaseException { - String s = graph.getPossibleRelatedValue(input, SysdynResource.getInstance(graph).HasSolver); + String s = graph.getPossibleRelatedValue(input, SysdynResource.getInstance(graph).SysdynModel_solver); return s != null ? s : ""; } }); @@ -143,7 +143,7 @@ public class ConfigurationTab extends LabelPropertyTabContributor { @Override public void applyText(WriteGraph graph, Resource input, String text) throws DatabaseException { - graph.claimLiteral(input, SysdynResource.getInstance(graph).HasSolver, text); + graph.claimLiteral(input, SysdynResource.getInstance(graph).SysdynModel_solver, text); } }); @@ -151,8 +151,8 @@ public class ConfigurationTab extends LabelPropertyTabContributor { label.setText("Tolerance"); TrackedText tolerance = new TrackedText(composite, support, SWT.BORDER | SWT.RIGHT); - tolerance.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasTolerance)); - tolerance.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasTolerance)); + tolerance.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.SysdynModel_tolerance)); + tolerance.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.SysdynModel_tolerance)); tolerance.setInputValidator(new DoubleValidator()); GridDataFactory.fillDefaults().hint(200, SWT.DEFAULT).applyTo(tolerance.getWidget()); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java index a57da158..7ebec21a 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java @@ -72,8 +72,8 @@ public class DependencyTab extends LabelPropertyTabContributor { other.setSelectionFactory(new OtherPolaritySelectionFactory(new String[] {null, "+", "-", ""})); polarityText = new TrackedText(polarityGroup, support, SWT.BORDER); - polarityText.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.Polarity)); - polarityText.addModifyListener(new StringPropertyModifier(context, SysdynResource.URIs.Polarity)); + polarityText.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.DependencyConnection_polarity)); + polarityText.addModifyListener(new StringPropertyModifier(context, SysdynResource.URIs.DependencyConnection_polarity)); GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget()); Group locationGroup = new Group(composite, SWT.NONE); @@ -103,7 +103,7 @@ public class DependencyTab extends LabelPropertyTabContributor { @Override public void apply(WriteGraph graph, Resource connectionElement) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - graph.claimLiteral(connectionElement, sr.PolarityLocation, location); + graph.claimLiteral(connectionElement, sr.DependencyConnection_polarityLocation, location); } } @@ -123,7 +123,7 @@ public class DependencyTab extends LabelPropertyTabContributor { @Override public Boolean perform(ReadGraph graph, Resource dependencyConnection) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - String location = graph.getPossibleRelatedValue(dependencyConnection, sr.PolarityLocation, Bindings.STRING); + String location = graph.getPossibleRelatedValue(dependencyConnection, sr.DependencyConnection_polarityLocation, Bindings.STRING); if(DependencyNode.OUTSIDE.equals(this.location)) { return ObjectUtils.objectEquals(this.location, location); } else { @@ -146,7 +146,7 @@ public class DependencyTab extends LabelPropertyTabContributor { @Override public void apply(WriteGraph graph, Resource connectionElement) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - graph.claimLiteral(connectionElement, sr.Polarity, polarity.trim()); + graph.claimLiteral(connectionElement, sr.DependencyConnection_polarity, polarity.trim()); } } @@ -166,7 +166,7 @@ public class DependencyTab extends LabelPropertyTabContributor { @Override public Boolean perform(ReadGraph graph, Resource dependencyConnection) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - String polarity = graph.getPossibleRelatedValue(dependencyConnection, sr.Polarity, Bindings.STRING); + String polarity = graph.getPossibleRelatedValue(dependencyConnection, sr.DependencyConnection_polarity, Bindings.STRING); if(polarity == null && this.polarity.equals("")) return true; return ObjectUtils.objectEquals(polarity, this.polarity); @@ -189,7 +189,7 @@ public class DependencyTab extends LabelPropertyTabContributor { @Override public Boolean perform(ReadGraph graph, Resource dependencyConnection) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - String polarity = graph.getPossibleRelatedValue(dependencyConnection, sr.Polarity, Bindings.STRING); + String polarity = graph.getPossibleRelatedValue(dependencyConnection, sr.DependencyConnection_polarity, Bindings.STRING); for(String s : limits) { if(ObjectUtils.objectEquals(polarity, s)) return false; diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java index b0ceb8a0..08be0f8b 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java @@ -160,7 +160,7 @@ public class EnumerationTab extends LabelPropertyTabContributor implements Widge @Override public void run(ReadGraph graph) throws DatabaseException { - enumerationIndexes = graph.getSingleObject(enumeration, SysdynResource.getInstance(graph).HasEnumerationIndexes); + enumerationIndexes = graph.getSingleObject(enumeration, SysdynResource.getInstance(graph).Enumeration_enumerationIndexes); } }); } catch (DatabaseException e) { @@ -218,7 +218,7 @@ public class EnumerationTab extends LabelPropertyTabContributor implements Widge @Override public void run(ReadGraph graph) throws DatabaseException { - enumerationIndexes = graph.getSingleObject(enumeration, SysdynResource.getInstance(graph).HasEnumerationIndexes); + enumerationIndexes = graph.getSingleObject(enumeration, SysdynResource.getInstance(graph).Enumeration_enumerationIndexes); } }); } catch (DatabaseException e) { @@ -276,10 +276,10 @@ public class EnumerationTab extends LabelPropertyTabContributor implements Widge public Boolean perform(ReadGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - enumerationIndexes = graph.getSingleObject(enumeration, sr.HasEnumerationIndexes); + enumerationIndexes = graph.getSingleObject(enumeration, sr.Enumeration_enumerationIndexes); List indexes = OrderedSetUtils.toList(graph, enumerationIndexes); for(Resource index : indexes) { - Boolean show = graph.getPossibleRelatedValue(index, sr.ShowEnumerationIndexInCharts, Bindings.BOOLEAN); + Boolean show = graph.getPossibleRelatedValue(index, sr.EnumerationIndex_showEnumerationIndexInCharts, Bindings.BOOLEAN); if(!Boolean.TRUE.equals(show)) return false; } @@ -326,11 +326,11 @@ public class EnumerationTab extends LabelPropertyTabContributor implements Widge SysdynResource sr = SysdynResource.getInstance(graph); List indexes = OrderedSetUtils.toList(graph, enumerationIndexes); for(Resource index : indexes) { - Boolean show = graph.getPossibleRelatedValue(index, sr.ShowEnumerationIndexInCharts, Bindings.BOOLEAN); + Boolean show = graph.getPossibleRelatedValue(index, sr.EnumerationIndex_showEnumerationIndexInCharts, Bindings.BOOLEAN); if(selected && !Boolean.TRUE.equals(show)) { - graph.claimLiteral(index, sr.ShowEnumerationIndexInCharts, true, Bindings.BOOLEAN); + graph.claimLiteral(index, sr.EnumerationIndex_showEnumerationIndexInCharts, true, Bindings.BOOLEAN); } else if(!selected && !Boolean.FALSE.equals(show)) { - graph.claimLiteral(index, sr.ShowEnumerationIndexInCharts, false, Bindings.BOOLEAN); + graph.claimLiteral(index, sr.EnumerationIndex_showEnumerationIndexInCharts, false, Bindings.BOOLEAN); } } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java index 74fc5cac..a8340f24 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java @@ -179,17 +179,17 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget { SysdynResource sr = SysdynResource.getInstance(graph); Layer0 l0 = Layer0.getInstance(graph); Resource expressions = OrderedSetUtils.create(graph, sr.Expressions); - graph.claim(variable, sr.HasExpressions, expressions); + graph.claim(variable, sr.Variable_expressions, expressions); final Resource expression = graph.newResource(); if(graph.isInstanceOf(variable, sr.Auxiliary) || graph.isInstanceOf(variable, sr.Valve)) { graph.claim(expression, l0.InstanceOf, null, sr.NormalExpression); - graph.claimLiteral(expression, sr.HasEquation, ""); + graph.claimLiteral(expression, sr.Expression_equation, ""); } else if(graph.isInstanceOf(variable, sr.Stock)) { graph.claim(expression, l0.InstanceOf, null, sr.StockExpression); - graph.claimLiteral(expression, sr.HasInitialEquation, ""); + graph.claimLiteral(expression, sr.StockExpression_initialEquation, ""); } OrderedSetUtils.add(graph, expressions, expression); graph.claim(variable, l0.ConsistsOf, expression); @@ -204,9 +204,9 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget { @Override public void perform(WriteGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - if(graph.hasStatement(variable, sr.HasActiveExpression)) - graph.deny(variable, sr.HasActiveExpression); - graph.claim(variable, sr.HasActiveExpression, expression); + if(graph.hasStatement(variable, sr.IndependentVariable_activeExpression)) + graph.deny(variable, sr.IndependentVariable_activeExpression); + graph.claim(variable, sr.IndependentVariable_activeExpression, expression); } } ); @@ -229,7 +229,7 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget { @Override public Pair perform(ReadGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - Resource expressions = graph.getPossibleObject(variable, sr.HasExpressions); + Resource expressions = graph.getPossibleObject(variable, sr.Variable_expressions); if(expressions == null) { return new Pair(false, false); } @@ -249,7 +249,7 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget { * the ranges is the default range, an expression can be added */ for(Resource expression : expressionList) { - String range = graph.getPossibleRelatedValue(expression, sr.HasArrayRange); + String range = graph.getPossibleRelatedValue(expression, sr.Expression_arrayRange); if(range == null || range.equals("") || range.equals(defaultRange)) { canAdd = false; break; @@ -318,7 +318,7 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget { Layer0 l0 = Layer0.getInstance(graph); // Currently active expressin should be located in (Model sr.HasActiveExpression expression) - Resource activeExpression = graph.getPossibleObject(input, sr.HasActiveExpression); + Resource activeExpression = graph.getPossibleObject(input, sr.IndependentVariable_activeExpression); if(activeExpression == null) return; @@ -350,9 +350,9 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget { @Override public void perform(WriteGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - if(graph.hasStatement(input, sr.HasActiveExpression)) - graph.deny(input, sr.HasActiveExpression); - graph.claim(input, sr.HasActiveExpression, newActive); + if(graph.hasStatement(input, sr.IndependentVariable_activeExpression)) + graph.deny(input, sr.IndependentVariable_activeExpression); + graph.claim(input, sr.IndependentVariable_activeExpression, newActive); } } ); @@ -370,18 +370,18 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget { SysdynResource sr = SysdynResource.getInstance(graph); Layer0 l0 = Layer0.getInstance(graph); - Resource expressions = graph.getPossibleObject(input, sr.HasExpressions); + Resource expressions = graph.getPossibleObject(input, sr.Variable_expressions); if(expressions == null) { return; } // Get the currently active expression - Resource activeExpression = graph.getPossibleObject(input, sr.HasActiveExpression); + Resource activeExpression = graph.getPossibleObject(input, sr.IndependentVariable_activeExpression); Resource newExpression = graph.newResource(); if(activeExpression != null) { // Create a new expression based on the old expression graph.claim(newExpression, l0.InstanceOf, graph.getSingleObject(activeExpression, l0.InstanceOf)); if(graph.isInstanceOf(newExpression, sr.StockExpression)) { - graph.claimLiteral(newExpression, sr.HasInitialEquation, ""); + graph.claimLiteral(newExpression, sr.StockExpression_initialEquation, ""); } } else { // If there was no active expression, create a normal expression @@ -616,9 +616,9 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget { */ private Resource getActiveExpression(ReadGraph graph, Resource variable) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - Resource expression = graph.getPossibleObject(variable, sr.HasActiveExpression); + Resource expression = graph.getPossibleObject(variable, sr.IndependentVariable_activeExpression); if(expression == null) { - Resource expressions = graph.getPossibleObject(variable, sr.HasExpressions); + Resource expressions = graph.getPossibleObject(variable, sr.Variable_expressions); if(expressions == null) { return null; } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java index 4ee58758..a3d6b187 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java @@ -60,8 +60,8 @@ public class InputVariableTab extends LabelPropertyTabContributor { label.setText("Default Value:"); TrackedText defaultValue = new TrackedText(defaultValueComposite, support, SWT.RIGHT | SWT.BORDER); - defaultValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasDefaultInputValue)); - defaultValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasDefaultInputValue)); + defaultValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.Input_defaultInputValue)); + defaultValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.Input_defaultInputValue)); defaultValue.setInputValidator(new DoubleValidator()); GridDataFactory.fillDefaults().grab(true, false).applyTo(defaultValue.getWidget()); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/LookupTableTab.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/LookupTableTab.java index 678227ff..16c92c38 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/LookupTableTab.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/LookupTableTab.java @@ -41,15 +41,15 @@ public class LookupTableTab extends LabelPropertyTabContributor { GridDataFactory.fillDefaults().grab(false, true).applyTo(Ycontainer); TrackedText maxYText = new TrackedText(Ycontainer, support, SWT.BORDER); - maxYText.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasMaxY)); - maxYText.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasMaxY)); + maxYText.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.WithLookupExpression_maxY)); + maxYText.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.WithLookupExpression_maxY)); Label l = new Label(Ycontainer, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(false, true).applyTo(l); TrackedText minYText = new TrackedText(Ycontainer, support, SWT.BORDER); - minYText.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasMinY)); - minYText.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasMinY)); + minYText.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.WithLookupExpression_minY)); + minYText.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.WithLookupExpression_minY)); Composite chartContainer = new Composite(baseContainer, SWT.NONE); @@ -73,15 +73,15 @@ public class LookupTableTab extends LabelPropertyTabContributor { GridDataFactory.fillDefaults().grab(true, false).applyTo(Xcontainer); TrackedText minXText = new TrackedText(Xcontainer, support, SWT.BORDER); - minXText.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasMinX)); - minXText.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasMinX)); + minXText.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.WithLookupExpression_minX)); + minXText.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.WithLookupExpression_minX)); l = new Label(Xcontainer, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, false).applyTo(l); TrackedText maxXText = new TrackedText(Xcontainer, support, SWT.BORDER); - maxXText.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasMaxX)); - maxXText.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasMaxX)); + maxXText.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.WithLookupExpression_maxX)); + maxXText.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.WithLookupExpression_maxX)); } } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java index f188749c..2ee0ac0f 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java @@ -69,8 +69,8 @@ public class ModuleInputTab extends LabelPropertyTabContributor { Resource configuration = graph.getSingleObject(instanceOf, sr2.IsDefinedBy); for(Resource input : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Input))) { Resource dependency = null; - for(Resource dep : graph.getObjects(module, sr.IsHeadOf)) { - Resource refersTo = graph.getPossibleObject(dep, sr.RefersTo); + for(Resource dep : graph.getObjects(module, sr.Variable_isHeadOf)) { + Resource refersTo = graph.getPossibleObject(dep, sr.Dependency_refersTo); if(refersTo != null && refersTo.equals(input)) { dependency = dep; break; diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java index 29c2819f..24e08266 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java @@ -71,8 +71,8 @@ public class ModuleOutputTab extends LabelPropertyTabContributor { if(!graph.hasStatement(variable, sr.IsOutput)) continue; Resource dependency = null; - for(Resource dep : graph.getObjects(module, sr.IsTailOf)) { - Resource refersTo = graph.getPossibleObject(dep, sr.RefersTo); + for(Resource dep : graph.getObjects(module, sr.Variable_isTailOf)) { + Resource refersTo = graph.getPossibleObject(dep, sr.Dependency_refersTo); if(refersTo != null && refersTo.equals(variable)) { dependency = dep; break; diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java index 6ba81d70..d26e3668 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java @@ -117,14 +117,14 @@ public class ResourceSelectionProcessor implements SelectionProcessor expressionList = OrderedSetUtils.toList(backend, expressions); if(expressionList.isEmpty()) { System.err.println("expressionList is empty for " + r); @@ -257,7 +257,7 @@ public class ResourceSelectionProcessor implements SelectionProcessor expressions = getExpressions(graph, input); @@ -102,7 +102,7 @@ public class ArrayExpressionCombo extends TrackedCombo { } else { expression = activeExpression; } - String range = graph.getPossibleRelatedValue(expression, sr.HasArrayRange); + String range = graph.getPossibleRelatedValue(expression, sr.Expression_arrayRange); if(range != null) return name + range; else @@ -155,7 +155,7 @@ public class ArrayExpressionCombo extends TrackedCombo { private ArrayList getExpressions(ReadGraph graph, Resource variable) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - Resource hasExpressions = graph.getPossibleObject(variable, sr.HasExpressions); + Resource hasExpressions = graph.getPossibleObject(variable, sr.Variable_expressions); if(hasExpressions == null) return new ArrayList(); else @@ -164,7 +164,7 @@ public class ArrayExpressionCombo extends TrackedCombo { public static String getDefaultRange(ReadGraph graph, Resource variable) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - Resource hasArrayIndexes = graph.getPossibleObject(variable, sr.HasArrayIndexes); + Resource hasArrayIndexes = graph.getPossibleObject(variable, sr.Variable_arrayIndexes); if(hasArrayIndexes == null) return null; @@ -240,13 +240,15 @@ public class ArrayExpressionCombo extends TrackedCombo { SysdynResource sr = SysdynResource.getInstance(graph); if(range != null && lastExpression != null) { - String oldRange = graph.getPossibleRelatedValue(lastExpression, sr.HasArrayRange); + String oldRange = graph.getPossibleRelatedValue(lastExpression, sr.Expression_arrayRange); if(oldRange == null || !range.equals(oldRange)) { - graph.claimLiteral(lastExpression, sr.HasArrayRange, "[" + range + "]"); + graph.claimLiteral(lastExpression, sr.Expression_arrayRange, "[" + range + "]"); } + } else if (range == null && lastExpression != null && graph.hasStatement(lastExpression, sr.Expression_arrayRange)) { + graph.deny(lastExpression, sr.Expression_arrayRange); } - Resource activeExpression = graph.getPossibleObject(variable, sr.HasActiveExpression); + Resource activeExpression = graph.getPossibleObject(variable, sr.IndependentVariable_activeExpression); if(lastExpression != null && !lastExpression.equals(activeExpression)) { VirtualGraphSupport support = graph.getService(VirtualGraphSupport.class); @@ -259,9 +261,9 @@ public class ArrayExpressionCombo extends TrackedCombo { @Override public void perform(WriteGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - if(graph.hasStatement(variable, sr.HasActiveExpression)) - graph.deny(variable, sr.HasActiveExpression); - graph.claim(variable, sr.HasActiveExpression, lastExpression); + if(graph.hasStatement(variable, sr.IndependentVariable_activeExpression)) + graph.deny(variable, sr.IndependentVariable_activeExpression); + graph.claim(variable, sr.IndependentVariable_activeExpression, lastExpression); } } ); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ChartTableWidget.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ChartTableWidget.java index bc78c153..b600df86 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ChartTableWidget.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ChartTableWidget.java @@ -170,7 +170,7 @@ public class ChartTableWidget implements Widget { SysdynResource sr = SysdynResource.getInstance(graph); if(!graph.isInstanceOf(expression, sr.WithLookupExpression)) return null; - return graph.getPossibleRelatedValue(expression, sr.HasLookup); + return graph.getPossibleRelatedValue(expression, sr.WithLookupExpression_lookup); } }, new Listener() { @@ -239,7 +239,7 @@ public class ChartTableWidget implements Widget { @Override public void perform(WriteGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - graph.claimLiteral(expression, sr.HasLookup, table); + graph.claimLiteral(expression, sr.WithLookupExpression_lookup, table); } }); } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ChartWidget.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ChartWidget.java index 742264c1..2dd769dc 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ChartWidget.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ChartWidget.java @@ -104,11 +104,11 @@ public class ChartWidget implements Widget { if(!graph.isInstanceOf(expression, sr.WithLookupExpression)) return null; Auxiliary auxiliary = new Auxiliary(); - auxiliary.minX = graph.getPossibleRelatedValue(expression, sr.HasMinX); - auxiliary.maxX = graph.getPossibleRelatedValue(expression, sr.HasMaxX); - auxiliary.minY = graph.getPossibleRelatedValue(expression, sr.HasMinY); - auxiliary.maxY = graph.getPossibleRelatedValue(expression, sr.HasMaxY); - auxiliary.table = graph.getPossibleRelatedValue(expression, sr.HasLookup); + auxiliary.minX = graph.getPossibleRelatedValue(expression, sr.WithLookupExpression_minX); + auxiliary.maxX = graph.getPossibleRelatedValue(expression, sr.WithLookupExpression_maxX); + auxiliary.minY = graph.getPossibleRelatedValue(expression, sr.WithLookupExpression_minY); + auxiliary.maxY = graph.getPossibleRelatedValue(expression, sr.WithLookupExpression_maxY); + auxiliary.table = graph.getPossibleRelatedValue(expression, sr.WithLookupExpression_lookup); return auxiliary; } }, new Listener() { @@ -231,7 +231,7 @@ public class ChartWidget implements Widget { @Override public void perform(WriteGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - graph.claimLiteral(expression, sr.HasLookup, table); + graph.claimLiteral(expression, sr.WithLookupExpression_lookup, table); } }); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ExpressionWidget.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ExpressionWidget.java index 5da8f765..1aff73aa 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ExpressionWidget.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ExpressionWidget.java @@ -228,7 +228,7 @@ public class ExpressionWidget implements Widget { Collection expressionLists = OrderedSetUtils.getOwnerLists(graph, expr, l0.OrderedSet); Resource variable = null; if(expressionLists.size() == 1) - variable = graph.getPossibleObject(expressionLists.iterator().next(), sr.HasExpressions_Inverse); + variable = graph.getPossibleObject(expressionLists.iterator().next(), sr.Variable_expressions_Inverse); return variable; } }); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleInputEditingSupport.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleInputEditingSupport.java index cfc2810c..2491d6e2 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleInputEditingSupport.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleInputEditingSupport.java @@ -70,9 +70,9 @@ public class ModuleInputEditingSupport extends EditingSupport { Layer0 l0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); HashMap result = new HashMap(); - for(Resource dependency : graph.syncRequest(new ObjectsWithType(module, sr.IsHeadOf, sr.Dependency))) { - if(graph.getPossibleObject(dependency, sr.RefersTo) == null || - graph.getPossibleObject(dependency, sr.RefersTo).equals(inputVariable)) { + for(Resource dependency : graph.syncRequest(new ObjectsWithType(module, sr.Variable_isHeadOf, sr.Dependency))) { + if(graph.getPossibleObject(dependency, sr.Dependency_refersTo) == null || + graph.getPossibleObject(dependency, sr.Dependency_refersTo).equals(inputVariable)) { Resource output = graph.getSingleObject(dependency, sr.HasTail); result.put((String)graph.getRelatedValue(output, l0.HasName), dependency); } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleOutputEditingSupport.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleOutputEditingSupport.java index 7a69d742..91d3c487 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleOutputEditingSupport.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleOutputEditingSupport.java @@ -70,10 +70,10 @@ public class ModuleOutputEditingSupport extends EditingSupport { Layer0 l0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); HashMap result = new HashMap(); - for(Resource dependency : graph.syncRequest(new ObjectsWithType(module, sr.IsTailOf, sr.Dependency))) { - if(graph.getPossibleObject(dependency, sr.RefersTo) == null - || !graph.hasStatement(graph.getPossibleObject(dependency, sr.RefersTo), l0.HasName) - || graph.getPossibleObject(dependency, sr.RefersTo).equals(outputVariable)) { + for(Resource dependency : graph.syncRequest(new ObjectsWithType(module, sr.Variable_isTailOf, sr.Dependency))) { + if(graph.getPossibleObject(dependency, sr.Dependency_refersTo) == null + || !graph.hasStatement(graph.getPossibleObject(dependency, sr.Dependency_refersTo), l0.HasName) + || graph.getPossibleObject(dependency, sr.Dependency_refersTo).equals(outputVariable)) { Resource input = graph.getSingleObject(dependency, sr.HasHead); result.put((String)graph.getRelatedValue(input, l0.HasName), dependency); } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ReferenceRow.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ReferenceRow.java index 5aeeaec7..6bebab0e 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ReferenceRow.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ReferenceRow.java @@ -93,14 +93,14 @@ public class ReferenceRow { @Override public void perform(WriteGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - if(getDependency() != null && graph.hasStatement(getDependency(), sr.RefersTo)) - graph.deny(getDependency(), sr.RefersTo); - if(dependency != null && graph.hasStatement(dependency, sr.RefersTo)) - graph.deny(dependency, sr.RefersTo); + if(getDependency() != null && graph.hasStatement(getDependency(), sr.Dependency_refersTo)) + graph.deny(getDependency(), sr.Dependency_refersTo); + if(dependency != null && graph.hasStatement(dependency, sr.Dependency_refersTo)) + graph.deny(dependency, sr.Dependency_refersTo); setDependency(null); if(dependency != null) { setDependency(dependency); - graph.claim(getDependency(), SysdynResource.getInstance(graph).RefersTo, getVariable()); + graph.claim(getDependency(), SysdynResource.getInstance(graph).Dependency_refersTo, getVariable()); } } }); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ShortcutTabWidget.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ShortcutTabWidget.java index 4e8374e7..89da1e7a 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ShortcutTabWidget.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ShortcutTabWidget.java @@ -224,7 +224,7 @@ public class ShortcutTabWidget implements Widget { SysdynResource sr = SysdynResource.getInstance(graph); Layer0 l0 = Layer0.getInstance(graph); - Collection dependencies = graph.getObjects(r, sr.IsHeadOf); + Collection dependencies = graph.getObjects(r, sr.Variable_isHeadOf); for(Resource d : dependencies) { if(graph.isInstanceOf(d, sr.Dependency)) { diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ValveOrientationGroup.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ValveOrientationGroup.java index 6f7546ed..dbdf9514 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ValveOrientationGroup.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ValveOrientationGroup.java @@ -96,7 +96,7 @@ public class ValveOrientationGroup extends WidgetImpl { if(symbol == null) return Boolean.FALSE; - Resource orientation = graph.getPossibleObject(symbol, sr.HasValveOrientation); + Resource orientation = graph.getPossibleObject(symbol, sr.ValveSymbol_orientation); if(orientation == null) return defaultSelected; @@ -127,14 +127,14 @@ public class ValveOrientationGroup extends WidgetImpl { if(symbol == null) return; - if(graph.hasStatement(symbol, sr.HasValveOrientation)) - graph.deny(symbol, sr.HasValveOrientation); - graph.claim(symbol, sr.HasValveOrientation, graph.getResource(uri)); + if(graph.hasStatement(symbol, sr.ValveSymbol_orientation)) + graph.deny(symbol, sr.ValveSymbol_orientation); + graph.claim(symbol, sr.ValveSymbol_orientation, graph.getResource(uri)); - if(graph.hasStatement(symbol, sr.HasTextLocation)) - graph.deny(symbol, sr.HasTextLocation); + if(graph.hasStatement(symbol, sr.ValveSymbol_textLocation)) + graph.deny(symbol, sr.ValveSymbol_textLocation); if(sr.Vertical.equals(graph.getResource(uri))) - graph.claim(symbol, sr.HasTextLocation, sr.Right); + graph.claim(symbol, sr.ValveSymbol_textLocation, sr.Right); } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ValveTextLocationGroup.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ValveTextLocationGroup.java index 69d8376a..87615966 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ValveTextLocationGroup.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ValveTextLocationGroup.java @@ -111,7 +111,7 @@ public class ValveTextLocationGroup extends WidgetImpl { if(symbol == null) return Boolean.FALSE; - Resource location = graph.getPossibleObject(symbol, sr.HasTextLocation); + Resource location = graph.getPossibleObject(symbol, sr.ValveSymbol_textLocation); if(location == null) return defaultSelected; @@ -142,9 +142,9 @@ public class ValveTextLocationGroup extends WidgetImpl { if(symbol == null) return; - if(graph.hasStatement(symbol, sr.HasTextLocation)) - graph.deny(symbol, sr.HasTextLocation); - graph.claim(symbol, sr.HasTextLocation, graph.getResource(uri)); + if(graph.hasStatement(symbol, sr.ValveSymbol_textLocation)) + graph.deny(symbol, sr.ValveSymbol_textLocation); + graph.claim(symbol, sr.ValveSymbol_textLocation, graph.getResource(uri)); } } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationIndexNode.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationIndexNode.java index da74629d..e5aaef7e 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationIndexNode.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationIndexNode.java @@ -82,7 +82,7 @@ public class EnumerationIndexNode extends AbstractNode implements IMo @Override public void perform(WriteGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - graph.claimLiteral(data, sr.ShowEnumerationIndexInCharts, selected); + graph.claimLiteral(data, sr.EnumerationIndex_showEnumerationIndexInCharts, selected); } }); } catch (DatabaseException e) { diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationIndexes.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationIndexes.java index fcf13e91..dc9c290a 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationIndexes.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationIndexes.java @@ -21,7 +21,7 @@ public class EnumerationIndexes extends ViewpointContributorImpl { SysdynResource sr = SysdynResource.getInstance(graph); if(!graph.isInstanceOf(input, sr.Enumeration)) return null; - Resource enumerationIndexList = graph.getPossibleObject(input, sr.HasEnumerationIndexes); + Resource enumerationIndexList = graph.getPossibleObject(input, sr.Enumeration_enumerationIndexes); if(enumerationIndexList == null) return null; ArrayList> result = new ArrayList>(); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationLabeler.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationLabeler.java index bbaaa54a..801b4853 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationLabeler.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/EnumerationLabeler.java @@ -25,7 +25,7 @@ public class EnumerationLabeler extends ColumnLabelerContributorImpl indexes = OrderedSetUtils.iterator(graph, enumerationIndexes); StringBuilder sb = new StringBuilder(); sb.append("["); @@ -37,7 +37,7 @@ public class EnumerationLabeler extends ColumnLabelerContributorImpl implements IModif try { Resource redeclaration = getRedeclaration(graph); if(redeclaration != null) { - result = graph.getSingleObject(redeclaration, sr.ReplacingEnumeration); + result = graph.getSingleObject(redeclaration, sr.Redeclaration_replacingEnumeration); } } catch(DatabaseException e) { e.printStackTrace(); @@ -72,8 +72,8 @@ public class RedeclarationNode extends AbstractNode implements IModif public Resource getRedeclaration(ReadGraph graph) { try { SysdynResource sr = SysdynResource.getInstance(graph); - for(Resource redeclaration : graph.syncRequest(new ObjectsWithType(module, sr.HasRedeclaration, sr.Redeclaration))) { - Resource replacedEnumeration = graph.getPossibleObject(redeclaration, sr.ReplacedEnumeration); + for(Resource redeclaration : graph.syncRequest(new ObjectsWithType(module, sr.Module_redeclaration, sr.Redeclaration))) { + Resource replacedEnumeration = graph.getPossibleObject(redeclaration, sr.Redeclaration_replacedEnumeration); if(replacedEnumeration != null && replacedEnumeration.equals(getReplacedEnumeration())) { return redeclaration; } @@ -89,11 +89,11 @@ public class RedeclarationNode extends AbstractNode implements IModif SysdynResource sr = SysdynResource.getInstance(graph); Resource oldRedeclaration = getRedeclaration(graph); if(oldRedeclaration != null || redeclaration == null) { - graph.deny(module, sr.HasRedeclaration, oldRedeclaration); + graph.deny(module, sr.Module_redeclaration, oldRedeclaration); } if(redeclaration != null) - graph.claim(module, sr.HasRedeclaration, redeclaration); + graph.claim(module, sr.Module_redeclaration, redeclaration); } catch (DatabaseException e) { e.printStackTrace(); @@ -148,8 +148,8 @@ public class RedeclarationNode extends AbstractNode implements IModif SysdynResource sr = SysdynResource.getInstance(graph); Resource redeclaration = GraphUtils.create2(graph, sr.Redeclaration, - sr.ReplacedEnumeration, getReplacedEnumeration(), - sr.ReplacingEnumeration, enumObject); + sr.Redeclaration_replacedEnumeration, getReplacedEnumeration(), + sr.Redeclaration_replacingEnumeration, enumObject); setRedeclaration(graph, redeclaration); } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableEnumerations.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableEnumerations.java index 78faa6b3..7f8a1fa2 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableEnumerations.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableEnumerations.java @@ -44,7 +44,7 @@ public class ReplaceableEnumerations extends ViewpointContributorImpl return result; for(Resource r : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Enumeration))) { - if(Boolean.TRUE.equals(graph.getRelatedValue(r, sr.IsReplaceable))) + if(Boolean.TRUE.equals(graph.getRelatedValue(r, sr.Enumeration_isReplaceable))) result.add(new RedeclarationNode(graph, input, r)); } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableIndexesWidget.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableIndexesWidget.java index 06caf4d4..0dd0a49a 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableIndexesWidget.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ReplaceableIndexesWidget.java @@ -61,7 +61,7 @@ public class ReplaceableIndexesWidget implements Widget { @Override public void run(ReadGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - final Boolean replaceable = graph.getPossibleRelatedValue(variable, sr.IsReplaceable); + final Boolean replaceable = graph.getPossibleRelatedValue(variable, sr.Enumeration_isReplaceable); if(replaceable != null) selected = replaceable; final Button button = getWidget(); @@ -90,12 +90,12 @@ public class ReplaceableIndexesWidget implements Widget { @Override public void apply(WriteGraph graph, Resource input) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - Boolean replaceable = graph.getPossibleRelatedValue(input, sr.IsReplaceable); + Boolean replaceable = graph.getPossibleRelatedValue(input, sr.Enumeration_isReplaceable); if(Boolean.TRUE.equals(replaceable)) { - graph.claimLiteral(input, sr.IsReplaceable, false); + graph.claimLiteral(input, sr.Enumeration_isReplaceable, false); selected = false; } else { - graph.claimLiteral(input, sr.IsReplaceable, true); + graph.claimLiteral(input, sr.Enumeration_isReplaceable, true); selected = true; } } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ShowInChartsCheckBox.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ShowInChartsCheckBox.java index 232db37b..da412f47 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ShowInChartsCheckBox.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/ShowInChartsCheckBox.java @@ -13,7 +13,7 @@ public class ShowInChartsCheckBox extends CheckedStateContributor { ArrayList> result = new ArrayList>(); - Resource arrayIndexes = graph.getPossibleObject(input, sr.HasArrayIndexes); + Resource arrayIndexes = graph.getPossibleObject(input, sr.Variable_arrayIndexes); if(arrayIndexes == null) { return result; } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java index 96c6268e..4f4abc53 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java @@ -90,7 +90,7 @@ public class BasicExpression implements IExpression { public String perform(ReadGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); if (expression != null) { - String equation = graph.getPossibleRelatedValue(expression, sr.HasEquation); + String equation = graph.getPossibleRelatedValue(expression, sr.Expression_equation); if(equation != null) return equation; } @@ -158,12 +158,12 @@ public class BasicExpression implements IExpression { return; Resource ownerList = ownerLists.iterator().next(); final Resource newExpression = GraphUtils.create2(g, expressionType, - sr.HasEquation, currentText); - String arrayRange = g.getPossibleRelatedValue(expression, sr.HasArrayRange, Bindings.STRING); + sr.Expression_equation, currentText); + String arrayRange = g.getPossibleRelatedValue(expression, sr.Expression_arrayRange, Bindings.STRING); if(arrayRange != null) - g.claimLiteral(newExpression, sr.HasArrayRange, arrayRange); + g.claimLiteral(newExpression, sr.Expression_arrayRange, arrayRange); - final Resource variable = g.getSingleObject(ownerList, sr.HasExpressions_Inverse); + final Resource variable = g.getSingleObject(ownerList, sr.Variable_expressions_Inverse); OrderedSetUtils.replace(g, ownerList, expression, newExpression); g.deny(expression, l0.PartOf); g.claim(newExpression, l0.PartOf, variable); @@ -175,16 +175,16 @@ public class BasicExpression implements IExpression { public void perform(WriteGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); if(variable != null) { - if(graph.hasStatement(variable, sr.HasActiveExpression)) - graph.deny(variable, sr.HasActiveExpression); - graph.claim(variable, sr.HasActiveExpression, newExpression); + if(graph.hasStatement(variable, sr.IndependentVariable_activeExpression)) + graph.deny(variable, sr.IndependentVariable_activeExpression); + graph.claim(variable, sr.IndependentVariable_activeExpression, newExpression); } } } ); } else { // Claim value for the expression - g.claimLiteral(expression, sr.HasEquation, currentText); + g.claimLiteral(expression, sr.Expression_equation, currentText); } } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/DelayExpression.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/DelayExpression.java index 8494a8c9..d9401442 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/DelayExpression.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/DelayExpression.java @@ -243,11 +243,11 @@ public class DelayExpression implements IExpression { // Create a new DelayExpression, if the old expression was something else Resource ownerList = OrderedSetUtils.getSingleOwnerList(g, expression); final Resource newExpression = GraphUtils.create2(g, sr.DelayExpression); - String arrayRange = g.getPossibleRelatedValue(expression, sr.HasArrayRange, Bindings.STRING); + String arrayRange = g.getPossibleRelatedValue(expression, sr.Expression_arrayRange, Bindings.STRING); if(arrayRange != null) - g.claimLiteral(newExpression, sr.HasArrayRange, arrayRange); + g.claimLiteral(newExpression, sr.Expression_arrayRange, arrayRange); - final Resource variable = g.getSingleObject(ownerList, sr.HasExpressions_Inverse); + final Resource variable = g.getSingleObject(ownerList, sr.Variable_expressions_Inverse); OrderedSetUtils.replace(g, ownerList, expression, newExpression); g.deny(expression, l0.PartOf); g.claim(newExpression, l0.PartOf, variable); @@ -257,9 +257,9 @@ public class DelayExpression implements IExpression { @Override public void perform(WriteGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - if(graph.hasStatement(variable, sr.HasActiveExpression)) - graph.deny(variable, sr.HasActiveExpression); - graph.claim(variable, sr.HasActiveExpression, newExpression); + if(graph.hasStatement(variable, sr.IndependentVariable_activeExpression)) + graph.deny(variable, sr.IndependentVariable_activeExpression); + graph.claim(variable, sr.IndependentVariable_activeExpression, newExpression); } } ); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/StockExpression.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/StockExpression.java index 96d833dc..ec2caa18 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/StockExpression.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/StockExpression.java @@ -96,7 +96,7 @@ public class StockExpression implements IExpression { public String perform(ReadGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); if (graph.isInstanceOf(expression, sr.StockExpression)) { - String initialEquation = graph.getPossibleRelatedValue(expression, sr.HasInitialEquation); + String initialEquation = graph.getPossibleRelatedValue(expression, sr.StockExpression_initialEquation); return initialEquation != null ? initialEquation : ""; } else { return ""; @@ -149,12 +149,12 @@ public class StockExpression implements IExpression { } g.claim(expression, l0.InstanceOf, null, sr.StockExpression); - Resource variable = g.getSingleObject(expressionList, sr.HasExpressions_Inverse); + Resource variable = g.getSingleObject(expressionList, sr.Variable_expressions_Inverse); OrderedSetUtils.replace(g, expressionList, temp, expression); g.deny(expression, l0.PartOf); g.claim(expression, l0.PartOf, variable); } - g.claimLiteral(expression, sr.HasInitialEquation, currentText); + g.claimLiteral(expression, sr.StockExpression_initialEquation, currentText); } }); @@ -186,7 +186,7 @@ public class StockExpression implements IExpression { // find the variable Resource expressionList = OrderedSetUtils.getSingleOwnerList(graph, expression); - Resource variable = graph.getPossibleObject(expressionList, sr.HasExpressions_Inverse); + Resource variable = graph.getPossibleObject(expressionList, sr.Variable_expressions_Inverse); if(variable == null) return ""; @@ -196,7 +196,7 @@ public class StockExpression implements IExpression { Stock stock = (Stock)model.getElement(variable); - String range = graph.getPossibleRelatedValue(expression, sr.HasArrayRange); + String range = graph.getPossibleRelatedValue(expression, sr.Expression_arrayRange); if(range == null) range = ""; diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/WithLookupExpression.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/WithLookupExpression.java index 9af73a64..c8e10962 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/WithLookupExpression.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/WithLookupExpression.java @@ -151,7 +151,7 @@ public class WithLookupExpression implements IExpression { SysdynResource sr = SysdynResource.getInstance(graph); String result = ""; if (expr != null && graph.isInstanceOf(expr, sr.WithLookupExpression)) { - result = graph.getPossibleRelatedValue(expr, sr.HasLookup); + result = graph.getPossibleRelatedValue(expr, sr.WithLookupExpression_lookup); } return result; } @@ -215,8 +215,8 @@ public class WithLookupExpression implements IExpression { Auxiliary results = new Auxiliary(); SysdynResource sr = SysdynResource.getInstance(graph); if (expression != null && graph.isInstanceOf(expression, sr.WithLookupExpression)) { - results.equation = graph.getPossibleRelatedValue(expression, sr.HasEquation); - results.lookup = graph.getPossibleRelatedValue(expression, sr.HasLookup); + results.equation = graph.getPossibleRelatedValue(expression, sr.WithLookupExpression_expression); + results.lookup = graph.getPossibleRelatedValue(expression, sr.WithLookupExpression_lookup); } else { results.equation = ""; results.lookup = ""; @@ -273,15 +273,15 @@ public class WithLookupExpression implements IExpression { Resource ownerList = OrderedSetUtils.getSingleOwnerList(g, expression); final Resource newExpression = GraphUtils.create2(g, sr.WithLookupExpression, - sr.HasMinX, 0.0, - sr.HasMaxX, 10.0, - sr.HasMinY, 0.0, - sr.HasMaxY, 10.0); - String arrayRange = g.getPossibleRelatedValue(expression, sr.HasArrayRange, Bindings.STRING); + sr.WithLookupExpression_minX, 0.0, + sr.WithLookupExpression_maxX, 10.0, + sr.WithLookupExpression_minY, 0.0, + sr.WithLookupExpression_maxY, 10.0); + String arrayRange = g.getPossibleRelatedValue(expression, sr.Expression_arrayRange, Bindings.STRING); if(arrayRange != null) - g.claimLiteral(newExpression, sr.HasArrayRange, arrayRange); + g.claimLiteral(newExpression, sr.Expression_arrayRange, arrayRange); - final Resource variable = g.getSingleObject(ownerList, sr.HasExpressions_Inverse); + final Resource variable = g.getSingleObject(ownerList, sr.Variable_expressions_Inverse); OrderedSetUtils.replace(g, ownerList, expression, newExpression); g.deny(expression, l0.PartOf); g.claim(newExpression, l0.PartOf, variable); @@ -291,17 +291,17 @@ public class WithLookupExpression implements IExpression { @Override public void perform(WriteGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - if(graph.hasStatement(variable, sr.HasActiveExpression)) - graph.deny(variable, sr.HasActiveExpression); - graph.claim(variable, sr.HasActiveExpression, newExpression); + if(graph.hasStatement(variable, sr.IndependentVariable_activeExpression)) + graph.deny(variable, sr.IndependentVariable_activeExpression); + graph.claim(variable, sr.IndependentVariable_activeExpression, newExpression); } } ); expr = newExpression; } - g.claimLiteral(expr, sr.HasEquation, currentExpression); - g.claimLiteral(expr, sr.HasLookup, currentLookupTable); + g.claimLiteral(expr, sr.WithLookupExpression_expression, currentExpression); + g.claimLiteral(expr, sr.WithLookupExpression_lookup, currentLookupTable); } }); } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/functions/FunctionCodeWidget.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/functions/FunctionCodeWidget.java index 7c07e305..a39568bc 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/functions/FunctionCodeWidget.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/functions/FunctionCodeWidget.java @@ -131,7 +131,7 @@ public class FunctionCodeWidget implements Widget { @Override public String perform(ReadGraph graph) throws DatabaseException { String code = graph.getPossibleRelatedValue( - function, SysdynResource.getInstance(graph).HasModelicaFunctionCode); + function, SysdynResource.getInstance(graph).SysdynModelicaFunction_modelicaFunctionCode); return code; } @@ -194,7 +194,7 @@ public class FunctionCodeWidget implements Widget { public void perform(WriteGraph graph) throws DatabaseException { graph.claimLiteral( function, - SysdynResource.getInstance(graph).HasModelicaFunctionCode, + SysdynResource.getInstance(graph).SysdynModelicaFunction_modelicaFunctionCode, code); Resource library = graph.getSingleObject(function, Layer0.getInstance(graph).PartOf); FunctionUtils.updateFunctionFileForLibrary(graph, library); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartDropTarget.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartDropTarget.java index f641a3c7..a1b8cd46 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartDropTarget.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartDropTarget.java @@ -15,6 +15,7 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DropTargetAdapter; import org.eclipse.swt.dnd.DropTargetEvent; +import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.simantics.db.Resource; import org.simantics.ui.utils.AdaptionUtils; @@ -26,12 +27,12 @@ import org.simantics.ui.utils.AdaptionUtils; */ public class ChartDropTarget extends DropTargetAdapter { - private ChartPanelSeparator separator; + private Composite separator; private ChartPanelElement element; private Display display; private ChartPanel panel; - public ChartDropTarget(ChartPanelSeparator separator, ChartPanelElement element, ChartPanel panel) { + public ChartDropTarget(Composite separator, ChartPanelElement element, ChartPanel panel) { this.separator = separator; this.display = separator.getDisplay(); this.element = element; diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanel.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanel.java index a82b6c29..18021278 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanel.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanel.java @@ -157,7 +157,6 @@ public class ChartPanel extends ViewPart { sc.setExpandVertical(true); sc.getVerticalBar().setIncrement(sc.getVerticalBar().getIncrement()*3); sc.getHorizontalBar().setIncrement(sc.getHorizontalBar().getIncrement()*3); - setupDropTarget(); body = new Composite(sc, SWT.NONE); GridLayoutFactory.fillDefaults().margins(3, 0).spacing(0, 0).applyTo(body); @@ -165,6 +164,9 @@ public class ChartPanel extends ViewPart { sc.setContent(body); createContents(); + + setupDropTarget(); + } /** @@ -342,6 +344,10 @@ public class ChartPanel extends ViewPart { } }); + + DropTarget target2 = new DropTarget(body, DND.DROP_COPY | DND.DROP_MOVE); + target2.setTransfer(new Transfer[] { LocalObjectTransfer.getTransfer() }); + target2.addDropListener(new ChartDropTarget(body, null, this)); } @@ -369,6 +375,8 @@ public class ChartPanel extends ViewPart { * @param layout refresh layout. use with vertical layout. */ public void addChart(Resource chartResource, ChartPanelElement element, boolean layout) { + if(element == null) + element = chartElements.get(chartElements.size() - 1); int index = chartElements.indexOf(element); if(index >= 0) { ChartPanelElement e = chartElements.get(index); @@ -457,4 +465,7 @@ public class ChartPanel extends ViewPart { }); } + public ArrayList getElements() { + return chartElements; + } } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanelElement.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanelElement.java index 5c830dc5..405294a9 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanelElement.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanelElement.java @@ -52,10 +52,13 @@ public class ChartPanelElement extends Composite { oldData = GridDataFactory.fillDefaults().create(); } + int size = panel.getElements().size(); GridData data = (GridData) oldData; // Horizontal data data.widthHint = CHART_MINIMUM_WIDTH; - if(chartResource == null && !panel.isVertical()){ + if(getResource() == null && size == 1) { + data.grabExcessHorizontalSpace = true; + } else if(getResource() == null && !panel.isVertical()){ data.grabExcessHorizontalSpace = false; data.widthHint = SWT.DEFAULT; } else if(minimized && !panel.isVertical()) { @@ -66,7 +69,9 @@ public class ChartPanelElement extends Composite { } // Vertical data - if(!minimized && getResource() != null) { + if(getResource() == null && size == 1) { + data.grabExcessVerticalSpace = true; + } else if(!minimized && getResource() != null) { data.grabExcessVerticalSpace = true; data.heightHint = CHART_MINIMUM_HEIGHT; } else if(!panel.isVertical()){ @@ -99,7 +104,7 @@ public class ChartPanelElement extends Composite { * @param style The Style of the created chart element */ public ChartPanelElement(Composite parent, ChartPanel panel, Resource chartResource, boolean minimized, int style) { - super(parent, style | SWT.NONE); + super(parent, style | SWT.NONE ); this.panel = panel; this.chartResource = chartResource; diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanelSeparator.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanelSeparator.java index d529a865..e0bde1e2 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanelSeparator.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ChartPanelSeparator.java @@ -37,13 +37,20 @@ public class ChartPanelSeparator extends Composite { oldData = GridDataFactory.fillDefaults().create(); } GridData data = (GridData) oldData; - if(panel.isVertical()) { + // Empty panel -> drop area the size of the whole panel + if(panel.getElements().size() == 1 && panel.getElements().get(0).getResource() == null) { data.grabExcessHorizontalSpace = true; - data.grabExcessVerticalSpace = false; - } else { - data.grabExcessHorizontalSpace = false; data.grabExcessVerticalSpace = true; } + else { + if(panel.isVertical()) { + data.grabExcessHorizontalSpace = true; + data.grabExcessVerticalSpace = false; + } else { + data.grabExcessHorizontalSpace = false; + data.grabExcessVerticalSpace = true; + } + } return data; } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java index f0d36edf..88b0314f 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java @@ -193,7 +193,7 @@ public class TrendView extends ViewPart { public void run() { frame.removeAll(); if(jFreeChart != null) { - panel = new ChartPanel(jFreeChart); + panel = new ChartPanel(jFreeChart, false, true, true, true, true); frame.add(panel); } frame.repaint(); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/ChartUtils.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/ChartUtils.java index 92e8ba4d..3caccec9 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/ChartUtils.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/ChartUtils.java @@ -41,7 +41,7 @@ public class ChartUtils { // Create range axis axis = GraphUtils.create2(graph, jfree.NumberAxis, l0.HasName, "NumberAxis" + UUID.randomUUID().toString(), - l0.HasLabel, NameUtils.findFreshLabel(graph, "Range", plot), + l0.HasLabel, NameUtils.findFreshLabel(graph, "Y-axis", plot), jfree.Plot_rangeAxis_Inverse, plot, l0.PartOf, plot); @@ -104,7 +104,7 @@ public class ChartUtils { // Create series Resource series = GraphUtils.create2(graph, jfree.Series, l0.HasName, "Series" + UUID.randomUUID().toString(), - jfree.variableRVI, rvi == null ? " Set variable" : rvi, + jfree.variableRVI, rvi == null ? " " : rvi, l0.PartOf, dataset); // Add series to the dataset's series list diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/XYDataset.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/XYDataset.java index 35cf2eec..fa2fa2c4 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/XYDataset.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/XYDataset.java @@ -89,7 +89,7 @@ public class XYDataset extends AbstractDataset { Resource rendererResource = graph.getPossibleObject(resource, jfree.Dataset_renderer); if(rendererResource != null) renderer = graph.adapt(rendererResource, IRenderer.class); - + ArrayList series = new ArrayList(); String realizationURI = getRealizationURI(graph); @@ -128,10 +128,13 @@ public class XYDataset extends AbstractDataset { Resource c = graph.getPossibleObject(r, jfree.color); Color color = c == null ? null : G2DUtils.getColor(graph, c); + + String label = graph.getPossibleRelatedValue(r, Layer0.getInstance(graph).HasLabel); // Get a variable for the series Variable v = Variables.getVariable(graph, realizationURI + rvi); - + if(v == null) + return new Pair, IRenderer>(series, renderer); // Get values Object object = v.getPossiblePropertyValue(graph, SysdynVariableProperties.ACTIVE_DATASETS , Bindings.VARIANT); @@ -185,6 +188,8 @@ public class XYDataset extends AbstractDataset { if(ta!=null && va!=null && (va.length == ta.length)) { // Add series if everything OK String name = dataset.name; + if(label != null) + name = label; if(dataset.result != null && !dataset.result.isEmpty()) name = name + " : " + dataset.result; series.add(new TempSeries(name, new double[][] {ta, va}, width, color)); @@ -223,6 +228,8 @@ public class XYDataset extends AbstractDataset { try { // Get a variable for the series Variable v = Variables.getVariable(graph, realizationURI + rvi); + if(v == null) + return null; Double time = v.getPossiblePropertyValue(graph, SysdynVariableProperties.TIME , Bindings.DOUBLE); return time; } catch (MissingVariableException e) { @@ -419,9 +426,29 @@ public class XYDataset extends AbstractDataset { @Override public AbstractRenderer getRenderer() { if(renderer == null) { - XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); - renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); - return renderer; + + try { + renderer = SimanticsUI.getSession().syncRequest(new Read() { + + @Override + public IRenderer perform(ReadGraph graph) throws DatabaseException { + JFreeChartResource jfree = JFreeChartResource.getInstance(graph); + IRenderer renderer = null; + Resource rendererResource = graph.getPossibleObject(resource, jfree.Dataset_renderer); + if(rendererResource != null) + renderer = graph.adapt(rendererResource, IRenderer.class); + return renderer; + } + }); + } catch (DatabaseException e) { + } + if(renderer == null) { + XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false); + renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); + return renderer; + } else { + return renderer.getRenderer(); + } } else { return renderer.getRenderer(); } @@ -436,7 +463,7 @@ public class XYDataset extends AbstractDataset { private String getRealizationURI(ReadGraph graph) throws DatabaseException { if(resource == null) return null; - + Layer0 l0 = Layer0.getInstance(graph); ModelingResources mr = ModelingResources.getInstance(graph); @@ -448,7 +475,7 @@ public class XYDataset extends AbstractDataset { if(model == null) return null; - + // Find the variable realization of the current experiment String realizationURI = null; Resource realization = graph.syncRequest(new PossibleActiveExperiment(model)); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/AllVariablesOfModel.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/AllVariablesOfModel.java new file mode 100644 index 00000000..66ae6054 --- /dev/null +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/AllVariablesOfModel.java @@ -0,0 +1,99 @@ +package org.simantics.sysdyn.ui.trend.chart.properties; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.request.ObjectsWithType; +import org.simantics.db.common.utils.NameUtils; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; +import org.simantics.simulation.ontology.SimulationResource; +import org.simantics.structural.stubs.StructuralResource2; +import org.simantics.sysdyn.SysdynResource; +import org.simantics.utils.strings.AlphanumComparator; + +/** + * Request for getting all variables of a model in a String array. Includes also + * variables inside modules. + * + * @author Teemu Lempinen + * + */ +public class AllVariablesOfModel implements Read{ + + private Resource model; + + public AllVariablesOfModel(Resource model) { + this.model = model; + } + + @Override + public String[] perform(ReadGraph graph) throws DatabaseException { + Layer0 l0 = Layer0.getInstance(graph); + SimulationResource simu = SimulationResource.getInstance(graph); + SysdynResource sr = SysdynResource.getInstance(graph); + + // Find the model of this resource + Resource model = this.model; + while(model != null && !graph.isInstanceOf(model, sr.SysdynModel)) + model = graph.getPossibleObject(model, l0.PartOf); + + if(model == null) + return new String[0]; + + // Find the models configuration + Resource conf = graph.getSingleObject(model, simu.HasConfiguration); + List items = new ArrayList(); + + // Recursively read all configurations and add items + ReadConfiguration(graph, conf, "", items); + + // Add time to the variable list + items.add("time"); + + // Finally sort the results + Collections.sort(items, AlphanumComparator.CASE_INSENSITIVE_COMPARATOR); + return items.toArray(new String[items.size()]); + } + + /** + * Read components in a configuration and recursively all module configurations + * + * @param graph ReadGraph + * @param configuration Resource to be read + * @param path Current path from base realization + * @param items Found variables + * @throws DatabaseException + */ + private void ReadConfiguration(ReadGraph graph, Resource configuration, String path, Collection items) throws DatabaseException { + SysdynResource sr = SysdynResource.getInstance(graph); + Layer0 l0 = Layer0.getInstance(graph); + StructuralResource2 sr2 = StructuralResource2.getInstance(graph); + + String name; + for(Resource resource : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.IndependentVariable))) { + name = path + NameUtils.getSafeName(graph, resource); + items.add(name); + } + + for(Resource resource : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Input))) { + name = path + NameUtils.getSafeName(graph, resource); + items.add(name); + } + + for(Resource module : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Module))) { + Resource instanceOf = graph.getPossibleObject(module, l0.InstanceOf); + Resource conf = graph.getPossibleObject(instanceOf, sr2.IsDefinedBy); + if(conf != null) { + String p = path + NameUtils.getSafeName(graph, module) + "."; + ReadConfiguration(graph, conf, p, items); + } + } + } + +} diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/RangeComposite.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/RangeComposite.java index 40cbadef..e7284fc1 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/RangeComposite.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/RangeComposite.java @@ -95,10 +95,12 @@ public class RangeComposite extends Composite implements Widget { try { // Find the variable for the current variableRVI Variable v = Variables.getVariable(graph, realizationURI + rvi.trim()); + if(v == null) + return null; Resource variable = v.getRepresents(graph); // Return the enumerations assigned to that variable - Resource arrayIndexes = graph.getPossibleObject(variable, sr.HasArrayIndexes); + Resource arrayIndexes = graph.getPossibleObject(variable, sr.Variable_arrayIndexes); if(arrayIndexes != null) { LinkedHashMap result = new LinkedHashMap(); for(Resource enumeration : OrderedSetUtils.toList(graph, arrayIndexes)) { @@ -267,7 +269,7 @@ public class RangeComposite extends Composite implements Widget { public Map perform(ReadGraph graph, Resource series) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); LinkedHashMap result = new LinkedHashMap(); - Resource enumerationIndexes = graph.getPossibleObject(enumeration, sr.HasEnumerationIndexes); + Resource enumerationIndexes = graph.getPossibleObject(enumeration, sr.Enumeration_enumerationIndexes); List indexes = OrderedSetUtils.toList(graph, enumerationIndexes); // First add "All" and "Sum", then all of the enumeration indexes in order result.put("All", "All"); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/VariableExistsValidator.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/VariableExistsValidator.java new file mode 100644 index 00000000..1247e821 --- /dev/null +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/VariableExistsValidator.java @@ -0,0 +1,132 @@ +package org.simantics.sysdyn.ui.trend.chart.properties; + +import org.eclipse.jface.dialogs.IInputValidator; +import org.simantics.browsing.ui.swt.widgets.TrackedText; +import org.simantics.browsing.ui.swt.widgets.impl.Widget; +import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.management.ISessionContext; +import org.simantics.db.procedure.Listener; +import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; +import org.simantics.sysdyn.SysdynResource; +import org.simantics.ui.SimanticsUI; +import org.simantics.ui.utils.AdaptionUtils; + +/** + * Variable exists validator for tracked text widgets. + * + * @author Teemu Lempinen + * + */ +public class VariableExistsValidator implements IInputValidator, Widget { + + private String[] names; + private TrackedText text; + private boolean allowEmpty; + + /** + * Validate against all variables + * + * Do not allow empty input + * @param support WidgetSupport + * @param text Text widget + */ + public VariableExistsValidator(WidgetSupport support, TrackedText text) { + this(support, text, false); + } + + /** + * Validate against all variables + * + * @param support WidgetSupport + * @param text Text widget + * @param allowEmpty Allow empty input text + */ + public VariableExistsValidator(WidgetSupport support, TrackedText text, boolean allowEmpty) { + support.register(this); + names = new String[] {"time"}; + this.text = text; + this.allowEmpty = allowEmpty; + } + + /** + * Returns null if there is a variable named newText in the model + */ + @Override + public String isValid(String newText) { + if(newText == null || newText.isEmpty()) { + if(allowEmpty) + return null; + else + return "Empty name not allowed"; + } + + synchronized (names) { + for(String s : names) { + if(newText.equals(s)) + return null; + } + } + + return "Not a valid variable name"; + } + + @Override + public void setInput(ISessionContext context, Object input) { + final Resource resource = AdaptionUtils.adaptToSingle(input, Resource.class); + + if(resource == null) { + names = new String[] {"time"}; + return; + } + + Resource model = null; + try { + /* Find the model resource. It can be found with PartOf + relations from series resource in a chart */ + model = context.getSession().syncRequest(new Read() { + + @Override + public Resource perform(ReadGraph graph) throws DatabaseException { + Resource r = resource; + while((r = graph.getPossibleObject(r, Layer0.getInstance(graph).PartOf)) != null) { + if(graph.isInstanceOf(r, SysdynResource.getInstance(graph).SysdynModel)) + return r; + } + return null; + } + + }); + + if(model != null) { + // Find all variables and set them as the reference for isValid(String) + SimanticsUI.getSession().asyncRequest( + new AllVariablesOfModel(model) + , new Listener() { + + @Override + public void execute(String[] result) { + names = result; + } + + @Override + public void exception(Throwable t) { + t.printStackTrace(); + } + + @Override + public boolean isDisposed() { + return text.isDisposed(); + } + + }); + } + } catch (DatabaseException e) { + e.printStackTrace(); + } + } + +} diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/VariableProposalProvider.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/VariableProposalProvider.java index f4382101..c073516c 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/VariableProposalProvider.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/VariableProposalProvider.java @@ -11,30 +11,15 @@ *******************************************************************************/ package org.simantics.sysdyn.ui.trend.chart.properties; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - import org.eclipse.jface.fieldassist.SimpleContentProposalProvider; import org.eclipse.swt.widgets.Control; import org.simantics.browsing.ui.swt.widgets.impl.Widget; import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; -import org.simantics.db.ReadGraph; import org.simantics.db.Resource; -import org.simantics.db.common.request.ObjectsWithType; -import org.simantics.db.common.utils.NameUtils; -import org.simantics.db.exception.DatabaseException; import org.simantics.db.management.ISessionContext; import org.simantics.db.procedure.Listener; -import org.simantics.db.request.Read; -import org.simantics.layer0.Layer0; -import org.simantics.simulation.ontology.SimulationResource; -import org.simantics.structural.stubs.StructuralResource2; -import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.AdaptionUtils; -import org.simantics.utils.strings.AlphanumComparator; /** * Provides all variables a model contains @@ -68,35 +53,9 @@ public class VariableProposalProvider extends SimpleContentProposalProvider impl return; this.resource = resource; - SimanticsUI.getSession().asyncRequest(new Read() { - - @Override - public String[] perform(ReadGraph graph) throws DatabaseException { - Layer0 l0 = Layer0.getInstance(graph); - SimulationResource simu = SimulationResource.getInstance(graph); - SysdynResource sr = SysdynResource.getInstance(graph); - - // Find the model of this resource - Resource model = resource; - while(model != null && !graph.isInstanceOf(model, sr.SysdynModel)) - model = graph.getPossibleObject(model, l0.PartOf); - - if(model == null) - return new String[0]; - - // Find the models configuration - Resource conf = graph.getSingleObject(model, simu.HasConfiguration); - List items = new ArrayList(); - - // Recursively read all configurations and add items - ReadConfiguration(graph, conf, "", items); - - // Finally sort the results - Collections.sort(items, AlphanumComparator.CASE_INSENSITIVE_COMPARATOR); - return items.toArray(new String[items.size()]); - } - - }, new Listener() { + SimanticsUI.getSession().asyncRequest( + new AllVariablesOfModel(resource) + , new Listener() { @Override public void execute(String[] result) { @@ -119,39 +78,4 @@ public class VariableProposalProvider extends SimpleContentProposalProvider impl } - /** - * Read components in a configuration and recursively all module configurations - * - * @param graph ReadGraph - * @param configuration Resource to be read - * @param path Current path from base realization - * @param items Found variables - * @throws DatabaseException - */ - private void ReadConfiguration(ReadGraph graph, Resource configuration, String path, Collection items) throws DatabaseException { - SysdynResource sr = SysdynResource.getInstance(graph); - Layer0 l0 = Layer0.getInstance(graph); - StructuralResource2 sr2 = StructuralResource2.getInstance(graph); - - String name; - for(Resource resource : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.IndependentVariable))) { - name = path + NameUtils.getSafeName(graph, resource); - items.add(name); - } - - for(Resource resource : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Input))) { - name = path + NameUtils.getSafeName(graph, resource); - items.add(name); - } - - for(Resource module : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Module))) { - Resource instanceOf = graph.getPossibleObject(module, l0.InstanceOf); - Resource conf = graph.getPossibleObject(instanceOf, sr2.IsDefinedBy); - if(conf != null) { - String p = path + NameUtils.getSafeName(graph, module) + "."; - ReadConfiguration(graph, conf, p, items); - } - } - } - } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/bar/BarSeriesPropertyComposite.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/bar/BarSeriesPropertyComposite.java index c7597ac0..da07fe55 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/bar/BarSeriesPropertyComposite.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/bar/BarSeriesPropertyComposite.java @@ -30,6 +30,7 @@ import org.simantics.sysdyn.ui.trend.chart.properties.JFreeChartPropertyColorPro import org.simantics.sysdyn.ui.trend.chart.properties.RVIFactory; import org.simantics.sysdyn.ui.trend.chart.properties.RVIModifier; import org.simantics.sysdyn.ui.trend.chart.properties.RangeComposite; +import org.simantics.sysdyn.ui.trend.chart.properties.VariableExistsValidator; /** * Composite for modifying properties of a series in a bar chart @@ -53,6 +54,7 @@ public class BarSeriesPropertyComposite extends Composite { variable = new TrackedText(this, support, SWT.BORDER); variable.setTextFactory(new RVIFactory()); variable.addModifyListener(new RVIModifier(variable.getWidget(), support)); + variable.setInputValidator(new VariableExistsValidator(support, variable)); variable.setColorProvider(new JFreeChartPropertyColorProvider(this.variable.getResourceManager())); GridDataFactory.fillDefaults().grab(true, false).applyTo(this.variable.getWidget()); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/pie/PieSeriesPropertyComposite.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/pie/PieSeriesPropertyComposite.java index dad20d4a..7ea26a41 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/pie/PieSeriesPropertyComposite.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/pie/PieSeriesPropertyComposite.java @@ -34,6 +34,7 @@ import org.simantics.sysdyn.ui.trend.chart.properties.JFreeChartPropertyColorPro import org.simantics.sysdyn.ui.trend.chart.properties.RVIFactory; import org.simantics.sysdyn.ui.trend.chart.properties.RVIModifier; import org.simantics.sysdyn.ui.trend.chart.properties.RangeComposite; +import org.simantics.sysdyn.ui.trend.chart.properties.VariableExistsValidator; /** * Composite containing the properties of a series @@ -57,6 +58,7 @@ public class PieSeriesPropertyComposite extends Composite { variable = new TrackedText(this, support, SWT.BORDER); variable.setTextFactory(new RVIFactory()); variable.addModifyListener(new RVIModifier(variable.getWidget(), support)); + variable.setInputValidator(new VariableExistsValidator(support, variable)); variable.setColorProvider(new JFreeChartPropertyColorProvider(this.variable.getResourceManager())); GridDataFactory.fillDefaults().grab(true, false).applyTo(this.variable.getWidget()); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/SeriesPropertyComposite.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/SeriesPropertyComposite.java index f0568510..1dbe6d4c 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/SeriesPropertyComposite.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/SeriesPropertyComposite.java @@ -40,6 +40,7 @@ import org.simantics.sysdyn.ui.trend.chart.properties.RVIFactory; import org.simantics.sysdyn.ui.trend.chart.properties.RVIModifier; import org.simantics.sysdyn.ui.trend.chart.properties.RangeComposite; import org.simantics.sysdyn.ui.trend.chart.properties.TrackedSpinner; +import org.simantics.sysdyn.ui.trend.chart.properties.VariableExistsValidator; import org.simantics.ui.utils.AdaptionUtils; /** @@ -67,6 +68,7 @@ public class SeriesPropertyComposite extends Composite { variable.setTextFactory(new RVIFactory()); variable.addModifyListener(new RVIModifier(variable.getWidget(), support)); variable.setColorProvider(new JFreeChartPropertyColorProvider(this.variable.getResourceManager())); + variable.setInputValidator(new VariableExistsValidator(support, variable)); GridDataFactory.fillDefaults().grab(true, false).applyTo(this.variable.getWidget()); // Range diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/XYLineAxisAndVariablesTab.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/XYLineAxisAndVariablesTab.java index 530d611a..3081abbb 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/XYLineAxisAndVariablesTab.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/XYLineAxisAndVariablesTab.java @@ -11,6 +11,8 @@ *******************************************************************************/ package org.simantics.sysdyn.ui.trend.chart.properties.xyline; +import java.util.List; + import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.jface.viewers.ISelectionProvider; @@ -24,6 +26,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Tree; import org.eclipse.ui.IWorkbenchSite; +import org.simantics.browsing.ui.NodeContext; import org.simantics.browsing.ui.swt.SingleSelectionInputSource; import org.simantics.browsing.ui.swt.widgets.Button; import org.simantics.browsing.ui.swt.widgets.GraphExplorerComposite; @@ -206,10 +209,25 @@ public class XYLineAxisAndVariablesTab extends LabelPropertyTabContributor { @Override public void apply(WriteGraph graph, Resource input) throws DatabaseException { - if(input == null) + NodeContext nc = explorer.getExplorer().getRoot(); + if(nc == null) return; + JFreeChartResource jfree = JFreeChartResource.getInstance(graph); Layer0 l0 = Layer0.getInstance(graph); + + if(input == null) { + Resource chart = AdaptionUtils.adaptToSingle(nc, Resource.class); + if(chart == null) return; + Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.Plot)); + if(plot == null) return; + Resource rangelist = graph.getPossibleObject(plot, jfree.Plot_rangeAxisList); + if(rangelist == null) return; + List list = ListUtils.toList(graph, rangelist); + if(list == null || list.isEmpty()) return; + input = list.get(0); + } + Resource dataset; if(graph.isInstanceOf(input, jfree.Series)) { // Selected resource is series. Add to same dataset diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/XYLineGeneralPropertiesTab.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/XYLineGeneralPropertiesTab.java index c4e730da..9bba7fcc 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/XYLineGeneralPropertiesTab.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/properties/xyline/XYLineGeneralPropertiesTab.java @@ -58,6 +58,7 @@ import org.simantics.sysdyn.ui.trend.chart.properties.RVIFactory; import org.simantics.sysdyn.ui.trend.chart.properties.RVIModifier; import org.simantics.sysdyn.ui.trend.chart.properties.TitleFactory; import org.simantics.sysdyn.ui.trend.chart.properties.TitleModifier; +import org.simantics.sysdyn.ui.trend.chart.properties.VariableExistsValidator; import org.simantics.ui.utils.AdaptionUtils; /** @@ -168,6 +169,7 @@ public class XYLineGeneralPropertiesTab extends LabelPropertyTabContributor impl xvariable.setTextFactory(new RVIFactory()); xvariable.addModifyListener(new RVIModifier(xvariable.getWidget(), domainAxisSupport)); xvariable.setColorProvider(new JFreeChartPropertyColorProvider(xvariable.getResourceManager())); + xvariable.setInputValidator(new VariableExistsValidator(support, xvariable, true)); GridDataFactory.fillDefaults().grab(true, false).applyTo(xvariable.getWidget()); Composite axisHide = new AxisHidePropertyComposite(xgroup, context, domainAxisSupport, SWT.NONE); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ExpressionUtils.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ExpressionUtils.java index 6abe38f2..d0acb085 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ExpressionUtils.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ExpressionUtils.java @@ -53,409 +53,411 @@ import org.simantics.ui.SimanticsUI; public class ExpressionUtils { - /** - * Determines if the given expression is a parameter expression. Parameters are numbers. - * If the expression contains anything other than numbers, it is not a parameter. - * - * @param expression The expression to be checked - * @return is the expression a parameter - */ - static public boolean isParameter(String expression) { - try { - /* + /** + * Determines if the given expression is a parameter expression. Parameters are numbers. + * If the expression contains anything other than numbers, it is not a parameter. + * + * @param expression The expression to be checked + * @return is the expression a parameter + */ + static public boolean isParameter(String expression) { + try { + /* StringTokenizer st = new StringTokenizer(expression, "{}[],;"); while(st.hasMoreTokens()) { Double.parseDouble(st.nextToken().trim()); } - */ - Double.parseDouble(expression.trim()); - return true; - } catch (NumberFormatException e) { - return false; - } - } - - /** - * Validates the expressionfield of a given IExpression - * - * @param expression The expression whose fields are validated - * @param connectedVariables Table items from the shortcut widget. (Items needed so that they can be coloured) - * @param configuration configuration where the variable is located - */ - static public void validateExpressionFields(final Resource variable, IExpression expression, Table variableTable) { - - Resource configuration = null; - try { - configuration = SimanticsUI.getSession().syncRequest(new Read() { - - @Override - public Resource perform(ReadGraph graph) throws DatabaseException { - SysdynResource sr = SysdynResource.getInstance(graph); - Resource configuration = variable; - while (configuration != null) { - configuration = graph.getPossibleObject(configuration, Layer0.getInstance(graph).PartOf); - - if(configuration == null || graph.isInstanceOf(configuration, sr.Configuration)) { - break; - } - } - return configuration; - } - }); - } catch (DatabaseException e) { - e.printStackTrace(); - return; - } - - if(configuration == null) - return; - - ExpressionParser parser = new ExpressionParser(new StringReader("")); - Set variables = new HashSet(); - HashMap>> references = new HashMap>>(); - final HashMap>>> ranges = new HashMap>>>(); - HashMap>> forIndices = new HashMap>>(); - HashMap>> enumerationReferences = new HashMap>>(); - HashMap>> functionReferences = new HashMap>>(); - - // Build references and variable array - for(ExpressionField ef : expression.getExpressionFields()) { - ef.resetAnnotations(); - String textString = ef.getExpression(); - parser.ReInit(new StringReader(textString)); - try { - parser.expr(); - HashMap> refs = parser.getReferences(); - references.put(ef, refs); - variables.addAll(refs.keySet()); - - ranges.put(ef, parser.getRanges()); - - forIndices.put(ef, parser.getForIndices()); - - enumerationReferences.put(ef, parser.getEnumerationReferences()); - + */ + Double.parseDouble(expression.trim()); + return true; + } catch (NumberFormatException e) { + return false; + } + } + + /** + * Validates the expressionfield of a given IExpression + * + * @param expression The expression whose fields are validated + * @param connectedVariables Table items from the shortcut widget. (Items needed so that they can be coloured) + * @param configuration configuration where the variable is located + */ + static public void validateExpressionFields(final Resource variable, IExpression expression, Table variableTable) { + + Resource configuration = null; + try { + configuration = SimanticsUI.getSession().syncRequest(new Read() { + + @Override + public Resource perform(ReadGraph graph) throws DatabaseException { + SysdynResource sr = SysdynResource.getInstance(graph); + Resource configuration = variable; + while (configuration != null) { + configuration = graph.getPossibleObject(configuration, Layer0.getInstance(graph).PartOf); + + if(configuration == null || graph.isInstanceOf(configuration, sr.Configuration)) { + break; + } + } + return configuration; + } + }); + } catch (DatabaseException e) { + e.printStackTrace(); + return; + } + + if(configuration == null) + return; + + ExpressionParser parser = new ExpressionParser(new StringReader("")); + Set variables = new HashSet(); + HashMap>> references = new HashMap>>(); + final HashMap>>> ranges = new HashMap>>>(); + HashMap>> forIndices = new HashMap>>(); + HashMap>> enumerationReferences = new HashMap>>(); + HashMap>> functionReferences = new HashMap>>(); + + // Build references and variable array + for(ExpressionField ef : expression.getExpressionFields()) { + ef.resetAnnotations(); + String textString = ef.getExpression(); + parser.ReInit(new StringReader(textString)); + try { + parser.expr(); + HashMap> refs = parser.getReferences(); + references.put(ef, refs); + variables.addAll(refs.keySet()); + + ranges.put(ef, parser.getRanges()); + + forIndices.put(ef, parser.getForIndices()); + + enumerationReferences.put(ef, parser.getEnumerationReferences()); + functionReferences.put(ef, parser.getFunctionCallReferences()); - - } catch (ParseException e1) { - ef.setSyntaxError(e1.currentToken, "Syntax Error"); - } catch (TokenMgrError err) { - ef.setSyntaxError(0, textString.length(), ExpressionField.SYNTAX_ERROR, "Expression contains unsupported characters"); - } - } + + } catch (ParseException e1) { + ef.setSyntaxError(e1.currentToken, "Syntax Error"); + } catch (TokenMgrError err) { + ef.setSyntaxError(0, textString.length(), ExpressionField.SYNTAX_ERROR, "Expression contains unsupported characters"); + } + } - final HashMap modelVariables = new HashMap(); + final HashMap modelVariables = new HashMap(); HashSet ignoreVariables = new HashSet(); - if(!variables.isEmpty() || !functionReferences.isEmpty()) { - Set noSuchVariables = new HashSet(); - SysdynModelManager sdm = SysdynModelManager.getInstance(SimanticsUI.getSession()); - SysdynModel model = sdm.getModel(configuration); - try { - model.update(); - } catch (DatabaseException e1) { - e1.printStackTrace(); - } + if(!variables.isEmpty() || !functionReferences.isEmpty()) { + Set noSuchVariables = new HashSet(); + SysdynModelManager sdm = SysdynModelManager.getInstance(SimanticsUI.getSession()); + SysdynModel model = sdm.getModel(configuration); + try { + model.update(); + } catch (DatabaseException e1) { + e1.printStackTrace(); + } - Configuration conf = model.getConfiguration(); - ArrayList elements = conf.getElements(); - for(IElement e : elements) { - if(e instanceof Variable) { - Variable v = (Variable) e; - modelVariables.put(v.getName(), v); - } else if(e instanceof Module) { - ignoreVariables.add(((Module)e).getName()); - } - } + Configuration conf = model.getConfiguration(); + ArrayList elements = conf.getElements(); + for(IElement e : elements) { + if(e instanceof Variable) { + Variable v = (Variable) e; + modelVariables.put(v.getName(), v); + } else if(e instanceof Module) { + ignoreVariables.add(((Module)e).getName()); + } + } - // VARIABLE NAMES - - if(variables.contains("time")) - variables.remove("time"); - - // Examine sheets - for(ExpressionField ef : functionReferences.keySet()) { - for(String key : functionReferences.get(ef).keySet()) { - String[] parts = key.split("\\."); - Object current = conf; - for(int i = 0; i < parts.length && current != null; i++) { - current = getElement(current, parts[i]); - } - if(current != null && current instanceof Sheet) { - Sheet sheet = (Sheet) current; - String e = ef.getExpression(); - int start = 0, end = 0, call = 0; - String cellOrRange = null; - while((call = e.indexOf(key, end)) >= 0) { - start = e.indexOf("(", call) +1; - end = e.indexOf(")", start); - if(start < 0 || end < 0 || end < start) { - break; - } - Pattern p = Pattern.compile("[-\\+\\*\\/\\(\\)\\{\\}\\[\\],\\.\\t\\n\\r\\f]"); - cellOrRange = e.substring(start, end); - Matcher m = p.matcher(cellOrRange); - if (m.find() || cellOrRange.split(":").length > 2) { - ef.setSyntaxError(start, end - start, ExpressionField.SYNTAX_ERROR, "Not a valid cell or range"); - } - } - - List tokens = functionReferences.get(ef).get(key); - for(Token cell : tokens) { - List refs = references.get(ef).get(cell.image); - if(refs != null) - refs.remove(cell); - if(!sheet.getCells().containsKey(cell.image)) - ef.setSyntaxError(cell.image, "Invalid cell", cell.beginLine, cell.beginColumn, cell.endLine, cell.endColumn); - } - - } - } - } + // VARIABLE NAMES - for(String v : variables) { - - if(modelVariables.get(v) instanceof Enumeration || modelVariables.get(v) instanceof Sheet) { - ignoreVariables.add(v); - } - - // Reference to some other module, spreadsheet or enumeration - if(v.contains(".")) { - String[] parts = v.split("\\."); - Object parent = conf; - for(int i = 0; i < parts.length && parent != null; i++) { - parent = getElement(parent, parts[i]); - } - if(parent == null) { - noSuchVariables.add(v); - } else { - ignoreVariables.add(v); - } - } else if(!modelVariables.keySet().contains(v)) { - noSuchVariables.add(v); - } - } + if(variables.contains("time")) + variables.remove("time"); - if(!noSuchVariables.isEmpty()) { - noSuchVariables.removeAll(ignoreVariables); - // remove no such variables from variable list - for(String s : noSuchVariables) - variables.remove(s); - // create annotations - HashMap> positions = getPositionsForVariables(references, noSuchVariables); - for(ExpressionField ef : positions.keySet()) { - ef.setNoSuchVariableAnnotations(positions.get(ef)); - } - } - } - - // Check that the variables that exist have connections and the connected variables have references in the expressions - if(!(expression instanceof StockExpression)) { - - if(variableTable != null && !variableTable.isDisposed()) { - TableItem[] connectedVariables = variableTable.getItems(); - for(TableItem ti : connectedVariables) { - if(!variables.contains(ti.getText())) { - ti.setForeground(new Color(ti.getDisplay(), 255,125,0)); - } else { - ti.setForeground(new Color(ti.getDisplay(), 0, 0, 0)); - variables.remove(ti.getText()); - } - } - } - - // Remove all enumerations and sheets, they cannot have connections - variables.removeAll(ignoreVariables); + // Examine sheets + for(ExpressionField ef : functionReferences.keySet()) { + for(String key : functionReferences.get(ef).keySet()) { + String[] parts = key.split("\\."); + Object current = conf; + for(int i = 0; i < parts.length && current != null; i++) { + current = getElement(current, parts[i]); + } + if(current != null && current instanceof Sheet) { + Sheet sheet = (Sheet) current; + String e = ef.getExpression(); + int start = 0, end = 0, call = 0; + String cellOrRange = null; + while((call = e.indexOf(key, end)) >= 0) { + start = e.indexOf("(", call) +1; + end = e.indexOf(")", start); + if(start < 0 || end < 0 || end < start) { + break; + } + Pattern p = Pattern.compile("[-\\+\\*\\/\\(\\)\\{\\}\\[\\],\\.\\t\\n\\r\\f]"); + cellOrRange = e.substring(start, end); + Matcher m = p.matcher(cellOrRange); + if (m.find() || cellOrRange.split(":").length > 2) { + ef.setSyntaxError(start, end - start, ExpressionField.SYNTAX_ERROR, "Not a valid cell or range"); + } + } - if(!variables.isEmpty()) { - HashMap> positions = getPositionsForVariables(references, variables); - for(ExpressionField ef : positions.keySet()) { - ef.setMissingLinkAnnotations(positions.get(ef)); - } + List tokens = functionReferences.get(ef).get(key); + for(Token cell : tokens) { + List refs = references.get(ef).get(cell.image); + if(refs != null) + refs.remove(cell); + if(!sheet.getCells().containsKey(cell.image)) + ef.setSyntaxError(cell.image, "Invalid cell", cell.beginLine, cell.beginColumn, cell.endLine, cell.endColumn); + } - } - } - - - - HashMap> errors = new HashMap>(); - HashMap result = null; - - for(final ExpressionField ef : ranges.keySet()) { - - // RANGES - try { - result = SimanticsUI.getSession().syncRequest(new Read>() { - - @Override - public HashMap perform(ReadGraph graph) throws DatabaseException { - HashMap result = new HashMap(); - for(String s : ranges.get(ef).keySet()) { - if(ranges.get(ef).containsKey(s)) { - for(List l : ranges.get(ef).get(s)) { - String[] ss = new String[l.size()]; - for(int i = 0; i < l.size(); i++) { - ss[i] = l.get(i).image; - } - Map invalidRanges = ArrayVariableUtils.isRangeValid(graph, modelVariables.get(s), ss); - if(invalidRanges != null && !invalidRanges.isEmpty()) { - for(Integer i : invalidRanges.keySet()) { - result.put(l.get(i), invalidRanges.get(i)); - } - } - } - } - } - return result; - } - }); - } catch (DatabaseException e) { - e.printStackTrace(); - } - - // FOR-INDICES - - HashMap> indexList = forIndices.get(ef); - for(Token t : indexList.keySet()) { - boolean isFound = false; - for(Token rt : indexList.get(t)) { - if(rt.image.equals(t.image)) { - isFound = true; - // remove range token from invalid ranges - result.remove(rt); - break; - } - } - if(!isFound) { - result.put(t, "Invalid index"); - } - } - - // ENUMERATION REFERENCES IN FOR-LOOPS - HashMap> enumRefList = enumerationReferences.get(ef); - for(String enumeration : enumRefList.keySet()) { - for(Token et : enumRefList.get(enumeration)) { - Variable v = modelVariables.get(enumeration); - if(v != null && v instanceof Enumeration) { - boolean isFound = false; - Enumeration e = (Enumeration)v; - - if(enumeration.equals(et.image) || - "size".equals(et.image) || - "elements".equals(et.image)){ - // The full enumeration - isFound = true; - } else { - for(EnumerationIndex ei : e.getEnumerationIndexes()) { - if(ei.getName().equals(et.image)) { - isFound = true; - break; - } - } - } - - if(!isFound) { - StringBuilder sb = new StringBuilder(); - sb.append("Enumeration "); - sb.append(enumeration); - sb.append(" has no such index.\nAvailable indexes are: "); - Iterator iterator = e.getEnumerationIndexes().iterator(); - while(iterator.hasNext()) { - sb.append(iterator.next().getName()); - if(iterator.hasNext()) - sb.append(", "); - } - result.put(et, sb.toString()); - } - - - } else { - result.put(et, "No such enumeration (" + enumeration + ")"); - } - } - } - - errors.put(ef, result); - - - } - - for(ExpressionField ef : ranges.keySet()) { - HashMap tokens = errors.get(ef); - if(tokens == null || tokens.isEmpty()) continue; - for(Token t : tokens.keySet()) { - ef.setSyntaxError(t, tokens.get(t)); - } - } - - } - - static private Object getElement(Object parent, String name) { - Configuration c = null; - if(parent instanceof Module) { + } + } + } + + for(String v : variables) { + + if(modelVariables.get(v) instanceof Enumeration || modelVariables.get(v) instanceof Sheet) { + ignoreVariables.add(v); + } + + // Reference to some other module, spreadsheet or enumeration + if(v.contains(".")) { + String[] parts = v.split("\\."); + Object parent = conf; + for(int i = 0; i < parts.length && parent != null; i++) { + parent = getElement(parent, parts[i]); + } + if(parent == null) { + noSuchVariables.add(v); + } else { + ignoreVariables.add(v); + } + } else if(!modelVariables.keySet().contains(v)) { + noSuchVariables.add(v); + } + } + + if(!noSuchVariables.isEmpty()) { + noSuchVariables.removeAll(ignoreVariables); + // remove no such variables from variable list + for(String s : noSuchVariables) + variables.remove(s); + // create annotations + HashMap> positions = getPositionsForVariables(references, noSuchVariables); + for(ExpressionField ef : positions.keySet()) { + ef.setNoSuchVariableAnnotations(positions.get(ef)); + } + } + } + + // Check that the variables that exist have connections and the connected variables have references in the expressions + if(!(expression instanceof StockExpression)) { + + if(variableTable != null && !variableTable.isDisposed()) { + TableItem[] connectedVariables = variableTable.getItems(); + for(TableItem ti : connectedVariables) { + if(!variables.contains(ti.getText())) { + ti.setForeground(new Color(ti.getDisplay(), 255,125,0)); + } else { + ti.setForeground(new Color(ti.getDisplay(), 0, 0, 0)); + variables.remove(ti.getText()); + } + } + } + + // Remove all enumerations and sheets, they cannot have connections + variables.removeAll(ignoreVariables); + + if(!variables.isEmpty()) { + HashMap> positions = getPositionsForVariables(references, variables); + for(ExpressionField ef : positions.keySet()) { + ef.setMissingLinkAnnotations(positions.get(ef)); + } + + } + } + + + + HashMap> errors = new HashMap>(); + HashMap result = null; + + for(final ExpressionField ef : ranges.keySet()) { + + // RANGES + try { + result = SimanticsUI.getSession().syncRequest(new Read>() { + + @Override + public HashMap perform(ReadGraph graph) throws DatabaseException { + HashMap result = new HashMap(); + for(String s : ranges.get(ef).keySet()) { + if(ranges.get(ef).containsKey(s)) { + for(List l : ranges.get(ef).get(s)) { + String[] ss = new String[l.size()]; + for(int i = 0; i < l.size(); i++) { + ss[i] = l.get(i).image; + } + Map invalidRanges = ArrayVariableUtils.isRangeValid(graph, modelVariables.get(s), ss); + if(invalidRanges != null && !invalidRanges.isEmpty()) { + for(Integer i : invalidRanges.keySet()) { + result.put(l.get(i), invalidRanges.get(i)); + } + } + } + } + } + return result; + } + }); + } catch (DatabaseException e) { + e.printStackTrace(); + } + + // FOR-INDICES + + HashMap> indexList = forIndices.get(ef); + for(Token t : indexList.keySet()) { + boolean isFound = false; + if(indexList.get(t) != null) { + for(Token rt : indexList.get(t)) { + if(rt.image.equals(t.image)) { + isFound = true; + // remove range token from invalid ranges + result.remove(rt); + break; + } + } + } + if(!isFound) { + result.put(t, "Invalid index"); + } + } + + // ENUMERATION REFERENCES IN FOR-LOOPS + HashMap> enumRefList = enumerationReferences.get(ef); + for(String enumeration : enumRefList.keySet()) { + for(Token et : enumRefList.get(enumeration)) { + Variable v = modelVariables.get(enumeration); + if(v != null && v instanceof Enumeration) { + boolean isFound = false; + Enumeration e = (Enumeration)v; + + if(enumeration.equals(et.image) || + "size".equals(et.image) || + "elements".equals(et.image)){ + // The full enumeration + isFound = true; + } else { + for(EnumerationIndex ei : e.getEnumerationIndexes()) { + if(ei.getName().equals(et.image)) { + isFound = true; + break; + } + } + } + + if(!isFound) { + StringBuilder sb = new StringBuilder(); + sb.append("Enumeration "); + sb.append(enumeration); + sb.append(" has no such index.\nAvailable indexes are: "); + Iterator iterator = e.getEnumerationIndexes().iterator(); + while(iterator.hasNext()) { + sb.append(iterator.next().getName()); + if(iterator.hasNext()) + sb.append(", "); + } + result.put(et, sb.toString()); + } + + + } else { + result.put(et, "No such enumeration (" + enumeration + ")"); + } + } + } + + errors.put(ef, result); + + + } + + for(ExpressionField ef : ranges.keySet()) { + HashMap tokens = errors.get(ef); + if(tokens == null || tokens.isEmpty()) continue; + for(Token t : tokens.keySet()) { + ef.setSyntaxError(t, tokens.get(t)); + } + } + + } + + static private Object getElement(Object parent, String name) { + Configuration c = null; + if(parent instanceof Module) { Module m = (Module)parent; c = m.getType().getConfiguration(); - } else if (parent instanceof Configuration) { - c = (Configuration)parent; - } - - if(c != null) { - for(IElement e : c.getElements()) { - if(e instanceof Variable && ((Variable)e).getName().equals(name)) { - return e; - } else if(e instanceof Module && ((Module)e).getName().equals(name)) { + } else if (parent instanceof Configuration) { + c = (Configuration)parent; + } + + if(c != null) { + for(IElement e : c.getElements()) { + if(e instanceof Variable && ((Variable)e).getName().equals(name)) { + return e; + } else if(e instanceof Module && ((Module)e).getName().equals(name)) { return e; - } - } - } else if(parent instanceof Sheet) { + } + } + } else if(parent instanceof Sheet) { Sheet s = (Sheet)parent; for(String key : s.getCells().keySet()) { if(key.equals(name)) { return Boolean.TRUE; } } - + } else if(parent instanceof Enumeration) { Enumeration e = (Enumeration)parent; if(name.equals("size") || name.equals("elements")) return Boolean.TRUE; - + for(EnumerationIndex ei : e.getEnumerationIndexes()) { if(ei.getName().equals(name)) { return Boolean.TRUE; } } - + } - - return null; - } - - @SuppressWarnings("unchecked") - static private HashMap> getPositionsForVariables(HashMap>> references, Set variables) { - HashMap> result = new HashMap>(); - for(String s : variables) { - List tlist = new ArrayList(); - for(ExpressionField ef : references.keySet()) { - ArrayList positions = new ArrayList(); - tlist = references.get(ef).get(s); - if(tlist != null) - for(Token t : tlist) { - StyledText st = ef.getSourceViewer().getTextWidget(); - int start = st.getOffsetAtLine(t.beginLine - 1) + t.beginColumn - 1; - int offset = st.getOffsetAtLine(t.endLine - 1) + t.endColumn - start; - positions.add(new Position( - start, - offset)); - } - if(result.keySet().contains(ef)) { - result.get(ef).addAll((ArrayList)positions.clone()); - } else { - result.put(ef, (ArrayList)positions.clone()); - } - } - } - return result; - } + + return null; + } + + @SuppressWarnings("unchecked") + static private HashMap> getPositionsForVariables(HashMap>> references, Set variables) { + HashMap> result = new HashMap>(); + for(String s : variables) { + List tlist = new ArrayList(); + for(ExpressionField ef : references.keySet()) { + ArrayList positions = new ArrayList(); + tlist = references.get(ef).get(s); + if(tlist != null) + for(Token t : tlist) { + StyledText st = ef.getSourceViewer().getTextWidget(); + int start = st.getOffsetAtLine(t.beginLine - 1) + t.beginColumn - 1; + int offset = st.getOffsetAtLine(t.endLine - 1) + t.endColumn - start; + positions.add(new Position( + start, + offset)); + } + if(result.keySet().contains(ef)) { + result.get(ef).addAll((ArrayList)positions.clone()); + } else { + result.put(ef, (ArrayList)positions.clone()); + } + } + } + return result; + } } diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/VariableNameUtils.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/VariableNameUtils.java index 422f9e9a..9cec3f2b 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/VariableNameUtils.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/VariableNameUtils.java @@ -49,18 +49,21 @@ public class VariableNameUtils { * How this works when range used in equations has the same string as * the renamed variable? Should it be possible? */ + if(originalName.equals(newName)) + return; // Do nothing + Layer0 l0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); Resource configuration = graph.getSingleObject(variable, l0.PartOf); for(Resource r : graph.getObjects(configuration, l0.ConsistsOf)) { if(graph.isInstanceOf(r, sr.IndependentVariable)) { - Resource expressions = graph.getPossibleObject(r, sr.HasExpressions); + Resource expressions = graph.getPossibleObject(r, sr.Variable_expressions); if(expressions == null) continue; List expressionList = OrderedSetUtils.toList(graph, expressions); for(Resource s : expressionList) { for(Resource p : graph.getPredicates(s)) { Resource o = graph.getPossibleObject(s, p); - if(o != null && graph.isInstanceOf(o, l0.String) && !p.equals(sr.HasArrayRange)) { + if(o != null && graph.isInstanceOf(o, l0.String) && !p.equals(sr.Expression_arrayRange)) { String string = graph.getRelatedValue(s, p); String replaced = replaceAllWords(string, originalName, newName); graph.claimLiteral(s, p, replaced); diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java index dbad2a45..88dbac81 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java @@ -57,13 +57,9 @@ public class DependencyFunction { if (!graph.hasStatement(component) || !graph.hasStatement(component, l0.PartOf)) return Collections.emptyList(); - - // Find all variables that are linked to component with arrows - Set dependencies = ValidationUtils.getDependencies(graph, component); - Set references = null; - + ArrayList result = new ArrayList(); - + Set references = null; // Find all references in equations of component try { @@ -72,6 +68,9 @@ public class DependencyFunction { return result; } + // Find all variables that are linked to component with arrows + Set dependencies = ValidationUtils.getDependencies(graph, component); + // Check that all arrow dependencies are used in equations if (dependencies != null) { for (String dependency : dependencies) { diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ValidationUtils.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ValidationUtils.java index 5ad0123a..3826bbc9 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ValidationUtils.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ValidationUtils.java @@ -55,7 +55,7 @@ public class ValidationUtils { if(expressionList == null || expressionList.isEmpty()) throw new UndefinedExpressionException(); for(Resource expression : expressionList) { - Collection statements = graph.getStatements(expression, sr.HasEquation); + Collection statements = graph.getStatements(expression, sr.Expression_equation); if(statements.isEmpty()) throw new UndefinedExpressionException(); @@ -94,7 +94,7 @@ public class ValidationUtils { */ private static List getExpressions(ReadGraph graph, Resource r) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - Resource hasExpressions = graph.getPossibleObject(r, sr.HasExpressions); + Resource hasExpressions = graph.getPossibleObject(r, sr.Variable_expressions); if(hasExpressions != null) return OrderedSetUtils.toList(graph, hasExpressions); else @@ -116,7 +116,7 @@ public class ValidationUtils { SysdynResource sr = SysdynResource.getInstance(graph); Layer0 l0 = Layer0.getInstance(graph); - Collection dependencies = graph.getObjects(r, sr.IsHeadOf); + Collection dependencies = graph.getObjects(r, sr.Variable_isHeadOf); for(Resource d : dependencies) { if(graph.isInstanceOf(d, sr.Dependency)) { diff --git a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/modules/WizardModulesExportPage.java b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/modules/WizardModulesExportPage.java index 1bfea7c3..d14135a9 100644 --- a/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/modules/WizardModulesExportPage.java +++ b/stable/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/modules/WizardModulesExportPage.java @@ -392,21 +392,21 @@ public class WizardModulesExportPage extends WizardPage { ArrayList> replacements = new ArrayList>(); for(Resource enumeration : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Enumeration))) { - if(graph.hasStatement(enumeration, sr.ReplacedEnumeration_Inverse)) { - for(Resource replacement : graph.getObjects(enumeration, sr.ReplacedEnumeration_Inverse)) { + if(graph.hasStatement(enumeration, sr.Redeclaration_replacedEnumeration_Inverse)) { + for(Resource replacement : graph.getObjects(enumeration, sr.Redeclaration_replacedEnumeration_Inverse)) { replacements.add(new Pair(enumeration, replacement)); } } } for(Pair replacement : replacements) - graph.deny(replacement.first, sr.ReplacedEnumeration_Inverse, replacement.second); + graph.deny(replacement.first, sr.Redeclaration_replacedEnumeration_Inverse, replacement.second); TransferableGraph1 tg = graph.syncRequest(new TransferableGraphRequest2(roots, component)); Files.createFile(new File(path), Bindings.getBindingUnchecked(TransferableGraph1.class), tg); for(Pair replacement : replacements) - graph.claim(replacement.first, sr.ReplacedEnumeration_Inverse, replacement.second); + graph.claim(replacement.first, sr.Redeclaration_replacedEnumeration_Inverse, replacement.second); } catch (RuntimeBindingConstructionException e) { e.printStackTrace(); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariable.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariable.java index a68c2eef..31dc733e 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariable.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/ChildVariable.java @@ -47,13 +47,13 @@ public class ChildVariable extends AbstractChildVariable { SysdynResource sr = SysdynResource.getInstance(graph); if(this.resource == null) return null; //FIXME: doesn't support multiple expressions - Resource expressions = graph.getPossibleObject(this.resource, sr.HasExpressions); + Resource expressions = graph.getPossibleObject(this.resource, sr.Variable_expressions); if(expressions == null) return null; List expressionList = OrderedSetUtils.toList(graph, expressions); Resource expression = expressionList.get(0); if(expression == null) return null; if(!graph.isInstanceOf(expression, sr.ParameterExpression)) return null; - String text = graph.getPossibleRelatedValue(expression, sr.HasEquation); + String text = graph.getPossibleRelatedValue(expression, sr.Expression_equation); if(text == null) return null; Double value = Double.parseDouble(text); return (T)value; @@ -65,13 +65,13 @@ public class ChildVariable extends AbstractChildVariable { SysdynResource sr = SysdynResource.getInstance(graph); if(this.resource == null) return; //FIXME: doesn't support multiple expressions - Resource expressions = graph.getPossibleObject(this.resource, sr.HasExpressions); + Resource expressions = graph.getPossibleObject(this.resource, sr.Variable_expressions); if(expressions == null) return; List expressionList = OrderedSetUtils.toList(graph, expressions); Resource expression = expressionList.get(0); if(expression == null) return; if(!graph.isInstanceOf(expression, sr.ParameterExpression)) return; - graph.claimLiteral(expression, sr.HasEquation, object.toString(), Bindings.STRING); + graph.claimLiteral(expression, sr.Expression_equation, object.toString(), Bindings.STRING); } // FIXME: Support properties! This is just for the system to work like it used to. diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableRVIUtils.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableRVIUtils.java index c5f05085..62118077 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableRVIUtils.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/VariableRVIUtils.java @@ -79,12 +79,12 @@ public class VariableRVIUtils { private static void traverseIndexes(ReadGraph g, String rvi, HashMap rvis, List arrayIndexes, Resource currentEnumeration, String indexesSoFar, String indexNamesSoFar) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(g); // Enumeration indexes of the current enumeration (e.g. the first EnumIndexes in Var[EnumIndexes, EnumIndexes, EnumIndexes]) - Resource enumerationIndexes = g.getPossibleObject(currentEnumeration, sr.HasEnumerationIndexes); + Resource enumerationIndexes = g.getPossibleObject(currentEnumeration, sr.Enumeration_enumerationIndexes); if(enumerationIndexes == null) return; List indexes = OrderedSetUtils.toList(g, enumerationIndexes); for(int i = 0; i < indexes.size(); i++) { - Boolean b = g.getPossibleRelatedValue(indexes.get(i), sr.ShowEnumerationIndexInCharts, Bindings.BOOLEAN); + Boolean b = g.getPossibleRelatedValue(indexes.get(i), sr.EnumerationIndex_showEnumerationIndexInCharts, Bindings.BOOLEAN); // If this index is not wanted to be shown in charts, the recursion does not go any further and rvis.put() is not called for this enumeration if(Boolean.TRUE.equals(b)) { int arrayIndex = arrayIndexes.indexOf(currentEnumeration); @@ -127,11 +127,11 @@ public class VariableRVIUtils { // If the variable is located in a module, it might have overridden (redeclared) enumerations boolean somethingIsReplaced = false; // Find all redeclarations - for(Resource redeclaration : graph.syncRequest(new ObjectsWithType(module, sr.HasRedeclaration, sr.Redeclaration))) { - Resource replaced = graph.getSingleObject(redeclaration, sr.ReplacedEnumeration); + for(Resource redeclaration : graph.syncRequest(new ObjectsWithType(module, sr.Module_redeclaration, sr.Redeclaration))) { + Resource replaced = graph.getSingleObject(redeclaration, sr.Redeclaration_replacedEnumeration); if(enumerations.contains(replaced)) { // Replace the redelcared enumeration in enumerations -list with the replacing enumeration - enumerations.add(enumerations.indexOf(replaced), graph.getSingleObject(redeclaration, sr.ReplacingEnumeration)); + enumerations.add(enumerations.indexOf(replaced), graph.getSingleObject(redeclaration, sr.Redeclaration_replacingEnumeration)); enumerations.remove(replaced); somethingIsReplaced = true; } @@ -168,7 +168,7 @@ public class VariableRVIUtils { Resource r = variable.getPropertyValue(graph, Variables.REPRESENTS); - Resource arrayIndexes = graph.getPossibleObject(r, sr.HasArrayIndexes); + Resource arrayIndexes = graph.getPossibleObject(r, sr.Variable_arrayIndexes); if(arrayIndexes == null) { // If variable is single-dimensional, use the same rvi rvis.put(rvi, rvi); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/FunctionUtils.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/FunctionUtils.java index e3d02a2c..91fb1cd9 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/FunctionUtils.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/FunctionUtils.java @@ -183,7 +183,7 @@ public class FunctionUtils { String name = NameUtils.getSafeName(graph, externalFunction); if(name.endsWith(".o") || name.endsWith(".a")) { FileOutputStream fos = new FileOutputStream(dir + "\\" + name); - byte[] fileBArray = graph.getPossibleRelatedValue(externalFunction, sr.HasExternalFile, Bindings.BYTE_ARRAY); + byte[] fileBArray = graph.getPossibleRelatedValue(externalFunction, sr.ExternalFunctionFile_externalFile, Bindings.BYTE_ARRAY); fos.write(fileBArray); fos.close(); } @@ -282,7 +282,7 @@ public class FunctionUtils { SysdynResource sr = SysdynResource.getInstance(graph); for(Resource function : graph.syncRequest(new ObjectsWithType(library, l0.ConsistsOf, sr.SysdynModelicaFunction))) { String name = NameUtils.getSafeName(graph, function); - String functionCode = graph.getRelatedValue(function, sr.HasModelicaFunctionCode); + String functionCode = graph.getRelatedValue(function, sr.SysdynModelicaFunction_modelicaFunctionCode); stream.println("function " + name); stream.println(functionCode); stream.println("end " + name + ";\n"); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java index 2dbe53d5..fec55b04 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java @@ -91,8 +91,8 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment { l0.HasLabel, name, l0.HasName, name, l0.PartOf, model, - sr.HasResultFile, file.getAbsolutePath()); - graph.claim(experiment, sr.HasResult, res); + sr.Result_resultFile, file.getAbsolutePath()); + graph.claim(experiment, sr.Experiment_result, res); sysdynModel.getSysdynResult().saveToFile(file); } }); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java index 4ffb342b..2bb5a165 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynModel.java @@ -201,12 +201,12 @@ public class SysdynModel implements IMappingListener, IModel { Resource model = graph.getSingleObject(getConfigurationResource(), SIMU.IsConfigurationOf); Collection experiments = graph.syncRequest(new ObjectsWithType(model, l0.ConsistsOf, sr.Experiment)); for(Resource experiment : experiments) { - Collection experimentResults = graph.getObjects(experiment, sr.HasResult); + Collection experimentResults = graph.getObjects(experiment, sr.Experiment_result); for(Resource result : experimentResults) { - if(graph.hasStatement(result, sr.ShowResult)) { + if(graph.hasStatement(result, sr.Result_showResult)) { SysdynResult sysdynResult = new SysdynResult( (String) graph.getPossibleRelatedValue(result, l0.HasLabel), - (String) graph.getPossibleRelatedValue(result, sr.HasResultFile)); + (String) graph.getPossibleRelatedValue(result, sr.Result_resultFile)); activeResults.add(sysdynResult); } } @@ -292,6 +292,7 @@ public class SysdynModel implements IMappingListener, IModel { inits.put("outputFormat", outputFormat); if(numberOfIntervals != null) { inits.put("step value", numberOfIntervals.toString()); + inits.put("numberOfIntervals", "" + ((int)((stopTime - startTime) / numberOfIntervals))); } else { inits.put("step value", "" + (stopTime - startTime) / 500); } diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynPlaybackExperiment.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynPlaybackExperiment.java index 814c0beb..ad5ce4e0 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynPlaybackExperiment.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynPlaybackExperiment.java @@ -230,9 +230,9 @@ public class SysdynPlaybackExperiment extends SysdynExperiment implements IDynam Double[] numbers = new Double[3]; Resource model = getModel(); SysdynResource sr = SysdynResource.getInstance(graph); - numbers[0] = graph.getRelatedValue(model, sr.HasStartTime); - numbers[1] = graph.getRelatedValue(model, sr.HasStopTime); - numbers[2] = graph.getPossibleRelatedValue(model, sr.HasOutputInterval); + numbers[0] = graph.getRelatedValue(model, sr.SysdynModel_startTime); + numbers[1] = graph.getRelatedValue(model, sr.SysdynModel_stopTime); + numbers[2] = graph.getPossibleRelatedValue(model, sr.SysdynModel_outputInterval); PlaybackConfiguration config = new PlaybackConfiguration(); config.simulationDuration = numbers[1] - numbers[0] - time; diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Auxiliary.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Auxiliary.java index 375878d2..62c3764b 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Auxiliary.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Auxiliary.java @@ -26,7 +26,7 @@ public class Auxiliary extends Variable { SysdynResource sr = SysdynResource.getInstance(graph); Resource e = GraphUtils.create2(graph, sr.NormalExpression, - sr.HasEquation, ImportUtils.escapeExpression(expression.getExpression()).trim()); + sr.Expression_equation, ImportUtils.escapeExpression(expression.getExpression()).trim()); return e; } diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Dependency.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Dependency.java index 65b4c60a..1b5bdc8e 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Dependency.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Dependency.java @@ -40,7 +40,7 @@ public class Dependency extends Connection { if(connection != null) { ModelingResources mr = ModelingResources.getInstance(graph); Resource diagramConnection = graph.getSingleObject(connection, mr.ConnectionToDiagramConnection); - graph.claimLiteral(diagramConnection, sr.angle, angle); + graph.claimLiteral(diagramConnection, sr.Dependency_angle, angle); } } catch (DatabaseException e) { diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Function.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Function.java index faadc02f..43afed7e 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Function.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Function.java @@ -46,7 +46,7 @@ public class Function extends Variable { sb.append(" output Real result;\n"); sb.append("algorithm\n"); sb.append(" result := interpolate(a, " + expressions.get(0).getExpression() + ");"); - graph.claimLiteral(function, sr.HasModelicaFunctionCode, sb.toString()); + graph.claimLiteral(function, sr.SysdynModelicaFunction_modelicaFunctionCode, sb.toString()); } graph.claim(parent, l0.ConsistsOf, function); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Model.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Model.java index 48cc1fce..3e0caf6d 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Model.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Model.java @@ -234,8 +234,8 @@ public class Model implements IWriteableMDLObject { l0.PartOf, parent, l0.HasName, NameUtils.findFreshName(graph, getName(), parent, l0.ConsistsOf, "%s%d"), l0.HasLabel, getName(), - sr.HasStartTime, startTime, - sr.HasStopTime, endTime, + sr.SysdynModel_startTime, startTime, + sr.SysdynModel_stopTime, endTime, l0.IsLinkedTo, sysdyn, l0.IsLinkedTo, layer0 ); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Stock.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Stock.java index e3437f38..61f3111b 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Stock.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Stock.java @@ -27,7 +27,7 @@ public class Stock extends Variable { SysdynResource sr = SysdynResource.getInstance(graph); Resource e = GraphUtils.create2(graph, sr.StockExpression, - sr.HasInitialEquation, integralEquation); + sr.StockExpression_initialEquation, integralEquation); return e; } diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Subscript.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Subscript.java index 40ca4761..a0087d4e 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Subscript.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Subscript.java @@ -53,7 +53,7 @@ public class Subscript extends Variable { Resource enumeration = GraphUtils.create2(graph, sr.Enumeration, l0.HasName, this.getName(), - sr.HasEnumerationIndexes, enumerationIndexes); + sr.Enumeration_enumerationIndexes, enumerationIndexes); graph.claim(parent, l0.ConsistsOf, enumeration); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Valve.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Valve.java index e3987d15..620ad56b 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Valve.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Valve.java @@ -26,7 +26,7 @@ public class Valve extends Variable { String expressionString = ImportUtils.escapeExpression(expression.getExpression()); Resource e = GraphUtils.create2(graph, sr.NormalExpression, - sr.HasEquation, expressionString.trim()); + sr.Expression_equation, expressionString.trim()); return e; } diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Variable.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Variable.java index 126dd35e..02c5f706 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Variable.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Variable.java @@ -59,7 +59,7 @@ public abstract class Variable extends Element { Resource variable = GraphUtils.create2(graph, variableType, l0.HasName, ImportUtils.escapeName(name), - sr.HasExpressions, expressionList); + sr.Variable_expressions, expressionList); graph.claim(variable, mr.Mapped, variable); for(Expression e : getExpressions()) { @@ -68,7 +68,7 @@ public abstract class Variable extends Element { Resource expression = getExpression(graph, e); if(e.getRange() != null) { - graph.claimLiteral(expression, sr.HasArrayRange, "[" + e.getRange().trim() + "]"); + graph.claimLiteral(expression, sr.Expression_arrayRange, "[" + e.getRange().trim() + "]"); } OrderedSetUtils.add(graph, expressionList, expression); graph.claim(variable, l0.ConsistsOf, expression); @@ -79,7 +79,7 @@ public abstract class Variable extends Element { if(sub.getResource() != null) OrderedSetUtils.add(graph, arrayIndexList, sub.getResource()); } - graph.claim(variable, sr.HasArrayIndexes, arrayIndexList); + graph.claim(variable, sr.Variable_arrayIndexes, arrayIndexList); } if(units != null && units.length() > 0) diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java index a9a7be8b..c9cecaf0 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java @@ -182,7 +182,7 @@ public class ModelicaWriter { b.append("// Default values for inputs in modules\n"); for(String moduleLabel : moduleInputs.keySet()) { for(Input input : moduleInputs.get(moduleLabel)) { - b.append(" " + moduleLabel + "." + input.getName() + " = " + input.getDefaultInputValue() + ";\n"); + b.append(" " + moduleLabel + "." + input.getName() + " = " + input.getDefaultInputValue(moduleLabel) + ";\n"); } } diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ArrayIndexes.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ArrayIndexes.java index 1db1239b..869ff09e 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ArrayIndexes.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ArrayIndexes.java @@ -4,8 +4,9 @@ import java.util.ArrayList; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedOrderedSetElements; +import org.simantics.sysdyn.SysdynResource; -@GraphType("http://www.simantics.org/Sysdyn-1.1/ArrayIndexes") +@GraphType(SysdynResource.URIs.ArrayIndexes) public class ArrayIndexes { @RelatedOrderedSetElements diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Auxiliary.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Auxiliary.java index fa150c78..bf68a9d4 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Auxiliary.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Auxiliary.java @@ -12,9 +12,10 @@ package org.simantics.sysdyn.representation; import org.simantics.objmap.annotations.GraphType; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Auxiliary") +@GraphType(SysdynResource.URIs.Auxiliary) public class Auxiliary extends IndependentVariable { @Override public void accept(IElementVisitorVoid v) { diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Book.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Book.java index 8456e27c..c4621a7e 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Book.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Book.java @@ -3,6 +3,7 @@ package org.simantics.sysdyn.representation; import java.util.ArrayList; import java.util.List; +import org.simantics.layer0.Layer0; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedElements; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; @@ -11,7 +12,7 @@ import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; public class Book extends Variable { @RelatedElements( - value = "http://www.simantics.org/Layer0-1.0/ConsistsOf", + value = Layer0.URIs.ConsistsOf, composition = true) private ArrayList sheets = new ArrayList(); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Cloud.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Cloud.java index 56840b6c..1244dcf2 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Cloud.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Cloud.java @@ -12,9 +12,10 @@ package org.simantics.sysdyn.representation; import org.simantics.objmap.annotations.GraphType; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Cloud") +@GraphType(SysdynResource.URIs.Cloud) public class Cloud implements IElement { @Override public void accept(IElementVisitorVoid v) { diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Configuration.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Configuration.java index b2e8e8a5..02279551 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Configuration.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Configuration.java @@ -13,29 +13,33 @@ package org.simantics.sysdyn.representation; import java.util.ArrayList; +import org.simantics.layer0.Layer0; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedElement; import org.simantics.objmap.annotations.RelatedElements; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.simulation.ontology.SimulationResource; +import org.simantics.structural.stubs.StructuralResource2; +import org.simantics.sysdyn.SysdynResource; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Configuration") +@GraphType(SysdynResource.URIs.Configuration) public class Configuration { - @RelatedValue("http://www.simantics.org/Layer0-1.0/HasName") + @RelatedValue(Layer0.URIs.HasName) private String name; - @RelatedValue("http://www.simantics.org/Layer0-1.0/HasLabel") + @RelatedValue(Layer0.URIs.HasLabel) private String label; - @RelatedElement("http://www.simantics.org/Structural-1.0/Defines") + @RelatedElement(StructuralResource2.URIs.Defines) private ModuleType moduleType; - - @RelatedElement("http://www.simantics.org/Simulation-1.0/IsConfigurationOf") + + @RelatedElement(SimulationResource.URIs.IsConfigurationOf) private Model model; @RelatedElements( - value = "http://www.simantics.org/Layer0-1.0/ConsistsOf", + value = Layer0.URIs.ConsistsOf, composition = true) private ArrayList elements = new ArrayList(); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Dependency.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Dependency.java index 2b220fbf..a907c3f2 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Dependency.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Dependency.java @@ -13,15 +13,16 @@ package org.simantics.sysdyn.representation; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedElement; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Dependency") +@GraphType(SysdynResource.URIs.Dependency) public class Dependency implements IElement { - @RelatedElement("http://www.simantics.org/Sysdyn-1.1/HasTail") + @RelatedElement(SysdynResource.URIs.HasTail) private IElement tail; - @RelatedElement("http://www.simantics.org/Sysdyn-1.1/HasHead") + @RelatedElement(SysdynResource.URIs.HasHead) private IElement head; - @RelatedElement("http://www.simantics.org/Sysdyn-1.1/RefersTo") + @RelatedElement(SysdynResource.URIs.Dependency_refersTo) private IElement refersTo; @Override diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/DiagramContainerDummy.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/DiagramContainerDummy.java index f30cc284..3ad14641 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/DiagramContainerDummy.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/DiagramContainerDummy.java @@ -11,10 +11,11 @@ *******************************************************************************/ package org.simantics.sysdyn.representation; +import org.simantics.diagram.stubs.DiagramResource; import org.simantics.objmap.annotations.GraphType; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Diagram-2.1/DiagramContainer") +@GraphType(DiagramResource.URIs.DiagramContainer) public class DiagramContainerDummy implements IElement { @Override diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Enumeration.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Enumeration.java index 741f3375..51996a19 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Enumeration.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Enumeration.java @@ -17,19 +17,20 @@ import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedElement; import org.simantics.objmap.annotations.RelatedElements; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Enumeration") +@GraphType(SysdynResource.URIs.Enumeration) public class Enumeration extends Variable { - @RelatedElement("http://www.simantics.org/Sysdyn-1.1/HasEnumerationIndexes") + @RelatedElement(SysdynResource.URIs.Enumeration_enumerationIndexes) private EnumerationIndexes enumerationIndexes; - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/IsReplaceable") + @RelatedValue(SysdynResource.URIs.Enumeration_isReplaceable) private Boolean isReplaceable; @RelatedElements( - value = "http://www.simantics.org/Sysdyn-1.1/ReplacedEnumeration/Inverse", + value = SysdynResource.URIs.Redeclaration_replacedEnumeration_Inverse, composition = true) private ArrayList redeclarations = new ArrayList(); @@ -45,6 +46,9 @@ public class Enumeration extends Variable { sb.append(this.name + "_class"); sb.append(" " + this.name); sb.append(";\n"); + + sb.append(" parameter Integer " + this.name + "_size = " + this.name + ".size;\n"); + sb.append(" parameter Integer " + this.name + "_elements[:] = " + this.name + ".elements;\n"); return sb.toString(); } diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/EnumerationIndex.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/EnumerationIndex.java index 0d565c41..47ee9864 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/EnumerationIndex.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/EnumerationIndex.java @@ -1,12 +1,14 @@ package org.simantics.sysdyn.representation; +import org.simantics.layer0.Layer0; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; -@GraphType("http://www.simantics.org/Sysdyn-1.1/EnumerationIndex") +@GraphType(SysdynResource.URIs.EnumerationIndex) public class EnumerationIndex { - @RelatedValue("http://www.simantics.org/Layer0-1.0/HasName") + @RelatedValue(Layer0.URIs.HasName) protected String name; public String getName() { diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/EnumerationIndexes.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/EnumerationIndexes.java index 43e111f3..fa7eca93 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/EnumerationIndexes.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/EnumerationIndexes.java @@ -4,8 +4,9 @@ import java.util.ArrayList; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedOrderedSetElements; +import org.simantics.sysdyn.SysdynResource; -@GraphType("http://www.simantics.org/Sysdyn-1.1/EnumerationIndexes") +@GraphType(SysdynResource.URIs.EnumerationIndexes) public class EnumerationIndexes { @RelatedOrderedSetElements diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Flow.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Flow.java index 98996b11..786855b3 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Flow.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Flow.java @@ -13,13 +13,14 @@ package org.simantics.sysdyn.representation; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedElement; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Flow") +@GraphType(SysdynResource.URIs.Flow) public class Flow implements IElement { - @RelatedElement("http://www.simantics.org/Sysdyn-1.1/HasTail") + @RelatedElement(SysdynResource.URIs.HasTail) private IElement tail; - @RelatedElement("http://www.simantics.org/Sysdyn-1.1/HasHead") + @RelatedElement(SysdynResource.URIs.HasHead) private IElement head; @Override diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Input.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Input.java index 5ad136a2..96f3a5c4 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Input.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Input.java @@ -18,14 +18,15 @@ import java.util.List; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedElements; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Input") +@GraphType(SysdynResource.URIs.Input) public class Input extends Variable { - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasDefaultInputValue") + @RelatedValue(SysdynResource.URIs.Input_defaultInputValue) private Double defaultInputValue; - @RelatedElements("http://www.simantics.org/Sysdyn-1.1/IsHeadOf") + @RelatedElements(SysdynResource.URIs.Variable_isHeadOf) private List isHeadOf; @@ -35,25 +36,29 @@ public class Input extends Variable { v.visit(this); } - public String getDefaultInputValue() { + public String getDefaultInputValue(String inModule) { if( getArrayIndexes() == null || getArrayIndexes().getEnumerations().isEmpty()) { - return defaultInputValue.toString(); + return defaultInputValue.toString(); } else { - StringBuilder sb = new StringBuilder(); - sb.append("fill("); - sb.append(defaultInputValue); - sb.append(", "); - Iterator i = getArrayIndexes().getEnumerations().iterator(); - while(i.hasNext()) { - Enumeration e = i.next(); - sb.append(e.getEnumerationIndexes().size()); - if(i.hasNext()) - sb.append(", "); - } - sb.append(")"); - return sb.toString(); + StringBuilder sb = new StringBuilder(); + sb.append("fill("); + sb.append(defaultInputValue); + sb.append(", "); + Iterator i = getArrayIndexes().getEnumerations().iterator(); + while(i.hasNext()) { + Enumeration e = i.next(); + sb.append((!inModule.isEmpty() && inModule != null ? inModule + "." : "") + e.getName() + ".size"); + if(i.hasNext()) + sb.append(", "); + } + sb.append(")"); + return sb.toString(); } } + + public String getDefaultInputValue() { + return getDefaultInputValue(null); + } public boolean isHeadOfDependency() { return !isHeadOf.isEmpty(); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/LibraryDummy.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/LibraryDummy.java index 8762ade8..9e0c59b1 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/LibraryDummy.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/LibraryDummy.java @@ -1,10 +1,11 @@ package org.simantics.sysdyn.representation; +import org.simantics.layer0.Layer0; import org.simantics.objmap.annotations.GraphType; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Layer0-1.0/Library") +@GraphType(Layer0.URIs.Library) public class LibraryDummy implements IElement { @Override diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Model.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Model.java index 8be91f13..d2d5da2d 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Model.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Model.java @@ -13,23 +13,24 @@ package org.simantics.sysdyn.representation; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; -@GraphType("http://www.simantics.org/Sysdyn-1.1/SysdynModel") +@GraphType(SysdynResource.URIs.SysdynModel) public class Model { - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasStartTime") + @RelatedValue(SysdynResource.URIs.SysdynModel_startTime) private Double startTime = 0.0; - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasStopTime") + @RelatedValue(SysdynResource.URIs.SysdynModel_stopTime) private Double stopTime = 10.0; - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasOutputInterval") + @RelatedValue(SysdynResource.URIs.SysdynModel_outputInterval) private Double outputInterval; - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasTolerance") + @RelatedValue(SysdynResource.URIs.SysdynModel_tolerance) private Double tolerance; - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasSolver") + @RelatedValue(SysdynResource.URIs.SysdynModel_solver) private String solver; public Double getStartTime() { diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java index 4c7fb5ba..c5ece68c 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Module.java @@ -15,25 +15,27 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import org.simantics.layer0.Layer0; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedElement; import org.simantics.objmap.annotations.RelatedElements; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Module") +@GraphType(SysdynResource.URIs.Module) public class Module implements IElement { - @RelatedValue("http://www.simantics.org/Layer0-1.0/HasName") + @RelatedValue(Layer0.URIs.HasName) private String name; - @RelatedElement("http://www.simantics.org/Layer0-1.0/PartOf") + @RelatedElement(Layer0.URIs.PartOf) private Configuration parentConfiguration; - @RelatedElement("http://www.simantics.org/Layer0-1.0/InstanceOf") + @RelatedElement(Layer0.URIs.InstanceOf) private ModuleType type; - @RelatedElements("http://www.simantics.org/Sysdyn-1.1/HasRedeclaration") + @RelatedElements(SysdynResource.URIs.Module_redeclaration) private List redeclarations; @Override @@ -63,17 +65,13 @@ public class Module implements IElement { */ public String getDeclaration() { - StringBuilder parameters = new StringBuilder(); StringBuilder redeclarations = new StringBuilder(); - - if(!getRedeclarations().isEmpty()) { redeclarations.append("("); Iterator i = getRedeclarations().iterator(); while(i.hasNext()) { Redeclaration rd = i.next(); redeclarations.append(rd.getRedeclaration()); - parameters.append(rd.getParameters()); if(i.hasNext()) redeclarations.append(","); } @@ -82,7 +80,6 @@ public class Module implements IElement { StringBuilder sb = new StringBuilder(); - sb.append(parameters); sb.append(" "); sb.append(getType().getName()); sb.append(" "); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java index 826937b9..148018c7 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/ModuleType.java @@ -11,18 +11,20 @@ *******************************************************************************/ package org.simantics.sysdyn.representation; +import org.simantics.layer0.Layer0; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedElement; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.structural.stubs.StructuralResource2; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Structural-1.0/ComponentType") +@GraphType(StructuralResource2.URIs.ComponentType) public class ModuleType implements IElement { - @RelatedValue("http://www.simantics.org/Layer0-1.0/HasName") + @RelatedValue(Layer0.URIs.HasName) private String name; - @RelatedElement("http://www.simantics.org/Structural-1.0/IsDefinedBy") + @RelatedElement(StructuralResource2.URIs.IsDefinedBy) private Configuration configuration; public String getName() { diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Redeclaration.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Redeclaration.java index 417fbbab..6f1e8b3c 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Redeclaration.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Redeclaration.java @@ -13,77 +13,33 @@ package org.simantics.sysdyn.representation; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedElement; +import org.simantics.sysdyn.SysdynResource; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Redeclaration") +@GraphType(SysdynResource.URIs.Redeclaration) public class Redeclaration { - @RelatedElement("http://www.simantics.org/Sysdyn-1.1/ReplacedEnumeration") + @RelatedElement(SysdynResource.URIs.Redeclaration_replacedEnumeration) private Enumeration replacedEnumeration; - @RelatedElement("http://www.simantics.org/Sysdyn-1.1/ReplacingEnumeration") + @RelatedElement(SysdynResource.URIs.Redeclaration_replacingEnumeration) private Enumeration replacingEnumeration; public String getRedeclaration() { if(replacedEnumeration == null || replacingEnumeration == null) { return ""; } - String separator = getSeparator(); StringBuilder sb = new StringBuilder(); sb.append(replacedEnumeration.getName()); sb.append(".size = "); sb.append(replacingEnumeration.getName()); - sb.append(separator + "size, "); + sb.append("_size, "); sb.append(replacedEnumeration.getName()); sb.append(".elements = "); sb.append(replacingEnumeration.getName()); - sb.append(separator + "elements"); + sb.append("_elements"); return sb.toString(); } - - /** - * Change the name of the re-declaration parameters to enable the use of - * enumerations with same names. - * - * @return - */ - public String getParameters() { - String separator = getSeparator(); - StringBuilder sb = new StringBuilder(); - sb.append(" parameter Integer " + replacingEnumeration.getName() + separator + "size = " + replacingEnumeration.getName() + ".size;\n"); - sb.append(" parameter Integer " + replacingEnumeration.getName() + separator + "elements[:] = " + replacingEnumeration.getName() + ".elements;\n"); - return sb.toString(); - } - - private String getSeparator() { - return getSeparator(this, "_"); - } - - /** - * Add enough separation marks that name conflicts would not exist. - * - * @param redeclaration - * @param separator - * @return - */ - private String getSeparator(Redeclaration redeclaration, String separator) { - if(redeclaration == null || redeclaration.replacedEnumeration == null || - redeclaration.replacedEnumeration.getParentConfiguration() == null) - return separator = "_"; - for(IElement e : redeclaration.replacedEnumeration.getParentConfiguration().getElements()) { - if(e instanceof Module) { - for(Redeclaration rd : ((Module)e).getRedeclarations()) { - if(rd.replacedEnumeration.name.equals(redeclaration.replacedEnumeration.name) && - rd.replacingEnumeration.equals(redeclaration.replacedEnumeration)) { - String separatorTmp = getSeparator(rd, separator); - if(separatorTmp.length() > separator.length()) - separator = separatorTmp; - } - } - } - } - return separator + "_"; - } public Enumeration getReplacedEnumeration() { return replacedEnumeration; diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Sheet.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Sheet.java index 00fcf7cc..e88081eb 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Sheet.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Sheet.java @@ -27,7 +27,7 @@ import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; @GraphType("http://www.simantics.org/Spreadsheet-1.1/Spreadsheet") public class Sheet extends org.simantics.sysdyn.representation.Variable { - @RelatedElement("http://www.simantics.org/Layer0-1.0/PartOf") + @RelatedElement(Layer0.URIs.PartOf) protected Book book; HashMap cells = new HashMap(); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Stock.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Stock.java index 8aee598a..ec92d298 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Stock.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Stock.java @@ -15,19 +15,20 @@ import java.util.ArrayList; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedElements; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Stock") +@GraphType(SysdynResource.URIs.Stock) public class Stock extends IndependentVariable { @RelatedElements( - value = "http://www.simantics.org/Sysdyn-1.1/IsHeadOf", + value = SysdynResource.URIs.Variable_isHeadOf, composition = true) private ArrayList incomingConnections = new ArrayList(); @RelatedElements( - value = "http://www.simantics.org/Sysdyn-1.1/IsTailOf", + value = SysdynResource.URIs.Variable_isTailOf, composition = true) private ArrayList outgoingConnections = new ArrayList(); diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Valve.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Valve.java index 0ae3c3b0..aa3d012b 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Valve.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Valve.java @@ -12,9 +12,10 @@ package org.simantics.sysdyn.representation; import org.simantics.objmap.annotations.GraphType; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Valve") +@GraphType(SysdynResource.URIs.Valve) public class Valve extends IndependentVariable { @Override public void accept(IElementVisitorVoid v) { diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variable.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variable.java index 69c03432..f8d5a943 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variable.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Variable.java @@ -11,25 +11,27 @@ *******************************************************************************/ package org.simantics.sysdyn.representation; +import org.simantics.layer0.Layer0; import org.simantics.objmap.annotations.RelatedElement; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.expressions.Expressions; public abstract class Variable implements IElement { - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/Variable/Type") + @RelatedValue(SysdynResource.URIs.Variable_type) protected String type; - @RelatedValue("http://www.simantics.org/Layer0-1.0/HasName") + @RelatedValue(Layer0.URIs.HasName) protected String name; - @RelatedElement("http://www.simantics.org/Layer0-1.0/PartOf") + @RelatedElement(Layer0.URIs.PartOf) protected Object parent; - @RelatedElement("http://www.simantics.org/Sysdyn-1.1/HasArrayIndexes") + @RelatedElement(SysdynResource.URIs.Variable_arrayIndexes) protected ArrayIndexes arrayIndexes; - @RelatedElement("http://www.simantics.org/Sysdyn-1.1/HasExpressions") + @RelatedElement(SysdynResource.URIs.Variable_expressions) protected Expressions expressions; diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ConstantExpression.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ConstantExpression.java index c4a3d1e6..c134bd6c 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ConstantExpression.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ConstantExpression.java @@ -13,12 +13,13 @@ package org.simantics.sysdyn.representation.expressions; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.IndependentVariable; -@GraphType("http://www.simantics.org/Sysdyn-1.1/ConstantExpression") +@GraphType(SysdynResource.URIs.ConstantExpression) public class ConstantExpression extends Expression { - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasEquation") + @RelatedValue(SysdynResource.URIs.Expression_equation) private String equation; @Override diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java index 852ea14c..b8c969b2 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/DelayExpression.java @@ -16,6 +16,7 @@ import java.util.Iterator; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.ArrayIndexes; import org.simantics.sysdyn.representation.Enumeration; import org.simantics.sysdyn.representation.IndependentVariable; @@ -48,19 +49,19 @@ import org.simantics.sysdyn.representation.utils.IndexUtils; * @author Teemu Lempinen * */ -@GraphType("http://www.simantics.org/Sysdyn-1.1/DelayExpression") +@GraphType(SysdynResource.URIs.DelayExpression) public class DelayExpression extends Expression { - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/DelayExpression/initialValue") + @RelatedValue(SysdynResource.URIs.DelayExpression_initialValue) private String initialValue; - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/DelayExpression/delayTime") + @RelatedValue(SysdynResource.URIs.DelayExpression_delayTime) private String delayTime; - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/DelayExpression/order") + @RelatedValue(SysdynResource.URIs.DelayExpression_order) private Integer order; - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/DelayExpression/expression") + @RelatedValue(SysdynResource.URIs.DelayExpression_expression) private String equation; @Override diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expression.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expression.java index ea8eb302..e500115f 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expression.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expression.java @@ -12,11 +12,12 @@ package org.simantics.sysdyn.representation.expressions; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.IndependentVariable; public abstract class Expression implements IExpression { - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasArrayRange") + @RelatedValue(SysdynResource.URIs.Expression_arrayRange) private String range; @Override diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expressions.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expressions.java index 394ce422..d05b9873 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expressions.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/Expressions.java @@ -4,8 +4,9 @@ import java.util.ArrayList; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedOrderedSetElements; +import org.simantics.sysdyn.SysdynResource; -@GraphType("http://www.simantics.org/Sysdyn-1.1/Expressions") +@GraphType(SysdynResource.URIs.Expressions) public class Expressions { @RelatedOrderedSetElements diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/LookupExpression.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/LookupExpression.java index e6ef859c..5d5b4d89 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/LookupExpression.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/LookupExpression.java @@ -12,8 +12,9 @@ package org.simantics.sysdyn.representation.expressions; import org.simantics.objmap.annotations.GraphType; +import org.simantics.sysdyn.SysdynResource; -@GraphType("http://www.simantics.org/Sysdyn-1.1/LookupExpression") +@GraphType(SysdynResource.URIs.LookupExpression) public class LookupExpression extends Expression { } diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/NormalExpression.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/NormalExpression.java index 6495c4d6..360ad577 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/NormalExpression.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/NormalExpression.java @@ -16,16 +16,17 @@ import java.util.Iterator; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.ArrayIndexes; import org.simantics.sysdyn.representation.Enumeration; import org.simantics.sysdyn.representation.IndependentVariable; import org.simantics.sysdyn.representation.utils.FormatUtils; import org.simantics.sysdyn.representation.utils.IndexUtils; -@GraphType("http://www.simantics.org/Sysdyn-1.1/NormalExpression") +@GraphType(SysdynResource.URIs.NormalExpression) public class NormalExpression extends Expression { - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasEquation") + @RelatedValue(SysdynResource.URIs.Expression_equation) private String equation; @Override diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ParameterExpression.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ParameterExpression.java index 14819372..90ca0c5b 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ParameterExpression.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/ParameterExpression.java @@ -16,15 +16,16 @@ import java.util.Iterator; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.ArrayIndexes; import org.simantics.sysdyn.representation.Enumeration; import org.simantics.sysdyn.representation.IndependentVariable; import org.simantics.sysdyn.representation.utils.IndexUtils; -@GraphType("http://www.simantics.org/Sysdyn-1.1/ParameterExpression") +@GraphType(SysdynResource.URIs.ParameterExpression) public class ParameterExpression extends Expression { - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasEquation") + @RelatedValue(SysdynResource.URIs.Expression_equation) private String equation; @Override diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/StockExpression.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/StockExpression.java index 32608c3b..6c30e6ba 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/StockExpression.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/StockExpression.java @@ -18,6 +18,7 @@ import java.util.Set; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.expressionParser.ExpressionParser; import org.simantics.sysdyn.expressionParser.ParseException; import org.simantics.sysdyn.representation.ArrayIndexes; @@ -37,10 +38,10 @@ import org.simantics.sysdyn.representation.utils.IndexUtils; * @author Teemu Lempinen * */ -@GraphType("http://www.simantics.org/Sysdyn-1.1/StockExpression") +@GraphType(SysdynResource.URIs.StockExpression) public class StockExpression extends Expression { - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasInitialEquation") + @RelatedValue(SysdynResource.URIs.StockExpression_initialEquation) private String initialEquation; @Override diff --git a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java index 3de4ffe7..ed99a236 100644 --- a/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java +++ b/stable/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/expressions/WithLookupExpression.java @@ -16,6 +16,7 @@ import java.util.Iterator; import org.simantics.objmap.annotations.GraphType; import org.simantics.objmap.annotations.RelatedValue; +import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.representation.ArrayIndexes; import org.simantics.sysdyn.representation.Enumeration; import org.simantics.sysdyn.representation.IndependentVariable; @@ -23,12 +24,12 @@ import org.simantics.sysdyn.representation.utils.FormatUtils; import org.simantics.sysdyn.representation.utils.IndexUtils; -@GraphType("http://www.simantics.org/Sysdyn-1.1/WithLookupExpression") +@GraphType(SysdynResource.URIs.WithLookupExpression) public class WithLookupExpression extends Expression { - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasLookup") + @RelatedValue(SysdynResource.URIs.WithLookupExpression_lookup) private String lookupTable; - @RelatedValue("http://www.simantics.org/Sysdyn-1.1/HasEquation") + @RelatedValue(SysdynResource.URIs.WithLookupExpression_expression) private String equation; @Override