]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Changed Builtins to Layer0
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 27 Aug 2010 12:14:04 +0000 (12:14 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 27 Aug 2010 12:14:04 +0000 (12:14 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@17658 ac1ea38d-2e2b-0410-8846-a27921b304fc

66 files changed:
org.simantics.modelica/src/org/simantics/modelica/data/SimulationResult.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/BrowserSelection.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/SysdynBrowser.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Experiment.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ExperimentLabeler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/InputLabeler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModelLabeler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleLabeler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleType.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleTypeLabeler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Modules.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Project.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultLabeler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/VariableLabeler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModelNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleTypeNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/VariableNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/dependencies/CreateDependencyGraph.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/OpenDiagramFromConfigurationAdapter.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/SysdynConnectionAdvisor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ComponentNameSynchronizer.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/SysdynElementFactory.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/connections/DependencyConnectionFactory.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/EquationView.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/NameComposite.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/ShortcutTabs.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/UnitSelector.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/AuxiliaryExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ConstantExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/LookupInputOutputTable.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/LookupPopup.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ParameterExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/StockExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/WithLookupExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModelHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/RunBasicExperiment.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ShowModuleHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleSimulation.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/DefaultVariable.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryRealizationVirtualGraph.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/HistoryVariable.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProjectLifeCycle.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ChartTableWidget.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ChartWidget.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ExpressionWidget.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleInputEditingSupport.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ModuleOutputEditingSupport.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ReferenceRow.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/ShortcutTabWidget.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/LookupInputOutputTable.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/StockExpression.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/WithLookupExpression.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/factories/DoublePropertyModifier.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/property/OperationProjectContributor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynExperiment.java
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Input.java

index 89ce4c9b844c6a70ff87f2599a2ee444f7b0a314..8a5e5639bcd3ab9ce4dc4798ca6c2ea946f71950 100644 (file)
@@ -11,8 +11,6 @@
  *******************************************************************************/\r
 package org.simantics.modelica.data;\r
 \r
-import gnu.trove.TDoubleArrayList;\r
-\r
 import java.io.File;\r
 import java.io.FileInputStream;\r
 import java.io.FileNotFoundException;\r
index f30b80084453cb6cf169690cc77c6232387fef91..422646db22608809f426a8309002fe98a06ec1f6 100644 (file)
@@ -14,6 +14,7 @@ public class BrowserSelection implements IAdaptable {
                this.model = model;\r
        }\r
 \r
+       @SuppressWarnings("rawtypes")\r
        @Override\r
        public Object getAdapter(Class adapter) {\r
                if (adapter == Resource.class)\r
index 032328a8d027015102e16cf7dd23ee6e6096daf5..97b57c675d8add1d5390500e0a0d39e004f36294 100644 (file)
@@ -92,7 +92,8 @@ public class SysdynBrowser extends GraphExplorerView {
         //toolBar.add(new HomeAction());\r
     }\r
     \r
-    @Override\r
+    @SuppressWarnings("rawtypes")\r
+       @Override\r
     public Object getAdapter(Class adapter) {\r
         if (adapter == IPropertyPage.class)\r
             return new SysdynPropertyPage(getSite(), Collections.singleton("http://www.simantics.org/Sysdyn-1.0/Browser"));\r
index 3016f8e842bff969c8e51fff2330cd5d466f5a9d..a314315d5eb192668eed08f19002de5186e0b297 100644 (file)
@@ -5,10 +5,10 @@ import java.util.Collection;
 \r
 import org.simantics.browsing.ui.common.node.AbstractNode;\r
 import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode;\r
 import org.simantics.sysdyn.ui.browser.nodes.InputNode;\r
@@ -19,9 +19,9 @@ public class Configuration extends ViewpointContributor<ConfigurationNode<Resour
 \r
        @Override\r
        public Collection<?> getContribution(ReadGraph graph, ConfigurationNode<Resource> configuration) throws DatabaseException {\r
-               Builtins b = graph.getBuiltins();\r
+               Layer0 l0 = Layer0.getInstance(graph);\r
                ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
-               if (!graph.isInheritedFrom(graph.getSingleObject(configuration.data, b.InstanceOf), b.Realization))\r
+               if (!graph.isInheritedFrom(graph.getSingleObject(configuration.data, l0.InstanceOf), l0.Realization))\r
                        return result;\r
                \r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
@@ -29,8 +29,8 @@ public class Configuration extends ViewpointContributor<ConfigurationNode<Resour
                ArrayList<Resource> inputs = new ArrayList<Resource>();\r
                ArrayList<Resource> modules = new ArrayList<Resource>();\r
                \r
-               for(Resource r : graph.getObjects(configuration.data, b.ConsistsOf)) {\r
-                       Resource represents  = graph.getSingleObject(r, b.Represents);\r
+               for(Resource r : graph.getObjects(configuration.data, l0.ConsistsOf)) {\r
+                       Resource represents  = graph.getSingleObject(r, l0.Represents);\r
                        if(graph.isInstanceOf(represents, sr.IndependentVariable)) {\r
                                variables.add(r);\r
                        } else if (graph.isInstanceOf(represents, sr.Input)) {\r
index 307b3eb74d872eea852fb0ca6fecc01f10c82d00..21a1d9158fffedece8e2892099a52acfd1c3d88a 100644 (file)
@@ -16,11 +16,11 @@ import java.util.Collection;
 \r
 import org.simantics.browsing.ui.common.node.AbstractNode;\r
 import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ObjectsWithType;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
 \r
@@ -30,8 +30,8 @@ public class Experiment extends ViewpointContributor<ExperimentsFolder> {
        @Override\r
     public Collection<?> getContribution(ReadGraph graph, ExperimentsFolder experimentsFolder) throws DatabaseException {\r
         ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
-        Builtins b = graph.getBuiltins();\r
-        for(Resource r : graph.syncRequest(new ObjectsWithType(experimentsFolder.data, b.ConsistsOf, SimulationResource.getInstance(graph).Experiment))) {\r
+        Layer0 l0 = Layer0.getInstance(graph);\r
+        for(Resource r : graph.syncRequest(new ObjectsWithType(experimentsFolder.data, l0.ConsistsOf, SimulationResource.getInstance(graph).Experiment))) {\r
             try {\r
                 result.add(graph.adapt(r, AbstractNode.class));\r
             } catch(DatabaseException e) {\r
index e26f807df491529db5d924f8422e1fcb5b4a53cf..c5e409e0111d818459d91715d55cbbbf9352a3e8 100644 (file)
@@ -15,13 +15,14 @@ package org.simantics.sysdyn.ui.browser.contributions;
 import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.ui.browser.nodes.ExperimentNode;\r
 \r
 public class ExperimentLabeler extends LabelerContributor<ExperimentNode>{\r
 \r
     @Override\r
     public String getLabel(ReadGraph graph, ExperimentNode experiment) throws DatabaseException {\r
-        String name = graph.getPossibleRelatedValue(experiment.data, graph.getBuiltins().HasLabel);\r
+        String name = graph.getPossibleRelatedValue(experiment.data, Layer0.getInstance(graph).HasLabel);\r
         return name == null ? "Experiment (no name)" : name;\r
     }\r
 \r
index 5e1938166bb0fd528890394e05da66cd863647aa..d2c60c8a515281de7ac4b8fd9384022a99712077 100644 (file)
@@ -1,24 +1,24 @@
 package org.simantics.sysdyn.ui.browser.contributions;\r
 \r
 import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.ui.browser.nodes.InputNode;\r
 \r
 public class InputLabeler extends LabelerContributor<InputNode>{\r
 \r
     @Override\r
     public String getLabel(ReadGraph graph, InputNode var) throws DatabaseException {\r
-        Builtins b = graph.getBuiltins();\r
+       Layer0 l0 = Layer0.getInstance(graph);\r
         Resource varres = var.data;\r
         StringBuilder sb = new StringBuilder();\r
-        for(Resource r : graph.getObjects(varres, b.HasName))\r
+        for(Resource r : graph.getObjects(varres, l0.HasName))\r
             sb.append(graph.getValue(r));\r
         sb.append(" : ");\r
-        for(Resource t : graph.getObjects(varres, b.InstanceOf))\r
-            for(Resource r : graph.getObjects(t, b.HasName))\r
+        for(Resource t : graph.getObjects(varres, l0.InstanceOf))\r
+            for(Resource r : graph.getObjects(t, l0.HasName))\r
                 sb.append(graph.getValue(r));\r
         return sb.toString();\r
     }\r
index cb122ee1f673f01e35926ee8f00dd59423a54d8e..1deff6d3502cb3028ef8897f459014c306e8c87c 100644 (file)
@@ -3,13 +3,14 @@ package org.simantics.sysdyn.ui.browser.contributions;
 import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.ui.browser.nodes.ModelNode;\r
 \r
 public class ModelLabeler extends LabelerContributor<ModelNode>{\r
 \r
     @Override\r
     public String getLabel(ReadGraph graph, ModelNode model) throws DatabaseException {\r
-        String label = graph.getPossibleRelatedValue(model.data, graph.getBuiltins().HasLabel);\r
+        String label = graph.getPossibleRelatedValue(model.data, Layer0.getInstance(graph).HasLabel);\r
         return label == null ? "Model (no name)" : label;\r
     }\r
 }\r
index b7a9925af443982e2935074d770a381e1dec9c4f..abaf0c6510e9c665d9c9e7da3e152dd08d891990 100644 (file)
 package org.simantics.sysdyn.ui.browser.contributions;\r
 \r
 import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.ui.browser.nodes.ModuleNode;\r
 \r
 public class ModuleLabeler  extends LabelerContributor<ModuleNode>{\r
 \r
     @Override\r
     public String getLabel(ReadGraph graph, ModuleNode module) throws DatabaseException {\r
-        Builtins b = graph.getBuiltins();\r
+       Layer0 l0 = Layer0.getInstance(graph);\r
         Resource resource = module.data;\r
         StringBuilder sb = new StringBuilder();\r
-        for(Resource r : graph.getObjects(resource, b.HasName))\r
+        for(Resource r : graph.getObjects(resource, l0.HasName))\r
             sb.append(graph.getValue(r));\r
         sb.append(" : ");\r
-        for(Resource t : graph.getObjects(resource, b.InstanceOf))\r
-            for(Resource r : graph.getObjects(t, b.HasName))\r
+        for(Resource t : graph.getObjects(resource, l0.InstanceOf))\r
+            for(Resource r : graph.getObjects(t, l0.HasName))\r
                 sb.append(graph.getValue(r));\r
         return sb.toString();\r
     }\r
index b47e8d7e577f69a999b029fd4b0bec6402c5b269..38c1a60d4dc245abb4eb3d9f43a35930141d9197 100644 (file)
@@ -5,11 +5,11 @@ import java.util.Collection;
 \r
 import org.simantics.browsing.ui.common.node.AbstractNode;\r
 import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ObjectsWithType;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
 import org.simantics.sysdyn.SysdynResource;\r
@@ -23,7 +23,7 @@ public class ModuleType extends ViewpointContributor<ModuleTypeNode> {
        @Override\r
        public Collection<?> getContribution(ReadGraph graph, ModuleTypeNode module) throws DatabaseException {\r
                ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
-               Builtins b = graph.getBuiltins();\r
+               Layer0 l0 = Layer0.getInstance(graph);\r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
                StructuralResource2 str = StructuralResource2.getInstance(graph);\r
                \r
@@ -32,13 +32,13 @@ public class ModuleType extends ViewpointContributor<ModuleTypeNode> {
 \r
                if(instance == null) return result;\r
                Resource conf = graph.getSingleObject(instance, str.IsDefinedBy);\r
-               for(Resource r : graph.syncRequest(new ObjectsWithType(conf, b.ConsistsOf, sr.IndependentVariable))) {\r
+               for(Resource r : graph.syncRequest(new ObjectsWithType(conf, l0.ConsistsOf, sr.IndependentVariable))) {\r
                        result.add(new VariableNode<Resource>(r));\r
                }\r
-               for(Resource r : graph.syncRequest(new ObjectsWithType(conf, b.ConsistsOf, sr.Input))) {\r
+               for(Resource r : graph.syncRequest(new ObjectsWithType(conf, l0.ConsistsOf, sr.Input))) {\r
                        result.add(new InputNode(r));\r
                }\r
-               for(Resource r : graph.syncRequest(new ObjectsWithType(conf, b.ConsistsOf, sr.Module))) {\r
+               for(Resource r : graph.syncRequest(new ObjectsWithType(conf, l0.ConsistsOf, sr.Module))) {\r
                        result.add(new ModuleNode(r));\r
                }\r
                return result;\r
index 2d78a549ec849583b76013e3dd85ae9aec07cd49..941112f0767a7c8fc45c04e8ee5822933255e75e 100644 (file)
@@ -4,6 +4,7 @@ import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode;\r
 \r
@@ -13,7 +14,7 @@ public class ModuleTypeLabeler extends LabelerContributor<ModuleTypeNode>{
     public String getLabel(ReadGraph graph, ModuleTypeNode moduleType) throws DatabaseException {\r
         ModelingResources mr = ModelingResources.getInstance(graph);\r
         Resource typeResource =  graph.getPossibleObject(moduleType.data, mr.SymbolToComponentType);\r
-        String label = graph.getPossibleRelatedValue(typeResource, graph.getBuiltins().HasName);\r
+        String label = graph.getPossibleRelatedValue(typeResource, Layer0.getInstance(graph).HasName);\r
         return label == null ? "ModuleType (no name)" : label;\r
     }\r
 \r
index 70645d2d653ed74b34ce4e39dcbfa950fef7f028..769968a72f430228b0c64df2cfc4ea159709a096 100644 (file)
@@ -5,11 +5,11 @@ import java.util.Collection;
 \r
 import org.simantics.browsing.ui.common.node.AbstractNode;\r
 import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ObjectsWithType;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
 import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode;\r
@@ -22,9 +22,9 @@ public class Modules extends ViewpointContributor<ModulesNode> {
     throws DatabaseException {\r
 \r
         ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
-        Builtins b = graph.getBuiltins();\r
+        Layer0 l0 = Layer0.getInstance(graph);\r
         StructuralResource2 st = StructuralResource2.getInstance(graph);\r
-        for(Resource r : graph.syncRequest(new ObjectsWithType(model.data, b.ConsistsOf, st.ComponentType))) {\r
+        for(Resource r : graph.syncRequest(new ObjectsWithType(model.data, l0.ConsistsOf, st.ComponentType))) {\r
             Resource symbol = graph.getPossibleObject(r,ModelingResources.getInstance(graph).ComponentTypeToSymbol);\r
             result.add(new ModuleTypeNode(symbol));\r
         }\r
index cc763e6c340a13bee613246831f21b3a7bd86267..578838f97cbbe18828fa098b0af5ff8e945983fb 100644 (file)
@@ -5,11 +5,11 @@ import java.util.Collection;
 \r
 import org.simantics.browsing.ui.common.node.AbstractNode;\r
 import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ObjectsWithType;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 \r
 public class Project extends ViewpointContributor<Resource> {\r
@@ -20,9 +20,9 @@ public class Project extends ViewpointContributor<Resource> {
     throws DatabaseException {\r
 \r
         ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
-        Builtins b = graph.getBuiltins();\r
+        Layer0 l0 = Layer0.getInstance(graph);\r
         SysdynResource sr = SysdynResource.getInstance(graph);\r
-        for(Resource r : graph.syncRequest(new ObjectsWithType(project, b.ConsistsOf, sr.SysdynModel))) {\r
+        for(Resource r : graph.syncRequest(new ObjectsWithType(project, l0.ConsistsOf, sr.SysdynModel))) {\r
             try {\r
                 result.add(graph.adapt(r, AbstractNode.class));\r
             } catch(DatabaseException e) {\r
index 84489473ece6210fa8bf23eb76794ee441744b99..3ec071fcc5cb1b7bbcc9927af56b63645d311061 100644 (file)
@@ -3,13 +3,14 @@ package org.simantics.sysdyn.ui.browser.contributions;
 import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode;\r
 \r
 public class SimulationResultLabeler extends LabelerContributor<SimulationResultNode>{\r
 \r
     @Override\r
     public String getLabel(ReadGraph graph, SimulationResultNode result) throws DatabaseException {\r
-        String name = graph.getPossibleRelatedValue(result.data, graph.getBuiltins().HasLabel);\r
+        String name = graph.getPossibleRelatedValue(result.data, Layer0.getInstance(graph).HasLabel);\r
         return name == null ? "Experiment (no name)" : name;\r
     }\r
 \r
index 7243a5390e902b9c372826e0122a589fe098f2b6..7e78b3a8379177c0c414de9d85905283d3063baf 100644 (file)
 package org.simantics.sysdyn.ui.browser.contributions;\r
 \r
 import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.ui.browser.nodes.VariableNode;\r
 \r
 public class VariableLabeler  extends LabelerContributor<VariableNode<Resource>>{\r
 \r
     @Override\r
     public String getLabel(ReadGraph graph, VariableNode<Resource> var) throws DatabaseException {\r
-        Builtins b = graph.getBuiltins();\r
+       Layer0 l0 = Layer0.getInstance(graph);\r
         Resource varres = var.data;\r
         StringBuilder sb = new StringBuilder();\r
-        for(Resource r : graph.getObjects(varres, b.HasName))\r
+        for(Resource r : graph.getObjects(varres, l0.HasName))\r
             sb.append(graph.getValue(r));\r
         sb.append(" : ");\r
-        for(Resource t : graph.getObjects(varres, b.InstanceOf))\r
-            for(Resource r : graph.getObjects(t, b.HasName))\r
+        for(Resource t : graph.getObjects(varres, l0.InstanceOf))\r
+            for(Resource r : graph.getObjects(t, l0.HasName))\r
                 sb.append(graph.getValue(r));\r
         return sb.toString();\r
     }\r
index ad0a5f54c578c0f5098765898fb56b4a335ee3b2..49962dc9b1fe5d5106b0bd1caac32d8c86a0dfc8 100644 (file)
@@ -6,7 +6,6 @@ import org.simantics.browsing.ui.common.node.IDeletableNode;
 import org.simantics.browsing.ui.common.node.IModifiableNode;\r
 import org.simantics.browsing.ui.content.Labeler.Modifier;\r
 import org.simantics.browsing.ui.graph.impl.LabelModifier;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -15,6 +14,7 @@ import org.simantics.db.exception.CancelTransactionException;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.procedure.Listener;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
@@ -37,10 +37,10 @@ public class ModelNode extends AbstractNode<Resource> implements IDeletableNode,
                                        \r
                                        @Override\r
                                        public void perform(WriteGraph graph) throws DatabaseException {\r
-                                               Builtins b = graph.getBuiltins();\r
+                                               Layer0 l0 = Layer0.getInstance(graph);\r
                                                SimulationResource sim = SimulationResource.getInstance(graph);\r
                                                Resource configuration = graph.getPossibleObject(data, sim.HasConfiguration);\r
-                                               graph.claimValue(configuration, b.HasLabel, result);\r
+                                               graph.claimLiteral(configuration, l0.HasLabel, result);\r
                                        }\r
                                });\r
                        }\r
@@ -60,8 +60,7 @@ public class ModelNode extends AbstractNode<Resource> implements IDeletableNode,
 \r
                        @Override\r
                        public String perform(ReadGraph graph) throws DatabaseException {\r
-                               Builtins b = graph.getBuiltins();\r
-                               return graph.getRelatedValue(data, b.HasLabel);\r
+                               return graph.getRelatedValue(data, Layer0.getInstance(graph).HasLabel);\r
                        }\r
                \r
         }, configurationNameSynchronizer);\r
@@ -89,13 +88,13 @@ public class ModelNode extends AbstractNode<Resource> implements IDeletableNode,
             SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
                 @Override\r
                 public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
-                    Builtins b = graph.getBuiltins();\r
-\r
-                    for(Resource r : graph.getObjects(data, b.ConsistsOf))\r
+                       Layer0 l0 = Layer0.getInstance(graph);\r
+                       \r
+                    for(Resource r : graph.getObjects(data, l0.ConsistsOf))\r
                         if(graph.isInstanceOf(r, SysdynResource.getInstance(graph).Result))\r
                             SimulationResultNode.deleteResultFiles(graph, r);\r
 \r
-                    graph.deny(data, b.PartOf);\r
+                    graph.deny(data, l0.PartOf);\r
                 }\r
             });\r
         } catch (DatabaseException e) {\r
index bb4890fb04baad904cf1c96572d6fc4326ed6edc..a8c6afdd948bafbc98dd36adf9355a79f476edf4 100644 (file)
@@ -8,7 +8,6 @@ import org.simantics.browsing.ui.common.node.IDeletableNode;
 import org.simantics.browsing.ui.common.node.IModifiableNode;\r
 import org.simantics.browsing.ui.content.Labeler.Modifier;\r
 import org.simantics.browsing.ui.graph.impl.LabelModifier;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -19,6 +18,7 @@ import org.simantics.db.exception.ManyObjectsForFunctionalRelationException;
 import org.simantics.db.exception.ServiceException;\r
 import org.simantics.db.procedure.Listener;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
@@ -42,12 +42,12 @@ public class ModuleTypeNode extends AbstractNode<Resource> implements IDeletable
                                        \r
                                        @Override\r
                                        public void perform(WriteGraph graph) throws DatabaseException {\r
-                                               Builtins b = graph.getBuiltins();\r
+                                               Layer0 l0 = Layer0.getInstance(graph);\r
                                ModelingResources mr = ModelingResources.getInstance(graph);\r
                                StructuralResource2 sr2 = StructuralResource2.getInstance(graph);\r
                                Resource type =  graph.getPossibleObject(data, mr.SymbolToComponentType);\r
                                Resource configuration = graph.getPossibleObject(type, sr2.IsDefinedBy);\r
-                                               graph.claimValue(configuration, b.HasLabel, result);\r
+                                               graph.claimLiteral(configuration, l0.HasLabel, result);\r
                                        }\r
                                });\r
                        }\r
@@ -67,10 +67,10 @@ public class ModuleTypeNode extends AbstractNode<Resource> implements IDeletable
 \r
                        @Override\r
                        public String perform(ReadGraph graph) throws DatabaseException {\r
-                Builtins b = graph.getBuiltins();\r
+                               Layer0 l0 = Layer0.getInstance(graph);\r
                 ModelingResources mr = ModelingResources.getInstance(graph);\r
                 Resource type =  graph.getPossibleObject(data, mr.SymbolToComponentType);\r
-                               return graph.getRelatedValue(type, b.HasName);\r
+                               return graph.getRelatedValue(type, l0.HasName);\r
                        }\r
                \r
         }, configurationNameSynchronizer);\r
@@ -86,10 +86,10 @@ public class ModuleTypeNode extends AbstractNode<Resource> implements IDeletable
                 @Override\r
                 public Modifier perform(ReadGraph graph) throws ManyObjectsForFunctionalRelationException, ServiceException {\r
                     ModelingResources mr = ModelingResources.getInstance(graph);\r
-                    Builtins b = graph.getBuiltins();\r
+                    Layer0 l0 = Layer0.getInstance(graph);\r
                     Resource type =  graph.getPossibleObject(data, mr.SymbolToComponentType);\r
 \r
-                    LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), type, b.HasName) {\r
+                    LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), type, l0.HasName) {\r
                         @Override\r
                         public String isValid(String label) {\r
                             if (label.isEmpty())\r
@@ -117,26 +117,26 @@ public class ModuleTypeNode extends AbstractNode<Resource> implements IDeletable
 \r
                 @Override\r
                 public void perform(WriteGraph graph) throws DatabaseException {\r
-                    Builtins b = graph.getBuiltins();\r
+                       Layer0 l0 = Layer0.getInstance(graph);\r
                     StructuralResource2 st = StructuralResource2.getInstance(graph);\r
                     ModelingResources mr = ModelingResources.getInstance(graph);\r
 \r
                     Resource type =  graph.getPossibleObject(data, mr.SymbolToComponentType);\r
-                    Resource model = graph.getSingleObject(type, b.PartOf);\r
+                    Resource model = graph.getSingleObject(type, l0.PartOf);\r
                     Resource modelConfiguration = graph.getSingleObject(model, SimulationResource.getInstance(graph).HasConfiguration);\r
-                    if (!graph.syncRequest(new ObjectsWithType(modelConfiguration, b.ConsistsOf, type)).isEmpty()) {\r
+                    if (!graph.syncRequest(new ObjectsWithType(modelConfiguration, l0.ConsistsOf, type)).isEmpty()) {\r
                         System.out.println("The module is used at the model configuration");\r
                         return;\r
                     }\r
-                    Collection<Resource> moduleTypes = graph.syncRequest(new ObjectsWithType(model, b.ConsistsOf, st.ComponentType));\r
+                    Collection<Resource> moduleTypes = graph.syncRequest(new ObjectsWithType(model, l0.ConsistsOf, st.ComponentType));\r
                     for(Resource r : moduleTypes) {\r
                         Resource configuration = graph.getSingleObject(r, st.IsDefinedBy);\r
-                        if(!graph.syncRequest(new ObjectsWithType(configuration, b.ConsistsOf, type)).isEmpty()) {\r
-                            System.out.println("The module is used at another module: " + graph.getRelatedValue(r, b.HasName));\r
+                        if(!graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, type)).isEmpty()) {\r
+                            System.out.println("The module is used at another module: " + graph.getRelatedValue(r, l0.HasName));\r
                             return;\r
                         }\r
                     }\r
-                    graph.deny(model, b.ConsistsOf, type);\r
+                    graph.deny(model, l0.ConsistsOf, type);\r
                 }\r
             });\r
         } catch (DatabaseException e) {\r
index 01e9a85430733e8392f5f77d0c471425e86cfee6..4347140c98af62f4b57f1f0d82c8dd3f2d55cf4c 100644 (file)
 package org.simantics.sysdyn.ui.browser.nodes;\r
 \r
 import org.simantics.browsing.ui.common.node.AbstractNode;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ReadRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
@@ -33,10 +33,10 @@ public class VariableNode<T> extends AbstractNode<Resource> {
 \r
                        @Override\r
                        public void run(ReadGraph graph) throws DatabaseException {\r
-                               Builtins b = graph.getBuiltins();\r
+                               Layer0 l0 = Layer0.getInstance(graph);\r
                                SysdynResource sr = SysdynResource.getInstance(graph);\r
                                \r
-                               VariableNode.this.resource = graph.getPossibleObject(data, b.Represents);\r
+                               VariableNode.this.resource = graph.getPossibleObject(data, l0.Represents);\r
                                \r
                                if(VariableNode.this.resource == null)\r
                                        return;\r
@@ -44,14 +44,14 @@ public class VariableNode<T> extends AbstractNode<Resource> {
                                uri = getName(graph);\r
                                \r
                                // don't search for a parent if the resource is not part of a realization\r
-                               if(!graph.isInheritedFrom(graph.getSingleObject(data, b.InstanceOf), b.Realization))\r
+                               if(!graph.isInheritedFrom(graph.getSingleObject(data, l0.InstanceOf), l0.Realization))\r
                                        return;\r
                                \r
                                // search for the model parent and build the uri\r
-                               Resource parent = graph.getSingleObject(data, b.PartOf);\r
+                               Resource parent = graph.getSingleObject(data, l0.PartOf);\r
                                while (!graph.isInstanceOf(parent, sr.SysdynModel)) {\r
-                                       uri = graph.getRelatedValue(parent, b.HasName) + "/" + uri;\r
-                                       parent = graph.getSingleObject(parent, b.PartOf);\r
+                                       uri = graph.getRelatedValue(parent, l0.HasName) + "/" + uri;\r
+                                       parent = graph.getSingleObject(parent, l0.PartOf);\r
                                }\r
                                // cut out the realization name\r
                                uri = uri.substring(uri.indexOf("/") + 1);\r
@@ -69,11 +69,11 @@ public class VariableNode<T> extends AbstractNode<Resource> {
        }\r
 \r
        public String getName(ReadGraph graph) throws DatabaseException {\r
-               return (String)graph.getRelatedValue(data, graph.getBuiltins().HasName);\r
+               return (String)graph.getRelatedValue(data, Layer0.getInstance(graph).HasName);\r
        }\r
 \r
        public Resource getParent(ReadGraph graph) throws DatabaseException {\r
-               return graph.getSingleObject(data, graph.getBuiltins().PartOf);\r
+               return graph.getSingleObject(data, Layer0.getInstance(graph).PartOf);\r
        }\r
        \r
        public Resource getResource() {\r
index 2215ca0177fc7271600131e364f7fe39e6727c90..1ff508ca592a9bee47ea7c159ee0342ddca47c2d 100644 (file)
@@ -14,6 +14,7 @@ import org.simantics.graphviz.Edge;
 import org.simantics.graphviz.Graph;\r
 import org.simantics.graphviz.IGraph;\r
 import org.simantics.graphviz.Node;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.sysdyn.SysdynResource;\r
 \r
@@ -130,7 +131,7 @@ public class CreateDependencyGraph implements Read<Graph> {
        }\r
 \r
        private String getName(ReadGraph g, Resource r) throws DatabaseException {\r
-               return (String)g.getRelatedValue(r, g.getBuiltins().HasName);\r
+               return (String)g.getRelatedValue(r, Layer0.getInstance(g).HasName);\r
        }\r
 \r
 }\r
index e425fe1a4f6d52f29697783dc96f9732ee312a83..e82c0b6b3988f06c772876ca4504940b97c73341 100644 (file)
@@ -1,10 +1,10 @@
 package org.simantics.sysdyn.ui.editor;\r
 \r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ComponentUtils;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
@@ -34,8 +34,8 @@ public class OpenDiagramFromConfigurationAdapter extends org.simantics.modeling.
                        Resource componentType = g.getSingleObject(r, mr.SymbolToComponentType);\r
                        r = g.getSingleObject(componentType, sr2.IsDefinedBy);\r
                }\r
-               Builtins b = g.getBuiltins();\r
-               Resource represents = g.getPossibleObject(r, b.Represents);\r
+               Layer0 l0 = Layer0.getInstance(g);\r
+               Resource represents = g.getPossibleObject(r, l0.Represents);\r
                if(represents != null){\r
                        if(g.isInstanceOf(represents, sr.Configuration)) {\r
                                r = represents;\r
@@ -52,7 +52,7 @@ public class OpenDiagramFromConfigurationAdapter extends org.simantics.modeling.
 \r
                                @Override\r
                                public Resource perform(ReadGraph graph) throws DatabaseException {\r
-                                       Builtins b = graph.getBuiltins();\r
+                                       Layer0 l0 = Layer0.getInstance(graph);\r
                                        if(graph.isInheritedFrom(r, SysdynResource.getInstance(graph).ModuleSymbol)) {\r
                                                ModelingResources mr = ModelingResources.getInstance(graph);\r
                                                StructuralResource2 sr2 = StructuralResource2.getInstance(graph);\r
@@ -60,7 +60,7 @@ public class OpenDiagramFromConfigurationAdapter extends org.simantics.modeling.
                                                Resource configuration = graph.getSingleObject(componentType, sr2.IsDefinedBy);\r
                                                return configuration;\r
                                        } else {     \r
-                                               Resource represents = graph.getPossibleObject(r, b.Represents);\r
+                                               Resource represents = graph.getPossibleObject(r, l0.Represents);\r
                                                if(represents != null && graph.isInstanceOf(represents, SysdynResource.getInstance(graph).Configuration)){\r
                                                        return represents;\r
                                                }\r
index e289eddffbc861103ce8ffde990d2727d05060c6..1ba473a05b2bfb5aadcd2285627e739bf29980df 100644 (file)
@@ -15,9 +15,7 @@ import org.simantics.g2d.connection.IConnectionAdvisor;
 import org.simantics.g2d.diagram.handler.Topology.Terminal;\r
 import org.simantics.g2d.element.ElementUtils;\r
 import org.simantics.g2d.element.IElement;\r
-import org.simantics.g2d.elementclass.FlagHandler;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
-import org.simantics.structural2.modelingRules.CPFlag;\r
 import org.simantics.structural2.modelingRules.ConnectionJudgement;\r
 import org.simantics.structural2.modelingRules.ConnectionJudgementType;\r
 import org.simantics.structural2.modelingRules.IConnectionPoint;\r
@@ -45,10 +43,6 @@ public class SysdynConnectionAdvisor  implements IConnectionAdvisor {
             return ConnectionUtil.toConnectionPoint(g, elementResource, term);\r
         }\r
 \r
-        if(element.getElementClass().containsClass(FlagHandler.class)) {\r
-            return new CPFlag(null);\r
-        }\r
-\r
         return null;\r
     }\r
 \r
index a1f14b321907d8722bab827998090b5ed6c75db4..c0c804bcecba3d56657ad81486fee48a9fdc79bd 100644 (file)
 package org.simantics.sysdyn.ui.elements2;\r
 \r
 import org.simantics.databoard.binding.java.StringBindingDefault;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.Session;\r
+import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.diagram.synchronization.IModificationQueue;\r
 import org.simantics.diagram.synchronization.ISynchronizationContext;\r
 import org.simantics.diagram.synchronization.graph.GraphSynchronizationHints;\r
 import org.simantics.diagram.synchronization.graph.RelatedPropertyModification;\r
 import org.simantics.diagram.synchronization.graph.ResourceSynchronizer;\r
 import org.simantics.g2d.element.ElementHints;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
 import org.simantics.utils.datastructures.hints.IHintObservable;\r
@@ -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) {\r
         if (ElementHints.KEY_TEXT.equals(key)) {\r
             Session session = context.get(GraphSynchronizationHints.SESSION);\r
-            Builtins b = session.getBuiltins();\r
-            ModelingResources mr = session.getService(ModelingResources.class);\r
-            return queue.offer(new RelatedPropertyModification(object, mr.ElementToComponent, b.HasName, b.String, newValue, StringBindingDefault.INSTANCE), null);\r
+            Layer0 l0;\r
+                       try {\r
+                               l0 = Layer0.getInstance(session);\r
+                   ModelingResources mr = session.getService(ModelingResources.class);\r
+                   return queue.offer(new RelatedPropertyModification(object, mr.ElementToComponent, l0.HasName, l0.String, newValue, StringBindingDefault.INSTANCE), null);\r
+                       } catch (DatabaseException e) {\r
+                               e.printStackTrace();\r
+                       }\r
         }\r
         return false;\r
     }\r
index 1876d3a685936dbf384d052689e69213b93d0e7a..757d431046202f39e70f377173b62f4995e55917 100644 (file)
@@ -9,7 +9,6 @@ import java.awt.geom.Path2D;
 import java.awt.geom.Rectangle2D;\r
 import java.util.Collection;\r
 \r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
@@ -38,6 +37,7 @@ import org.simantics.g2d.element.handler.impl.TextImpl;
 import org.simantics.g2d.image.Image;\r
 import org.simantics.g2d.image.impl.ShapeImage;\r
 import org.simantics.g2d.utils.Alignment;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.scenegraph.g2d.G2DParentNode;\r
 import org.simantics.sysdyn.SysdynResource;\r
@@ -86,7 +86,7 @@ public class InputFactory extends SysdynElementFactory {
     @Override\r
     public void load(ReadGraph graph, final ICanvasContext canvas, final IDiagram diagram, final Resource element, final IElement e) throws DatabaseException {\r
         super.load(graph, canvas, diagram, element, e);\r
-        Builtins b = graph.getBuiltins();\r
+        Layer0 l0 = Layer0.getInstance(graph);\r
         ModelingResources mr = ModelingResources.getInstance(graph);\r
         SysdynResource sr = SysdynResource.getInstance(graph);\r
         Resource component = null;\r
@@ -101,9 +101,9 @@ public class InputFactory extends SysdynElementFactory {
         if(dependency != null) {\r
             refersTo = graph.getPossibleObject(dependency, sr.RefersTo);\r
             if(refersTo != null) {\r
-                referenceName = (String) graph.getPossibleRelatedValue(refersTo, b.HasName);\r
+                referenceName = (String) graph.getPossibleRelatedValue(refersTo, l0.HasName);\r
                 module = graph.getPossibleObject(dependency, sr.HasTail);\r
-                moduleName = (String) graph.getPossibleRelatedValue(module, b.HasName);\r
+                moduleName = (String) graph.getPossibleRelatedValue(module, l0.HasName);\r
             }\r
         } else {\r
             Resource runtime = diagram.getHint((DiagramModelHints.KEY_DIAGRAM_RUNTIME_RESOURCE));\r
@@ -111,22 +111,22 @@ public class InputFactory extends SysdynElementFactory {
             String variable = (String)graph.getRelatedValue(runtime, dr.HasVariable);\r
             Resource moduleRepresentation = graph.getPossibleResource(variable);\r
             if(moduleRepresentation != null)\r
-                module = graph.getPossibleObject(moduleRepresentation, b.Represents);\r
+                module = graph.getPossibleObject(moduleRepresentation, l0.Represents);\r
             if(module != null)\r
                 for(Resource dep : graph.getObjects(module, sr.IsHeadOf)) {\r
                     Resource reference = graph.getPossibleObject(dep, sr.RefersTo);\r
                     if(reference!= null && reference.equals(component)) {\r
                         refersTo = graph.getSingleObject(dep, sr.HasTail);\r
-                        referenceName = (String) graph.getPossibleRelatedValue(refersTo, b.HasName);\r
+                        referenceName = (String) graph.getPossibleRelatedValue(refersTo, l0.HasName);\r
                         moduleRepresentation = graph.getPossibleResource(variable.substring(0, variable.lastIndexOf("/")));\r
-                        Resource parent = graph.getPossibleObject(moduleRepresentation, b.PartOf);\r
+                        Resource parent = graph.getPossibleObject(moduleRepresentation, l0.PartOf);\r
                         String parentURI = graph.getURI(parent);\r
                         String modelURI =  diagram.getHint((DiagramModelHints.KEY_DIAGRAM_MODEL_URI));\r
-                        module = graph.getPossibleObject(moduleRepresentation, b.Represents);\r
+                        module = graph.getPossibleObject(moduleRepresentation, l0.Represents);\r
                         if(parentURI.equals(modelURI) || module == null)\r
                             moduleName = "";\r
                         else {\r
-                            moduleName = (String) graph.getPossibleRelatedValue(module, b.HasName);\r
+                            moduleName = (String) graph.getPossibleRelatedValue(module, l0.HasName);\r
                         }\r
                         break;\r
                     }\r
index 989380f0178789c87aeb8286277c22bc93ef8a63..5bf9d33398fcc57e8db09be596d448168c525ad3 100644 (file)
@@ -17,7 +17,6 @@ import java.util.ArrayList;
 import java.util.Collection;\r
 import java.util.Collections;\r
 \r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.utils.OrderedSetUtils;\r
@@ -39,6 +38,7 @@ import org.simantics.g2d.element.ElementHints;
 import org.simantics.g2d.element.ElementUtils;\r
 import org.simantics.g2d.element.IElement;\r
 import org.simantics.g2d.element.handler.impl.ObjectTerminal;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
 import org.simantics.sysdyn.SysdynResource;\r
@@ -57,7 +57,7 @@ public abstract class SysdynElementFactory extends SyncElementFactory {
 \r
     @Override\r
     public void load(ReadGraph graph, final ICanvasContext canvas, final IDiagram diagram, final Resource element, final IElement e) throws DatabaseException {\r
-        Builtins b = graph.getBuiltins();\r
+       Layer0 l0 = Layer0.getInstance(graph);\r
         G2DResource g2d = G2DResource.getInstance(graph);\r
         DiagramResource dr = DiagramResource.getInstance(graph);\r
         ModelingResources mr = ModelingResources.getInstance(graph);\r
@@ -65,7 +65,7 @@ public abstract class SysdynElementFactory extends SyncElementFactory {
         Resource component = graph.getPossibleObject(element, mr.ElementToComponent);\r
         String text = null;\r
         if (component != null) {\r
-            text = (String) graph.getPossibleRelatedValue(component, b.HasName);\r
+            text = (String) graph.getPossibleRelatedValue(component, l0.HasName);\r
         }\r
         if (text == null)\r
             text = "[empty]";\r
index 403aa412d9a4f912aefc862b0be3c943803b0e8f..76a9f9e7311ba091104dd1417fae6e42c72f15dd 100644 (file)
@@ -18,6 +18,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import org.simantics.databoard.binding.java.StringBindingDefault;\r
 import org.simantics.db.AsyncReadGraph;\r
 import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.procedure.AsyncMultiProcedure;\r
 import org.simantics.db.procedure.AsyncProcedure;\r
 import org.simantics.diagram.adapter.ElementFactoryAdapter;\r
@@ -29,6 +30,7 @@ import org.simantics.g2d.element.ElementClass;
 import org.simantics.g2d.element.IElement;\r
 import org.simantics.g2d.element.handler.impl.StaticObjectAdapter;\r
 import org.simantics.g2d.routing.RouterFactory;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.utils.datastructures.Pair;\r
 \r
 /**\r
@@ -76,8 +78,14 @@ public class DependencyConnectionFactory extends ElementFactoryAdapter {
                        public void execute(AsyncReadGraph graph, final Resource property) {\r
                                \r
                                ready.incrementAndGet();\r
-\r
-                               graph.forIsSubrelationOf(property, graph.getBuiltins().HasProperty, new AsyncProcedure<Boolean>() {\r
+                               Layer0 l0;\r
+                               try {\r
+                                       l0 = Layer0.getInstance(graph.getSession());\r
+                               } catch (DatabaseException e) {\r
+                                       e.printStackTrace();\r
+                                       return;\r
+                               }\r
+                               graph.forIsSubrelationOf(property, l0.HasProperty, new AsyncProcedure<Boolean>() {\r
 \r
                                        @Override\r
                                        public void exception(AsyncReadGraph graph, Throwable throwable) {\r
@@ -99,7 +107,15 @@ public class DependencyConnectionFactory extends ElementFactoryAdapter {
                                                                @Override\r
                                                                public void execute(AsyncReadGraph graph, final Object value) {\r
 \r
-                                                                       graph.forPossibleRelatedValue(property, graph.getBuiltins().HasName, StringBindingDefault.INSTANCE, new AsyncProcedure<String>() {\r
+                                                                       Layer0 l0;\r
+                                                                       try {\r
+                                                                               l0 = Layer0.getInstance(graph.getSession());\r
+                                                                       } catch (DatabaseException e) {\r
+                                                                               e.printStackTrace();\r
+                                                                               return;\r
+                                                                       }\r
+                                                                       \r
+                                                                       graph.forPossibleRelatedValue(property, l0.HasName, StringBindingDefault.INSTANCE, new AsyncProcedure<String>() {\r
 \r
                                                                                @Override\r
                                                                                public void exception(AsyncReadGraph graph, Throwable throwable) {\r
index ae407a9687cff46b5e321e82de0ce46d522b7d27..0c968556f23e4fc1248e6c072d30883e7a003751 100644 (file)
@@ -45,12 +45,12 @@ import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.IWorkbenchPart;\r
 import org.eclipse.ui.IWorkbenchPartReference;\r
 import org.eclipse.ui.part.ViewPart;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.procedure.Listener;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.expressionParser.ExpressionParser;\r
@@ -168,7 +168,7 @@ public class EquationView extends ViewPart implements ISelectionListener {
 \r
         @Override\r
         public Auxiliary perform(ReadGraph graph) throws DatabaseException {\r
-            Builtins b = graph.getBuiltins();\r
+               Layer0 l0 = Layer0.getInstance(graph);\r
             SysdynResource sr = SysdynResource.getInstance(graph);\r
             ModelingResources mr = ModelingResources.getInstance(graph);\r
             \r
@@ -177,8 +177,8 @@ public class EquationView extends ViewPart implements ISelectionListener {
             \r
             Auxiliary a = new Auxiliary();\r
             variable = resource;\r
-            a.configuration = graph.getPossibleObject(variable, b.PartOf);\r
-            a.name = graph.getPossibleRelatedValue(resource, b.HasName);\r
+            a.configuration = graph.getPossibleObject(variable, l0.PartOf);\r
+            a.name = graph.getPossibleRelatedValue(resource, l0.HasName);\r
             a.isVariable = graph.isInstanceOf(variable, sr.IndependentVariable);\r
             if(a.name == null)\r
                 a.name = "";\r
index bc959253ff37beffc87b76f7ee6347bf59598693..51fcc66d6e0339bbd095f6005d5a96d1a564da78 100644 (file)
@@ -27,11 +27,11 @@ import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IEditorInput;\r
 import org.eclipse.ui.IEditorPart;\r
 import org.eclipse.ui.PlatformUI;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.manager.SysdynModel;\r
 import org.simantics.sysdyn.manager.SysdynModelManager;\r
 import org.simantics.sysdyn.representation.Configuration;\r
@@ -136,8 +136,8 @@ public class NameComposite extends Composite {
                     @Override\r
                     public void perform(WriteGraph g)\r
                     throws DatabaseException {\r
-                        Builtins b = g.getBuiltins();\r
-                        g.claimValue(variable, b.HasName, nameNew);\r
+                       Layer0 l0 = Layer0.getInstance(g);\r
+                        g.claimLiteral(variable, l0.HasName, nameNew);\r
                     }\r
                 });\r
             } catch (DatabaseException e) {\r
index 8cba344fd56672fc1859a20d57ca35fce4e34afb..4fd98beed9c0742de0992a53fcb52c785ed25a8d 100644 (file)
@@ -22,11 +22,11 @@ import org.eclipse.swt.widgets.TabFolder;
 import org.eclipse.swt.widgets.TabItem;\r
 import org.eclipse.swt.widgets.Table;\r
 import org.eclipse.swt.widgets.TableItem;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.utils.ui.ExceptionUtils;\r
@@ -97,7 +97,7 @@ public class ShortcutTabs extends Composite {
                     throws DatabaseException {\r
                         HashSet<String> variables = new HashSet<String>();\r
                         SysdynResource sr = SysdynResource.getInstance(graph);\r
-                        Builtins b = graph.getBuiltins();\r
+                        Layer0 l0 = Layer0.getInstance(graph);\r
 \r
                         Collection<Resource> dependencies = graph.getObjects(r, sr.IsHeadOf);\r
 \r
@@ -105,7 +105,7 @@ public class ShortcutTabs extends Composite {
                             if(graph.isInstanceOf(d, sr.Dependency)) {\r
                                 Resource tail = graph.getPossibleObject(d, sr.HasTail);\r
                                 if(tail != null) {\r
-                                    Object name = graph.getPossibleRelatedValue(tail, b.HasName);\r
+                                    Object name = graph.getPossibleRelatedValue(tail, l0.HasName);\r
                                     if(name != null)\r
                                         variables.add((String)name);\r
                                 }\r
index b78edbd3dddd7f14fefc845a76ca0fff48c9501d..a0af1faeffe88f2ca4d07b5bcece2f8a4f722506 100644 (file)
@@ -23,13 +23,13 @@ import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.widgets.Combo;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.swt.widgets.Label;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.utils.ui.ExceptionUtils;\r
@@ -86,7 +86,7 @@ public class UnitSelector extends Composite {
                     throws DatabaseException {\r
                         SysdynResource sr = SysdynResource.getInstance(g);\r
                         if (!unitNew.equals("")) {\r
-                            g.claimValue(variable, sr.HasUnit, unitNew);\r
+                            g.claimLiteral(variable, sr.HasUnit, unitNew);\r
                         }\r
                         else if (g.getPossibleRelatedValue(variable, sr.HasUnit) != null)\r
                             g.deny(variable, sr.HasUnit);\r
@@ -155,10 +155,10 @@ public class UnitSelector extends Composite {
                         ArrayList<String> units = new ArrayList<String>();\r
 \r
                         SysdynResource sr = SysdynResource.getInstance(graph);\r
-                        Builtins b = graph.getBuiltins();\r
-                        Resource model = graph.getPossibleObject(variable, b.PartOf);\r
+                        Layer0 l0 = Layer0.getInstance(graph);\r
+                        Resource model = graph.getPossibleObject(variable, l0.PartOf);\r
                         if (model != null) {\r
-                            Collection<Resource> variables = graph.getObjects(model, b.ConsistsOf);\r
+                            Collection<Resource> variables = graph.getObjects(model, l0.ConsistsOf);\r
                             for(Resource v : variables) {\r
                                 Object unit = graph.getPossibleRelatedValue(v, sr.HasUnit);\r
                                 if (unit != null && !units.contains((String) unit)) {\r
index 9a74a19c53dec0551b2f0b551b282eab0c15e4be..ab46cba1b9c9f1e552b53a4b03fce58c879f22ef 100644 (file)
@@ -23,13 +23,13 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.swt.widgets.Label;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
@@ -94,14 +94,14 @@ public class AuxiliaryExpressionViewFactor implements IExpressionViewFactor {
                 throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(g);\r
                     Resource expression = g.getPossibleObject(variable, sr.HasExpression);\r
-                    Builtins b = g.getBuiltins();\r
+                    Layer0 l0 = Layer0.getInstance(g);\r
                     if(expression != null) {\r
                         g.deny(variable, sr.HasExpression);\r
                     }\r
                     expression = g.newResource();\r
-                    g.claim(expression, b.InstanceOf, null, sr.NormalExpression);\r
+                    g.claim(expression, l0.InstanceOf, null, sr.NormalExpression);\r
                     g.claim(variable, sr.HasExpression, expression);\r
-                    g.claimValue(expression, sr.HasEquation, currentText);\r
+                    g.claimLiteral(expression, sr.HasEquation, currentText);\r
                 }\r
 \r
             });\r
index 1994fd0c6145e799afca389edeb99df942ed7a79..9c0eea5bd6ee456df7b7780ce0e2f2d9b17fa98a 100644 (file)
@@ -23,13 +23,13 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.swt.widgets.Label;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
@@ -112,14 +112,14 @@ public class ConstantExpressionViewFactor implements IExpressionViewFactor {
                 throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(g);\r
                     Resource expression = g.getPossibleObject(variable, sr.HasExpression);\r
-                    Builtins b = g.getBuiltins();\r
+                    Layer0 l0 = Layer0.getInstance(g);\r
                     if(expression != null) {\r
                         g.deny(variable, sr.HasExpression);\r
                     }\r
                     expression = g.newResource();\r
-                    g.claim(expression, b.InstanceOf, null, sr.ConstantExpression);\r
+                    g.claim(expression, l0.InstanceOf, null, sr.ConstantExpression);\r
                     g.claim(variable, sr.HasExpression, expression);\r
-                    g.claimValue(expression, sr.HasEquation, currentText);\r
+                    g.claimLiteral(expression, sr.HasEquation, currentText);\r
                 }\r
 \r
             });\r
index 585ac91cb3d4e1e1a5f6766772408d5a95cb766b..fcfff42a9ba05d77ddfcecb9d48526dc9b115246 100644 (file)
@@ -124,8 +124,8 @@ public class LookupInputOutputTable extends Composite {
          * @param clazz String.class or Double.class\r
          * @return input as string or double or null if asked for something else\r
          */\r
-        @SuppressWarnings("unchecked")\r
-        public Object getInput(Class clazz) {\r
+        @SuppressWarnings("rawtypes")\r
+               public Object getInput(Class clazz) {\r
             if(clazz == String.class) {\r
                 return "" + input;\r
             } else if (clazz == Double.class) {\r
@@ -152,7 +152,7 @@ public class LookupInputOutputTable extends Composite {
          * @param clazz String.class or Double.class\r
          * @return output as string or double or null if asked for something else\r
          */\r
-        @SuppressWarnings("unchecked")\r
+        @SuppressWarnings("rawtypes")\r
         public Object getOutput(Class clazz) {\r
             if(clazz == String.class) {\r
                 return "" + output;\r
index f6d45739abf694aefd952909ffce7597553177d3..8a93ca10ce44c31a884b76a28c22baf9bf7950cd 100644 (file)
@@ -304,7 +304,6 @@ public class LookupPopup extends Dialog {
         super.okPressed();\r
     }\r
     \r
-    @SuppressWarnings("unchecked")\r
     private String graphToModelicaTable() {\r
         StringBuilder b = new StringBuilder();\r
         b.append("{");\r
@@ -312,7 +311,8 @@ public class LookupPopup extends Dialog {
         XYSeries series = collection.getSeries(0);\r
         if(series.isEmpty())\r
             return "";\r
-        Iterator iterator = series.getItems().iterator();\r
+        @SuppressWarnings("rawtypes")\r
+               Iterator iterator = series.getItems().iterator();\r
         while(iterator.hasNext()){\r
             XYDataItem item = (XYDataItem)iterator.next();\r
             b.append("{" + item.getX() + "," + item.getY() + "}");\r
index fe23484823eba18101e6047f9f23a1bafa9b5c43..f101f3eaeefad9d38441b7d996c36aecd351db59 100644 (file)
@@ -23,13 +23,13 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Point;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.swt.widgets.Label;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
@@ -113,14 +113,14 @@ public class ParameterExpressionViewFactor implements IExpressionViewFactor {
                 throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(g);\r
                     Resource expression = g.getPossibleObject(variable, sr.HasExpression);\r
-                    Builtins b = g.getBuiltins();\r
+                    Layer0 l0 = Layer0.getInstance(g);\r
                     if(expression != null) {\r
                         g.deny(variable, sr.HasExpression);\r
                     }\r
                     expression = g.newResource();\r
-                    g.claim(expression, b.InstanceOf, null, sr.ParameterExpression);\r
+                    g.claim(expression, l0.InstanceOf, null, sr.ParameterExpression);\r
                     g.claim(variable, sr.HasExpression, expression);\r
-                    g.claimValue(expression, sr.HasEquation, currentText);\r
+                    g.claimLiteral(expression, sr.HasEquation, currentText);\r
                 }\r
 \r
             });\r
index ac8b74559e119d88439eb8d8d37448a0aa4cddb2..1a6c161c170576cf805905b41b0b4cd9bc23d1e7 100644 (file)
@@ -25,13 +25,13 @@ import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.swt.widgets.Label;\r
 import org.eclipse.swt.widgets.Text;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
@@ -114,14 +114,14 @@ public class StockExpressionViewFactor implements IExpressionViewFactor {
                 throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(g);\r
                     Resource expression = g.getPossibleObject(variable, sr.HasExpression);\r
-                    Builtins b = g.getBuiltins();\r
+                    Layer0 l0 = Layer0.getInstance(g);\r
                     if(expression != null) {\r
                         g.deny(variable, sr.HasExpression);\r
                     }\r
                     expression = g.newResource();\r
-                    g.claim(expression, b.InstanceOf, null, sr.StockExpression);\r
+                    g.claim(expression, l0.InstanceOf, null, sr.StockExpression);\r
                     g.claim(variable, sr.HasExpression, expression);\r
-                    g.claimValue(expression, sr.HasInitialEquation, currentText);\r
+                    g.claimLiteral(expression, sr.HasInitialEquation, currentText);\r
                 }\r
 \r
             });\r
@@ -136,7 +136,7 @@ public class StockExpressionViewFactor implements IExpressionViewFactor {
                 @Override\r
                 public String perform(ReadGraph graph) throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(graph);\r
-                    Builtins b = graph.getBuiltins();\r
+                    Layer0 l0 = Layer0.getInstance(graph);\r
                     Collection<Resource> heads = graph.getObjects(variable, sr.IsHeadOf);\r
                     Collection<Resource> tails = graph.getObjects(variable, sr.IsTailOf);\r
 \r
@@ -146,7 +146,7 @@ public class StockExpressionViewFactor implements IExpressionViewFactor {
                         if(graph.isInstanceOf(r, sr.Flow)) {\r
                             Resource tail = graph.getPossibleObject(r, sr.HasTail);\r
                             if(tail != null) {\r
-                                Object name = graph.getPossibleRelatedValue(tail, b.HasName);\r
+                                Object name = graph.getPossibleRelatedValue(tail, l0.HasName);\r
                                 if (name != null)\r
                                     builder.append(" + " + name);\r
                             }\r
@@ -156,7 +156,7 @@ public class StockExpressionViewFactor implements IExpressionViewFactor {
                         if(graph.isInstanceOf(r, sr.Flow)) {\r
                             Resource head = graph.getPossibleObject(r, sr.HasHead);\r
                             if(head != null) {\r
-                                Object name = graph.getPossibleRelatedValue(head, b.HasName);\r
+                                Object name = graph.getPossibleRelatedValue(head, l0.HasName);\r
                                 if (name != null)\r
                                     builder.append(" - " + name);\r
                             }\r
index 43218e06c4704066bcb45a57b713e9855f1ac4bf..b97c6c21b09e7021a9b74db706d9e30a219d64a4 100644 (file)
@@ -28,13 +28,13 @@ import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Button;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.swt.widgets.Label;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
@@ -163,19 +163,19 @@ public class WithLookupExpressionViewFactor implements IExpressionViewFactor {
                 throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(g);\r
                     Resource expression = g.getPossibleObject(variable, sr.HasExpression);\r
-                    Builtins b = g.getBuiltins();\r
+                    Layer0 l0 = Layer0.getInstance(g);\r
                     if(expression != null) {\r
                         g.deny(variable, sr.HasExpression);\r
                     }\r
                     expression = g.newResource();\r
-                    g.claim(expression, b.InstanceOf, null, sr.WithLookupExpression);\r
+                    g.claim(expression, l0.InstanceOf, null, sr.WithLookupExpression);\r
                     g.claim(variable, sr.HasExpression, expression);\r
-                    g.claimValue(expression, sr.HasEquation, currentExpression);\r
-                    g.claimValue(expression, sr.HasLookup, currentLookupTable);\r
-                    g.claimValue(expression, sr.HasMinX, chartInfo.minX);\r
-                    g.claimValue(expression, sr.HasMaxX, chartInfo.maxX);\r
-                    g.claimValue(expression, sr.HasMinY, chartInfo.minY);\r
-                    g.claimValue(expression, sr.HasMaxY, chartInfo.maxY);\r
+                    g.claimLiteral(expression, sr.HasEquation, currentExpression);\r
+                    g.claimLiteral(expression, sr.HasLookup, currentLookupTable);\r
+                    g.claimLiteral(expression, sr.HasMinX, chartInfo.minX);\r
+                    g.claimLiteral(expression, sr.HasMaxX, chartInfo.maxX);\r
+                    g.claimLiteral(expression, sr.HasMinY, chartInfo.minY);\r
+                    g.claimLiteral(expression, sr.HasMaxY, chartInfo.maxY);\r
                 }\r
             });\r
         }\r
index 5dcf74c5df804f2da144615a398be0bc12128b4d..ed549eea2b91d630030fee3814b3be1885e5cb85 100644 (file)
@@ -4,7 +4,6 @@ import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;\r
 import org.eclipse.core.commands.ExecutionException;\r
 import org.simantics.databoard.binding.java.StringBindingDefault;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.request.WriteRequest;\r
@@ -13,6 +12,7 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.diagram.DiagramConstants;\r
 import org.simantics.diagram.synchronization.graph.layer.GraphLayer;\r
 import org.simantics.diagram.synchronization.graph.layer.GraphLayerUtil;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.modeling.ModelingUtils;\r
@@ -28,45 +28,45 @@ public class NewModelHandler extends AbstractHandler {
             @Override\r
             public void perform(WriteGraph g) throws DatabaseException {\r
                 // Same as in SysdynProject.java. Should use the same code, not copy.\r
-                Builtins b = g.getBuiltins();\r
-                SysdynResource sr = SysdynResource.getInstance(g);\r
+               Layer0 l0 = Layer0.getInstance(g);\r
+               SysdynResource sr = SysdynResource.getInstance(g);\r
                 ModelingResources mr = ModelingResources.getInstance(g);\r
                 ModelingUtils mu = new ModelingUtils(g);\r
 \r
-                String modelName = GraphUtils.findFreshName(g, "Model", SimanticsUI.getProject().get(), b.ConsistsOf, "%s%d");\r
+                String modelName = GraphUtils.findFreshName(g, "Model", SimanticsUI.getProject().get(), l0.ConsistsOf, "%s%d");\r
 \r
                 Resource model = g.newResource();\r
-                g.claimValue(model, b.HasName, modelName);\r
-                g.claimValue(model, b.HasLabel, modelName);\r
-                g.claim(model, b.InstanceOf, sr.SysdynModel);\r
-                g.claim(model, b.PartOf, SimanticsUI.getProject().get());\r
+                g.claimLiteral(model, l0.HasName, modelName);\r
+                g.claimLiteral(model, l0.HasLabel, modelName);\r
+                g.claim(model, l0.InstanceOf, sr.SysdynModel);\r
+                g.claim(model, l0.PartOf, SimanticsUI.getProject().get());\r
 \r
 \r
                 Resource diagram = OrderedSetUtils.create(g, sr.ConfigurationDiagram);\r
                 GraphLayer l = new GraphLayerUtil(g).createLayer(DiagramConstants.DEFAULT_LAYER_NAME, true);\r
                 g.claim(diagram, mu.dr.HasLayer, l.getLayer());\r
-                g.claimValue(diagram, b.HasName, "Diagrammi", StringBindingDefault.INSTANCE);\r
+                g.claimLiteral(diagram, l0.HasName, "Diagrammi", StringBindingDefault.INSTANCE);\r
 \r
                 Resource conf = GraphUtils.create2(g,\r
                         sr.Configuration,\r
-                        b.PartOf, model,\r
-                        b.HasName, modelName\r
+                        l0.PartOf, model,\r
+                        l0.HasName, modelName\r
                 );\r
 \r
                 g.claim(conf, mr.CompositeToDiagram, diagram);\r
                 g.claim(model, mu.SIMU.HasConfiguration, conf);\r
 \r
                 Resource mapping = g.newResource();\r
-                g.claim(mapping, b.InstanceOf, null, sr.DiagramToCompositeMapping);\r
-                g.claim(diagram, b.HasTrigger, mapping);\r
+                g.claim(mapping, l0.InstanceOf, null, sr.DiagramToCompositeMapping);\r
+                g.claim(diagram, l0.HasTrigger, mapping);\r
 \r
-                Resource report = GraphUtils.create2(g, mu.b.Report,  mu.b.HasDocumentation, "===Report===");\r
+                Resource report = GraphUtils.create2(g, l0.Report,  l0.HasDocumentation, "===Report===");\r
 \r
                 GraphUtils.create2(g, mu.SIMU.Experiment,\r
-                        mu.b.HasName, "Experiment",\r
-                        mu.b.HasLabel, "Experiment",\r
-                        mu.b.HasReportFactory, report,\r
-                        mu.b.PartOf, model);\r
+                        l0.HasName, "Experiment",\r
+                        l0.HasLabel, "Experiment",\r
+                        l0.HasReportFactory, report,\r
+                        l0.PartOf, model);\r
             }\r
         });\r
         return null;\r
index 8ee3f6e0885c777acff60583af1c865c9103f8bd..edba73424c5387484d5750f4ccf7db3662c51f73 100644 (file)
@@ -42,7 +42,7 @@ public class NewModuleNodeHandler extends AbstractHandler {
                 String name = GraphUtils.findFreshName(g, "ModuleType", model, mu.b.ConsistsOf, "%s%d");\r
                 \r
                 Resource moduleType = g.newResource();\r
-                g.claimValue(moduleType, mu.b.HasName, name);\r
+                g.claimLiteral(moduleType, mu.b.HasName, name);\r
                 g.claim(moduleType, mu.b.Inherits, sr.Module);\r
                 g.claim(moduleType, mu.b.PartOf, model);\r
                 \r
@@ -64,8 +64,8 @@ public class NewModuleNodeHandler extends AbstractHandler {
                 \r
                 \r
                 Resource moduleSymbol = g.newResource();\r
-                g.claimValue(moduleSymbol, mu.b.HasName, name + " Symbol");\r
-                g.claimValue(moduleSymbol, mu.b.HasLabel, name);\r
+                g.claimLiteral(moduleSymbol, mu.b.HasName, name + " Symbol");\r
+                g.claimLiteral(moduleSymbol, mu.b.HasLabel, name);\r
                 g.claim(moduleSymbol, mu.b.Inherits, sr.ModuleSymbol);\r
                 g.claim(moduleSymbol, mu.mr.SymbolToComponentType, moduleType);\r
                 \r
index a4f6488d6f540818b163a46217cb206262696a8f..5780d4aee79fa4fe9bc7e977f13a8bcb4a9fa3be 100644 (file)
@@ -30,7 +30,8 @@ public class RunBasicExperiment extends AbstractHandler implements IElementUpdat
         return null;\r
     }\r
 \r
-    @Override\r
+    @SuppressWarnings("rawtypes")\r
+       @Override\r
     public void updateElement(UIElement element, Map parameters) {\r
         ICommandService commandService =\r
             (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);\r
index 7d48e60ee730e1359f2d6310c01c826604906777..45d8d893aabf6d717b42fdca64cc19ebfe07b36e 100644 (file)
@@ -19,7 +19,6 @@ import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;\r
 import org.eclipse.ui.handlers.HandlerUtil;\r
 import org.simantics.databoard.binding.java.StringBindingDefault;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ReadRequest;\r
@@ -27,6 +26,7 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.variable.Variable;\r
 import org.simantics.db.layer0.variable.Variables;\r
 import org.simantics.diagram.stubs.DiagramResource;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ComponentUtils;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
@@ -73,7 +73,7 @@ public class ShowModuleHandler extends AbstractHandler {
                                \r
                                for(Resource element : resources) {\r
 \r
-                                       Builtins b = graph.getBuiltins();\r
+                                       Layer0 l0 = Layer0.getInstance(graph);\r
                                        ModelingResources mr = ModelingResources.getInstance(graph);\r
                                        SysdynResource sr = SysdynResource.getInstance(graph);\r
                                        StructuralResource2 st = StructuralResource2.getInstance(graph);\r
@@ -85,7 +85,7 @@ public class ShowModuleHandler extends AbstractHandler {
                                        \r
                                        if(diagram == null) return;\r
                                        \r
-                                       final String rvi = currentRVI + "/" + graph.getPossibleRelatedValue(component, b.HasName, StringBindingDefault.INSTANCE);\r
+                                       final String rvi = currentRVI + "/" + graph.getPossibleRelatedValue(component, l0.HasName, StringBindingDefault.INSTANCE);\r
 \r
                                        PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {\r
 \r
index 3f220a5e6a1bd1218513bfe731d5bbdb5e7b571e..7677150ff9283e9229aecbb45dae706b652f75f9 100644 (file)
@@ -65,7 +65,8 @@ public class ToggleSimulation extends AbstractHandler implements IElementUpdater
         return (Boolean)state.getValue();\r
     }\r
 \r
-    @Override\r
+    @SuppressWarnings("rawtypes")\r
+       @Override\r
     public void updateElement(UIElement element, Map parameters) {\r
         ICommandService commandService =\r
             (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);\r
index a8a3bf382f627be894f03334ee7c7dc8eb1cff2f..4890bb60e2434e1886c75e4483cb3dc81ebbb87b 100644 (file)
@@ -4,10 +4,8 @@ import org.simantics.databoard.binding.Binding;
 import org.simantics.databoard.binding.java.DoubleBindingDefault;\r
 import org.simantics.databoard.binding.java.StringBindingDefault;\r
 import org.simantics.databoard.binding.mutable.MutableDouble;\r
-import org.simantics.databoard.binding.mutable.MutableDoubleBinding;\r
 import org.simantics.databoard.type.DataType;\r
 import org.simantics.databoard.type.DoubleType;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -22,6 +20,7 @@ public class DefaultVariable extends ResourceVariable {
                super(resource);\r
        }\r
 \r
+       @SuppressWarnings("unchecked")\r
        @Override\r
        public <T> T getValue(ReadGraph graph) throws DatabaseException {\r
                Layer0 b = Layer0.getInstance(graph);\r
@@ -45,11 +44,11 @@ public class DefaultVariable extends ResourceVariable {
        \r
        @Override\r
        public void setValue(WriteGraph graph, Object object, Binding binding) throws DatabaseException {\r
-               Builtins b = graph.getBuiltins();\r
+               Layer0 l0 = Layer0.getInstance(graph);\r
                SysdynResource sr = SysdynResource.getInstance(graph);\r
 //             if(!DoubleBindingDefault.INSTANCE.equals(binding)) return;\r
 //             if(!MutableDoubleBinding.INSTANCE.equals(binding)) return;\r
-               Resource represents = graph.getPossibleObject(resource, b.Represents);\r
+               Resource represents = graph.getPossibleObject(resource, l0.Represents);\r
                if(represents == null) return;\r
                Resource expression = graph.getPossibleObject(represents, sr.HasExpression);\r
                if(expression == null) return;\r
@@ -58,6 +57,7 @@ public class DefaultVariable extends ResourceVariable {
                graph.claimLiteral(expression, sr.HasEquation, value.toString(), StringBindingDefault.INSTANCE);\r
        }\r
        \r
+       @SuppressWarnings("unchecked")\r
        @Override\r
        public <T> T getInterface(ReadGraph graph, Class<T> clazz)\r
                        throws DatabaseException {\r
index 2634bad7cebf750b923c77ee3e714368d10a0c02..d637d8a862ab0fe297ac55585a3cef610b589f91 100644 (file)
@@ -4,7 +4,6 @@ import java.util.Collection;
 import java.util.HashSet;\r
 \r
 import org.simantics.databoard.binding.java.StringBindingDefault;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.Session;\r
@@ -19,6 +18,7 @@ import org.simantics.db.layer0.realization.RealizationVirtualGraph;
 import org.simantics.db.layer0.realization.ResourceData;\r
 import org.simantics.db.layer0.util.RemoverUtil;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.sysdyn.SysdynResource;\r
 \r
@@ -37,11 +37,11 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph {
             public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {\r
 //                             System.out.println("Compute runs starts");\r
                 HashSet<Resource> result = new HashSet<Resource>();\r
-                Builtins b = graph.getBuiltins();\r
+                Layer0 l0 = Layer0.getInstance(graph);\r
                 SimulationResource SIMU = SimulationResource.getInstance(graph);\r
-                for(Resource config : graph.getObjects(model, b.ConsistsOf)) {\r
+                for(Resource config : graph.getObjects(model, l0.ConsistsOf)) {\r
                     if(graph.isInstanceOf(config, SIMU.Experiment)) {\r
-                        for(Resource run : graph.getObjects(config, b.ConsistsOf)) {\r
+                        for(Resource run : graph.getObjects(config, l0.ConsistsOf)) {\r
                             if(graph.isInstanceOf(run, SIMU.Run)) {\r
 //                                                             System.out.println("found run " + run);\r
                                 result.add(run);\r
@@ -58,7 +58,8 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph {
             @Override\r
             public void add(ReadGraph graph, final Resource run) throws DatabaseException {\r
 \r
-                final String experimentName = graph.getPossibleRelatedValue(run, b.HasName, StringBindingDefault.INSTANCE);\r
+               final Layer0 l0 = Layer0.getInstance(graph);\r
+                final String experimentName = graph.getPossibleRelatedValue(run, l0.HasName, StringBindingDefault.INSTANCE);\r
 \r
 //                             System.out.println("RealizationVirtualGraph new experiment " + experimentName);\r
 \r
@@ -74,7 +75,7 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph {
                         public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {\r
                             HashSet<Resource> result = new HashSet<Resource>();\r
                             Resource configuration = graph.getPossibleObject(model, SimulationResource.getInstance(graph).HasConfiguration);\r
-                            for(Resource part : graph.getObjects(configuration, b.ConsistsOf)) {\r
+                            for(Resource part : graph.getObjects(configuration, l0.ConsistsOf)) {\r
                                 result.add(part);\r
                             }\r
                             return result;\r
@@ -87,11 +88,11 @@ public class HistoryRealizationVirtualGraph extends RealizationVirtualGraph {
                                 @Override\r
                                 public void perform(WriteGraph graph) throws DatabaseException {\r
                                     int runNode = context.getIndex(run);\r
-                                    String partName = graph.getPossibleRelatedValue(part, b.HasName, StringBindingDefault.INSTANCE);\r
+                                    String partName = graph.getPossibleRelatedValue(part, l0.HasName, StringBindingDefault.INSTANCE);\r
                                     if(partName != null) {\r
                                         Resource partResource = graph.newResource();\r
                                         int partNode = context.getIndex(partResource);\r
-                                        graph.claim(run, b.ConsistsOf, null, partResource);\r
+                                        graph.claim(run, l0.ConsistsOf, null, partResource);\r
                                         undiscovered.put(partNode, new ResourceData(runNode, part, valuation, partName, experimentName, null));\r
                                     }\r
                                 }\r
index 035f2020d8ed66f5e1da8fa66d14f2c5b4f52931..d0054c041458d904deb44c3c1e695c1491d03d80 100644 (file)
@@ -7,7 +7,6 @@ import org.simantics.databoard.accessor.RecordAccessor;
 import org.simantics.databoard.accessor.error.AccessorConstructionException;\r
 import org.simantics.databoard.accessor.error.AccessorException;\r
 import org.simantics.databoard.binding.error.RuntimeBindingConstructionException;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
@@ -52,11 +51,11 @@ public class HistoryVariable extends ResourceVariable {
 //             return super.getInterface(graph, clazz);\r
 //     }\r
        \r
+       @SuppressWarnings("unchecked")\r
        @Override\r
        public <T> T getInterface(ReadGraph graph, Class<T> clazz) throws DatabaseException {\r
                if(RecordAccessor.class.equals(clazz) || Accessor.class.equals(clazz)) {\r
                        SimulationResource SIMU = SimulationResource.getInstance(graph);\r
-                       Builtins b = graph.getBuiltins();\r
                        Resource model = Variables.getModel(graph, this);\r
                        Resource configuration = graph.getPossibleObject(model, SIMU.HasConfiguration);\r
                        final SysdynModel sm = SysdynModelManager.getInstance(graph.getSession()).getModel(graph, configuration);\r
index 64057687f7f4e3177124e846e63611d57f8377d1..b9ce5bd2f19473f71f0ebfd447e86c81222d395b 100644 (file)
@@ -14,7 +14,6 @@ package org.simantics.sysdyn.ui.project;
 import org.eclipse.swt.widgets.Shell;\r
 import org.eclipse.ui.PartInitException;\r
 import org.simantics.databoard.binding.java.StringBindingDefault;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.Session;\r
 import org.simantics.db.WriteGraph;\r
@@ -26,6 +25,7 @@ import org.simantics.db.service.LifecycleSupport;
 import org.simantics.diagram.DiagramConstants;\r
 import org.simantics.diagram.synchronization.graph.layer.GraphLayer;\r
 import org.simantics.diagram.synchronization.graph.layer.GraphLayerUtil;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.modeling.ModelingUtils;\r
@@ -83,44 +83,44 @@ public class SysdynProject extends AbstractProjectFeature {
         @Override\r
         public void run(WriteGraph g, Resource library, Callback<Resource> callback, Callback<Throwable> errorCallback) {\r
             try {\r
-                Builtins b = g.getBuiltins();\r
                 SysdynResource sr = SysdynResource.getInstance(g);\r
                 ModelingResources mr = ModelingResources.getInstance(g);\r
                 ModelingUtils mu = new ModelingUtils(g);\r
+                Layer0 l0 = Layer0.getInstance(g);\r
 \r
                 Resource model = g.newResource();\r
 \r
-                String modelName = GraphUtils.findFreshName(g, "Model", library, b.ConsistsOf, "%s%d");\r
+                String modelName = GraphUtils.findFreshName(g, "Model", library, l0.ConsistsOf, "%s%d");\r
 \r
-                g.claimValue(model, b.HasName, modelName);\r
-                g.claimValue(model, b.HasLabel, modelName);\r
-                g.claim(model, b.InstanceOf, sr.SysdynModel);\r
-                g.claim(model, b.PartOf, library);\r
+                g.claimLiteral(model, l0.HasName, modelName);\r
+                g.claimLiteral(model, l0.HasLabel, modelName);\r
+                g.claim(model, l0.InstanceOf, sr.SysdynModel);\r
+                g.claim(model, l0.PartOf, library);\r
 \r
                 Resource diagram = OrderedSetUtils.create(g, sr.ConfigurationDiagram);\r
                 GraphLayer l = new GraphLayerUtil(g).createLayer(DiagramConstants.DEFAULT_LAYER_NAME, true);\r
                 g.claim(diagram, mu.dr.HasLayer, l.getLayer());\r
-                g.claimValue(diagram, b.HasName, "Diagrammi", StringBindingDefault.INSTANCE);\r
+                g.claimLiteral(diagram, l0.HasName, "Diagrammi", StringBindingDefault.INSTANCE);\r
 \r
 \r
                 Resource conf = g.newResource();\r
-                g.claimValue(conf, b.HasName, modelName+"Configuration");\r
-                g.claim(conf, b.InstanceOf, sr.Configuration);\r
+                g.claimLiteral(conf, l0.HasName, modelName+"Configuration");\r
+                g.claim(conf, l0.InstanceOf, sr.Configuration);\r
 \r
                 g.claim(conf, mr.CompositeToDiagram, diagram);\r
                 g.claim(model, mu.SIMU.HasConfiguration, conf);\r
 \r
                 Resource mapping = g.newResource();\r
-                g.claim(mapping, b.InstanceOf, null, mr.DiagramToCompositeMapping);\r
-                g.claim(diagram, b.HasTrigger, mapping);\r
+                g.claim(mapping, l0.InstanceOf, null, mr.DiagramToCompositeMapping);\r
+                g.claim(diagram, l0.HasTrigger, mapping);\r
 \r
-                Resource report = GraphUtils.create2(g, mu.b.Report,  mu.b.HasDocumentation, "===Report===");\r
+                Resource report = GraphUtils.create2(g, l0.Report,  l0.HasDocumentation, "===Report===");\r
 \r
                 GraphUtils.create2(g, mu.SIMU.Experiment,\r
-                        mu.b.HasName, "Experiment",\r
-                        mu.b.HasLabel, "Experiment",\r
-                        mu.b.HasReportFactory, report,\r
-                        mu.b.PartOf, model);\r
+                        l0.HasName, "Experiment",\r
+                        l0.HasLabel, "Experiment",\r
+                        l0.HasReportFactory, report,\r
+                        l0.PartOf, model);\r
 \r
                 callback.run(model);\r
             } catch(Exception e) {\r
index 33148333b8e619e65bd47917c3282ea7da7f012b..85899bf83d1031b7fef92c19bad7a4dcb53f0ee1 100644 (file)
@@ -24,6 +24,7 @@ import org.simantics.db.layer0.service.ActivationManager;
 import org.simantics.db.layer0.util.Simantics;\r
 import org.simantics.db.request.Read;\r
 import org.simantics.db.service.VirtualGraphSupport;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.project.IProject;\r
 import org.simantics.project.IProjectLifecycle;\r
 import org.simantics.project.exception.ProjectException;\r
@@ -36,7 +37,6 @@ import org.simantics.utils.ui.ErrorLogger;
 \r
 public class SysdynProjectLifeCycle implements IProjectLifecycle {\r
 \r
-    private static final String CHEATSHEET_ID           = "org.simantics.sysdyn.ui.cheatsheet1";\r
     private static final String FIRST_SYSDYN_PROJECT    = "firstSysdynProject";\r
 \r
     @Override\r
@@ -74,7 +74,7 @@ public class SysdynProjectLifeCycle implements IProjectLifecycle {
 \r
 \r
 \r
-            final Builtins b = session.getBuiltins();\r
+            final Layer0 l0 = Layer0.getInstance(session);\r
             ActivationManager activationManager = session.getService(ActivationManager.class);\r
             if (activationManager != null) {\r
                 activationManager.activate(session, projectResource);\r
@@ -85,7 +85,7 @@ public class SysdynProjectLifeCycle implements IProjectLifecycle {
             final VirtualGraph graph = session.getService(VirtualGraph.class);\r
 \r
             SimulationResource SIMU = SimulationResource.getInstance(session);\r
-            session.asyncRequest(new ObjectsWithType(projectResource, b.ConsistsOf, SIMU.Model), new SingleSetListener<Resource>() {\r
+            session.asyncRequest(new ObjectsWithType(projectResource, l0.ConsistsOf, SIMU.Model), new SingleSetListener<Resource>() {\r
 \r
                 @Override\r
                 public void add(final Resource model) {\r
@@ -165,12 +165,12 @@ public class SysdynProjectLifeCycle implements IProjectLifecycle {
 \r
                 @Override\r
                 public String perform(ReadGraph graph) throws DatabaseException {\r
-                    Builtins b = graph.getBuiltins();\r
+                       Layer0 l0 = Layer0.getInstance(graph);\r
                     SimulationResource SIMU = SimulationResource.getInstance(graph);\r
                     SysdynResource sr = SysdynResource.getInstance(graph);\r
-                    for(Resource model : graph.getObjects(projectResource, b.ConsistsOf)) {\r
+                    for(Resource model : graph.getObjects(projectResource, l0.ConsistsOf)) {\r
                         if(graph.isInstanceOf(model, sr.SysdynModel)){\r
-                            for(Resource experiment : graph.getObjects(model, b.ConsistsOf)) {\r
+                            for(Resource experiment : graph.getObjects(model, l0.ConsistsOf)) {\r
                                 if(graph.isInstanceOf(experiment, SIMU.Experiment)) {\r
                                     for(Resource result : graph.getObjects(experiment, sr.HasResult)) {\r
                                         String resultFile = (String)graph.getPossibleRelatedValue(result, sr.HasResultFile);\r
@@ -180,7 +180,7 @@ public class SysdynProjectLifeCycle implements IProjectLifecycle {
                             }\r
                         }\r
                     }\r
-                    return graph.getPossibleRelatedValue(projectResource, b.HasName);\r
+                    return graph.getPossibleRelatedValue(projectResource, l0.HasName);\r
 \r
                 }\r
             });\r
index 312a6b87ce0902c72ee48efdf20eb4b070ebf2cf..85994cc6914188e128cdbf15bffd22f5536147c3 100644 (file)
@@ -29,12 +29,12 @@ import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;
 import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListener;\r
 import org.simantics.browsing.ui.swt.widgets.impl.TrackedModifyEvent;\r
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.management.ISessionContext;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.properties.widgets.ExpressionTypes;\r
 import org.simantics.sysdyn.ui.properties.widgets.ExpressionWidget;\r
@@ -53,8 +53,8 @@ public class EquationTab extends PropertyTabContributorImpl {
         GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
         GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(6).applyTo(composite);\r
         TrackedText nameText = new TrackedText(composite, support, SWT.BORDER);\r
-        nameText.setTextFactory(new StringPropertyFactory(Builtins.URIs.HasName));\r
-        nameText.addModifyListener(new StringPropertyModifier(context, Builtins.URIs.HasName));\r
+        nameText.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName));\r
+        nameText.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName));\r
         GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText.getWidget());\r
 \r
 \r
@@ -136,10 +136,10 @@ public class EquationTab extends PropertyTabContributorImpl {
                 Map<String, Object> map = new HashMap<String, Object>();\r
 \r
                 SysdynResource sr = SysdynResource.getInstance(graph);\r
-                Builtins b = graph.getBuiltins();\r
-                Resource model = graph.getPossibleObject(input, b.PartOf);\r
+                Layer0 l0 = Layer0.getInstance(graph);\r
+                Resource model = graph.getPossibleObject(input, l0.PartOf);\r
                 if (model != null) {\r
-                    Collection<Resource> variables = graph.getObjects(model, b.ConsistsOf);\r
+                    Collection<Resource> variables = graph.getObjects(model, l0.ConsistsOf);\r
                     for(Resource v : variables) {\r
                         Object unit = graph.getPossibleRelatedValue(v, sr.HasUnit);\r
                         if (unit != null && !map.keySet().contains((String) unit)) {\r
@@ -167,7 +167,7 @@ public class EquationTab extends PropertyTabContributorImpl {
 \r
             @Override\r
             public void applyText(WriteGraph graph, Resource input, String text) throws DatabaseException {\r
-                graph.claimValue(input, SysdynResource.getInstance(graph).HasUnit, text);\r
+                graph.claimLiteral(input, SysdynResource.getInstance(graph).HasUnit, text);\r
             }\r
         });\r
 \r
index f8fccc79406939deca37c07ea3004c557756e0e2..53f40a1925f679ca9d061d21d9f0943dd4caa33d 100644 (file)
@@ -9,12 +9,12 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IWorkbenchSite;\r
 import org.simantics.browsing.ui.swt.PropertyTabContributorImpl;\r
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ObjectsWithType;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.management.ISessionContext;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.properties.widgets.ModuleInputEditingSupport;\r
@@ -50,14 +50,14 @@ public class ModuleInputTab  extends PropertyTabContributorImpl {
             \r
             @Override\r
             public ArrayList<ReferenceRow> getRows(ReadGraph graph, Resource module) throws DatabaseException {\r
-                Builtins b = graph.getBuiltins();\r
+                Layer0 l0 = Layer0.getInstance(graph);\r
                 SysdynResource sr = SysdynResource.getInstance(graph);\r
                 StructuralResource2 sr2 = StructuralResource2.getInstance(graph);\r
                 ArrayList<ReferenceRow> result = new ArrayList<ReferenceRow>();\r
-                Resource instanceOf = graph.getPossibleObject(module, b.InstanceOf);\r
+                Resource instanceOf = graph.getPossibleObject(module, l0.InstanceOf);\r
                 if(instanceOf == null) return result;\r
                 Resource configuration = graph.getSingleObject(instanceOf, sr2.IsDefinedBy);\r
-                for(Resource input : graph.syncRequest(new ObjectsWithType(configuration, b.ConsistsOf, sr.Input))) {\r
+                for(Resource input : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Input))) {\r
                     Resource dependency = null;\r
                     for(Resource dep : graph.getObjects(module, sr.IsHeadOf)) {\r
                         Resource refersTo = graph.getPossibleObject(dep, sr.RefersTo);\r
index a12623a4f08f33cb0386968853f3fb4e1ac87f74..7bc047e967aa29bb6f5b29041cd8b02963129938 100644 (file)
@@ -9,12 +9,12 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IWorkbenchSite;\r
 import org.simantics.browsing.ui.swt.PropertyTabContributorImpl;\r
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ObjectsWithType;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.management.ISessionContext;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.properties.widgets.ModuleOutputEditingSupport;\r
@@ -50,14 +50,14 @@ public class ModuleOutputTab   extends PropertyTabContributorImpl {
             \r
             @Override\r
             public ArrayList<ReferenceRow> getRows(ReadGraph graph, Resource module) throws DatabaseException {\r
-                Builtins b = graph.getBuiltins();\r
+                Layer0 l0 = Layer0.getInstance(graph);\r
                 SysdynResource sr = SysdynResource.getInstance(graph);\r
                 StructuralResource2 sr2 = StructuralResource2.getInstance(graph);\r
                 ArrayList<ReferenceRow> result = new ArrayList<ReferenceRow>();\r
-                Resource instanceOf = graph.getPossibleObject(module, b.InstanceOf);\r
+                Resource instanceOf = graph.getPossibleObject(module, l0.InstanceOf);\r
                 if(instanceOf == null) return result;\r
                 Resource configuration = graph.getSingleObject(instanceOf, sr2.IsDefinedBy);\r
-                for(Resource variable : graph.syncRequest(new ObjectsWithType(configuration, b.ConsistsOf, sr.Variable))) {\r
+                for(Resource variable : graph.syncRequest(new ObjectsWithType(configuration, l0.ConsistsOf, sr.Variable))) {\r
                     if(!graph.hasStatement(variable, sr.IsOutput)) continue;\r
                     \r
                     Resource dependency = null;\r
index 2776d5b69c5c8279b04b6c9810d146618dfb7707..31acfd1150b9a4d07cba84e4f20a46c73a4f5dbf 100644 (file)
@@ -6,12 +6,12 @@ import java.util.Collections;
 \r
 import org.simantics.browsing.ui.SelectionProcessor;\r
 import org.simantics.browsing.ui.swt.ComparableTabContributor;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.ManyObjectsForFunctionalRelationException;\r
 import org.simantics.db.exception.ServiceException;\r
 import org.simantics.diagram.stubs.DiagramResource;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.sysdyn.SysdynResource;\r
@@ -29,7 +29,7 @@ public class ResourceSelectionProcessor implements SelectionProcessor<Object, Re
             SysdynResource sr = SysdynResource.getInstance(backend);\r
             DiagramResource dr = DiagramResource.getInstance(backend);\r
             ModelingResources mr = ModelingResources.getInstance(backend);\r
-            Builtins b = backend.getBuiltins();\r
+            Layer0 l0 = Layer0.getInstance(backend);\r
             Collection<ComparableTabContributor> tabs = new ArrayList<ComparableTabContributor>();\r
             if (backend.isInstanceOf(r, dr.Element)) {\r
                 Resource component = backend.getPossibleObject(r, mr.ElementToComponent);\r
@@ -69,7 +69,7 @@ public class ResourceSelectionProcessor implements SelectionProcessor<Object, Re
                         r,\r
                 "Input"));\r
             }\r
-            Resource represents = backend.getPossibleObject(r, b.Represents);\r
+            Resource represents = backend.getPossibleObject(r, l0.Represents);\r
             if ((represents != null && backend.isInstanceOf(represents, sr.Configuration)) || (backend.isInstanceOf(r, sr.SysdynModel))) {\r
                 Resource model;\r
                 if (represents != null)\r
index b0e6e63e30aedc19c352598df68682075bbbc93a..d25759161b77b941ff2bfe1036325ba024abab4e 100644 (file)
@@ -223,7 +223,7 @@ public class ChartTableWidget implements Widget {
             @Override\r
             public void perform(WriteGraph graph) throws DatabaseException {\r
                 SysdynResource sr = SysdynResource.getInstance(graph);\r
-                graph.claimValue(expression, sr.HasLookup, table);\r
+                graph.claimLiteral(expression, sr.HasLookup, table);\r
             }\r
         });\r
     }\r
index 1b2ac67ac8f347d10295b0663ae6c77a2cc51660..4f22ec7a0ef184639025e8890fe900da4a755568 100644 (file)
@@ -212,7 +212,7 @@ public class ChartWidget implements Widget {
                 @Override\r
                 public void perform(WriteGraph graph) throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(graph);\r
-                    graph.claimValue(expression, sr.HasLookup, table);\r
+                    graph.claimLiteral(expression, sr.HasLookup, table);\r
                 }\r
             });\r
 \r
index 94643afabf11f61a43470a64d52c8422eb86893d..d569cd9629c163c4420646f2a0669e574b6f3fd6 100644 (file)
@@ -18,6 +18,7 @@ import org.simantics.db.Resource;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.management.ISessionContext;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.properties.widgets.ExpressionTypes.ExpressionType;\r
 import org.simantics.sysdyn.ui.properties.widgets.expressions.AuxiliaryExpression;\r
@@ -131,7 +132,7 @@ public class ExpressionWidget implements Widget {
                     Resource configuration = variable;\r
                     \r
                     do {\r
-                    configuration = graph.getSingleObject(configuration, graph.getBuiltins().PartOf);\r
+                    configuration = graph.getSingleObject(configuration, Layer0.getInstance(graph).PartOf);\r
                         if(graph.isInstanceOf(configuration, sr.Configuration))\r
                             return configuration;\r
                     } while (configuration != null);\r
index 1031a792743414ce511267fdcb071711d6d33255..d2ad8fc9731d3ae397ac1693a004432329f1ece5 100644 (file)
@@ -8,12 +8,12 @@ import org.eclipse.jface.viewers.EditingSupport;
 import org.eclipse.jface.viewers.TableViewer;\r
 import org.eclipse.jface.viewers.TextCellEditor;\r
 import org.eclipse.swt.SWT;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ObjectsWithType;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
@@ -56,14 +56,14 @@ public class ModuleInputEditingSupport extends EditingSupport {
 \r
                         @Override\r
                         public HashMap<String, Resource> perform(ReadGraph graph) throws DatabaseException {\r
-                            Builtins b = graph.getBuiltins();\r
+                               Layer0 l0 = Layer0.getInstance(graph);\r
                             SysdynResource sr = SysdynResource.getInstance(graph);\r
                             HashMap<String, Resource> result = new HashMap<String, Resource>();\r
                             for(Resource dependency : graph.syncRequest(new ObjectsWithType(module, sr.IsHeadOf, sr.Dependency))) {\r
                                 if(graph.getPossibleObject(dependency, sr.RefersTo) == null ||\r
                                         graph.getPossibleObject(dependency, sr.RefersTo).equals(inputVariable)) {\r
                                     Resource output = graph.getSingleObject(dependency, sr.HasTail);\r
-                                    result.put((String)graph.getRelatedValue(output, b.HasName), dependency);\r
+                                    result.put((String)graph.getRelatedValue(output, l0.HasName), dependency);\r
                                 }\r
                             }\r
                             return result;\r
index 50da2dbc16508be0d5ccfdbb80125c8c590a41d2..9625e59621f8ea679d5653fd0aac298da5870e7d 100644 (file)
@@ -8,12 +8,12 @@ import org.eclipse.jface.viewers.EditingSupport;
 import org.eclipse.jface.viewers.TableViewer;\r
 import org.eclipse.jface.viewers.TextCellEditor;\r
 import org.eclipse.swt.SWT;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ObjectsWithType;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
@@ -56,14 +56,14 @@ public class ModuleOutputEditingSupport  extends EditingSupport {
 \r
                         @Override\r
                         public HashMap<String, Resource> perform(ReadGraph graph) throws DatabaseException {\r
-                            Builtins b = graph.getBuiltins();\r
+                               Layer0 l0 = Layer0.getInstance(graph);\r
                             SysdynResource sr = SysdynResource.getInstance(graph);\r
                             HashMap<String, Resource> result = new HashMap<String, Resource>();\r
                             for(Resource dependency : graph.syncRequest(new ObjectsWithType(module, sr.IsTailOf, sr.Dependency))) {\r
                                 if(graph.getPossibleObject(dependency, sr.RefersTo) == null ||\r
                                         graph.getPossibleObject(dependency, sr.RefersTo).equals(outputVariable)) {\r
                                     Resource input = graph.getSingleObject(dependency, sr.HasHead);\r
-                                    result.put((String)graph.getRelatedValue(input, b.HasName), dependency);\r
+                                    result.put((String)graph.getRelatedValue(input, l0.HasName), dependency);\r
                                 }\r
                             }\r
                             return result;\r
index d3e4f8a502d123483dac5e260ad63496cf27b994..d40411d5eb479372e6080bec32ce734280d69edb 100644 (file)
@@ -1,13 +1,13 @@
 package org.simantics.sysdyn.ui.properties.widgets;\r
 \r
 import org.simantics.databoard.binding.java.StringBindingDefault;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
@@ -42,7 +42,7 @@ public class ReferenceRow {
 \r
                 @Override\r
                 public String perform(ReadGraph graph) throws DatabaseException {\r
-                    return (String)graph.getRelatedValue(getVariable(), graph.getBuiltins().HasName);\r
+                    return (String)graph.getRelatedValue(getVariable(), Layer0.getInstance(graph).HasName);\r
                 }\r
             });\r
         } catch (DatabaseException e) {\r
@@ -60,14 +60,14 @@ public class ReferenceRow {
 \r
                 @Override\r
                 public String perform(ReadGraph graph) throws DatabaseException {\r
-                    Builtins b = graph.getBuiltins();\r
+                    Layer0 l0 = Layer0.getInstance(graph);\r
                     SysdynResource sr = SysdynResource.getInstance(graph);\r
                     Resource valueResource = graph.getPossibleObject(dependency, sr.HasTail);\r
                     if(!graph.isInstanceOf(valueResource, sr.Variable))\r
                         valueResource = graph.getPossibleObject(dependency, sr.HasHead);\r
                     if(!graph.isInstanceOf(valueResource, sr.Variable))\r
                         return "";\r
-                    return (String)graph.getRelatedValue(valueResource, b.HasName, StringBindingDefault.INSTANCE);\r
+                    return (String)graph.getRelatedValue(valueResource, l0.HasName, StringBindingDefault.INSTANCE);\r
                 }\r
             });\r
         } catch (DatabaseException e) {\r
index 1c9fda3488cb7ef483aa75425c8df322ac68197e..0eeba7a80f22edd40bb662b89ba0b40ce982f644 100644 (file)
@@ -16,12 +16,12 @@ import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableItem;\r
 import org.simantics.browsing.ui.swt.widgets.impl.Widget;\r
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.management.ISessionContext;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 import org.simantics.utils.ui.ExceptionUtils;\r
@@ -106,15 +106,15 @@ public class ShortcutTabWidget implements Widget {
                     throws DatabaseException {\r
                         HashSet<String> variables = new HashSet<String>();\r
                         SysdynResource sr = SysdynResource.getInstance(graph);\r
-                        Builtins b = graph.getBuiltins();\r
-\r
+                        Layer0 l0 = Layer0.getInstance(graph);\r
+                        \r
                         Collection<Resource> dependencies = graph.getObjects(r, sr.IsHeadOf);\r
 \r
                         for(Resource d : dependencies) {\r
                             if(graph.isInstanceOf(d, sr.Dependency)) {\r
                                 Resource tail = graph.getPossibleObject(d, sr.HasTail);\r
                                 if(tail != null) {\r
-                                    Object name = graph.getPossibleRelatedValue(tail, b.HasName);\r
+                                    Object name = graph.getPossibleRelatedValue(tail, l0.HasName);\r
                                     if(name != null)\r
                                         variables.add((String)name);\r
                                 }\r
index 4fc7b78e1a3b943622ff7d35d02e2cb793771ec1..01acc49ea6f16e08a11ae691d7e575c0a992aa1f 100644 (file)
@@ -124,7 +124,7 @@ public class BasicExpression implements IExpression {
                         g.claim(expression, b.InstanceOf, null, expressionType);\r
                         g.claim(variable, sr.HasExpression, expression);\r
                     }\r
-                    g.claimValue(expression, sr.HasEquation, currentText);\r
+                    g.claimLiteral(expression, sr.HasEquation, currentText);\r
                 }\r
 \r
             });\r
index 60104211b0103ff7fab65aec16f1b008e39bfaa3..81935ada3fd7e238dbafab2e43bf01dd25d3ef78 100644 (file)
@@ -134,7 +134,8 @@ public class LookupInputOutputTable extends Composite {
          * @param clazz String.class or Double.class\r
          * @return input as string or double or null if asked for something else\r
          */\r
-        public Object getInput(Class clazz) {\r
+        @SuppressWarnings("rawtypes")\r
+               public Object getInput(Class clazz) {\r
             if(clazz == String.class) {\r
                 return "" + input;\r
             } else if (clazz == Double.class) {\r
@@ -161,7 +162,8 @@ public class LookupInputOutputTable extends Composite {
          * @param clazz String.class or Double.class\r
          * @return output as string or double or null if asked for something else\r
          */\r
-        public Object getOutput(Class clazz) {\r
+        @SuppressWarnings("rawtypes")\r
+               public Object getOutput(Class clazz) {\r
             if(clazz == String.class) {\r
                 return "" + output;\r
             } else if (clazz == Double.class) {\r
index 6d357d73de8ab882878029da46ebe4d518a8c5c6..5d9ab6091c2e72b0c1d49ce0fe2ac7af12a5bb88 100644 (file)
@@ -17,13 +17,13 @@ import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.swt.widgets.Label;\r
 import org.eclipse.swt.widgets.Text;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.ui.SimanticsUI;\r
 \r
@@ -123,17 +123,17 @@ public class StockExpression implements IExpression {
                 throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(g);\r
                     Resource expression = g.getPossibleObject(variable, sr.HasExpression);\r
-                    Builtins b = g.getBuiltins();\r
+                    Layer0 l0 = Layer0.getInstance(g);\r
                     if(expression != null && !g.isInstanceOf(expression, sr.StockExpression)) {\r
                         g.deny(variable, sr.HasExpression);\r
                         expression = null;\r
                     }\r
                     if(expression == null) {\r
                         expression = g.newResource();\r
-                        g.claim(expression, b.InstanceOf, null, sr.StockExpression);\r
+                        g.claim(expression, l0.InstanceOf, null, sr.StockExpression);\r
                         g.claim(variable, sr.HasExpression, expression);\r
                     } \r
-                    g.claimValue(expression, sr.HasInitialEquation, currentText);\r
+                    g.claimLiteral(expression, sr.HasInitialEquation, currentText);\r
                 }\r
 \r
             });\r
@@ -158,7 +158,7 @@ public class StockExpression implements IExpression {
                 @Override\r
                 public String perform(ReadGraph graph) throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(graph);\r
-                    Builtins b = graph.getBuiltins();\r
+                    Layer0 l0 = Layer0.getInstance(graph);\r
                     Collection<Resource> heads = graph.getObjects(variable, sr.IsHeadOf);\r
                     Collection<Resource> tails = graph.getObjects(variable, sr.IsTailOf);\r
 \r
@@ -168,7 +168,7 @@ public class StockExpression implements IExpression {
                         if(graph.isInstanceOf(r, sr.Flow)) {\r
                             Resource tail = graph.getPossibleObject(r, sr.HasTail);\r
                             if(tail != null) {\r
-                                Object name = graph.getPossibleRelatedValue(tail, b.HasName);\r
+                                Object name = graph.getPossibleRelatedValue(tail, l0.HasName);\r
                                 if (name != null) \r
                                     builder.append(" + " + name);\r
 \r
@@ -179,7 +179,7 @@ public class StockExpression implements IExpression {
                         if(graph.isInstanceOf(r, sr.Flow)) {\r
                             Resource head = graph.getPossibleObject(r, sr.HasHead);\r
                             if(head != null) {\r
-                                Object name = graph.getPossibleRelatedValue(head, b.HasName);\r
+                                Object name = graph.getPossibleRelatedValue(head, l0.HasName);\r
                                 if (name != null)\r
                                     builder.append(" - " + name);\r
                             }\r
index 8d9afd020ebb5f59e61ee1602916cbf55c7044eb..24b075daf799453efc850d87db9cae242094b64b 100644 (file)
@@ -35,7 +35,6 @@ import org.jfree.chart.plot.PlotOrientation;
 import org.jfree.data.xy.XYDataset;\r
 import org.jfree.data.xy.XYSeries;\r
 import org.jfree.data.xy.XYSeriesCollection;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
@@ -43,6 +42,7 @@ import org.simantics.db.common.request.WriteRequest;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.procedure.Listener;\r
 import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.representation.Auxiliary;\r
 import org.simantics.sysdyn.tableParser.ParseException;\r
@@ -253,23 +253,23 @@ public class WithLookupExpression implements IExpression {
                 throws DatabaseException {\r
                     SysdynResource sr = SysdynResource.getInstance(g);\r
                     Resource expression = g.getPossibleObject(variable, sr.HasExpression);\r
-                    Builtins b = g.getBuiltins();\r
+                    Layer0 l0 = Layer0.getInstance(g);\r
                     if(expression != null && !g.isInstanceOf(expression, sr.WithLookupExpression)) {\r
                         g.deny(variable, sr.HasExpression);\r
                         expression = null;\r
                     }\r
                     if(expression == null) {\r
                         expression = g.newResource();\r
-                        g.claim(expression, b.InstanceOf, null, sr.WithLookupExpression);\r
+                        g.claim(expression, l0.InstanceOf, null, sr.WithLookupExpression);\r
                         g.claim(variable, sr.HasExpression, expression);\r
-                        g.claimValue(expression, sr.HasMinX, 0.0);\r
-                        g.claimValue(expression, sr.HasMaxX, 10.0);\r
-                        g.claimValue(expression, sr.HasMinY, 0.0);\r
-                        g.claimValue(expression, sr.HasMaxY, 10.0);\r
+                        g.claimLiteral(expression, sr.HasMinX, 0.0);\r
+                        g.claimLiteral(expression, sr.HasMaxX, 10.0);\r
+                        g.claimLiteral(expression, sr.HasMinY, 0.0);\r
+                        g.claimLiteral(expression, sr.HasMaxY, 10.0);\r
 \r
                     } \r
-                    g.claimValue(expression, sr.HasEquation, currentExpression);\r
-                    g.claimValue(expression, sr.HasLookup, currentLookupTable);\r
+                    g.claimLiteral(expression, sr.HasEquation, currentExpression);\r
+                    g.claimLiteral(expression, sr.HasLookup, currentLookupTable);\r
                 }\r
             });\r
         }\r
index 5a2f5a72f7f796a632aec61dab93bb1ea34b297b..a0eb20b8e6fcbdbfe05bd3c39915f5c458c0d353 100644 (file)
@@ -17,7 +17,7 @@ public class DoublePropertyModifier extends TextModifyListenerImpl<Resource> {
 \r
     @Override\r
     public void applyText(WriteGraph graph, Resource input, String text) throws DatabaseException {\r
-        graph.claimValue(input, graph.getResource(propertyURI), Double.parseDouble(text), DoubleBindingDefault.INSTANCE);\r
+        graph.claimLiteral(input, graph.getResource(propertyURI), Double.parseDouble(text), DoubleBindingDefault.INSTANCE);\r
     }\r
 \r
 }\r
index af6e5e6fbc84283bfc6469fcf59d20039c38c5ae..cd1090703b113b0e7a07177346fc356bf14bbae9 100644 (file)
@@ -6,7 +6,6 @@ import java.util.Collection;
 import org.simantics.browsing.ui.Tester;\r
 import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
 import org.simantics.browsing.ui.graph.tester.GraphTesters;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.common.request.ObjectsWithType;\r
index cc6b6077539bfa84f705cbe802d8edf526a1e41c..d7a2c608ba8187654f4a158d36337cefd348a1be 100644 (file)
@@ -33,7 +33,6 @@ import org.jfree.chart.axis.NumberAxis;
 import org.jfree.chart.plot.XYPlot;\r
 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;\r
 import org.jfree.data.xy.AbstractXYDataset;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.Session;\r
@@ -43,6 +42,7 @@ import org.simantics.db.layer0.SelectionHints;
 import org.simantics.db.layer0.variable.Variable;\r
 import org.simantics.db.layer0.variable.Variables;\r
 import org.simantics.diagram.stubs.DiagramResource;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingUtils;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.sysdyn.SysdynResource;\r
@@ -220,7 +220,7 @@ public class TrendView extends ViewPart {
 \r
        protected Collection<SysdynDataSet> loadAllActive(ReadGraph g, Resource element, Resource runtime) throws DatabaseException {\r
 \r
-               Builtins b = g.getBuiltins();\r
+               Layer0 l0 = Layer0.getInstance(g);\r
 \r
                SysdynResource sr = SysdynResource.getInstance(g);\r
 \r
@@ -232,7 +232,7 @@ public class TrendView extends ViewPart {
 \r
                String variableURI = g.getPossibleRelatedValue(runtime, dr.HasVariable);\r
 \r
-               System.out.println("load dataset for '"+ g.getPossibleRelatedValue(resource, b.HasName) + "'in composite '" + variableURI + "'");\r
+               System.out.println("load dataset for '"+ g.getPossibleRelatedValue(resource, l0.HasName) + "'in composite '" + variableURI + "'");\r
                Variable compositeVariable = Variables.getVariable(g, variableURI);\r
                Variable item = compositeVariable.browsePossible(g, resource);\r
                if(item == null) return null;\r
index 2862850f6c4b6acc52c31fe4c069624646f461d6..b810ba47a47d4e53caeeba15a49994a4c28b2b5c 100644 (file)
@@ -9,7 +9,6 @@ import java.util.concurrent.locks.Lock;
 import org.eclipse.core.runtime.Platform;\r
 import org.simantics.databoard.annotations.Optional;\r
 import org.simantics.databoard.binding.mutable.Variant;\r
-import org.simantics.db.Builtins;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.Session;\r
@@ -18,8 +17,8 @@ import org.simantics.db.WriteGraph;
 import org.simantics.db.common.request.ReadRequest;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.service.LifecycleSupport;\r
 import org.simantics.db.service.VirtualGraphSupport;\r
+import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.simulation.experiment.Experiment;\r
 import org.simantics.simulation.experiment.ExperimentState;\r
@@ -63,29 +62,28 @@ public class SysdynExperiment extends Experiment implements IDynamicExperiment {
 \r
                 @Override\r
                 public void perform(WriteGraph graph) throws DatabaseException {\r
-                    Builtins b = graph.getBuiltins();\r
-                    Resource model = graph.getSingleObject(experiment, b.PartOf);\r
-                    Resource project = graph.getSingleObject(model, b.PartOf);\r
-                    String projectName = graph.getPossibleRelatedValue(project, b.HasName);\r
+                       Layer0 l0 = Layer0.getInstance(graph);\r
+                    Resource model = graph.getSingleObject(experiment, l0.PartOf);\r
+                    Resource project = graph.getSingleObject(model, l0.PartOf);\r
+                    String projectName = graph.getPossibleRelatedValue(project, l0.HasName);\r
                     File root = new File(Platform.getLocation().toOSString(), "www.simantics.org");\r
                     if(!root.isDirectory()) root.mkdir();\r
                     File projectRoot = new File(root, projectName);\r
                     if(!projectRoot.isDirectory()) projectRoot.mkdir();\r
                     File file = new File( projectRoot, UUID.randomUUID().toString() + ".dbb");\r
                     \r
-                    String name = GraphUtils.findFreshName(graph, "Result", model, b.ConsistsOf, "%s%d");\r
+                    String name = GraphUtils.findFreshName(graph, "Result", model, l0.ConsistsOf, "%s%d");\r
                     \r
                     SysdynResource sr = SysdynResource.getInstance(graph);\r
                     Resource res = GraphUtils.create2(graph, sr.Result,\r
-                            b.HasLabel, name,\r
-                            b.HasName, name,\r
-                            b.PartOf, model,\r
+                            l0.HasLabel, name,\r
+                            l0.HasName, name,\r
+                            l0.PartOf, model,\r
                             sr.HasResultFile, file.getAbsolutePath());\r
                     graph.claim(experiment, sr.HasResult, res);\r
                     sysdynModel.getSysdynResult().saveToFile(file);\r
                 }\r
             });\r
-            session.getService(LifecycleSupport.class).save();\r
         } catch (DatabaseException e) {\r
             e.printStackTrace();\r
         }\r
index 12a7c52e31a20a407cdaf41a00a294b9fff296c1..dcefbe88d056584087ef28de4eba9f655756f9d0 100644 (file)
@@ -3,7 +3,6 @@ package org.simantics.sysdyn.representation;
 import java.util.List;\r
 \r
 import org.simantics.objmap.annotations.GraphType;\r
-import org.simantics.objmap.annotations.RelatedElement;\r
 import org.simantics.objmap.annotations.RelatedElements;\r
 import org.simantics.objmap.annotations.RelatedValue;\r
 import org.simantics.sysdyn.representation.visitors.IElementVisitorVoid;\r