1 /*******************************************************************************
\r
2 * Copyright (c) 2010 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.sysdyn.ui.project;
\r
14 import org.simantics.db.Resource;
\r
15 import org.simantics.db.Session;
\r
16 import org.simantics.db.VirtualGraphContext;
\r
17 import org.simantics.db.WriteGraph;
\r
18 import org.simantics.db.exception.DatabaseException;
\r
19 import org.simantics.db.layer0.realization.RealizationVirtualGraph;
\r
20 import org.simantics.db.layer0.realization.ResourceData;
\r
21 import org.simantics.simulation.ontology.SimulationResource;
\r
22 import org.simantics.sysdyn.SysdynResource;
\r
24 public class DefaultRealizationVirtualGraph extends RealizationVirtualGraph {
\r
26 public DefaultRealizationVirtualGraph(Session session, Resource model) throws DatabaseException {
\r
27 super(session, model, SysdynResource.getInstance(session).DefaultRealization);
\r
31 public void initialize(final VirtualGraphContext context, WriteGraph graph) throws DatabaseException {
\r
33 Resource configuration = graph.getSingleObject(model, SimulationResource.getInstance(graph).HasConfiguration);
\r
35 Resource defaultsResource = graph.newResource();
\r
36 int modelNode = context.getIndex(model);
\r
37 int defaultsNode = context.getIndex(defaultsResource);
\r
38 graph.claim(model, L0.ConsistsOf, null, defaultsResource);
\r
39 graph.claim(model, L0X.HasBaseRealization, null, defaultsResource);
\r
41 // undiscovered.put(defaultsNode, new ResourceData(modelNode, configuration, L0.Realization, "BaseRealization", null, null));
\r