]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Make sure sysdyn modules can and will have subrelations 51/4351/2
authorJani Mäkinen <jani.makinen@semantum.fi>
Fri, 31 Jul 2020 11:57:36 +0000 (14:57 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 25 Aug 2020 09:36:08 +0000 (09:36 +0000)
gitlab #55

Change-Id: Iaa61ffd646b8dbf093ecc37a2bc2f0cbec2a0716

bundles/org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph
bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/newActions/NewModuleTypeAction.java

index 965ec3d58f4edcaa5f393f9b22a554002e79a52c..8037feceefda00def6376db5150a0bfe73e105a2 100644 (file)
@@ -155,7 +155,9 @@ SYSDYN.Variable <T SYSDYN.Component
         L0.valueAccessor FUNCTIONS.equationPropertyValue : L0.ExternalValue
     @L0.assert SYSDYN.Variable.equation 
         _ : L0.Value
-
+//Modules can have subrelations
+SYSDYN.subIsHeadOf <R SYSDYN.Variable.isHeadOf
+SYSDYN.subIsTailOf <R SYSDYN.Variable.isTailOf
 FUNCTIONS.valuePropertyProperties : L0.ExternalValue
 FUNCTIONS.valuePropertyValue : L0.ExternalValue
     
index b15bcfa222633b350970a8aa1c7fba50b0f8e547..ac5243806ba9868e75d95e69d9cdc87debd941f1 100644 (file)
@@ -118,12 +118,25 @@ public class NewModuleTypeAction implements ActionFactory{
         };
     }
 
-    public static Resource createTerminalRelation(WriteGraph graph, Resource symbol, Resource connectionRelation, Resource configurationRelation) throws DatabaseException {
+    public static Resource createTerminalRelation(WriteGraph graph, Resource symbol, Resource connectionRelation, Resource configurationRelationBase) throws DatabaseException {
         StructuralResource2 STR = StructuralResource2.getInstance(graph);
         ModelingResources MOD = ModelingResources.getInstance(graph);
         Layer0 L0 = Layer0.getInstance(graph);
-
-
+        
+        Resource configurationRelationBaseInverse = graph.getSingleObject(configurationRelationBase, L0.InverseOf);
+        
+        Resource configurationRelation = GraphUtils.create(graph,
+                L0.SubrelationOf, configurationRelationBase,
+                L0.PartOf, symbol,
+                L0.HasName, NameUtils.getSafeName(graph, configurationRelationBase)
+                );
+        
+        Resource configurationRelationInverse = GraphUtils.create(graph,
+                L0.PartOf, configurationRelation, 
+                L0.SubrelationOf, configurationRelationBaseInverse,
+                L0.HasName, "Inverse",
+                L0.InverseOf, configurationRelation);
+        
         Resource terminalRelation = null;
         terminalRelation = GraphUtils.create(graph,
                 MOD.DiagramConnectionRelationToConnectionRelation, configurationRelation,