From: lempinen Date: Fri, 27 Aug 2010 12:14:04 +0000 (+0000) Subject: Changed Builtins to Layer0 X-Git-Tag: simantics-1.2.0~70 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=38c9e60f243e1ea7b5620c3d79177096c6e5aff7;p=simantics%2Fsysdyn.git Changed Builtins to Layer0 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@17658 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.modelica/src/org/simantics/modelica/data/SimulationResult.java b/org.simantics.modelica/src/org/simantics/modelica/data/SimulationResult.java index 89ce4c9b..8a5e5639 100644 --- a/org.simantics.modelica/src/org/simantics/modelica/data/SimulationResult.java +++ b/org.simantics.modelica/src/org/simantics/modelica/data/SimulationResult.java @@ -11,8 +11,6 @@ *******************************************************************************/ package org.simantics.modelica.data; -import gnu.trove.TDoubleArrayList; - import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/BrowserSelection.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/BrowserSelection.java index f30b8008..422646db 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/BrowserSelection.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/BrowserSelection.java @@ -14,6 +14,7 @@ public class BrowserSelection implements IAdaptable { this.model = model; } + @SuppressWarnings("rawtypes") @Override public Object getAdapter(Class adapter) { if (adapter == Resource.class) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/SysdynBrowser.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/SysdynBrowser.java index 032328a8..97b57c67 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/SysdynBrowser.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/SysdynBrowser.java @@ -92,7 +92,8 @@ public class SysdynBrowser extends GraphExplorerView { //toolBar.add(new HomeAction()); } - @Override + @SuppressWarnings("rawtypes") + @Override public Object getAdapter(Class adapter) { if (adapter == IPropertyPage.class) return new SysdynPropertyPage(getSite(), Collections.singleton("http://www.simantics.org/Sysdyn-1.0/Browser")); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java index 3016f8e8..a314315d 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java @@ -5,10 +5,10 @@ import java.util.Collection; import org.simantics.browsing.ui.common.node.AbstractNode; import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode; import org.simantics.sysdyn.ui.browser.nodes.InputNode; @@ -19,9 +19,9 @@ public class Configuration extends ViewpointContributor getContribution(ReadGraph graph, ConfigurationNode configuration) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); ArrayList> result = new ArrayList>(); - if (!graph.isInheritedFrom(graph.getSingleObject(configuration.data, b.InstanceOf), b.Realization)) + if (!graph.isInheritedFrom(graph.getSingleObject(configuration.data, l0.InstanceOf), l0.Realization)) return result; SysdynResource sr = SysdynResource.getInstance(graph); @@ -29,8 +29,8 @@ public class Configuration extends ViewpointContributor inputs = new ArrayList(); ArrayList modules = new ArrayList(); - for(Resource r : graph.getObjects(configuration.data, b.ConsistsOf)) { - Resource represents = graph.getSingleObject(r, b.Represents); + for(Resource r : graph.getObjects(configuration.data, l0.ConsistsOf)) { + Resource represents = graph.getSingleObject(r, l0.Represents); if(graph.isInstanceOf(represents, sr.IndependentVariable)) { variables.add(r); } else if (graph.isInstanceOf(represents, sr.Input)) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiment.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiment.java index 307b3eb7..21a1d915 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiment.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiment.java @@ -16,11 +16,11 @@ import java.util.Collection; import org.simantics.browsing.ui.common.node.AbstractNode; import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder; @@ -30,8 +30,8 @@ public class Experiment extends ViewpointContributor { @Override public Collection getContribution(ReadGraph graph, ExperimentsFolder experimentsFolder) throws DatabaseException { ArrayList> result = new ArrayList>(); - Builtins b = graph.getBuiltins(); - for(Resource r : graph.syncRequest(new ObjectsWithType(experimentsFolder.data, b.ConsistsOf, SimulationResource.getInstance(graph).Experiment))) { + Layer0 l0 = Layer0.getInstance(graph); + for(Resource r : graph.syncRequest(new ObjectsWithType(experimentsFolder.data, l0.ConsistsOf, SimulationResource.getInstance(graph).Experiment))) { try { result.add(graph.adapt(r, AbstractNode.class)); } catch(DatabaseException e) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentLabeler.java index e26f807d..c5e409e0 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentLabeler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentLabeler.java @@ -15,13 +15,14 @@ package org.simantics.sysdyn.ui.browser.contributions; import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor; import org.simantics.db.ReadGraph; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.ui.browser.nodes.ExperimentNode; public class ExperimentLabeler extends LabelerContributor{ @Override public String getLabel(ReadGraph graph, ExperimentNode experiment) throws DatabaseException { - String name = graph.getPossibleRelatedValue(experiment.data, graph.getBuiltins().HasLabel); + String name = graph.getPossibleRelatedValue(experiment.data, Layer0.getInstance(graph).HasLabel); return name == null ? "Experiment (no name)" : name; } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/InputLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/InputLabeler.java index 5e193816..d2c60c8a 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/InputLabeler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/InputLabeler.java @@ -1,24 +1,24 @@ package org.simantics.sysdyn.ui.browser.contributions; import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.ui.browser.nodes.InputNode; public class InputLabeler extends LabelerContributor{ @Override public String getLabel(ReadGraph graph, InputNode var) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); Resource varres = var.data; StringBuilder sb = new StringBuilder(); - for(Resource r : graph.getObjects(varres, b.HasName)) + for(Resource r : graph.getObjects(varres, l0.HasName)) sb.append(graph.getValue(r)); sb.append(" : "); - for(Resource t : graph.getObjects(varres, b.InstanceOf)) - for(Resource r : graph.getObjects(t, b.HasName)) + for(Resource t : graph.getObjects(varres, l0.InstanceOf)) + for(Resource r : graph.getObjects(t, l0.HasName)) sb.append(graph.getValue(r)); return sb.toString(); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelLabeler.java index cb122ee1..1deff6d3 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelLabeler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelLabeler.java @@ -3,13 +3,14 @@ package org.simantics.sysdyn.ui.browser.contributions; import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor; import org.simantics.db.ReadGraph; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.ui.browser.nodes.ModelNode; public class ModelLabeler extends LabelerContributor{ @Override public String getLabel(ReadGraph graph, ModelNode model) throws DatabaseException { - String label = graph.getPossibleRelatedValue(model.data, graph.getBuiltins().HasLabel); + String label = graph.getPossibleRelatedValue(model.data, Layer0.getInstance(graph).HasLabel); return label == null ? "Model (no name)" : label; } } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleLabeler.java index b7a9925a..abaf0c65 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleLabeler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleLabeler.java @@ -12,24 +12,24 @@ package org.simantics.sysdyn.ui.browser.contributions; import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.ui.browser.nodes.ModuleNode; public class ModuleLabeler extends LabelerContributor{ @Override public String getLabel(ReadGraph graph, ModuleNode module) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); Resource resource = module.data; StringBuilder sb = new StringBuilder(); - for(Resource r : graph.getObjects(resource, b.HasName)) + for(Resource r : graph.getObjects(resource, l0.HasName)) sb.append(graph.getValue(r)); sb.append(" : "); - for(Resource t : graph.getObjects(resource, b.InstanceOf)) - for(Resource r : graph.getObjects(t, b.HasName)) + for(Resource t : graph.getObjects(resource, l0.InstanceOf)) + for(Resource r : graph.getObjects(t, l0.HasName)) sb.append(graph.getValue(r)); return sb.toString(); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleType.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleType.java index b47e8d7e..38c1a60d 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleType.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleType.java @@ -5,11 +5,11 @@ import java.util.Collection; import org.simantics.browsing.ui.common.node.AbstractNode; import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.structural.stubs.StructuralResource2; import org.simantics.sysdyn.SysdynResource; @@ -23,7 +23,7 @@ public class ModuleType extends ViewpointContributor { @Override public Collection getContribution(ReadGraph graph, ModuleTypeNode module) throws DatabaseException { ArrayList> result = new ArrayList>(); - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); StructuralResource2 str = StructuralResource2.getInstance(graph); @@ -32,13 +32,13 @@ public class ModuleType extends ViewpointContributor { if(instance == null) return result; Resource conf = graph.getSingleObject(instance, str.IsDefinedBy); - for(Resource r : graph.syncRequest(new ObjectsWithType(conf, b.ConsistsOf, sr.IndependentVariable))) { + for(Resource r : graph.syncRequest(new ObjectsWithType(conf, l0.ConsistsOf, sr.IndependentVariable))) { result.add(new VariableNode(r)); } - for(Resource r : graph.syncRequest(new ObjectsWithType(conf, b.ConsistsOf, sr.Input))) { + for(Resource r : graph.syncRequest(new ObjectsWithType(conf, l0.ConsistsOf, sr.Input))) { result.add(new InputNode(r)); } - for(Resource r : graph.syncRequest(new ObjectsWithType(conf, b.ConsistsOf, sr.Module))) { + for(Resource r : graph.syncRequest(new ObjectsWithType(conf, l0.ConsistsOf, sr.Module))) { result.add(new ModuleNode(r)); } return result; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleTypeLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleTypeLabeler.java index 2d78a549..941112f0 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleTypeLabeler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleTypeLabeler.java @@ -4,6 +4,7 @@ import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode; @@ -13,7 +14,7 @@ public class ModuleTypeLabeler extends LabelerContributor{ public String getLabel(ReadGraph graph, ModuleTypeNode moduleType) throws DatabaseException { ModelingResources mr = ModelingResources.getInstance(graph); Resource typeResource = graph.getPossibleObject(moduleType.data, mr.SymbolToComponentType); - String label = graph.getPossibleRelatedValue(typeResource, graph.getBuiltins().HasName); + String label = graph.getPossibleRelatedValue(typeResource, Layer0.getInstance(graph).HasName); return label == null ? "ModuleType (no name)" : label; } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Modules.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Modules.java index 70645d2d..769968a7 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Modules.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Modules.java @@ -5,11 +5,11 @@ import java.util.Collection; import org.simantics.browsing.ui.common.node.AbstractNode; import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.structural.stubs.StructuralResource2; import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode; @@ -22,9 +22,9 @@ public class Modules extends ViewpointContributor { throws DatabaseException { ArrayList> result = new ArrayList>(); - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); StructuralResource2 st = StructuralResource2.getInstance(graph); - for(Resource r : graph.syncRequest(new ObjectsWithType(model.data, b.ConsistsOf, st.ComponentType))) { + for(Resource r : graph.syncRequest(new ObjectsWithType(model.data, l0.ConsistsOf, st.ComponentType))) { Resource symbol = graph.getPossibleObject(r,ModelingResources.getInstance(graph).ComponentTypeToSymbol); result.add(new ModuleTypeNode(symbol)); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Project.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Project.java index cc763e6c..578838f9 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Project.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Project.java @@ -5,11 +5,11 @@ import java.util.Collection; import org.simantics.browsing.ui.common.node.AbstractNode; import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; public class Project extends ViewpointContributor { @@ -20,9 +20,9 @@ public class Project extends ViewpointContributor { throws DatabaseException { ArrayList> result = new ArrayList>(); - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); - for(Resource r : graph.syncRequest(new ObjectsWithType(project, b.ConsistsOf, sr.SysdynModel))) { + for(Resource r : graph.syncRequest(new ObjectsWithType(project, l0.ConsistsOf, sr.SysdynModel))) { try { result.add(graph.adapt(r, AbstractNode.class)); } catch(DatabaseException e) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultLabeler.java index 84489473..3ec071fc 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultLabeler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultLabeler.java @@ -3,13 +3,14 @@ package org.simantics.sysdyn.ui.browser.contributions; import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor; import org.simantics.db.ReadGraph; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode; public class SimulationResultLabeler extends LabelerContributor{ @Override public String getLabel(ReadGraph graph, SimulationResultNode result) throws DatabaseException { - String name = graph.getPossibleRelatedValue(result.data, graph.getBuiltins().HasLabel); + String name = graph.getPossibleRelatedValue(result.data, Layer0.getInstance(graph).HasLabel); return name == null ? "Experiment (no name)" : name; } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/VariableLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/VariableLabeler.java index 7243a539..7e78b3a8 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/VariableLabeler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/VariableLabeler.java @@ -12,24 +12,24 @@ package org.simantics.sysdyn.ui.browser.contributions; import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.ui.browser.nodes.VariableNode; public class VariableLabeler extends LabelerContributor>{ @Override public String getLabel(ReadGraph graph, VariableNode var) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); Resource varres = var.data; StringBuilder sb = new StringBuilder(); - for(Resource r : graph.getObjects(varres, b.HasName)) + for(Resource r : graph.getObjects(varres, l0.HasName)) sb.append(graph.getValue(r)); sb.append(" : "); - for(Resource t : graph.getObjects(varres, b.InstanceOf)) - for(Resource r : graph.getObjects(t, b.HasName)) + for(Resource t : graph.getObjects(varres, l0.InstanceOf)) + for(Resource r : graph.getObjects(t, l0.HasName)) sb.append(graph.getValue(r)); return sb.toString(); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModelNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModelNode.java index ad0a5f54..49962dc9 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModelNode.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModelNode.java @@ -6,7 +6,6 @@ import org.simantics.browsing.ui.common.node.IDeletableNode; import org.simantics.browsing.ui.common.node.IModifiableNode; import org.simantics.browsing.ui.content.Labeler.Modifier; import org.simantics.browsing.ui.graph.impl.LabelModifier; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -15,6 +14,7 @@ import org.simantics.db.exception.CancelTransactionException; import org.simantics.db.exception.DatabaseException; 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.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; @@ -37,10 +37,10 @@ public class ModelNode extends AbstractNode implements IDeletableNode, @Override public void perform(WriteGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); SimulationResource sim = SimulationResource.getInstance(graph); Resource configuration = graph.getPossibleObject(data, sim.HasConfiguration); - graph.claimValue(configuration, b.HasLabel, result); + graph.claimLiteral(configuration, l0.HasLabel, result); } }); } @@ -60,8 +60,7 @@ public class ModelNode extends AbstractNode implements IDeletableNode, @Override public String perform(ReadGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); - return graph.getRelatedValue(data, b.HasLabel); + return graph.getRelatedValue(data, Layer0.getInstance(graph).HasLabel); } }, configurationNameSynchronizer); @@ -89,13 +88,13 @@ public class ModelNode extends AbstractNode implements IDeletableNode, SimanticsUI.getSession().syncRequest(new WriteRequest() { @Override public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException { - Builtins b = graph.getBuiltins(); - - for(Resource r : graph.getObjects(data, b.ConsistsOf)) + Layer0 l0 = Layer0.getInstance(graph); + + for(Resource r : graph.getObjects(data, l0.ConsistsOf)) if(graph.isInstanceOf(r, SysdynResource.getInstance(graph).Result)) SimulationResultNode.deleteResultFiles(graph, r); - graph.deny(data, b.PartOf); + graph.deny(data, l0.PartOf); } }); } catch (DatabaseException e) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleTypeNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleTypeNode.java index bb4890fb..a8c6afdd 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleTypeNode.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleTypeNode.java @@ -8,7 +8,6 @@ import org.simantics.browsing.ui.common.node.IDeletableNode; import org.simantics.browsing.ui.common.node.IModifiableNode; import org.simantics.browsing.ui.content.Labeler.Modifier; import org.simantics.browsing.ui.graph.impl.LabelModifier; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -19,6 +18,7 @@ import org.simantics.db.exception.ManyObjectsForFunctionalRelationException; import org.simantics.db.exception.ServiceException; import org.simantics.db.procedure.Listener; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.simulation.ontology.SimulationResource; import org.simantics.structural.stubs.StructuralResource2; @@ -42,12 +42,12 @@ public class ModuleTypeNode extends AbstractNode implements IDeletable @Override public void perform(WriteGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); ModelingResources mr = ModelingResources.getInstance(graph); StructuralResource2 sr2 = StructuralResource2.getInstance(graph); Resource type = graph.getPossibleObject(data, mr.SymbolToComponentType); Resource configuration = graph.getPossibleObject(type, sr2.IsDefinedBy); - graph.claimValue(configuration, b.HasLabel, result); + graph.claimLiteral(configuration, l0.HasLabel, result); } }); } @@ -67,10 +67,10 @@ public class ModuleTypeNode extends AbstractNode implements IDeletable @Override public String perform(ReadGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); ModelingResources mr = ModelingResources.getInstance(graph); Resource type = graph.getPossibleObject(data, mr.SymbolToComponentType); - return graph.getRelatedValue(type, b.HasName); + return graph.getRelatedValue(type, l0.HasName); } }, configurationNameSynchronizer); @@ -86,10 +86,10 @@ public class ModuleTypeNode extends AbstractNode implements IDeletable @Override public Modifier perform(ReadGraph graph) throws ManyObjectsForFunctionalRelationException, ServiceException { ModelingResources mr = ModelingResources.getInstance(graph); - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); Resource type = graph.getPossibleObject(data, mr.SymbolToComponentType); - LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), type, b.HasName) { + LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), type, l0.HasName) { @Override public String isValid(String label) { if (label.isEmpty()) @@ -117,26 +117,26 @@ public class ModuleTypeNode extends AbstractNode implements IDeletable @Override public void perform(WriteGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); StructuralResource2 st = StructuralResource2.getInstance(graph); ModelingResources mr = ModelingResources.getInstance(graph); Resource type = graph.getPossibleObject(data, mr.SymbolToComponentType); - Resource model = graph.getSingleObject(type, b.PartOf); + Resource model = graph.getSingleObject(type, l0.PartOf); Resource modelConfiguration = graph.getSingleObject(model, SimulationResource.getInstance(graph).HasConfiguration); - if (!graph.syncRequest(new ObjectsWithType(modelConfiguration, b.ConsistsOf, type)).isEmpty()) { + if (!graph.syncRequest(new ObjectsWithType(modelConfiguration, l0.ConsistsOf, type)).isEmpty()) { System.out.println("The module is used at the model configuration"); return; } - Collection moduleTypes = graph.syncRequest(new ObjectsWithType(model, b.ConsistsOf, st.ComponentType)); + Collection moduleTypes = graph.syncRequest(new ObjectsWithType(model, l0.ConsistsOf, st.ComponentType)); for(Resource r : moduleTypes) { Resource configuration = graph.getSingleObject(r, st.IsDefinedBy); - if(!graph.syncRequest(new ObjectsWithType(configuration, b.ConsistsOf, type)).isEmpty()) { - System.out.println("The module is used at another module: " + graph.getRelatedValue(r, b.HasName)); + if(!graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, type)).isEmpty()) { + System.out.println("The module is used at another module: " + graph.getRelatedValue(r, l0.HasName)); return; } } - graph.deny(model, b.ConsistsOf, type); + graph.deny(model, l0.ConsistsOf, type); } }); } catch (DatabaseException e) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/VariableNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/VariableNode.java index 01e9a854..4347140c 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/VariableNode.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/VariableNode.java @@ -12,11 +12,11 @@ package org.simantics.sysdyn.ui.browser.nodes; import org.simantics.browsing.ui.common.node.AbstractNode; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ReadRequest; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; @@ -33,10 +33,10 @@ public class VariableNode extends AbstractNode { @Override public void run(ReadGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); - VariableNode.this.resource = graph.getPossibleObject(data, b.Represents); + VariableNode.this.resource = graph.getPossibleObject(data, l0.Represents); if(VariableNode.this.resource == null) return; @@ -44,14 +44,14 @@ public class VariableNode extends AbstractNode { uri = getName(graph); // don't search for a parent if the resource is not part of a realization - if(!graph.isInheritedFrom(graph.getSingleObject(data, b.InstanceOf), b.Realization)) + if(!graph.isInheritedFrom(graph.getSingleObject(data, l0.InstanceOf), l0.Realization)) return; // search for the model parent and build the uri - Resource parent = graph.getSingleObject(data, b.PartOf); + Resource parent = graph.getSingleObject(data, l0.PartOf); while (!graph.isInstanceOf(parent, sr.SysdynModel)) { - uri = graph.getRelatedValue(parent, b.HasName) + "/" + uri; - parent = graph.getSingleObject(parent, b.PartOf); + uri = graph.getRelatedValue(parent, l0.HasName) + "/" + uri; + parent = graph.getSingleObject(parent, l0.PartOf); } // cut out the realization name uri = uri.substring(uri.indexOf("/") + 1); @@ -69,11 +69,11 @@ public class VariableNode extends AbstractNode { } public String getName(ReadGraph graph) throws DatabaseException { - return (String)graph.getRelatedValue(data, graph.getBuiltins().HasName); + return (String)graph.getRelatedValue(data, Layer0.getInstance(graph).HasName); } public Resource getParent(ReadGraph graph) throws DatabaseException { - return graph.getSingleObject(data, graph.getBuiltins().PartOf); + return graph.getSingleObject(data, Layer0.getInstance(graph).PartOf); } public Resource getResource() { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/dependencies/CreateDependencyGraph.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/dependencies/CreateDependencyGraph.java index 2215ca01..1ff508ca 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/dependencies/CreateDependencyGraph.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/dependencies/CreateDependencyGraph.java @@ -14,6 +14,7 @@ import org.simantics.graphviz.Edge; import org.simantics.graphviz.Graph; import org.simantics.graphviz.IGraph; import org.simantics.graphviz.Node; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.sysdyn.SysdynResource; @@ -130,7 +131,7 @@ public class CreateDependencyGraph implements Read { } private String getName(ReadGraph g, Resource r) throws DatabaseException { - return (String)g.getRelatedValue(r, g.getBuiltins().HasName); + return (String)g.getRelatedValue(r, Layer0.getInstance(g).HasName); } } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/OpenDiagramFromConfigurationAdapter.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/OpenDiagramFromConfigurationAdapter.java index e425fe1a..e82c0b6b 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/OpenDiagramFromConfigurationAdapter.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/OpenDiagramFromConfigurationAdapter.java @@ -1,10 +1,10 @@ package org.simantics.sysdyn.ui.editor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ComponentUtils; import org.simantics.modeling.ModelingResources; import org.simantics.structural.stubs.StructuralResource2; @@ -34,8 +34,8 @@ public class OpenDiagramFromConfigurationAdapter extends org.simantics.modeling. Resource componentType = g.getSingleObject(r, mr.SymbolToComponentType); r = g.getSingleObject(componentType, sr2.IsDefinedBy); } - Builtins b = g.getBuiltins(); - Resource represents = g.getPossibleObject(r, b.Represents); + Layer0 l0 = Layer0.getInstance(g); + Resource represents = g.getPossibleObject(r, l0.Represents); if(represents != null){ if(g.isInstanceOf(represents, sr.Configuration)) { r = represents; @@ -52,7 +52,7 @@ public class OpenDiagramFromConfigurationAdapter extends org.simantics.modeling. @Override public Resource perform(ReadGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); if(graph.isInheritedFrom(r, SysdynResource.getInstance(graph).ModuleSymbol)) { ModelingResources mr = ModelingResources.getInstance(graph); StructuralResource2 sr2 = StructuralResource2.getInstance(graph); @@ -60,7 +60,7 @@ public class OpenDiagramFromConfigurationAdapter extends org.simantics.modeling. Resource configuration = graph.getSingleObject(componentType, sr2.IsDefinedBy); return configuration; } else { - Resource represents = graph.getPossibleObject(r, b.Represents); + Resource represents = graph.getPossibleObject(r, l0.Represents); if(represents != null && graph.isInstanceOf(represents, SysdynResource.getInstance(graph).Configuration)){ return represents; } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynConnectionAdvisor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynConnectionAdvisor.java index e289eddf..1ba473a0 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynConnectionAdvisor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynConnectionAdvisor.java @@ -15,9 +15,7 @@ import org.simantics.g2d.connection.IConnectionAdvisor; import org.simantics.g2d.diagram.handler.Topology.Terminal; import org.simantics.g2d.element.ElementUtils; import org.simantics.g2d.element.IElement; -import org.simantics.g2d.elementclass.FlagHandler; import org.simantics.structural.stubs.StructuralResource2; -import org.simantics.structural2.modelingRules.CPFlag; import org.simantics.structural2.modelingRules.ConnectionJudgement; import org.simantics.structural2.modelingRules.ConnectionJudgementType; import org.simantics.structural2.modelingRules.IConnectionPoint; @@ -45,10 +43,6 @@ public class SysdynConnectionAdvisor implements IConnectionAdvisor { return ConnectionUtil.toConnectionPoint(g, elementResource, term); } - if(element.getElementClass().containsClass(FlagHandler.class)) { - return new CPFlag(null); - } - return null; } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ComponentNameSynchronizer.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ComponentNameSynchronizer.java index a1f14b32..c0c804bc 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ComponentNameSynchronizer.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ComponentNameSynchronizer.java @@ -12,15 +12,16 @@ package org.simantics.sysdyn.ui.elements2; import org.simantics.databoard.binding.java.StringBindingDefault; -import org.simantics.db.Builtins; import org.simantics.db.Resource; import org.simantics.db.Session; +import org.simantics.db.exception.DatabaseException; import org.simantics.diagram.synchronization.IModificationQueue; import org.simantics.diagram.synchronization.ISynchronizationContext; import org.simantics.diagram.synchronization.graph.GraphSynchronizationHints; import org.simantics.diagram.synchronization.graph.RelatedPropertyModification; import org.simantics.diagram.synchronization.graph.ResourceSynchronizer; import org.simantics.g2d.element.ElementHints; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.utils.datastructures.hints.IHintContext.Key; import org.simantics.utils.datastructures.hints.IHintObservable; @@ -45,9 +46,14 @@ public class ComponentNameSynchronizer extends ResourceSynchronizer { public boolean hintChanged(ISynchronizationContext context, IModificationQueue queue, Resource object, IHintObservable sender, Key key, Object oldValue, Object newValue) { if (ElementHints.KEY_TEXT.equals(key)) { Session session = context.get(GraphSynchronizationHints.SESSION); - Builtins b = session.getBuiltins(); - ModelingResources mr = session.getService(ModelingResources.class); - return queue.offer(new RelatedPropertyModification(object, mr.ElementToComponent, b.HasName, b.String, newValue, StringBindingDefault.INSTANCE), null); + Layer0 l0; + try { + l0 = Layer0.getInstance(session); + ModelingResources mr = session.getService(ModelingResources.class); + return queue.offer(new RelatedPropertyModification(object, mr.ElementToComponent, l0.HasName, l0.String, newValue, StringBindingDefault.INSTANCE), null); + } catch (DatabaseException e) { + e.printStackTrace(); + } } return false; } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java index 1876d3a6..757d4310 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java @@ -9,7 +9,6 @@ import java.awt.geom.Path2D; import java.awt.geom.Rectangle2D; import java.util.Collection; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; @@ -38,6 +37,7 @@ import org.simantics.g2d.element.handler.impl.TextImpl; import org.simantics.g2d.image.Image; import org.simantics.g2d.image.impl.ShapeImage; import org.simantics.g2d.utils.Alignment; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.scenegraph.g2d.G2DParentNode; import org.simantics.sysdyn.SysdynResource; @@ -86,7 +86,7 @@ public class InputFactory extends SysdynElementFactory { @Override public void load(ReadGraph graph, final ICanvasContext canvas, final IDiagram diagram, final Resource element, final IElement e) throws DatabaseException { super.load(graph, canvas, diagram, element, e); - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); ModelingResources mr = ModelingResources.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); Resource component = null; @@ -101,9 +101,9 @@ public class InputFactory extends SysdynElementFactory { if(dependency != null) { refersTo = graph.getPossibleObject(dependency, sr.RefersTo); if(refersTo != null) { - referenceName = (String) graph.getPossibleRelatedValue(refersTo, b.HasName); + referenceName = (String) graph.getPossibleRelatedValue(refersTo, l0.HasName); module = graph.getPossibleObject(dependency, sr.HasTail); - moduleName = (String) graph.getPossibleRelatedValue(module, b.HasName); + moduleName = (String) graph.getPossibleRelatedValue(module, l0.HasName); } } else { Resource runtime = diagram.getHint((DiagramModelHints.KEY_DIAGRAM_RUNTIME_RESOURCE)); @@ -111,22 +111,22 @@ public class InputFactory extends SysdynElementFactory { String variable = (String)graph.getRelatedValue(runtime, dr.HasVariable); Resource moduleRepresentation = graph.getPossibleResource(variable); if(moduleRepresentation != null) - module = graph.getPossibleObject(moduleRepresentation, b.Represents); + module = graph.getPossibleObject(moduleRepresentation, l0.Represents); if(module != null) for(Resource dep : graph.getObjects(module, sr.IsHeadOf)) { Resource reference = graph.getPossibleObject(dep, sr.RefersTo); if(reference!= null && reference.equals(component)) { refersTo = graph.getSingleObject(dep, sr.HasTail); - referenceName = (String) graph.getPossibleRelatedValue(refersTo, b.HasName); + referenceName = (String) graph.getPossibleRelatedValue(refersTo, l0.HasName); moduleRepresentation = graph.getPossibleResource(variable.substring(0, variable.lastIndexOf("/"))); - Resource parent = graph.getPossibleObject(moduleRepresentation, b.PartOf); + Resource parent = graph.getPossibleObject(moduleRepresentation, l0.PartOf); String parentURI = graph.getURI(parent); String modelURI = diagram.getHint((DiagramModelHints.KEY_DIAGRAM_MODEL_URI)); - module = graph.getPossibleObject(moduleRepresentation, b.Represents); + module = graph.getPossibleObject(moduleRepresentation, l0.Represents); if(parentURI.equals(modelURI) || module == null) moduleName = ""; else { - moduleName = (String) graph.getPossibleRelatedValue(module, b.HasName); + moduleName = (String) graph.getPossibleRelatedValue(module, l0.HasName); } break; } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/SysdynElementFactory.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/SysdynElementFactory.java index 989380f0..5bf9d333 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/SysdynElementFactory.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/SysdynElementFactory.java @@ -17,7 +17,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.utils.OrderedSetUtils; @@ -39,6 +38,7 @@ import org.simantics.g2d.element.ElementHints; import org.simantics.g2d.element.ElementUtils; import org.simantics.g2d.element.IElement; import org.simantics.g2d.element.handler.impl.ObjectTerminal; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.structural.stubs.StructuralResource2; import org.simantics.sysdyn.SysdynResource; @@ -57,7 +57,7 @@ public abstract class SysdynElementFactory extends SyncElementFactory { @Override public void load(ReadGraph graph, final ICanvasContext canvas, final IDiagram diagram, final Resource element, final IElement e) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); G2DResource g2d = G2DResource.getInstance(graph); DiagramResource dr = DiagramResource.getInstance(graph); ModelingResources mr = ModelingResources.getInstance(graph); @@ -65,7 +65,7 @@ public abstract class SysdynElementFactory extends SyncElementFactory { Resource component = graph.getPossibleObject(element, mr.ElementToComponent); String text = null; if (component != null) { - text = (String) graph.getPossibleRelatedValue(component, b.HasName); + text = (String) graph.getPossibleRelatedValue(component, l0.HasName); } if (text == null) text = "[empty]"; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/DependencyConnectionFactory.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/DependencyConnectionFactory.java index 403aa412..76a9f9e7 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/DependencyConnectionFactory.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/DependencyConnectionFactory.java @@ -18,6 +18,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.simantics.databoard.binding.java.StringBindingDefault; import org.simantics.db.AsyncReadGraph; import org.simantics.db.Resource; +import org.simantics.db.exception.DatabaseException; import org.simantics.db.procedure.AsyncMultiProcedure; import org.simantics.db.procedure.AsyncProcedure; import org.simantics.diagram.adapter.ElementFactoryAdapter; @@ -29,6 +30,7 @@ import org.simantics.g2d.element.ElementClass; import org.simantics.g2d.element.IElement; import org.simantics.g2d.element.handler.impl.StaticObjectAdapter; import org.simantics.g2d.routing.RouterFactory; +import org.simantics.layer0.Layer0; import org.simantics.utils.datastructures.Pair; /** @@ -76,8 +78,14 @@ public class DependencyConnectionFactory extends ElementFactoryAdapter { public void execute(AsyncReadGraph graph, final Resource property) { ready.incrementAndGet(); - - graph.forIsSubrelationOf(property, graph.getBuiltins().HasProperty, new AsyncProcedure() { + Layer0 l0; + try { + l0 = Layer0.getInstance(graph.getSession()); + } catch (DatabaseException e) { + e.printStackTrace(); + return; + } + graph.forIsSubrelationOf(property, l0.HasProperty, new AsyncProcedure() { @Override public void exception(AsyncReadGraph graph, Throwable throwable) { @@ -99,7 +107,15 @@ public class DependencyConnectionFactory extends ElementFactoryAdapter { @Override public void execute(AsyncReadGraph graph, final Object value) { - graph.forPossibleRelatedValue(property, graph.getBuiltins().HasName, StringBindingDefault.INSTANCE, new AsyncProcedure() { + Layer0 l0; + try { + l0 = Layer0.getInstance(graph.getSession()); + } catch (DatabaseException e) { + e.printStackTrace(); + return; + } + + graph.forPossibleRelatedValue(property, l0.HasName, StringBindingDefault.INSTANCE, new AsyncProcedure() { @Override public void exception(AsyncReadGraph graph, Throwable throwable) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/EquationView.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/EquationView.java index ae407a96..0c968556 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/EquationView.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/EquationView.java @@ -45,12 +45,12 @@ import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPartReference; import org.eclipse.ui.part.ViewPart; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.db.procedure.Listener; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.expressionParser.ExpressionParser; @@ -168,7 +168,7 @@ public class EquationView extends ViewPart implements ISelectionListener { @Override public Auxiliary perform(ReadGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); ModelingResources mr = ModelingResources.getInstance(graph); @@ -177,8 +177,8 @@ public class EquationView extends ViewPart implements ISelectionListener { Auxiliary a = new Auxiliary(); variable = resource; - a.configuration = graph.getPossibleObject(variable, b.PartOf); - a.name = graph.getPossibleRelatedValue(resource, b.HasName); + a.configuration = graph.getPossibleObject(variable, l0.PartOf); + a.name = graph.getPossibleRelatedValue(resource, l0.HasName); a.isVariable = graph.isInstanceOf(variable, sr.IndependentVariable); if(a.name == null) a.name = ""; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/NameComposite.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/NameComposite.java index bc959253..51fcc66d 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/NameComposite.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/NameComposite.java @@ -27,11 +27,11 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PlatformUI; -import org.simantics.db.Builtins; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.manager.SysdynModel; import org.simantics.sysdyn.manager.SysdynModelManager; import org.simantics.sysdyn.representation.Configuration; @@ -136,8 +136,8 @@ public class NameComposite extends Composite { @Override public void perform(WriteGraph g) throws DatabaseException { - Builtins b = g.getBuiltins(); - g.claimValue(variable, b.HasName, nameNew); + Layer0 l0 = Layer0.getInstance(g); + g.claimLiteral(variable, l0.HasName, nameNew); } }); } catch (DatabaseException e) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/ShortcutTabs.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/ShortcutTabs.java index 8cba344f..4fd98bee 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/ShortcutTabs.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/ShortcutTabs.java @@ -22,11 +22,11 @@ import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ExceptionUtils; @@ -97,7 +97,7 @@ public class ShortcutTabs extends Composite { throws DatabaseException { HashSet variables = new HashSet(); SysdynResource sr = SysdynResource.getInstance(graph); - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); Collection dependencies = graph.getObjects(r, sr.IsHeadOf); @@ -105,7 +105,7 @@ public class ShortcutTabs extends Composite { if(graph.isInstanceOf(d, sr.Dependency)) { Resource tail = graph.getPossibleObject(d, sr.HasTail); if(tail != null) { - Object name = graph.getPossibleRelatedValue(tail, b.HasName); + Object name = graph.getPossibleRelatedValue(tail, l0.HasName); if(name != null) variables.add((String)name); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/UnitSelector.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/UnitSelector.java index b78edbd3..a0af1fae 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/UnitSelector.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/UnitSelector.java @@ -23,13 +23,13 @@ import org.eclipse.swt.graphics.GC; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ExceptionUtils; @@ -86,7 +86,7 @@ public class UnitSelector extends Composite { throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(g); if (!unitNew.equals("")) { - g.claimValue(variable, sr.HasUnit, unitNew); + g.claimLiteral(variable, sr.HasUnit, unitNew); } else if (g.getPossibleRelatedValue(variable, sr.HasUnit) != null) g.deny(variable, sr.HasUnit); @@ -155,10 +155,10 @@ public class UnitSelector extends Composite { ArrayList units = new ArrayList(); SysdynResource sr = SysdynResource.getInstance(graph); - Builtins b = graph.getBuiltins(); - Resource model = graph.getPossibleObject(variable, b.PartOf); + Layer0 l0 = Layer0.getInstance(graph); + Resource model = graph.getPossibleObject(variable, l0.PartOf); if (model != null) { - Collection variables = graph.getObjects(model, b.ConsistsOf); + Collection variables = graph.getObjects(model, l0.ConsistsOf); for(Resource v : variables) { Object unit = graph.getPossibleRelatedValue(v, sr.HasUnit); if (unit != null && !units.contains((String) unit)) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/AuxiliaryExpressionViewFactor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/AuxiliaryExpressionViewFactor.java index 9a74a19c..ab46cba1 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/AuxiliaryExpressionViewFactor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/AuxiliaryExpressionViewFactor.java @@ -23,13 +23,13 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; @@ -94,14 +94,14 @@ public class AuxiliaryExpressionViewFactor implements IExpressionViewFactor { throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(g); Resource expression = g.getPossibleObject(variable, sr.HasExpression); - Builtins b = g.getBuiltins(); + Layer0 l0 = Layer0.getInstance(g); if(expression != null) { g.deny(variable, sr.HasExpression); } expression = g.newResource(); - g.claim(expression, b.InstanceOf, null, sr.NormalExpression); + g.claim(expression, l0.InstanceOf, null, sr.NormalExpression); g.claim(variable, sr.HasExpression, expression); - g.claimValue(expression, sr.HasEquation, currentText); + g.claimLiteral(expression, sr.HasEquation, currentText); } }); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ConstantExpressionViewFactor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ConstantExpressionViewFactor.java index 1994fd0c..9c0eea5b 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ConstantExpressionViewFactor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ConstantExpressionViewFactor.java @@ -23,13 +23,13 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; @@ -112,14 +112,14 @@ public class ConstantExpressionViewFactor implements IExpressionViewFactor { throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(g); Resource expression = g.getPossibleObject(variable, sr.HasExpression); - Builtins b = g.getBuiltins(); + Layer0 l0 = Layer0.getInstance(g); if(expression != null) { g.deny(variable, sr.HasExpression); } expression = g.newResource(); - g.claim(expression, b.InstanceOf, null, sr.ConstantExpression); + g.claim(expression, l0.InstanceOf, null, sr.ConstantExpression); g.claim(variable, sr.HasExpression, expression); - g.claimValue(expression, sr.HasEquation, currentText); + g.claimLiteral(expression, sr.HasEquation, currentText); } }); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/LookupInputOutputTable.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/LookupInputOutputTable.java index 585ac91c..fcfff42a 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/LookupInputOutputTable.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/LookupInputOutputTable.java @@ -124,8 +124,8 @@ public class LookupInputOutputTable extends Composite { * @param clazz String.class or Double.class * @return input as string or double or null if asked for something else */ - @SuppressWarnings("unchecked") - public Object getInput(Class clazz) { + @SuppressWarnings("rawtypes") + public Object getInput(Class clazz) { if(clazz == String.class) { return "" + input; } else if (clazz == Double.class) { @@ -152,7 +152,7 @@ public class LookupInputOutputTable extends Composite { * @param clazz String.class or Double.class * @return output as string or double or null if asked for something else */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public Object getOutput(Class clazz) { if(clazz == String.class) { return "" + output; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/LookupPopup.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/LookupPopup.java index f6d45739..8a93ca10 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/LookupPopup.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/LookupPopup.java @@ -304,7 +304,6 @@ public class LookupPopup extends Dialog { super.okPressed(); } - @SuppressWarnings("unchecked") private String graphToModelicaTable() { StringBuilder b = new StringBuilder(); b.append("{"); @@ -312,7 +311,8 @@ public class LookupPopup extends Dialog { XYSeries series = collection.getSeries(0); if(series.isEmpty()) return ""; - Iterator iterator = series.getItems().iterator(); + @SuppressWarnings("rawtypes") + Iterator iterator = series.getItems().iterator(); while(iterator.hasNext()){ XYDataItem item = (XYDataItem)iterator.next(); b.append("{" + item.getX() + "," + item.getY() + "}"); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ParameterExpressionViewFactor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ParameterExpressionViewFactor.java index fe234848..f101f3ea 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ParameterExpressionViewFactor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ParameterExpressionViewFactor.java @@ -23,13 +23,13 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; @@ -113,14 +113,14 @@ public class ParameterExpressionViewFactor implements IExpressionViewFactor { throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(g); Resource expression = g.getPossibleObject(variable, sr.HasExpression); - Builtins b = g.getBuiltins(); + Layer0 l0 = Layer0.getInstance(g); if(expression != null) { g.deny(variable, sr.HasExpression); } expression = g.newResource(); - g.claim(expression, b.InstanceOf, null, sr.ParameterExpression); + g.claim(expression, l0.InstanceOf, null, sr.ParameterExpression); g.claim(variable, sr.HasExpression, expression); - g.claimValue(expression, sr.HasEquation, currentText); + g.claimLiteral(expression, sr.HasEquation, currentText); } }); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/StockExpressionViewFactor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/StockExpressionViewFactor.java index ac8b7455..1a6c161c 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/StockExpressionViewFactor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/StockExpressionViewFactor.java @@ -25,13 +25,13 @@ import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; @@ -114,14 +114,14 @@ public class StockExpressionViewFactor implements IExpressionViewFactor { throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(g); Resource expression = g.getPossibleObject(variable, sr.HasExpression); - Builtins b = g.getBuiltins(); + Layer0 l0 = Layer0.getInstance(g); if(expression != null) { g.deny(variable, sr.HasExpression); } expression = g.newResource(); - g.claim(expression, b.InstanceOf, null, sr.StockExpression); + g.claim(expression, l0.InstanceOf, null, sr.StockExpression); g.claim(variable, sr.HasExpression, expression); - g.claimValue(expression, sr.HasInitialEquation, currentText); + g.claimLiteral(expression, sr.HasInitialEquation, currentText); } }); @@ -136,7 +136,7 @@ public class StockExpressionViewFactor implements IExpressionViewFactor { @Override public String perform(ReadGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); Collection heads = graph.getObjects(variable, sr.IsHeadOf); Collection tails = graph.getObjects(variable, sr.IsTailOf); @@ -146,7 +146,7 @@ public class StockExpressionViewFactor implements IExpressionViewFactor { if(graph.isInstanceOf(r, sr.Flow)) { Resource tail = graph.getPossibleObject(r, sr.HasTail); if(tail != null) { - Object name = graph.getPossibleRelatedValue(tail, b.HasName); + Object name = graph.getPossibleRelatedValue(tail, l0.HasName); if (name != null) builder.append(" + " + name); } @@ -156,7 +156,7 @@ public class StockExpressionViewFactor implements IExpressionViewFactor { if(graph.isInstanceOf(r, sr.Flow)) { Resource head = graph.getPossibleObject(r, sr.HasHead); if(head != null) { - Object name = graph.getPossibleRelatedValue(head, b.HasName); + Object name = graph.getPossibleRelatedValue(head, l0.HasName); if (name != null) builder.append(" - " + name); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/WithLookupExpressionViewFactor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/WithLookupExpressionViewFactor.java index 43218e06..b97c6c21 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/WithLookupExpressionViewFactor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/WithLookupExpressionViewFactor.java @@ -28,13 +28,13 @@ import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; @@ -163,19 +163,19 @@ public class WithLookupExpressionViewFactor implements IExpressionViewFactor { throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(g); Resource expression = g.getPossibleObject(variable, sr.HasExpression); - Builtins b = g.getBuiltins(); + Layer0 l0 = Layer0.getInstance(g); if(expression != null) { g.deny(variable, sr.HasExpression); } expression = g.newResource(); - g.claim(expression, b.InstanceOf, null, sr.WithLookupExpression); + g.claim(expression, l0.InstanceOf, null, sr.WithLookupExpression); g.claim(variable, sr.HasExpression, expression); - g.claimValue(expression, sr.HasEquation, currentExpression); - g.claimValue(expression, sr.HasLookup, currentLookupTable); - g.claimValue(expression, sr.HasMinX, chartInfo.minX); - g.claimValue(expression, sr.HasMaxX, chartInfo.maxX); - g.claimValue(expression, sr.HasMinY, chartInfo.minY); - g.claimValue(expression, sr.HasMaxY, chartInfo.maxY); + g.claimLiteral(expression, sr.HasEquation, currentExpression); + g.claimLiteral(expression, sr.HasLookup, currentLookupTable); + g.claimLiteral(expression, sr.HasMinX, chartInfo.minX); + g.claimLiteral(expression, sr.HasMaxX, chartInfo.maxX); + g.claimLiteral(expression, sr.HasMinY, chartInfo.minY); + g.claimLiteral(expression, sr.HasMaxY, chartInfo.maxY); } }); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModelHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModelHandler.java index 5dcf74c5..ed549eea 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModelHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModelHandler.java @@ -4,7 +4,6 @@ import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.simantics.databoard.binding.java.StringBindingDefault; -import org.simantics.db.Builtins; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; @@ -13,6 +12,7 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.diagram.DiagramConstants; import org.simantics.diagram.synchronization.graph.layer.GraphLayer; import org.simantics.diagram.synchronization.graph.layer.GraphLayerUtil; +import org.simantics.layer0.Layer0; import org.simantics.layer0.utils.direct.GraphUtils; import org.simantics.modeling.ModelingResources; import org.simantics.modeling.ModelingUtils; @@ -28,45 +28,45 @@ public class NewModelHandler extends AbstractHandler { @Override public void perform(WriteGraph g) throws DatabaseException { // Same as in SysdynProject.java. Should use the same code, not copy. - Builtins b = g.getBuiltins(); - SysdynResource sr = SysdynResource.getInstance(g); + Layer0 l0 = Layer0.getInstance(g); + SysdynResource sr = SysdynResource.getInstance(g); ModelingResources mr = ModelingResources.getInstance(g); ModelingUtils mu = new ModelingUtils(g); - String modelName = GraphUtils.findFreshName(g, "Model", SimanticsUI.getProject().get(), b.ConsistsOf, "%s%d"); + String modelName = GraphUtils.findFreshName(g, "Model", SimanticsUI.getProject().get(), l0.ConsistsOf, "%s%d"); Resource model = g.newResource(); - g.claimValue(model, b.HasName, modelName); - g.claimValue(model, b.HasLabel, modelName); - g.claim(model, b.InstanceOf, sr.SysdynModel); - g.claim(model, b.PartOf, SimanticsUI.getProject().get()); + g.claimLiteral(model, l0.HasName, modelName); + g.claimLiteral(model, l0.HasLabel, modelName); + g.claim(model, l0.InstanceOf, sr.SysdynModel); + g.claim(model, l0.PartOf, SimanticsUI.getProject().get()); Resource diagram = OrderedSetUtils.create(g, sr.ConfigurationDiagram); GraphLayer l = new GraphLayerUtil(g).createLayer(DiagramConstants.DEFAULT_LAYER_NAME, true); g.claim(diagram, mu.dr.HasLayer, l.getLayer()); - g.claimValue(diagram, b.HasName, "Diagrammi", StringBindingDefault.INSTANCE); + g.claimLiteral(diagram, l0.HasName, "Diagrammi", StringBindingDefault.INSTANCE); Resource conf = GraphUtils.create2(g, sr.Configuration, - b.PartOf, model, - b.HasName, modelName + l0.PartOf, model, + l0.HasName, modelName ); g.claim(conf, mr.CompositeToDiagram, diagram); g.claim(model, mu.SIMU.HasConfiguration, conf); Resource mapping = g.newResource(); - g.claim(mapping, b.InstanceOf, null, sr.DiagramToCompositeMapping); - g.claim(diagram, b.HasTrigger, mapping); + g.claim(mapping, l0.InstanceOf, null, sr.DiagramToCompositeMapping); + g.claim(diagram, l0.HasTrigger, mapping); - Resource report = GraphUtils.create2(g, mu.b.Report, mu.b.HasDocumentation, "===Report==="); + Resource report = GraphUtils.create2(g, l0.Report, l0.HasDocumentation, "===Report==="); GraphUtils.create2(g, mu.SIMU.Experiment, - mu.b.HasName, "Experiment", - mu.b.HasLabel, "Experiment", - mu.b.HasReportFactory, report, - mu.b.PartOf, model); + l0.HasName, "Experiment", + l0.HasLabel, "Experiment", + l0.HasReportFactory, report, + l0.PartOf, model); } }); return null; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java index 8ee3f6e0..edba7342 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java @@ -42,7 +42,7 @@ public class NewModuleNodeHandler extends AbstractHandler { String name = GraphUtils.findFreshName(g, "ModuleType", model, mu.b.ConsistsOf, "%s%d"); Resource moduleType = g.newResource(); - g.claimValue(moduleType, mu.b.HasName, name); + g.claimLiteral(moduleType, mu.b.HasName, name); g.claim(moduleType, mu.b.Inherits, sr.Module); g.claim(moduleType, mu.b.PartOf, model); @@ -64,8 +64,8 @@ public class NewModuleNodeHandler extends AbstractHandler { Resource moduleSymbol = g.newResource(); - g.claimValue(moduleSymbol, mu.b.HasName, name + " Symbol"); - g.claimValue(moduleSymbol, mu.b.HasLabel, name); + g.claimLiteral(moduleSymbol, mu.b.HasName, name + " Symbol"); + g.claimLiteral(moduleSymbol, mu.b.HasLabel, name); g.claim(moduleSymbol, mu.b.Inherits, sr.ModuleSymbol); g.claim(moduleSymbol, mu.mr.SymbolToComponentType, moduleType); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/RunBasicExperiment.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/RunBasicExperiment.java index a4f6488d..5780d4ae 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/RunBasicExperiment.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/RunBasicExperiment.java @@ -30,7 +30,8 @@ public class RunBasicExperiment extends AbstractHandler implements IElementUpdat return null; } - @Override + @SuppressWarnings("rawtypes") + @Override public void updateElement(UIElement element, Map parameters) { ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ShowModuleHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ShowModuleHandler.java index 7d48e60e..45d8d893 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ShowModuleHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ShowModuleHandler.java @@ -19,7 +19,6 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.handlers.HandlerUtil; import org.simantics.databoard.binding.java.StringBindingDefault; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ReadRequest; @@ -27,6 +26,7 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; import org.simantics.diagram.stubs.DiagramResource; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ComponentUtils; import org.simantics.modeling.ModelingResources; import org.simantics.structural.stubs.StructuralResource2; @@ -73,7 +73,7 @@ public class ShowModuleHandler extends AbstractHandler { for(Resource element : resources) { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); ModelingResources mr = ModelingResources.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); StructuralResource2 st = StructuralResource2.getInstance(graph); @@ -85,7 +85,7 @@ public class ShowModuleHandler extends AbstractHandler { if(diagram == null) return; - final String rvi = currentRVI + "/" + graph.getPossibleRelatedValue(component, b.HasName, StringBindingDefault.INSTANCE); + final String rvi = currentRVI + "/" + graph.getPossibleRelatedValue(component, l0.HasName, StringBindingDefault.INSTANCE); PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleSimulation.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleSimulation.java index 3f220a5e..7677150f 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleSimulation.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleSimulation.java @@ -65,7 +65,8 @@ public class ToggleSimulation extends AbstractHandler implements IElementUpdater return (Boolean)state.getValue(); } - @Override + @SuppressWarnings("rawtypes") + @Override public void updateElement(UIElement element, Map parameters) { ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultVariable.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultVariable.java index a8a3bf38..4890bb60 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultVariable.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultVariable.java @@ -4,10 +4,8 @@ import org.simantics.databoard.binding.Binding; import org.simantics.databoard.binding.java.DoubleBindingDefault; import org.simantics.databoard.binding.java.StringBindingDefault; import org.simantics.databoard.binding.mutable.MutableDouble; -import org.simantics.databoard.binding.mutable.MutableDoubleBinding; import org.simantics.databoard.type.DataType; import org.simantics.databoard.type.DoubleType; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -22,6 +20,7 @@ public class DefaultVariable extends ResourceVariable { super(resource); } + @SuppressWarnings("unchecked") @Override public T getValue(ReadGraph graph) throws DatabaseException { Layer0 b = Layer0.getInstance(graph); @@ -45,11 +44,11 @@ public class DefaultVariable extends ResourceVariable { @Override public void setValue(WriteGraph graph, Object object, Binding binding) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); // if(!DoubleBindingDefault.INSTANCE.equals(binding)) return; // if(!MutableDoubleBinding.INSTANCE.equals(binding)) return; - Resource represents = graph.getPossibleObject(resource, b.Represents); + Resource represents = graph.getPossibleObject(resource, l0.Represents); if(represents == null) return; Resource expression = graph.getPossibleObject(represents, sr.HasExpression); if(expression == null) return; @@ -58,6 +57,7 @@ public class DefaultVariable extends ResourceVariable { graph.claimLiteral(expression, sr.HasEquation, value.toString(), StringBindingDefault.INSTANCE); } + @SuppressWarnings("unchecked") @Override public T getInterface(ReadGraph graph, Class clazz) throws DatabaseException { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryRealizationVirtualGraph.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryRealizationVirtualGraph.java index 2634bad7..d637d8a8 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryRealizationVirtualGraph.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryRealizationVirtualGraph.java @@ -4,7 +4,6 @@ import java.util.Collection; import java.util.HashSet; import org.simantics.databoard.binding.java.StringBindingDefault; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -19,6 +18,7 @@ import org.simantics.db.layer0.realization.RealizationVirtualGraph; import org.simantics.db.layer0.realization.ResourceData; import org.simantics.db.layer0.util.RemoverUtil; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.SysdynResource; @@ -37,11 +37,11 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph { public Collection perform(ReadGraph graph) throws DatabaseException { // System.out.println("Compute runs starts"); HashSet result = new HashSet(); - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); SimulationResource SIMU = SimulationResource.getInstance(graph); - for(Resource config : graph.getObjects(model, b.ConsistsOf)) { + for(Resource config : graph.getObjects(model, l0.ConsistsOf)) { if(graph.isInstanceOf(config, SIMU.Experiment)) { - for(Resource run : graph.getObjects(config, b.ConsistsOf)) { + for(Resource run : graph.getObjects(config, l0.ConsistsOf)) { if(graph.isInstanceOf(run, SIMU.Run)) { // System.out.println("found run " + run); result.add(run); @@ -58,7 +58,8 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph { @Override public void add(ReadGraph graph, final Resource run) throws DatabaseException { - final String experimentName = graph.getPossibleRelatedValue(run, b.HasName, StringBindingDefault.INSTANCE); + final Layer0 l0 = Layer0.getInstance(graph); + final String experimentName = graph.getPossibleRelatedValue(run, l0.HasName, StringBindingDefault.INSTANCE); // System.out.println("RealizationVirtualGraph new experiment " + experimentName); @@ -74,7 +75,7 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph { public Collection perform(ReadGraph graph) throws DatabaseException { HashSet result = new HashSet(); Resource configuration = graph.getPossibleObject(model, SimulationResource.getInstance(graph).HasConfiguration); - for(Resource part : graph.getObjects(configuration, b.ConsistsOf)) { + for(Resource part : graph.getObjects(configuration, l0.ConsistsOf)) { result.add(part); } return result; @@ -87,11 +88,11 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph { @Override public void perform(WriteGraph graph) throws DatabaseException { int runNode = context.getIndex(run); - String partName = graph.getPossibleRelatedValue(part, b.HasName, StringBindingDefault.INSTANCE); + String partName = graph.getPossibleRelatedValue(part, l0.HasName, StringBindingDefault.INSTANCE); if(partName != null) { Resource partResource = graph.newResource(); int partNode = context.getIndex(partResource); - graph.claim(run, b.ConsistsOf, null, partResource); + graph.claim(run, l0.ConsistsOf, null, partResource); undiscovered.put(partNode, new ResourceData(runNode, part, valuation, partName, experimentName, null)); } } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryVariable.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryVariable.java index 035f2020..d0054c04 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryVariable.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryVariable.java @@ -7,7 +7,6 @@ import org.simantics.databoard.accessor.RecordAccessor; import org.simantics.databoard.accessor.error.AccessorConstructionException; import org.simantics.databoard.accessor.error.AccessorException; import org.simantics.databoard.binding.error.RuntimeBindingConstructionException; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; @@ -52,11 +51,11 @@ public class HistoryVariable extends ResourceVariable { // return super.getInterface(graph, clazz); // } + @SuppressWarnings("unchecked") @Override public T getInterface(ReadGraph graph, Class clazz) throws DatabaseException { if(RecordAccessor.class.equals(clazz) || Accessor.class.equals(clazz)) { SimulationResource SIMU = SimulationResource.getInstance(graph); - Builtins b = graph.getBuiltins(); Resource model = Variables.getModel(graph, this); Resource configuration = graph.getPossibleObject(model, SIMU.HasConfiguration); final SysdynModel sm = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java index 64057687..b9ce5bd2 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java @@ -14,7 +14,6 @@ package org.simantics.sysdyn.ui.project; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PartInitException; import org.simantics.databoard.binding.java.StringBindingDefault; -import org.simantics.db.Builtins; import org.simantics.db.Resource; import org.simantics.db.Session; import org.simantics.db.WriteGraph; @@ -26,6 +25,7 @@ import org.simantics.db.service.LifecycleSupport; import org.simantics.diagram.DiagramConstants; import org.simantics.diagram.synchronization.graph.layer.GraphLayer; import org.simantics.diagram.synchronization.graph.layer.GraphLayerUtil; +import org.simantics.layer0.Layer0; import org.simantics.layer0.utils.direct.GraphUtils; import org.simantics.modeling.ModelingResources; import org.simantics.modeling.ModelingUtils; @@ -83,44 +83,44 @@ public class SysdynProject extends AbstractProjectFeature { @Override public void run(WriteGraph g, Resource library, Callback callback, Callback errorCallback) { try { - Builtins b = g.getBuiltins(); SysdynResource sr = SysdynResource.getInstance(g); ModelingResources mr = ModelingResources.getInstance(g); ModelingUtils mu = new ModelingUtils(g); + Layer0 l0 = Layer0.getInstance(g); Resource model = g.newResource(); - String modelName = GraphUtils.findFreshName(g, "Model", library, b.ConsistsOf, "%s%d"); + String modelName = GraphUtils.findFreshName(g, "Model", library, l0.ConsistsOf, "%s%d"); - g.claimValue(model, b.HasName, modelName); - g.claimValue(model, b.HasLabel, modelName); - g.claim(model, b.InstanceOf, sr.SysdynModel); - g.claim(model, b.PartOf, library); + g.claimLiteral(model, l0.HasName, modelName); + g.claimLiteral(model, l0.HasLabel, modelName); + g.claim(model, l0.InstanceOf, sr.SysdynModel); + g.claim(model, l0.PartOf, library); Resource diagram = OrderedSetUtils.create(g, sr.ConfigurationDiagram); GraphLayer l = new GraphLayerUtil(g).createLayer(DiagramConstants.DEFAULT_LAYER_NAME, true); g.claim(diagram, mu.dr.HasLayer, l.getLayer()); - g.claimValue(diagram, b.HasName, "Diagrammi", StringBindingDefault.INSTANCE); + g.claimLiteral(diagram, l0.HasName, "Diagrammi", StringBindingDefault.INSTANCE); Resource conf = g.newResource(); - g.claimValue(conf, b.HasName, modelName+"Configuration"); - g.claim(conf, b.InstanceOf, sr.Configuration); + g.claimLiteral(conf, l0.HasName, modelName+"Configuration"); + g.claim(conf, l0.InstanceOf, sr.Configuration); g.claim(conf, mr.CompositeToDiagram, diagram); g.claim(model, mu.SIMU.HasConfiguration, conf); Resource mapping = g.newResource(); - g.claim(mapping, b.InstanceOf, null, mr.DiagramToCompositeMapping); - g.claim(diagram, b.HasTrigger, mapping); + g.claim(mapping, l0.InstanceOf, null, mr.DiagramToCompositeMapping); + g.claim(diagram, l0.HasTrigger, mapping); - Resource report = GraphUtils.create2(g, mu.b.Report, mu.b.HasDocumentation, "===Report==="); + Resource report = GraphUtils.create2(g, l0.Report, l0.HasDocumentation, "===Report==="); GraphUtils.create2(g, mu.SIMU.Experiment, - mu.b.HasName, "Experiment", - mu.b.HasLabel, "Experiment", - mu.b.HasReportFactory, report, - mu.b.PartOf, model); + l0.HasName, "Experiment", + l0.HasLabel, "Experiment", + l0.HasReportFactory, report, + l0.PartOf, model); callback.run(model); } catch(Exception e) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProjectLifeCycle.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProjectLifeCycle.java index 33148333..85899bf8 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProjectLifeCycle.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProjectLifeCycle.java @@ -24,6 +24,7 @@ import org.simantics.db.layer0.service.ActivationManager; import org.simantics.db.layer0.util.Simantics; import org.simantics.db.request.Read; import org.simantics.db.service.VirtualGraphSupport; +import org.simantics.layer0.Layer0; import org.simantics.project.IProject; import org.simantics.project.IProjectLifecycle; import org.simantics.project.exception.ProjectException; @@ -36,7 +37,6 @@ import org.simantics.utils.ui.ErrorLogger; public class SysdynProjectLifeCycle implements IProjectLifecycle { - private static final String CHEATSHEET_ID = "org.simantics.sysdyn.ui.cheatsheet1"; private static final String FIRST_SYSDYN_PROJECT = "firstSysdynProject"; @Override @@ -74,7 +74,7 @@ public class SysdynProjectLifeCycle implements IProjectLifecycle { - final Builtins b = session.getBuiltins(); + final Layer0 l0 = Layer0.getInstance(session); ActivationManager activationManager = session.getService(ActivationManager.class); if (activationManager != null) { activationManager.activate(session, projectResource); @@ -85,7 +85,7 @@ public class SysdynProjectLifeCycle implements IProjectLifecycle { final VirtualGraph graph = session.getService(VirtualGraph.class); SimulationResource SIMU = SimulationResource.getInstance(session); - session.asyncRequest(new ObjectsWithType(projectResource, b.ConsistsOf, SIMU.Model), new SingleSetListener() { + session.asyncRequest(new ObjectsWithType(projectResource, l0.ConsistsOf, SIMU.Model), new SingleSetListener() { @Override public void add(final Resource model) { @@ -165,12 +165,12 @@ public class SysdynProjectLifeCycle implements IProjectLifecycle { @Override public String perform(ReadGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); SimulationResource SIMU = SimulationResource.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); - for(Resource model : graph.getObjects(projectResource, b.ConsistsOf)) { + for(Resource model : graph.getObjects(projectResource, l0.ConsistsOf)) { if(graph.isInstanceOf(model, sr.SysdynModel)){ - for(Resource experiment : graph.getObjects(model, b.ConsistsOf)) { + 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); @@ -180,7 +180,7 @@ public class SysdynProjectLifeCycle implements IProjectLifecycle { } } } - return graph.getPossibleRelatedValue(projectResource, b.HasName); + return graph.getPossibleRelatedValue(projectResource, l0.HasName); } }); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java index 312a6b87..85994cc6 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java @@ -29,12 +29,12 @@ import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl; import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListener; import org.simantics.browsing.ui.swt.widgets.impl.TrackedModifyEvent; import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.db.management.ISessionContext; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.properties.widgets.ExpressionTypes; import org.simantics.sysdyn.ui.properties.widgets.ExpressionWidget; @@ -53,8 +53,8 @@ public class EquationTab extends PropertyTabContributorImpl { GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(6).applyTo(composite); TrackedText nameText = new TrackedText(composite, support, SWT.BORDER); - nameText.setTextFactory(new StringPropertyFactory(Builtins.URIs.HasName)); - nameText.addModifyListener(new StringPropertyModifier(context, Builtins.URIs.HasName)); + nameText.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName)); + nameText.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName)); GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText.getWidget()); @@ -136,10 +136,10 @@ public class EquationTab extends PropertyTabContributorImpl { Map map = new HashMap(); SysdynResource sr = SysdynResource.getInstance(graph); - Builtins b = graph.getBuiltins(); - Resource model = graph.getPossibleObject(input, b.PartOf); + Layer0 l0 = Layer0.getInstance(graph); + Resource model = graph.getPossibleObject(input, l0.PartOf); if (model != null) { - Collection variables = graph.getObjects(model, b.ConsistsOf); + Collection variables = graph.getObjects(model, l0.ConsistsOf); for(Resource v : variables) { Object unit = graph.getPossibleRelatedValue(v, sr.HasUnit); if (unit != null && !map.keySet().contains((String) unit)) { @@ -167,7 +167,7 @@ public class EquationTab extends PropertyTabContributorImpl { @Override public void applyText(WriteGraph graph, Resource input, String text) throws DatabaseException { - graph.claimValue(input, SysdynResource.getInstance(graph).HasUnit, text); + graph.claimLiteral(input, SysdynResource.getInstance(graph).HasUnit, text); } }); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java index f8fccc79..53f40a19 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java @@ -9,12 +9,12 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IWorkbenchSite; import org.simantics.browsing.ui.swt.PropertyTabContributorImpl; import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.exception.DatabaseException; import org.simantics.db.management.ISessionContext; +import org.simantics.layer0.Layer0; import org.simantics.structural.stubs.StructuralResource2; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.properties.widgets.ModuleInputEditingSupport; @@ -50,14 +50,14 @@ public class ModuleInputTab extends PropertyTabContributorImpl { @Override public ArrayList getRows(ReadGraph graph, Resource module) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); StructuralResource2 sr2 = StructuralResource2.getInstance(graph); ArrayList result = new ArrayList(); - Resource instanceOf = graph.getPossibleObject(module, b.InstanceOf); + Resource instanceOf = graph.getPossibleObject(module, l0.InstanceOf); if(instanceOf == null) return result; Resource configuration = graph.getSingleObject(instanceOf, sr2.IsDefinedBy); - for(Resource input : graph.syncRequest(new ObjectsWithType(configuration, b.ConsistsOf, sr.Input))) { + 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); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java index a12623a4..7bc047e9 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java @@ -9,12 +9,12 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IWorkbenchSite; import org.simantics.browsing.ui.swt.PropertyTabContributorImpl; import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.exception.DatabaseException; import org.simantics.db.management.ISessionContext; +import org.simantics.layer0.Layer0; import org.simantics.structural.stubs.StructuralResource2; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.properties.widgets.ModuleOutputEditingSupport; @@ -50,14 +50,14 @@ public class ModuleOutputTab extends PropertyTabContributorImpl { @Override public ArrayList getRows(ReadGraph graph, Resource module) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); StructuralResource2 sr2 = StructuralResource2.getInstance(graph); ArrayList result = new ArrayList(); - Resource instanceOf = graph.getPossibleObject(module, b.InstanceOf); + Resource instanceOf = graph.getPossibleObject(module, l0.InstanceOf); if(instanceOf == null) return result; Resource configuration = graph.getSingleObject(instanceOf, sr2.IsDefinedBy); - for(Resource variable : graph.syncRequest(new ObjectsWithType(configuration, b.ConsistsOf, sr.Variable))) { + for(Resource variable : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Variable))) { if(!graph.hasStatement(variable, sr.IsOutput)) continue; Resource dependency = null; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java index 2776d5b6..31acfd11 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java @@ -6,12 +6,12 @@ import java.util.Collections; import org.simantics.browsing.ui.SelectionProcessor; import org.simantics.browsing.ui.swt.ComparableTabContributor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.ManyObjectsForFunctionalRelationException; import org.simantics.db.exception.ServiceException; import org.simantics.diagram.stubs.DiagramResource; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.SysdynResource; @@ -29,7 +29,7 @@ public class ResourceSelectionProcessor implements SelectionProcessor tabs = new ArrayList(); if (backend.isInstanceOf(r, dr.Element)) { Resource component = backend.getPossibleObject(r, mr.ElementToComponent); @@ -69,7 +69,7 @@ public class ResourceSelectionProcessor implements SelectionProcessor perform(ReadGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + 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)) { Resource output = graph.getSingleObject(dependency, sr.HasTail); - result.put((String)graph.getRelatedValue(output, b.HasName), dependency); + result.put((String)graph.getRelatedValue(output, l0.HasName), dependency); } } return result; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleOutputEditingSupport.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleOutputEditingSupport.java index 50da2dbc..9625e596 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleOutputEditingSupport.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleOutputEditingSupport.java @@ -8,12 +8,12 @@ import org.eclipse.jface.viewers.EditingSupport; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TextCellEditor; import org.eclipse.swt.SWT; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; @@ -56,14 +56,14 @@ public class ModuleOutputEditingSupport extends EditingSupport { @Override public HashMap perform(ReadGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + 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.getPossibleObject(dependency, sr.RefersTo).equals(outputVariable)) { Resource input = graph.getSingleObject(dependency, sr.HasHead); - result.put((String)graph.getRelatedValue(input, b.HasName), dependency); + result.put((String)graph.getRelatedValue(input, l0.HasName), dependency); } } return result; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ReferenceRow.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ReferenceRow.java index d3e4f8a5..d40411d5 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ReferenceRow.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ReferenceRow.java @@ -1,13 +1,13 @@ package org.simantics.sysdyn.ui.properties.widgets; import org.simantics.databoard.binding.java.StringBindingDefault; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; @@ -42,7 +42,7 @@ public class ReferenceRow { @Override public String perform(ReadGraph graph) throws DatabaseException { - return (String)graph.getRelatedValue(getVariable(), graph.getBuiltins().HasName); + return (String)graph.getRelatedValue(getVariable(), Layer0.getInstance(graph).HasName); } }); } catch (DatabaseException e) { @@ -60,14 +60,14 @@ public class ReferenceRow { @Override public String perform(ReadGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); SysdynResource sr = SysdynResource.getInstance(graph); Resource valueResource = graph.getPossibleObject(dependency, sr.HasTail); if(!graph.isInstanceOf(valueResource, sr.Variable)) valueResource = graph.getPossibleObject(dependency, sr.HasHead); if(!graph.isInstanceOf(valueResource, sr.Variable)) return ""; - return (String)graph.getRelatedValue(valueResource, b.HasName, StringBindingDefault.INSTANCE); + return (String)graph.getRelatedValue(valueResource, l0.HasName, StringBindingDefault.INSTANCE); } }); } catch (DatabaseException e) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ShortcutTabWidget.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ShortcutTabWidget.java index 1c9fda34..0eeba7a8 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ShortcutTabWidget.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ShortcutTabWidget.java @@ -16,12 +16,12 @@ import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; import org.simantics.browsing.ui.swt.widgets.impl.Widget; import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; -import org.simantics.db.Builtins; 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.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ExceptionUtils; @@ -106,15 +106,15 @@ public class ShortcutTabWidget implements Widget { throws DatabaseException { HashSet variables = new HashSet(); SysdynResource sr = SysdynResource.getInstance(graph); - Builtins b = graph.getBuiltins(); - + Layer0 l0 = Layer0.getInstance(graph); + Collection dependencies = graph.getObjects(r, sr.IsHeadOf); for(Resource d : dependencies) { if(graph.isInstanceOf(d, sr.Dependency)) { Resource tail = graph.getPossibleObject(d, sr.HasTail); if(tail != null) { - Object name = graph.getPossibleRelatedValue(tail, b.HasName); + Object name = graph.getPossibleRelatedValue(tail, l0.HasName); if(name != null) variables.add((String)name); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java index 4fc7b78e..01acc49e 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java @@ -124,7 +124,7 @@ public class BasicExpression implements IExpression { g.claim(expression, b.InstanceOf, null, expressionType); g.claim(variable, sr.HasExpression, expression); } - g.claimValue(expression, sr.HasEquation, currentText); + g.claimLiteral(expression, sr.HasEquation, currentText); } }); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/LookupInputOutputTable.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/LookupInputOutputTable.java index 60104211..81935ada 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/LookupInputOutputTable.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/LookupInputOutputTable.java @@ -134,7 +134,8 @@ public class LookupInputOutputTable extends Composite { * @param clazz String.class or Double.class * @return input as string or double or null if asked for something else */ - public Object getInput(Class clazz) { + @SuppressWarnings("rawtypes") + public Object getInput(Class clazz) { if(clazz == String.class) { return "" + input; } else if (clazz == Double.class) { @@ -161,7 +162,8 @@ public class LookupInputOutputTable extends Composite { * @param clazz String.class or Double.class * @return output as string or double or null if asked for something else */ - public Object getOutput(Class clazz) { + @SuppressWarnings("rawtypes") + public Object getOutput(Class clazz) { if(clazz == String.class) { return "" + output; } else if (clazz == Double.class) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/StockExpression.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/StockExpression.java index 6d357d73..5d9ab609 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/StockExpression.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/StockExpression.java @@ -17,13 +17,13 @@ import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; +import org.simantics.layer0.Layer0; import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; @@ -123,17 +123,17 @@ public class StockExpression implements IExpression { throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(g); Resource expression = g.getPossibleObject(variable, sr.HasExpression); - Builtins b = g.getBuiltins(); + Layer0 l0 = Layer0.getInstance(g); if(expression != null && !g.isInstanceOf(expression, sr.StockExpression)) { g.deny(variable, sr.HasExpression); expression = null; } if(expression == null) { expression = g.newResource(); - g.claim(expression, b.InstanceOf, null, sr.StockExpression); + g.claim(expression, l0.InstanceOf, null, sr.StockExpression); g.claim(variable, sr.HasExpression, expression); } - g.claimValue(expression, sr.HasInitialEquation, currentText); + g.claimLiteral(expression, sr.HasInitialEquation, currentText); } }); @@ -158,7 +158,7 @@ public class StockExpression implements IExpression { @Override public String perform(ReadGraph graph) throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(graph); - Builtins b = graph.getBuiltins(); + Layer0 l0 = Layer0.getInstance(graph); Collection heads = graph.getObjects(variable, sr.IsHeadOf); Collection tails = graph.getObjects(variable, sr.IsTailOf); @@ -168,7 +168,7 @@ public class StockExpression implements IExpression { if(graph.isInstanceOf(r, sr.Flow)) { Resource tail = graph.getPossibleObject(r, sr.HasTail); if(tail != null) { - Object name = graph.getPossibleRelatedValue(tail, b.HasName); + Object name = graph.getPossibleRelatedValue(tail, l0.HasName); if (name != null) builder.append(" + " + name); @@ -179,7 +179,7 @@ public class StockExpression implements IExpression { if(graph.isInstanceOf(r, sr.Flow)) { Resource head = graph.getPossibleObject(r, sr.HasHead); if(head != null) { - Object name = graph.getPossibleRelatedValue(head, b.HasName); + Object name = graph.getPossibleRelatedValue(head, l0.HasName); if (name != null) builder.append(" - " + name); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/WithLookupExpression.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/WithLookupExpression.java index 8d9afd02..24b075da 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/WithLookupExpression.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/WithLookupExpression.java @@ -35,7 +35,6 @@ import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.xy.XYDataset; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -43,6 +42,7 @@ import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; 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.sysdyn.representation.Auxiliary; import org.simantics.sysdyn.tableParser.ParseException; @@ -253,23 +253,23 @@ public class WithLookupExpression implements IExpression { throws DatabaseException { SysdynResource sr = SysdynResource.getInstance(g); Resource expression = g.getPossibleObject(variable, sr.HasExpression); - Builtins b = g.getBuiltins(); + Layer0 l0 = Layer0.getInstance(g); if(expression != null && !g.isInstanceOf(expression, sr.WithLookupExpression)) { g.deny(variable, sr.HasExpression); expression = null; } if(expression == null) { expression = g.newResource(); - g.claim(expression, b.InstanceOf, null, sr.WithLookupExpression); + g.claim(expression, l0.InstanceOf, null, sr.WithLookupExpression); g.claim(variable, sr.HasExpression, expression); - g.claimValue(expression, sr.HasMinX, 0.0); - g.claimValue(expression, sr.HasMaxX, 10.0); - g.claimValue(expression, sr.HasMinY, 0.0); - g.claimValue(expression, sr.HasMaxY, 10.0); + g.claimLiteral(expression, sr.HasMinX, 0.0); + g.claimLiteral(expression, sr.HasMaxX, 10.0); + g.claimLiteral(expression, sr.HasMinY, 0.0); + g.claimLiteral(expression, sr.HasMaxY, 10.0); } - g.claimValue(expression, sr.HasEquation, currentExpression); - g.claimValue(expression, sr.HasLookup, currentLookupTable); + g.claimLiteral(expression, sr.HasEquation, currentExpression); + g.claimLiteral(expression, sr.HasLookup, currentLookupTable); } }); } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/factories/DoublePropertyModifier.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/factories/DoublePropertyModifier.java index 5a2f5a72..a0eb20b8 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/factories/DoublePropertyModifier.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/factories/DoublePropertyModifier.java @@ -17,7 +17,7 @@ public class DoublePropertyModifier extends TextModifyListenerImpl { @Override public void applyText(WriteGraph graph, Resource input, String text) throws DatabaseException { - graph.claimValue(input, graph.getResource(propertyURI), Double.parseDouble(text), DoubleBindingDefault.INSTANCE); + graph.claimLiteral(input, graph.getResource(propertyURI), Double.parseDouble(text), DoubleBindingDefault.INSTANCE); } } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/property/OperationProjectContributor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/property/OperationProjectContributor.java index af6e5e6f..cd109070 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/property/OperationProjectContributor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/property/OperationProjectContributor.java @@ -6,7 +6,6 @@ import java.util.Collection; import org.simantics.browsing.ui.Tester; import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor; import org.simantics.browsing.ui.graph.tester.GraphTesters; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ObjectsWithType; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java index cc6b6077..d7a2c608 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java @@ -33,7 +33,6 @@ import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.xy.AbstractXYDataset; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -43,6 +42,7 @@ import org.simantics.db.layer0.SelectionHints; import org.simantics.db.layer0.variable.Variable; import org.simantics.db.layer0.variable.Variables; import org.simantics.diagram.stubs.DiagramResource; +import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingUtils; import org.simantics.simulation.ontology.SimulationResource; import org.simantics.sysdyn.SysdynResource; @@ -220,7 +220,7 @@ public class TrendView extends ViewPart { protected Collection loadAllActive(ReadGraph g, Resource element, Resource runtime) throws DatabaseException { - Builtins b = g.getBuiltins(); + Layer0 l0 = Layer0.getInstance(g); SysdynResource sr = SysdynResource.getInstance(g); @@ -232,7 +232,7 @@ public class TrendView extends ViewPart { String variableURI = g.getPossibleRelatedValue(runtime, dr.HasVariable); - System.out.println("load dataset for '"+ g.getPossibleRelatedValue(resource, b.HasName) + "'in composite '" + variableURI + "'"); + System.out.println("load dataset for '"+ g.getPossibleRelatedValue(resource, l0.HasName) + "'in composite '" + variableURI + "'"); Variable compositeVariable = Variables.getVariable(g, variableURI); Variable item = compositeVariable.browsePossible(g, resource); if(item == null) return null; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java index 2862850f..b810ba47 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java @@ -9,7 +9,6 @@ import java.util.concurrent.locks.Lock; import org.eclipse.core.runtime.Platform; import org.simantics.databoard.annotations.Optional; import org.simantics.databoard.binding.mutable.Variant; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.Session; @@ -18,8 +17,8 @@ import org.simantics.db.WriteGraph; import org.simantics.db.common.request.ReadRequest; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; -import org.simantics.db.service.LifecycleSupport; import org.simantics.db.service.VirtualGraphSupport; +import org.simantics.layer0.Layer0; import org.simantics.layer0.utils.direct.GraphUtils; import org.simantics.simulation.experiment.Experiment; import org.simantics.simulation.experiment.ExperimentState; @@ -63,29 +62,28 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment { @Override public void perform(WriteGraph graph) throws DatabaseException { - Builtins b = graph.getBuiltins(); - Resource model = graph.getSingleObject(experiment, b.PartOf); - Resource project = graph.getSingleObject(model, b.PartOf); - String projectName = graph.getPossibleRelatedValue(project, b.HasName); + Layer0 l0 = Layer0.getInstance(graph); + Resource model = graph.getSingleObject(experiment, l0.PartOf); + Resource project = graph.getSingleObject(model, l0.PartOf); + String projectName = graph.getPossibleRelatedValue(project, l0.HasName); File root = new File(Platform.getLocation().toOSString(), "www.simantics.org"); if(!root.isDirectory()) root.mkdir(); File projectRoot = new File(root, projectName); if(!projectRoot.isDirectory()) projectRoot.mkdir(); File file = new File( projectRoot, UUID.randomUUID().toString() + ".dbb"); - String name = GraphUtils.findFreshName(graph, "Result", model, b.ConsistsOf, "%s%d"); + String name = GraphUtils.findFreshName(graph, "Result", model, l0.ConsistsOf, "%s%d"); SysdynResource sr = SysdynResource.getInstance(graph); Resource res = GraphUtils.create2(graph, sr.Result, - b.HasLabel, name, - b.HasName, name, - b.PartOf, model, + l0.HasLabel, name, + l0.HasName, name, + l0.PartOf, model, sr.HasResultFile, file.getAbsolutePath()); graph.claim(experiment, sr.HasResult, res); sysdynModel.getSysdynResult().saveToFile(file); } }); - session.getService(LifecycleSupport.class).save(); } catch (DatabaseException e) { e.printStackTrace(); } diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Input.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Input.java index 12a7c52e..dcefbe88 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Input.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Input.java @@ -3,7 +3,6 @@ package org.simantics.sysdyn.representation; import java.util.List; 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.representation.visitors.IElementVisitorVoid;