--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.layer0.utils.writer;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.service.ClusteringSupport;\r
+import org.simantics.layer0.Layer0;\r
+\r
+public abstract class GraphWriterPartial implements GraphWriter {\r
+\r
+ ClusteringSupport clustering;\r
+ ReadGraph graph;\r
+ Layer0 l0;\r
+ \r
+ public GraphWriterPartial(ReadGraph graph) { \r
+ this.graph = graph;\r
+ this.l0 = Layer0.getInstance(graph);\r
+ clustering = graph.getSession().getService(ClusteringSupport.class);\r
+ }\r
+ \r
+ @Override\r
+ public ReadGraph getGraph() {\r
+ return graph;\r
+ }\r
+ \r
+// @Override\r
+// public GraphWriter create(Resource type) {\r
+// return create(type);\r
+// return let(b.InstanceOf, type);\r
+// }\r
+ \r
+ @Override\r
+ public GraphWriter create(String name, Resource type) throws DatabaseException {\r
+ create(type);\r
+ return let(l0.HasName, name, l0.String);\r
+ }\r
+ \r
+ @Override\r
+ public GraphWriter create(int clusterHint, String name, Resource type) throws DatabaseException {\r
+ create(clusterHint, type);\r
+ return let(clusterHint, l0.HasName, name, l0.String);\r
+ }\r
+ \r
+ @Override\r
+ public GraphWriter create(int clusterHint) throws DatabaseException {\r
+ return create();\r
+ }\r
+ \r
+ @Override\r
+ public GraphWriter create(int clusterHint, Resource type) throws DatabaseException {\r
+ return create(type);\r
+ }\r
+ \r
+ @Override\r
+ public GraphWriter let(int clusterHint, Resource p, Object value,\r
+ Resource dataType) throws DatabaseException {\r
+ return let(p, value, dataType);\r
+ }\r
+ \r
+ @Override\r
+ public GraphWriter createLiteral(int clusterHint, Object value,\r
+ Resource dataType) throws DatabaseException {\r
+ return createLiteral(value, dataType);\r
+ }\r
+\r
+ @Override\r
+ public GraphWriter stat(Resource s, Resource p, Resource o) throws DatabaseException {\r
+ return handle(s).let(p, o); \r
+ } \r
+ \r
+ @Override\r
+ public GraphWriter createInverse(int clusterHint, Resource r) throws DatabaseException {\r
+ return createInverse(r);\r
+ }\r
+ \r
+}\r