*******************************************************************************/\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
this.model = model;\r
}\r
\r
+ @SuppressWarnings("rawtypes")\r
@Override\r
public Object getAdapter(Class adapter) {\r
if (adapter == Resource.class)\r
//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
\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
\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
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
\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
@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
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
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
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
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
\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
@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
\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
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
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
\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
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
\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
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
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
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
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
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
\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
\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
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
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
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
\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
\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
@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
\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
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
\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
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
}\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
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
}\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
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
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
\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
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
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
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
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
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
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
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
@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
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
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
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
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
\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
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
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
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
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
@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
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
\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
\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
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
@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
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
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
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
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
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
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
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
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
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
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
* @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
* @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
super.okPressed();\r
}\r
\r
- @SuppressWarnings("unchecked")\r
private String graphToModelicaTable() {\r
StringBuilder b = new StringBuilder();\r
b.append("{");\r
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
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
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
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
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
@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
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
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
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
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
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
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
@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
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
\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
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
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
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
\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
\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
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
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
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
\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
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
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
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
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
@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
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
@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
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
// 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
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
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
@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
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
\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
\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
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
\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
}\r
}\r
}\r
- return graph.getPossibleRelatedValue(projectResource, b.HasName);\r
+ return graph.getPossibleRelatedValue(projectResource, l0.HasName);\r
\r
}\r
});\r
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
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
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
\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
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
\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
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
\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
\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
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
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
@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
@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
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
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
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
\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
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
\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
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
\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
\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
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
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
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
* @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
* @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
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
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
@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
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
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
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
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
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
\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
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
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
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
\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
\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
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
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
\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
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