From: lempinen Date: Thu, 19 Jan 2012 13:46:16 +0000 (+0000) Subject: Changed strengths in Redeclaration relations. If enumeration is removed, also redecla... X-Git-Tag: simantics-1.6~46 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=59c267ebf58c9130e7998dae52f845be89ad0e77;p=simantics%2Fsysdyn.git Changed strengths in Redeclaration relations. If enumeration is removed, also redeclaration is removed. If redeclaration is removed, enumeration is not removed. (refs #3130) SYSDYN.Redeclaration -- SYSDYN.Redeclaration.replacedEnumeration --> SYSDYN.Enumeration -- SYSDYN.Redeclaration.replacingEnumeration --> SYSDYN.Enumeration -- SYSDYN.Redeclaration.replacedEnumeration --> SYSDYN.Enumeration -- SYSDYN.Redeclaration.replacingEnumeration --> SYSDYN.Enumeration -- SYSDYN.Redeclaration.replacedEnumeration --> SYSDYN.Enumeration -- SYSDYN.Redeclaration.replacingEnumeration --> SYSDYN.Enumeration implements IDeletabl @Override public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException { SysdynResource sr = SysdynResource.getInstance(graph); - for(Resource redeclaration : graph.getObjects(data, sr.Redeclaration_replacedEnumeration_Inverse)) { + for(Resource redeclaration : graph.getObjects(data, sr.Redeclaration_replacedIn)) { graph.deny(redeclaration, sr.Module_redeclaration_Inverse); } - for(Resource redeclaration : graph.getObjects(data, sr.Redeclaration_replacingEnumeration_Inverse)) { + for(Resource redeclaration : graph.getObjects(data, sr.Redeclaration_replacedIn)) { graph.deny(redeclaration, sr.Module_redeclaration_Inverse); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java index 7b12325e..b7ca5c45 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java +++ b/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.Redeclaration_replacedEnumeration_Inverse)) { - for(Resource replacement : graph.getObjects(enumeration, sr.Redeclaration_replacedEnumeration_Inverse)) { + if(graph.hasStatement(enumeration, sr.Redeclaration_replacedIn)) { + for(Resource replacement : graph.getObjects(enumeration, sr.Redeclaration_replacedIn)) { replacements.add(new Pair(enumeration, replacement)); } } } for(Pair replacement : replacements) - graph.deny(replacement.first, sr.Redeclaration_replacedEnumeration_Inverse, replacement.second); + graph.deny(replacement.first, sr.Redeclaration_replacedIn, 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.Redeclaration_replacedEnumeration_Inverse, replacement.second); + graph.claim(replacement.first, sr.Redeclaration_replacedIn, replacement.second); } catch (RuntimeBindingConstructionException e) { e.printStackTrace(); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/modules/WizardModulesExportPage.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/modules/WizardModulesExportPage.java index d14135a9..91d6036d 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/modules/WizardModulesExportPage.java +++ b/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.Redeclaration_replacedEnumeration_Inverse)) { - for(Resource replacement : graph.getObjects(enumeration, sr.Redeclaration_replacedEnumeration_Inverse)) { + if(graph.hasStatement(enumeration, sr.Redeclaration_replacedIn)) { + for(Resource replacement : graph.getObjects(enumeration, sr.Redeclaration_replacedIn)) { replacements.add(new Pair(enumeration, replacement)); } } } for(Pair replacement : replacements) - graph.deny(replacement.first, sr.Redeclaration_replacedEnumeration_Inverse, replacement.second); + graph.deny(replacement.first, sr.Redeclaration_replacedIn, 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.Redeclaration_replacedEnumeration_Inverse, replacement.second); + graph.claim(replacement.first, sr.Redeclaration_replacedIn, replacement.second); } catch (RuntimeBindingConstructionException e) { e.printStackTrace(); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Enumeration.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Enumeration.java index 51996a19..c8a49888 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Enumeration.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Enumeration.java @@ -30,7 +30,7 @@ public class Enumeration extends Variable { private Boolean isReplaceable; @RelatedElements( - value = SysdynResource.URIs.Redeclaration_replacedEnumeration_Inverse, + value = SysdynResource.URIs.Redeclaration_replacedIn, composition = true) private ArrayList redeclarations = new ArrayList();