]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Issue view update: more checks working for dependencies. Issues are not updated when...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 7 Oct 2011 13:46:18 +0000 (13:46 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 7 Oct 2011 13:46:18 +0000 (13:46 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@22573 ac1ea38d-2e2b-0410-8846-a27921b304fc

19 files changed:
org.simantics.sysdyn.ontology/graph.tg
org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph
org.simantics.sysdyn.ontology/graph/Validation.pgraph
org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java
org.simantics.sysdyn.ui/adapters.xml
org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/StockExpression.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/WithLookupExpression.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ModelUtils.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ActiveIssueSources.java [deleted file]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyIssueSource.java [deleted file]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyIssues.java [deleted file]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencySynchronizer.java [deleted file]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyValidator.java [deleted file]
org.simantics.sysdyn/src/org/simantics/sysdyn/mdlImport/mdlElements/Variable.java

index bb64744d19f0db3ad0cc8a960dbe9c681887a957..75a536254a291bf81c15887ebe1d0322e376c9ad 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
index 5be5fa7cc76d3b202cb95d6699c3e7b2f1952fbc..8592edaff1352501379e2aaa467505b4d54c331d 100644 (file)
@@ -208,10 +208,10 @@ SYSDYN.RefersTo <R L0.IsRelatedTo : L0.FunctionalRelation
 SYSDYN.HasEquation <R L0.HasProperty
     L0.HasRange L0.String  
 
-SYSDYN.HasInitialEquation <R L0.HasProperty
+SYSDYN.HasInitialEquation <T SYSDYN.HasEquation
     L0.HasRange L0.String
 
-SYSDYN.HasLookup <R L0.HasProperty
+SYSDYN.HasLookup <T SYSDYN.HasEquation
     L0.HasRange L0.String  
 
 SYSDYN.HasMinX <R L0.HasProperty
index b83275c70e4db962c9d98b2af32e32f5c2b27c23..7ee8e1ff1d0b46d4341b474462628a07593c357e 100644 (file)
@@ -1,4 +1,5 @@
 L0 = <http://www.simantics.org/Layer0-1.0>\r
+L0X = <http://www.simantics.org/Layer0X-1.0>\r
 ISSUE = <http://www.simantics.org/Issue-1.0>\r
 SYSDYN = <http://www.simantics.org/Sysdyn-1.0>\r
 \r
@@ -6,5 +7,18 @@ VALIDATIONS = SYSDYN.Validations : L0.Library
 \r
 SYSDYN.SysdynIssue <T ISSUE.TextualIssue\r
 \r
-VALIDATIONS.DependencyConnections : ISSUE.IssueSource\r
-    L0.HasLabel "Find inconsistent equations and dependencies"
\ No newline at end of file
+VALIDATIONS.DependencyConnectionsIssueSource <T ISSUE.DependencyIssueSource\r
+  @L0.assert ISSUE.DependencyIssueSource.HasType SYSDYN.Variable\r
+  @L0.assert ISSUE.DependencyIssueSource.HasValidator VALIDATIONS.dependencyValidator\r
+  @L0.assert ISSUE.DependencyIssueSource.HasSynchronizer VALIDATIONS.dependencySynchronizer\r
+  @L0.assert ISSUE.DependencyIssueSource.HasBaseFunction VALIDATIONS.dependencyBaseRealizationFunction\r
+  \r
+  \r
+VALIDATIONS.dependencyValidator : L0X.Function\r
+\r
+\r
+VALIDATIONS.dependencySynchronizer : L0X.Function\r
+\r
+\r
+VALIDATIONS.dependencyBaseRealizationFunction : L0X.Function\r
+  
\ No newline at end of file
index 90fd042d2b4ffe0a21c49782af0078732701f591..68049fb4c448be245a2e2d6f1e0bb2f252b53776 100644 (file)
@@ -82,9 +82,7 @@ public class SysdynResource {
     public final Resource HasHead;\r
     public final Resource HasHeadTerminal;\r
     public final Resource HasInitialEquation;\r
-    public final Resource HasInitialEquation_Inverse;\r
     public final Resource HasLookup;\r
-    public final Resource HasLookup_Inverse;\r
     public final Resource HasMaxX;\r
     public final Resource HasMaxX_Inverse;\r
     public final Resource HasMaxY;\r
@@ -187,7 +185,10 @@ public class SysdynResource {
     public final Resource SysdynModuleLibrary;\r
     public final Resource SysdynTerminal;\r
     public final Resource Validations;\r
-    public final Resource Validations_DependencyConnections;\r
+    public final Resource Validations_DependencyConnectionsIssueSource;\r
+    public final Resource Validations_dependencyBaseRealizationFunction;\r
+    public final Resource Validations_dependencySynchronizer;\r
+    public final Resource Validations_dependencyValidator;\r
     public final Resource Valve;\r
     public final Resource ValveSymbol;\r
     public final Resource Variable;\r
@@ -272,9 +273,7 @@ public class SysdynResource {
         public static final String HasHead = "http://www.simantics.org/Sysdyn-1.0/HasHead";\r
         public static final String HasHeadTerminal = "http://www.simantics.org/Sysdyn-1.0/HasHeadTerminal";\r
         public static final String HasInitialEquation = "http://www.simantics.org/Sysdyn-1.0/HasInitialEquation";\r
-        public static final String HasInitialEquation_Inverse = "http://www.simantics.org/Sysdyn-1.0/HasInitialEquation/Inverse";\r
         public static final String HasLookup = "http://www.simantics.org/Sysdyn-1.0/HasLookup";\r
-        public static final String HasLookup_Inverse = "http://www.simantics.org/Sysdyn-1.0/HasLookup/Inverse";\r
         public static final String HasMaxX = "http://www.simantics.org/Sysdyn-1.0/HasMaxX";\r
         public static final String HasMaxX_Inverse = "http://www.simantics.org/Sysdyn-1.0/HasMaxX/Inverse";\r
         public static final String HasMaxY = "http://www.simantics.org/Sysdyn-1.0/HasMaxY";\r
@@ -377,7 +376,10 @@ public class SysdynResource {
         public static final String SysdynModuleLibrary = "http://www.simantics.org/Sysdyn-1.0/SysdynModuleLibrary";\r
         public static final String SysdynTerminal = "http://www.simantics.org/Sysdyn-1.0/SysdynTerminal";\r
         public static final String Validations = "http://www.simantics.org/Sysdyn-1.0/Validations";\r
-        public static final String Validations_DependencyConnections = "http://www.simantics.org/Sysdyn-1.0/Validations/DependencyConnections";\r
+        public static final String Validations_DependencyConnectionsIssueSource = "http://www.simantics.org/Sysdyn-1.0/Validations/DependencyConnectionsIssueSource";\r
+        public static final String Validations_dependencyBaseRealizationFunction = "http://www.simantics.org/Sysdyn-1.0/Validations/dependencyBaseRealizationFunction";\r
+        public static final String Validations_dependencySynchronizer = "http://www.simantics.org/Sysdyn-1.0/Validations/dependencySynchronizer";\r
+        public static final String Validations_dependencyValidator = "http://www.simantics.org/Sysdyn-1.0/Validations/dependencyValidator";\r
         public static final String Valve = "http://www.simantics.org/Sysdyn-1.0/Valve";\r
         public static final String ValveSymbol = "http://www.simantics.org/Sysdyn-1.0/ValveSymbol";\r
         public static final String Variable = "http://www.simantics.org/Sysdyn-1.0/Variable";\r
@@ -472,9 +474,7 @@ public class SysdynResource {
         HasHead = getResourceOrNull(graph, URIs.HasHead);\r
         HasHeadTerminal = getResourceOrNull(graph, URIs.HasHeadTerminal);\r
         HasInitialEquation = getResourceOrNull(graph, URIs.HasInitialEquation);\r
-        HasInitialEquation_Inverse = getResourceOrNull(graph, URIs.HasInitialEquation_Inverse);\r
         HasLookup = getResourceOrNull(graph, URIs.HasLookup);\r
-        HasLookup_Inverse = getResourceOrNull(graph, URIs.HasLookup_Inverse);\r
         HasMaxX = getResourceOrNull(graph, URIs.HasMaxX);\r
         HasMaxX_Inverse = getResourceOrNull(graph, URIs.HasMaxX_Inverse);\r
         HasMaxY = getResourceOrNull(graph, URIs.HasMaxY);\r
@@ -577,7 +577,10 @@ public class SysdynResource {
         SysdynModuleLibrary = getResourceOrNull(graph, URIs.SysdynModuleLibrary);\r
         SysdynTerminal = getResourceOrNull(graph, URIs.SysdynTerminal);\r
         Validations = getResourceOrNull(graph, URIs.Validations);\r
-        Validations_DependencyConnections = getResourceOrNull(graph, URIs.Validations_DependencyConnections);\r
+        Validations_DependencyConnectionsIssueSource = getResourceOrNull(graph, URIs.Validations_DependencyConnectionsIssueSource);\r
+        Validations_dependencyBaseRealizationFunction = getResourceOrNull(graph, URIs.Validations_dependencyBaseRealizationFunction);\r
+        Validations_dependencySynchronizer = getResourceOrNull(graph, URIs.Validations_dependencySynchronizer);\r
+        Validations_dependencyValidator = getResourceOrNull(graph, URIs.Validations_dependencyValidator);\r
         Valve = getResourceOrNull(graph, URIs.Valve);\r
         ValveSymbol = getResourceOrNull(graph, URIs.ValveSymbol);\r
         Variable = getResourceOrNull(graph, URIs.Variable);\r
index 454d59a4d061e6ccd26b7f0f969ddcae7614baeb..edbfeb085f6da13cb9fddc1d7dba2fb969c13bbe 100644 (file)
@@ -10,5 +10,5 @@
         VTT Technical Research Centre of Finland - initial API and implementation\r
  -->\r
 
-<adapters>\r\r   <target interface="org.simantics.db.layer0.adapter.Realization">\r               <type uri="http://www.simantics.org/Sysdyn-1.0/Module"\r                 class="org.simantics.structural2.realization.StructuralRealization">\r                   <this />\r               </type>\r        </target>\r\r<!-- \r       <target interface="org.simantics.db.layer0.variable.Variable">\r         <type uri="http://www.simantics.org/Sysdyn-1.0/HistoryRealization"\r                     class="org.simantics.sysdyn.ui.project.HistoryVariable" >\r                      <this />\r               </type>\r                <type uri="http://www.simantics.org/Sysdyn-1.0/DefaultRealization"\r                     class="org.simantics.sysdyn.ui.project.DefaultVariable" >\r                      <this />\r               </type>\r        </target>\r -->\r\r        <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r      <type uri = "http://www.simantics.org/Sysdyn-1.0/DiagramToCompositeMapping"\r          class = "org.simantics.sysdyn.ui.editor.DiagramToCompositeMapping3">\r         <graph/>\r           <this />\r       </type>\r        </target>\r      \r       <target interface="org.simantics.structural.ui.modelBrowser.nodes.AbstractNode">\r               <type uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r                    class="org.simantics.structural.ui.modelBrowser.nodes.ModelNode">\r                      <this />\r               </type>\r        </target>               \r               \r\r      <target\r                interface="org.simantics.browsing.ui.common.node.AbstractNode">\r                <type\r                  uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r                  class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r                       <this />\r               </type>\r\r               <resource\r                      uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r                 class="org.simantics.sysdyn.ui.browser.nodes.SymbolNode">\r                      <this />\r               </resource>\r\r           <type\r                  uri="http://www.simantics.org/Simulation-1.0/Experiment"\r                       class="org.simantics.sysdyn.ui.browser.nodes.ExperimentNode">\r                  <this />\r               </type>\r                \r               <type\r                  uri="http://www.simantics.org/Sysdyn-1.0/Result"\r                       class="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode">\r                    <this />\r               </type>\r                \r       </target>\r\r     <!-- Inject default connection routing algorithm for sysdyn diagrams -->\r       <target interface="org.simantics.g2d.diagram.DiagramClass">\r            <adapter uri="http://www.simantics.org/Sysdyn-1.0/ConfigurationDiagram"\r                        adapterClass="org.simantics.sysdyn.ui.elements2.ConfigurationDiagramClassAdapter" />\r   </target>\r\r     <!-- Sysdyn symbols -->\r        <target interface="org.simantics.diagram.adapter.ElementFactory">\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r                       class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <resource uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r                    class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <resource uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r             <type uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r                   class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <type uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r                        class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <type uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.InputFactory" />                       \r       </target>\r      \r       <!-- Sysdyn connections -->\r    <target interface="org.simantics.diagram.adapter.ElementFactory">\r              <!-- Edges -->\r         <resource uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                     class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r               <resource uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                       class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r               <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <!-- : SYSDYN.Connection-->\r            <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowConnectionFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyConnectionFactory" />\r   </target>\r      \r       <target interface="org.simantics.g2d.connection.EdgeVisualsConfigurer">\r          <baseType uri="http://www.simantics.org/Diagram-2.0/HasConnector" />\r   <resource uri="http://www.simantics.org/Diagram-2.0/HasPlainConnector"\r          class="org.simantics.diagram.content.ArrowConfigurer">\r         <string>none 0</string>\r       </resource>\r    <resource uri="http://www.simantics.org/Diagram-2.0/HasArrowConnector"\r          class="org.simantics.diagram.content.ArrowConfigurer">\r         <string>fill 1</string>\r       </resource>\r  </target>\r      \r       <!-- ModelBrowser2 -->\r \r       <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleTypeChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleContentChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/>            \r    </target>\r    \r    <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleTypeLabelRule"\r            class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r    </target>    \r    \r    <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewModuleType"\r            class="org.simantics.sysdyn.ui.browser.actions.NewModuleTypeAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewEnumeration"\r            class="org.simantics.sysdyn.ui.browser.actions.NewEnumerationAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/OpenWorkbook"\r            class="org.simantics.sysdyn.ui.browser.actions.OpenWorkbookAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunction"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionLibraryAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewSharedFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewSharedFunctionLibraryAction" />            \r    </target>              \r  \r  \r  <!-- ISSUES -->\r    <target interface="org.simantics.db.layer0.adapter.IssueSource">\r        <resource\r            uri="http://www.simantics.org/Sysdyn-1.0/Validations/DependencyConnections"\r            class="org.simantics.sysdyn.ui.validation.DependencyIssueSource">\r            <graph/>\r            <this />\r        </resource>\r    </target>\r
+<adapters>\r\r   <target interface="org.simantics.db.layer0.adapter.Realization">\r               <type uri="http://www.simantics.org/Sysdyn-1.0/Module"\r                 class="org.simantics.structural2.realization.StructuralRealization">\r                   <this />\r               </type>\r        </target>\r\r<!-- \r       <target interface="org.simantics.db.layer0.variable.Variable">\r         <type uri="http://www.simantics.org/Sysdyn-1.0/HistoryRealization"\r                     class="org.simantics.sysdyn.ui.project.HistoryVariable" >\r                      <this />\r               </type>\r                <type uri="http://www.simantics.org/Sysdyn-1.0/DefaultRealization"\r                     class="org.simantics.sysdyn.ui.project.DefaultVariable" >\r                      <this />\r               </type>\r        </target>\r -->\r\r        <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r      <type uri = "http://www.simantics.org/Sysdyn-1.0/DiagramToCompositeMapping"\r          class = "org.simantics.sysdyn.ui.editor.DiagramToCompositeMapping3">\r         <graph/>\r           <this />\r       </type>\r        </target>\r      \r       <target interface="org.simantics.structural.ui.modelBrowser.nodes.AbstractNode">\r               <type uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r                    class="org.simantics.structural.ui.modelBrowser.nodes.ModelNode">\r                      <this />\r               </type>\r        </target>               \r               \r\r      <target\r                interface="org.simantics.browsing.ui.common.node.AbstractNode">\r                <type\r                  uri="http://www.simantics.org/Sysdyn-1.0/SysdynModel"\r                  class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r                       <this />\r               </type>\r\r               <resource\r                      uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r                 class="org.simantics.sysdyn.ui.browser.nodes.SymbolNode">\r                      <this />\r               </resource>\r\r           <type\r                  uri="http://www.simantics.org/Simulation-1.0/Experiment"\r                       class="org.simantics.sysdyn.ui.browser.nodes.ExperimentNode">\r                  <this />\r               </type>\r                \r               <type\r                  uri="http://www.simantics.org/Sysdyn-1.0/Result"\r                       class="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode">\r                    <this />\r               </type>\r                \r       </target>\r\r     <!-- Inject default connection routing algorithm for sysdyn diagrams -->\r       <target interface="org.simantics.g2d.diagram.DiagramClass">\r            <adapter uri="http://www.simantics.org/Sysdyn-1.0/ConfigurationDiagram"\r                        adapterClass="org.simantics.sysdyn.ui.elements2.ConfigurationDiagramClassAdapter" />\r   </target>\r\r     <!-- Sysdyn symbols -->\r        <target interface="org.simantics.diagram.adapter.ElementFactory">\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r                       class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <resource uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r                    class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <resource uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r             <type uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r                   class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <type uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r                        class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <type uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.InputFactory" />                       \r       </target>\r      \r       <!-- Sysdyn connections -->\r    <target interface="org.simantics.diagram.adapter.ElementFactory">\r              <!-- Edges -->\r         <resource uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                     class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r               <resource uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                       class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r               <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <!-- : SYSDYN.Connection-->\r            <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowConnectionFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyConnectionFactory" />\r   </target>\r      \r       <target interface="org.simantics.g2d.connection.EdgeVisualsConfigurer">\r          <baseType uri="http://www.simantics.org/Diagram-2.0/HasConnector" />\r   <resource uri="http://www.simantics.org/Diagram-2.0/HasPlainConnector"\r          class="org.simantics.diagram.content.ArrowConfigurer">\r         <string>none 0</string>\r       </resource>\r    <resource uri="http://www.simantics.org/Diagram-2.0/HasArrowConnector"\r          class="org.simantics.diagram.content.ArrowConfigurer">\r         <string>fill 1</string>\r       </resource>\r  </target>\r      \r       <!-- ModelBrowser2 -->\r \r       <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleTypeChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleContentChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/>            \r    </target>\r    \r    <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleTypeLabelRule"\r            class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r    </target>    \r    \r    <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewModuleType"\r            class="org.simantics.sysdyn.ui.browser.actions.NewModuleTypeAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewEnumeration"\r            class="org.simantics.sysdyn.ui.browser.actions.NewEnumerationAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/OpenWorkbook"\r            class="org.simantics.sysdyn.ui.browser.actions.OpenWorkbookAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunction"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionLibraryAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewSharedFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewSharedFunctionLibraryAction" />            \r    </target>              \r  \r  \r  <!-- ISSUES\r    <target interface="org.simantics.db.layer0.adapter.IssueSource">\r        <resource\r            uri="http://www.simantics.org/Sysdyn-1.0/Validations/DependencyConnections"\r            class="org.simantics.sysdyn.ui.validation.DependencyIssueSource">\r            <graph/>\r            <this />\r        </resource>\r    </target>\r     -->\r
 </adapters>
\ No newline at end of file
index f6fb712b037dde7c840d45e563c3ee8ac6b591ce..bec90398a04bd40ef4959ea92b6a08fce0e19780 100644 (file)
             name="Export Function Library">\r
       </wizard>\r
    </extension>\r
+   \r
+   <extension point="org.simantics.scl.reflection.binding">\r
+      <namespace path="http://www.simantics.org/Sysdyn-1.0/Validations">\r
+         <class className="org.simantics.sysdyn.ui.validation.DependencyFunction"/>\r
+      </namespace>\r
+   </extension>\r
 </plugin>\r
index ca0af77e50d74497408947f83a854b0fb16ed1cc..377d91d68a57196efd84488391eaa8b093b0e1af 100644 (file)
@@ -13,7 +13,6 @@ package org.simantics.sysdyn.ui.project;
 \r
 import java.io.File;\r
 import java.util.HashMap;\r
-import java.util.Map;\r
 \r
 import org.eclipse.core.runtime.Platform;\r
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;\r
@@ -26,19 +25,21 @@ import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;\r
 import org.simantics.db.Session;\r
 import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.procedure.single.SingleSetSyncListener;\r
+import org.simantics.db.common.changeset.GenericChangeListener;\r
 import org.simantics.db.common.request.Queries;\r
+import org.simantics.db.common.request.ReadRequest;\r
 import org.simantics.db.common.request.WriteRequest;\r
-import org.simantics.db.common.utils.Logger;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.adapter.RuntimeValuations;\r
 import org.simantics.db.layer0.adapter.TrendVariable;\r
+import org.simantics.db.layer0.genericrelation.DependenciesRelation.DependencyChangesRequest;\r
+import org.simantics.db.layer0.genericrelation.DependencyChanges;\r
 import org.simantics.db.layer0.service.ActivationManager;\r
 import org.simantics.db.request.Read;\r
 import org.simantics.db.service.GraphChangeListenerSupport;\r
 import org.simantics.db.service.LifecycleSupport;\r
 import org.simantics.db.service.VirtualGraphSupport;\r
-import org.simantics.issues.common.IssueSource;\r
+import org.simantics.issues.common.IssueUtil;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.services.CaseInsensitiveComponentNamingStrategy2;\r
 import org.simantics.modeling.services.ComponentNamingStrategy;\r
@@ -54,7 +55,6 @@ import org.simantics.simulation.project.IExperimentManager;
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.Activator;\r
 import org.simantics.sysdyn.ui.editor.SysdynEditorNamingService;\r
-import org.simantics.sysdyn.ui.validation.ActiveIssueSources;\r
 import org.simantics.ui.workbench.IEditorNamingService;\r
 import org.simantics.ui.workbench.action.ChooseActionRequest;\r
 import org.simantics.ui.workbench.project.UIModelManager;\r
@@ -196,76 +196,16 @@ public class SysdynProject extends AbstractProjectFeature {
         \r
         \r
         // Issues\r
-        \r
         try {\r
-            \r
-            session.syncRequest(new ActiveIssueSources(project.get()), new SingleSetSyncListener<Resource>() {\r
-\r
-                Map<Resource, IssueSource> sources = new HashMap<Resource, IssueSource>();\r
-                Map<Resource, Runnable> listeners = new HashMap<Resource, Runnable>();\r
-                \r
-                @Override\r
-                public void add(ReadGraph graph, final Resource source) throws DatabaseException {\r
-                    final IssueSource is = graph.adapt(source, IssueSource.class);\r
-                    if(is != null) {\r
-\r
-                        Runnable listener = new Runnable() {\r
-\r
-                            @Override\r
-                            public void run() {\r
-\r
-                                project.getSession().asyncRequest(new WriteRequest() {\r
-\r
-                                    @Override\r
-                                    public void perform(WriteGraph graph) throws DatabaseException {\r
-                                        is.update(graph);\r
-                                    }\r
-\r
-                                });\r
-\r
-                            }\r
-\r
-                        };\r
-\r
-                        is.addDirtyListener(listener);\r
-                        sources.put(source, is);\r
-                        listeners.put(source, listener);\r
-\r
-                    } else {\r
-\r
-                        System.err.println("Issue source " + source + " does not have adapter!");\r
-\r
-                    }\r
-\r
-                }\r
-\r
+            session.syncRequest(new ReadRequest() {\r
                 @Override\r
-                public void remove(ReadGraph graph, final Resource source) throws DatabaseException {\r
-\r
-                    IssueSource is = sources.get(source);\r
-                    Runnable listener = listeners.get(source);\r
-                    if(is != null && listener != null) {\r
-                        is.removeDirtyListener(listener);\r
-                    }\r
-                    sources.remove(source);\r
-\r
-                }\r
-\r
-                @Override\r
-                public void exception(ReadGraph graph, Throwable t) {\r
-                 Logger.defaultLogError(t);\r
+                public void run(ReadGraph graph) throws DatabaseException {\r
+                    onActivated(graph, getProject());\r
                 }\r
-\r
-                @Override\r
-                public boolean isDisposed() {\r
-                    return false;\r
-                }\r
-\r
             });\r
         } catch (DatabaseException e) {\r
-            e.printStackTrace();\r
+            throw new ProjectException(e);\r
         }\r
-     \r
     }\r
 \r
     @Override\r
@@ -339,5 +279,24 @@ public class SysdynProject extends AbstractProjectFeature {
             }\r
         }\r
     }\r
+    \r
+    public void onActivated(final ReadGraph graph, final IProject project) throws DatabaseException {\r
+        \r
+        GraphChangeListenerSupport changeSupport = graph.getService(GraphChangeListenerSupport.class);\r
+        changeSupport.addMetadataListener(new GenericChangeListener<DependencyChangesRequest, DependencyChanges>() {\r
+\r
+            @Override\r
+            public void onEvent(ReadGraph graph, DependencyChanges event) throws DatabaseException {\r
+\r
+                WriteGraph w = (WriteGraph)graph;\r
+                w.addMetadata(event);\r
+\r
+            }\r
+\r
+        });\r
+        \r
+        \r
+        IssueUtil.listenActiveProjectIssueSources(graph, project.get());\r
+    }\r
 \r
 }\r
index ba68d2c95425ee212d9c659f0a57bf266008a54f..ea0808ebae1f5e763f9f2cb2b0641970f2d7516c 100644 (file)
@@ -198,6 +198,7 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget {
                                                        graph.claimLiteral(expression, sr.HasInitialEquation, "");\r
                                                }\r
                                                OrderedSetUtils.add(graph, expressions, expression);\r
+                                               graph.claim(variable, l0.ConsistsOf, expression);\r
 \r
                                                VirtualGraphSupport support = graph.getService(VirtualGraphSupport.class);\r
                                                final Session session = graph.getSession();\r
@@ -305,6 +306,8 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget {
                        throws DatabaseException {\r
 \r
                                SysdynResource sr = SysdynResource.getInstance(graph);\r
+                               Layer0 l0 = Layer0.getInstance(graph);\r
+                               \r
                                Resource activeExpression = graph.getPossibleObject(input, sr.HasActiveExpression);\r
                                if(activeExpression == null)\r
                                        return;\r
@@ -315,6 +318,8 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget {
 \r
                                Resource prev = OrderedSetUtils.prev(graph, expressionList, activeExpression);\r
                                OrderedSetUtils.remove(graph, expressionList, activeExpression);\r
+                               graph.deny(input, l0.ConsistsOf, activeExpression);\r
+                               \r
                                if(prev.equals(expressionList)) {\r
                                        Iterator<Resource> iterator = OrderedSetUtils.iterator(graph, expressionList);\r
                                        prev = iterator.next();\r
@@ -365,6 +370,7 @@ public class EquationTab extends LabelPropertyTabContributor implements Widget {
                                        graph.claim(newExpression, l0.InstanceOf, sr.NormalExpression);\r
                                }\r
                                OrderedSetUtils.add(graph, expressions, newExpression);\r
+                               graph.claim(input, l0.ConsistsOf, newExpression);\r
                        }\r
                });\r
 \r
index e36ffbad7e2e77f21dbe80d4c54a9e78b5844e8e..18083697a394281f45cfb79278224187a45a18ca 100644 (file)
@@ -36,6 +36,7 @@ import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.common.utils.OrderedSetUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.utils.ExpressionUtils;\r
@@ -125,6 +126,8 @@ public class BasicExpression implements IExpression {
                 public void perform(WriteGraph g)\r
                 throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(g);\r
+                    Layer0 l0 = Layer0.getInstance(g);\r
+                    \r
                     if(ExpressionUtils.isParameter(currentText)) {\r
                        if(!expressionType.equals(sr.ConstantExpression))\r
                                expressionType = sr.ParameterExpression;\r
@@ -146,18 +149,21 @@ public class BasicExpression implements IExpression {
                        if(arrayRange != null)\r
                                g.claimLiteral(newExpression, sr.HasArrayRange, arrayRange);\r
                        \r
+                       final Resource variable = g.getSingleObject(ownerList, sr.HasExpressions_Inverse);\r
                        OrderedSetUtils.replace(g, ownerList, expression, newExpression);\r
+                       g.deny(expression, l0.PartOf);\r
+                       g.claim(newExpression, l0.PartOf, variable);\r
+                       \r
                        \r
-                       final Resource activefor = g.getPossibleObject(expression, sr.HasActiveExpression_Inverse);\r
                                                VirtualGraph runtime = g.getService(VirtualGraph.class);\r
                                                g.syncRequest(new WriteRequest(runtime) {\r
                                                        @Override\r
                                                        public void perform(WriteGraph graph) throws DatabaseException {\r
                                                                SysdynResource sr = SysdynResource.getInstance(graph);\r
-                                                               if(activefor != null) {\r
-                                                                       if(graph.hasStatement(activefor, sr.HasActiveExpression))\r
-                                                                               graph.deny(activefor, sr.HasActiveExpression);\r
-                                                                       graph.claim(activefor, sr.HasActiveExpression, newExpression);\r
+                                                               if(variable != null) {\r
+                                                                       if(graph.hasStatement(variable, sr.HasActiveExpression))\r
+                                                                               graph.deny(variable, sr.HasActiveExpression);\r
+                                                                       graph.claim(variable, sr.HasActiveExpression, newExpression);\r
                                                                }\r
                                                        }\r
                                                }\r
index fbee902cd6604c680cc285f09dd31eaf49693ca5..4f9698b34619321534150150ab90efab70716f12 100644 (file)
@@ -147,7 +147,11 @@ public class StockExpression implements IExpression {
                                g.deny(expression, predicate);\r
                        }\r
                        g.claim(expression, l0.InstanceOf, null, sr.StockExpression);\r
-                       OrderedSetUtils.replace(g, expressionList, temp, expression);\r
+                       \r
+                        Resource variable = g.getSingleObject(expressionList, sr.HasExpressions_Inverse);\r
+                        OrderedSetUtils.replace(g, expressionList, temp, expression);\r
+                        g.deny(expression, l0.PartOf);\r
+                        g.claim(expression, l0.PartOf, variable);\r
                     }\r
                     g.claimLiteral(expression, sr.HasInitialEquation, currentText);\r
                 }\r
index c60fca1922049cdf43fe7eaa9cc31787f9d82a6a..9af73a64b5d60aa6c4e71aa77874da65f9726281 100644 (file)
@@ -57,6 +57,7 @@ import org.simantics.db.common.utils.OrderedSetUtils;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.procedure.Listener;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.tableParser.ParseException;\r
@@ -265,6 +266,8 @@ public class WithLookupExpression implements IExpression {
                 public void perform(WriteGraph g)\r
                 throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(g);\r
+                    Layer0 l0 = Layer0.getInstance(g);\r
+                    \r
                     if(!g.isInstanceOf(expr, sr.WithLookupExpression)) {\r
                        \r
                        \r
@@ -278,16 +281,19 @@ public class WithLookupExpression implements IExpression {
                        if(arrayRange != null)\r
                                g.claimLiteral(newExpression, sr.HasArrayRange, arrayRange);\r
                        \r
-                       OrderedSetUtils.replace(g, ownerList, expr, newExpression);\r
-                       final Resource activefor = g.getPossibleObject(expression, sr.HasActiveExpression_Inverse);\r
+                        final Resource variable = g.getSingleObject(ownerList, sr.HasExpressions_Inverse);\r
+                        OrderedSetUtils.replace(g, ownerList, expression, newExpression);\r
+                        g.deny(expression, l0.PartOf);\r
+                        g.claim(newExpression, l0.PartOf, variable);\r
+                        \r
                                                VirtualGraph runtime = g.getService(VirtualGraph.class);\r
                                                g.syncRequest(new WriteRequest(runtime) {\r
                                                        @Override\r
                                                        public void perform(WriteGraph graph) throws DatabaseException {\r
                                                                SysdynResource sr = SysdynResource.getInstance(graph);\r
-                                                               if(graph.hasStatement(activefor, sr.HasActiveExpression))\r
-                                                                       graph.deny(activefor, sr.HasActiveExpression);\r
-                                                               graph.claim(activefor, sr.HasActiveExpression, newExpression);\r
+                                                               if(graph.hasStatement(variable, sr.HasActiveExpression))\r
+                                                                       graph.deny(variable, sr.HasActiveExpression);\r
+                                                               graph.claim(variable, sr.HasActiveExpression, newExpression);\r
                                                        }\r
                                                }\r
                                                );\r
index f1fb5d894d4dab52ef2c2077ff6ab14dbe9f2e26..088d67fe8f4aba793901ed785835c3666bcafcbb 100644 (file)
@@ -73,9 +73,14 @@ public class ModelUtils {
                     l0.PartOf, project,\r
                     l0.HasName, modelName,\r
                     l0.HasLabel, modelName,\r
-                    L0X.IsActivatedBy, project,\r
-                    L0X.Activates, sr.Validations_DependencyConnections\r
-            );\r
+                    L0X.IsActivatedBy, project\r
+                    );\r
+\r
+            GraphUtils.create2(g,\r
+                    sr.Validations_DependencyConnectionsIssueSource,\r
+                    L0X.IsActivatedBy, model,\r
+                    l0.PartOf, model\r
+                    );\r
 \r
             Resource conf = GraphUtils.create2(g,\r
                     sr.Configuration,\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ActiveIssueSources.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/ActiveIssueSources.java
deleted file mode 100644 (file)
index 06229d9..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.simantics.sysdyn.ui.validation;\r
-\r
-import java.util.Collection;\r
-import java.util.HashSet;\r
-import java.util.Set;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.ObjectsWithType;\r
-import org.simantics.db.common.request.ResourceRead;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.issues.ontology.IssueResource;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.operation.Layer0X;\r
-import org.simantics.sysdyn.SysdynResource;\r
-\r
-public class ActiveIssueSources extends ResourceRead<Collection<Resource>> {\r
-    \r
-    Resource project;\r
-    \r
-    public ActiveIssueSources(Resource project) {\r
-        super(project);\r
-        this.project = project;\r
-    }\r
-\r
-    @Override\r
-    public Set<Resource> perform(ReadGraph graph) throws DatabaseException {\r
-        \r
-        SysdynResource sr = SysdynResource.getInstance(graph);\r
-        Layer0 l0 = Layer0.getInstance(graph);\r
-        Layer0X l0X = Layer0X.getInstance(graph);\r
-        IssueResource ISSUE = IssueResource.getInstance(graph);\r
-        \r
-        HashSet<Resource> result = new HashSet<Resource>();\r
-        \r
-        for(Resource model : graph.syncRequest(new ObjectsWithType(project, l0.ConsistsOf, sr.SysdynModel))) {\r
-            result.addAll(graph.syncRequest(new ObjectsWithType(model, l0X.Activates,  ISSUE.IssueSource)));\r
-        }\r
-        \r
-        return result;\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java
new file mode 100644 (file)
index 0000000..e719058
--- /dev/null
@@ -0,0 +1,261 @@
+package org.simantics.sysdyn.ui.validation;\r
+\r
+import java.io.StringReader;\r
+import java.text.DateFormat;\r
+import java.text.SimpleDateFormat;\r
+import java.util.Calendar;\r
+import java.util.Collection;\r
+import java.util.HashSet;\r
+import java.util.List;\r
+import java.util.Set;\r
+import java.util.UUID;\r
+\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.ObjectsWithType;\r
+import org.simantics.db.common.utils.OrderedSetUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.issues.ontology.IssueResource;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.scl.reflection.annotations.SCLValue;\r
+import org.simantics.simulation.ontology.SimulationResource;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.expressionParser.ExpressionParser;\r
+import org.simantics.sysdyn.expressionParser.ParseException;\r
+import org.simantics.sysdyn.expressionParser.TokenMgrError;\r
+\r
+public class DependencyFunction {\r
+\r
+\r
+    private static String getMissingLinkLabel(String name, String dependency) throws DatabaseException {\r
+        String label = "Missing link " + dependency + " in " + name;\r
+        return label;\r
+    }\r
+    \r
+    private static String getUnusedDependencyLabel(String name, String dependency) throws DatabaseException {\r
+        String label = "Unused dependency " + dependency + " in " + name;\r
+        return label;\r
+    }\r
+\r
+    /**\r
+     * \r
+     * One issue is enough. The first encounter of a new issue returns Boolean.FALSE.\r
+     * \r
+     * @param _graph\r
+     * @param _resource\r
+     * @param _existing\r
+     * @return\r
+     * @throws DatabaseException\r
+     */\r
+    @SCLValue(type = "a -> b -> c -> d")\r
+    public static Object dependencyValidator(Object _graph, Object _resource, Object _existing) throws DatabaseException {\r
+\r
+        ReadGraph graph = (ReadGraph)_graph;\r
+        Resource variable = (Resource)_resource;\r
+        Collection<Resource> existing = (Collection<Resource>)_existing;\r
+\r
+        Set<String> references = getReferences(graph, variable);\r
+        Set<String> dependencies = getDependencies(graph, variable);\r
+        \r
+        String name = graph.getRelatedValue(variable, Layer0.getInstance(graph).HasName, Bindings.STRING);\r
+        \r
+        for(String reference : references) {\r
+            if(!dependencies.contains(reference) && match(graph, existing, variable, getMissingLinkLabel(name, reference)) == null)\r
+                return Boolean.FALSE;\r
+        }\r
+        \r
+        for(String dependency : dependencies) {\r
+            if(!references.contains(dependency) && match(graph, existing, variable, getUnusedDependencyLabel(name, dependency)) == null)\r
+                return Boolean.FALSE;\r
+        }\r
+        \r
+        \r
+        /*\r
+         * See if there are any unnecessary issues in existing\r
+         * \r
+         * FIXME: Currently there are no other issues, so this can check ALL issues.\r
+         */\r
+        IssueResource ISSUE = IssueResource.getInstance(graph);\r
+\r
+        for(Resource exist : existing) {\r
+            if(variable.equals(graph.getSingleObject(exist, ISSUE.HasIssueContext))) {\r
+                return Boolean.FALSE;\r
+            }\r
+        }\r
+        System.out.println("NOTHING");\r
+        return Boolean.TRUE;\r
+    }\r
+\r
+    @SCLValue(type = "a -> b -> c -> d -> e -> f")\r
+    public static Object dependencySynchronizer(Object _graph, Object _resource, Object _source, Object _model, Object _existing) throws DatabaseException {\r
+\r
+        WriteGraph graph = (WriteGraph)_graph;\r
+        Resource variable = (Resource)_resource;\r
+        Resource model = (Resource)_model;\r
+        Resource source = (Resource)_source;\r
+        Collection<Resource> existing = (Collection<Resource>)_existing;\r
+        Layer0 L0 = Layer0.getInstance(graph);\r
+\r
+        Set<String> references = getReferences(graph, variable);\r
+        Set<String> dependencies = getDependencies(graph, variable);\r
+\r
+        \r
+        String name = graph.getRelatedValue(variable, L0.HasName, Bindings.STRING);\r
+        \r
+        System.out.println("SOME CHANGE IN " + name + "(existing: " + existing.size() + ")");\r
+        \r
+        Set<String> labels = new HashSet<String>();\r
+        String label;\r
+        Resource issue;\r
+        \r
+        for(String reference : references) {\r
+            label = getMissingLinkLabel(name, reference);\r
+            if(!dependencies.contains(reference)) {\r
+                labels.add(label);\r
+                if(match(graph, existing, variable, label) == null) {\r
+                    createIssue(graph, model, source, variable, label);\r
+                }\r
+            } \r
+            /*else {\r
+                if((issue = match(graph, existing, variable, label)) != null) {\r
+                    removeIssue(graph, model, source, variable, issue, existing);\r
+                }\r
+            }*/\r
+        }\r
+        \r
+        for(String dependency : dependencies) {\r
+            label = getUnusedDependencyLabel(name, dependency);\r
+            if(!references.contains(dependency)) {\r
+                labels.add(label);\r
+                if(match(graph, existing, variable, label) == null) {\r
+                    createIssue(graph, model, source, variable, label);\r
+                }\r
+            }\r
+            \r
+            /*else {\r
+                if((issue = match(graph, existing, variable, label)) != null) {\r
+                    removeIssue(graph, model, source, variable, issue, existing);\r
+                }\r
+            }*/\r
+        }\r
+        \r
+        Set<Resource> toBeRemoved = new HashSet<Resource>();\r
+        for(Resource exist : existing) {\r
+            String l = graph.getRelatedValue(exist, L0.HasLabel);\r
+            Resource i = graph.getSingleObject(exist, IssueResource.getInstance(graph).HasIssueContext);\r
+            if(variable.equals(i) && !labels.contains(l))\r
+                toBeRemoved.add(exist);\r
+        }\r
+        \r
+        for(Resource r : toBeRemoved) {\r
+            removeIssue(graph, model, source, variable, r, existing);\r
+        }\r
+        \r
+\r
+        return Boolean.TRUE;\r
+\r
+    }\r
+    \r
+    private static Resource createIssue(WriteGraph graph, Resource model, Resource source, Resource variable, String label) throws DatabaseException {\r
+        System.out.println("CREATE ISSUE: " + label);\r
+        Layer0 L0 = Layer0.getInstance(graph);\r
+        IssueResource ISSUE = IssueResource.getInstance(graph);\r
+        \r
+        Resource issue = graph.newResource();\r
+        graph.claim(issue, L0.InstanceOf, null, ISSUE.Issue);\r
+        graph.claim(issue, ISSUE.HasIssueContext, null, variable);\r
+        graph.claim(issue, ISSUE.HasSeverity, ISSUE.Severity_Error);\r
+        graph.claimLiteral(issue, L0.HasLabel, label, Bindings.STRING);\r
+        graph.claimLiteral(issue, L0.HasName, UUID.randomUUID().toString(), Bindings.STRING);\r
+        DateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");\r
+        String created = format.format(Calendar.getInstance().getTime());\r
+        graph.claimLiteral(issue, ISSUE.HasCreationTime, created, Bindings.STRING);\r
+        graph.claim(source, ISSUE.Manages, issue);\r
+        graph.claim(model, L0.ConsistsOf, issue);    \r
+        return issue;\r
+    }\r
+    \r
+    private static void removeIssue(WriteGraph graph, Resource model, Resource source, Resource variable, Resource issue, Collection<Resource> existing) throws DatabaseException {\r
+        System.out.println("REMOVE ISSUE: " + graph.getRelatedValue(issue, Layer0.getInstance(graph).HasLabel));\r
+        graph.deny(issue, Layer0.getInstance(graph).PartOf);\r
+        graph.deny(source, IssueResource.getInstance(graph).Manages, issue);\r
+        existing.remove(issue);\r
+    }\r
+\r
+    @SCLValue(type = "a -> b -> c")\r
+    public static Object dependencyBaseRealizationFunction(Object _graph, Object _model) throws DatabaseException {\r
+        ReadGraph graph = (ReadGraph)_graph;\r
+        Resource model = (Resource)_model;\r
+        return graph.getSingleObject(model, SimulationResource.getInstance(graph).HasConfiguration);\r
+\r
+    }\r
+\r
+\r
+    private static Resource match(ReadGraph graph, Collection<Resource> existing, Resource variable, String description) throws DatabaseException {\r
+        Layer0 L0 = Layer0.getInstance(graph);\r
+        IssueResource ISSUE = IssueResource.getInstance(graph);\r
+        for(Resource exist : existing) {\r
+            Resource source = graph.getSingleObject(exist, ISSUE.HasIssueContext);\r
+            String desc = graph.getRelatedValue(exist, L0.HasLabel);\r
+//            if(source.equals(variable) && desc.startsWith(description.substring(0, description.lastIndexOf(" ")))) return exist;\r
+            if(source.equals(variable) && desc.equals(description)) return exist;\r
+        }\r
+        return null;\r
+    }\r
+    \r
+    // Returns the names of the related variables (dependencies)\r
+    private static HashSet<String> getDependencies(ReadGraph graph, Resource r) throws DatabaseException {\r
+        HashSet<String> variables = new HashSet<String>();\r
+        if(graph != null && r != null) {\r
+            SysdynResource sr = SysdynResource.getInstance(graph);\r
+            Layer0 l0 = Layer0.getInstance(graph);\r
+\r
+            Collection<Resource> dependencies = graph.getObjects(r, sr.IsHeadOf);\r
+\r
+            for(Resource d : dependencies) {\r
+                if(graph.isInstanceOf(d, sr.Dependency)) {\r
+                    Resource tail = graph.getPossibleObject(d, sr.HasTail);\r
+                    if(tail != null) {\r
+                        Object name = graph.getPossibleRelatedValue(tail, l0.HasName);\r
+                        if(name != null)\r
+                            variables.add((String)name);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return variables;\r
+    }\r
+    \r
+    private static HashSet<String> getReferences(ReadGraph graph, Resource r) throws DatabaseException {\r
+        HashSet<String> references = new HashSet<String>();\r
+        ExpressionParser parser = new ExpressionParser(new StringReader(""));\r
+\r
+        SysdynResource sr = SysdynResource.getInstance(graph);\r
+        Layer0 l0 = Layer0.getInstance(graph);\r
+        Resource hasExpressions = graph.getPossibleObject(r, sr.HasExpressions);\r
+        if(hasExpressions != null){\r
+            List<Resource> expressionList = OrderedSetUtils.toList(graph, hasExpressions);\r
+            for(Resource expression : expressionList) {\r
+                for(Resource s : graph.syncRequest(new ObjectsWithType(expression, sr.HasEquation, l0.String))) {\r
+                    String value = graph.getValue(s, Bindings.STRING);\r
+                    parser.ReInit(new StringReader(value));\r
+                    try {\r
+                        parser.expr();\r
+                        references.addAll(parser.getReferences().keySet());\r
+                    } catch (ParseException e1) {\r
+                        // TODO: Issue\r
+                        System.out.println("SYNTAX ERROR");\r
+//                        ef.setSyntaxError(e1.currentToken, "Syntax Error");\r
+                    } catch (TokenMgrError err) {\r
+                        // TODO: Issue\r
+                        System.out.println("UNSUPPORTED CHARACTERS");\r
+//                        ef.setSyntaxError(0, textString.length(), ExpressionField.SYNTAX_ERROR, "Expression contains unsupported characters");\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return references;\r
+    }\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyIssueSource.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyIssueSource.java
deleted file mode 100644 (file)
index 93b75a5..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.simantics.sysdyn.ui.validation;\r
-\r
-import java.util.concurrent.CopyOnWriteArraySet;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.changeset.GenericChangeListener;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.genericrelation.DependenciesRelation.DependencyChangesRequest;\r
-import org.simantics.db.layer0.genericrelation.DependencyChanges;\r
-import org.simantics.db.layer0.util.Simantics;\r
-import org.simantics.db.service.GraphChangeListenerSupport;\r
-import org.simantics.issues.common.IssueSource;\r
-import org.simantics.issues.common.IssueSourceUtils;\r
-import org.simantics.operation.Layer0X;\r
-import org.simantics.sysdyn.SysdynResource;\r
-\r
-public class DependencyIssueSource implements IssueSource {\r
-\r
-    private Resource source;\r
-    private Resource model;\r
-    private Resource baseRealization;\r
-\r
-    private CopyOnWriteArraySet<Runnable> listeners = new CopyOnWriteArraySet<Runnable>();\r
-    private boolean tracking = false;\r
-\r
-    public DependencyIssueSource(ReadGraph graph, Resource source) throws DatabaseException {\r
-        Layer0X L0X = Layer0X.getInstance(graph);\r
-        this.source = source;\r
-        this.model = graph.getSingleObject(source, L0X.IsActivatedBy);\r
-        this.baseRealization = graph.getSingleObject(model, L0X.HasBaseRealization);\r
-    }\r
-\r
-    @Override\r
-    public void addDirtyListener(Runnable runnable) {\r
-\r
-        boolean added = listeners.add(runnable);\r
-        if(added && !tracking) {\r
-\r
-            GraphChangeListenerSupport changeSupport = Simantics.getSession().getService(GraphChangeListenerSupport.class);\r
-            changeSupport.addMetadataListener(new GenericChangeListener<DependencyChangesRequest, DependencyChanges>() {\r
-\r
-                @Override\r
-                public void onEvent(ReadGraph graph, DependencyChanges event) throws DatabaseException {\r
-                    if(IssueSourceUtils.hasChanges(graph, event, model, baseRealization)) {\r
-                        for(Runnable r : listeners) {\r
-                            r.run();\r
-                        }\r
-                    }\r
-\r
-                }\r
-\r
-            });\r
-\r
-        }\r
-\r
-    }\r
-\r
-    @Override\r
-    public void removeDirtyListener(Runnable runnable) {\r
-        listeners.remove(runnable);\r
-    }\r
-\r
-    @Override\r
-    public void update(WriteGraph graph) throws DatabaseException {\r
-\r
-        SysdynResource sr = SysdynResource.getInstance(graph);\r
-\r
-        for(Resource unit : IssueSourceUtils.getChangedDependencies(graph, source, model, baseRealization, sr.Variable)) {\r
-            if(!graph.syncRequest(new DependencyValidator(unit, model))) new DependencySynchronizer(unit, model).perform(graph);\r
-        }\r
-\r
-        IssueSourceUtils.claimUpdated(graph, source);\r
-\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyIssues.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyIssues.java
deleted file mode 100644 (file)
index 3ed195a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.simantics.sysdyn.ui.validation;\r
-\r
-import java.util.HashSet;\r
-import java.util.Set;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.ResourceRead;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.issues.common.AllVisibleIssues;\r
-import org.simantics.issues.ontology.IssueResource;\r
-\r
-public class DependencyIssues extends ResourceRead<Set<Resource>>{\r
-\r
-    public DependencyIssues(Resource resource) {\r
-        super(resource);\r
-    }\r
-\r
-    @Override\r
-    public Set<Resource> perform(ReadGraph graph) throws DatabaseException {\r
-        IssueResource ISSUE = IssueResource.getInstance(graph);\r
-        HashSet<Resource> result = new HashSet<Resource>();\r
-        for (Resource issue : graph.syncRequest(new AllVisibleIssues(resource))) {\r
-            if (ISSUE.Severity_Error.equals(graph.getPossibleObject(issue, ISSUE.HasSeverity)))\r
-                result.add(issue);\r
-        }\r
-        return result;\r
-    }\r
-\r
-}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencySynchronizer.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencySynchronizer.java
deleted file mode 100644 (file)
index 84be096..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.simantics.sysdyn.ui.validation;\r
-\r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.Calendar;\r
-import java.util.Collection;\r
-import java.util.HashSet;\r
-import java.util.Map;\r
-import java.util.Set;\r
-import java.util.UUID;\r
-\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.request.WriteRequest;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.issues.ontology.IssueResource;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.structural.stubs.StructuralResource2;\r
-import org.simantics.utils.datastructures.Pair;\r
-\r
-public class DependencySynchronizer extends WriteRequest {\r
-    public static final boolean DEBUG = true;\r
-    \r
-    final private Resource unit;\r
-    final private Resource model;\r
-\r
-    public DependencySynchronizer(Resource unit, Resource model) {\r
-     this.unit = unit;\r
-     this.model = model;\r
-    }\r
-\r
-    @Override\r
-    public void perform(WriteGraph graph) throws DatabaseException {\r
-\r
-     Layer0 L0 = Layer0.getInstance(graph);\r
-     \r
-     StructuralResource2 sr = StructuralResource2.getInstance(graph);\r
-     IssueResource ISSUE = IssueResource.getInstance(graph);\r
-\r
-     if(DEBUG) System.out.println("Running DependencySynchronizer for " + unit);\r
-\r
-     Set<Resource> set  = graph.syncRequest(new DependencyIssues(model));\r
-     \r
-     if(DEBUG) System.out.println(set.size() + " issues");\r
-     \r
-     /*\r
-     Collection<Resource> removed = new HashSet<Resource>();\r
-\r
-     boolean unitExists = graph.hasStatement(unit);\r
-     if(unitExists) {\r
-     \r
-      removed.addAll(map.values());\r
-    \r
-      for(Resource predicate : graph.getPredicates(unit)) {\r
-       if(graph.isSubrelationOf(predicate, FB.Parameter)) {\r
-        boolean hasIssue = false;\r
-        Resource literal = graph.getPossibleObject(unit, predicate);\r
-        Boolean required = graph.getPossibleRelatedValue(literal, FB.IsRequired, Bindings.BOOLEAN);\r
-        if(required != null && required && !DependencyValidator.excluded(graph, unit)) {\r
-         Boolean def = graph.getPossibleRelatedValue(literal, FB.IsDefault, Bindings.BOOLEAN);\r
-         if(def != null && def) {\r
-          hasIssue = true;\r
-         }\r
-        }\r
-        Resource issue = map.get(Pair.make(unit, predicate)); \r
-        if(hasIssue != (issue != null)) {\r
-         \r
-         if(hasIssue) {\r
-          \r
-          issue = graph.newResource();\r
-          graph.claim(issue, L0.InstanceOf, null, FB.ParameterIssue);\r
-          graph.claim(issue, ISSUE.HasIssueContext, null, unit);\r
-          graph.claim(issue, ISSUE.HasIssueContext, null, predicate);\r
-          graph.claim(issue, ISSUE.HasSeverity, ISSUE.Severity_Error);\r
-          graph.claimValue(issue, L0.HasDescription, "= Missing connection =", Bindings.STRING);\r
-          graph.claimValue(issue, L0.HasName, UUID.randomUUID().toString(), Bindings.STRING);\r
-          DateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");\r
-          String created = format.format(Calendar.getInstance().getTime());\r
-          graph.claimValue(issue, ISSUE.HasCreationTime, created, Bindings.STRING);\r
-          graph.claim(model, L0.ConsistsOf, issue);\r
-          \r
-         } else {\r
-          \r
-          graph.deny(issue, L0.PartOf);\r
-          \r
-         }\r
-         \r
-        }\r
-        \r
-       }\r
-      }\r
-      \r
-     } else {\r
-      \r
-      for(Map.Entry<Pair<Resource, Resource>, Resource> entry : map.entrySet()) {\r
-//       System.err.println("entry " + entry.getKey());\r
-       if(entry.getKey().first.equals(unit)) {\r
-        graph.deny(entry.getValue(), L0.PartOf);\r
-       }\r
-       if(entry.getKey().first == null) {\r
-        graph.deny(entry.getValue(), L0.PartOf);\r
-       }\r
-      }\r
-      \r
-     }\r
-*/\r
-     \r
-    }\r
-    \r
-}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyValidator.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyValidator.java
deleted file mode 100644 (file)
index ffac712..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.simantics.sysdyn.ui.validation;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.ResourceRead2;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.issues.common.impl.DependencyIssue;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.sysdyn.SysdynResource;\r
-import org.simantics.utils.datastructures.Pair;\r
-\r
-public class DependencyValidator extends ResourceRead2<Boolean> {\r
-\r
-    public static final boolean DEBUG = true;\r
-    \r
-    public DependencyValidator(Resource resource, Resource resource2) {\r
-        super(resource, resource2);\r
-    }\r
-\r
-    static boolean excluded(ReadGraph graph, Resource component) throws DatabaseException {\r
-        SysdynResource sr = SysdynResource.getInstance(graph);\r
-        return !graph.isInstanceOf(component, sr.Variable);\r
-    }\r
-\r
-    @Override\r
-    public Boolean perform(ReadGraph graph) throws DatabaseException {\r
-\r
-        Layer0 L0 = Layer0.getInstance(graph);\r
-\r
-        if(DEBUG) System.out.println("Running DependencyValidator for " + resource);\r
-\r
-        //if(!graph.hasStatement(resource, L0.Represents)) return false;\r
-\r
-        if(!graph.hasStatement(resource)) return false;\r
-\r
-        Set<Resource> resources = graph.syncRequest(new DependencyIssues(resource2));\r
-        if(DEBUG) System.out.println(resources.size() + " resources");\r
-\r
-        /*\r
-        Set<Resource> resources = graph.syncRequest(new DependencyIssues(resource2));\r
-        HashMap<Pair<Resource, Resource>, Resource> existing = new HashMap<Pair<Resource, Resource>, Resource>(existing_); \r
-\r
-        for(Resource predicate : graph.getPredicates(resource)) {\r
-            if(graph.isSubrelationOf(predicate, FB.Parameter)) {\r
-                boolean hasIssue = false;\r
-                Resource literal = graph.getPossibleObject(resource, predicate);\r
-                Boolean required = graph.getPossibleRelatedValue(literal, FB.IsRequired, Bindings.BOOLEAN);\r
-                if(required != null && required && !excluded(graph, resource)) {\r
-                    Boolean def = graph.getPossibleRelatedValue(literal, FB.IsDefault, Bindings.BOOLEAN);\r
-                    if(def != null && def) {\r
-                        hasIssue = true;\r
-                        return false;\r
-                    }\r
-                }\r
-                if(hasIssue != existing.containsKey(Pair.make(resource, predicate))) return false;\r
-            }\r
-        }\r
-        */\r
-\r
-        return true;\r
-\r
-    }\r
-\r
-}\r
index 405280436865f2a2306efb804be0cfce47b8f011..126dd35ebe9b22b05a4adf7ef288e312db9889ac 100644 (file)
@@ -53,17 +53,6 @@ public abstract class Variable extends Element {
                        getExpressions().add(e);\r
                }\r
                \r
-               for(Expression e : getExpressions()) {\r
-                       \r
-                       // Get expression from the variable. They have different types\r
-                       Resource expression = getExpression(graph, e);\r
-                       \r
-                       if(e.getRange() != null) {\r
-                               graph.claimLiteral(expression, sr.HasArrayRange, "[" + e.getRange().trim() + "]");\r
-                       }\r
-                       OrderedSetUtils.add(graph, expressionList, expression);\r
-               }\r
-               \r
                Resource arrayIndexList = OrderedSetUtils.create(graph, sr.ArrayIndexes);\r
                \r
 \r
@@ -72,11 +61,22 @@ public abstract class Variable extends Element {
                                l0.HasName, ImportUtils.escapeName(name),\r
                                sr.HasExpressions, expressionList);\r
                graph.claim(variable, mr.Mapped, variable);\r
-               \r
-               \r
+\r
+               for(Expression e : getExpressions()) {\r
+\r
+                   // Get expression from the variable. They have different types\r
+                   Resource expression = getExpression(graph, e);\r
+\r
+                   if(e.getRange() != null) {\r
+                       graph.claimLiteral(expression, sr.HasArrayRange, "[" + e.getRange().trim() + "]");\r
+                   }\r
+                   OrderedSetUtils.add(graph, expressionList, expression);\r
+                   graph.claim(variable, l0.ConsistsOf, expression);\r
+               }\r
+\r
                if(subscripts != null) {\r
-                       for(Subscript sub : subscripts) {\r
-                               if(sub.getResource() != null)\r
+                   for(Subscript sub : subscripts) {\r
+                       if(sub.getResource() != null)\r
                                        OrderedSetUtils.add(graph, arrayIndexList, sub.getResource());\r
                        }\r
                        graph.claim(variable, sr.HasArrayIndexes, arrayIndexList);\r