1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\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.layer0.utils.writer;
\r
14 import org.simantics.db.ReadGraph;
\r
15 import org.simantics.db.Resource;
\r
16 import org.simantics.db.exception.DatabaseException;
\r
17 import org.simantics.db.service.ClusteringSupport;
\r
18 import org.simantics.layer0.Layer0;
\r
20 public abstract class GraphWriterPartial implements GraphWriter {
\r
22 ClusteringSupport clustering;
\r
26 public GraphWriterPartial(ReadGraph graph) {
\r
28 this.l0 = Layer0.getInstance(graph);
\r
29 clustering = graph.getSession().getService(ClusteringSupport.class);
\r
33 public ReadGraph getGraph() {
\r
38 // public GraphWriter create(Resource type) {
\r
39 // return create(type);
\r
40 // return let(b.InstanceOf, type);
\r
44 public GraphWriter create(String name, Resource type) throws DatabaseException {
\r
46 return let(l0.HasName, name, l0.String);
\r
50 public GraphWriter create(int clusterHint, String name, Resource type) throws DatabaseException {
\r
51 create(clusterHint, type);
\r
52 return let(clusterHint, l0.HasName, name, l0.String);
\r
56 public GraphWriter create(int clusterHint) throws DatabaseException {
\r
61 public GraphWriter create(int clusterHint, Resource type) throws DatabaseException {
\r
62 return create(type);
\r
66 public GraphWriter let(int clusterHint, Resource p, Object value,
\r
67 Resource dataType) throws DatabaseException {
\r
68 return let(p, value, dataType);
\r
72 public GraphWriter createLiteral(int clusterHint, Object value,
\r
73 Resource dataType) throws DatabaseException {
\r
74 return createLiteral(value, dataType);
\r
78 public GraphWriter stat(Resource s, Resource p, Resource o) throws DatabaseException {
\r
79 return handle(s).let(p, o);
\r
83 public GraphWriter createInverse(int clusterHint, Resource r) throws DatabaseException {
\r
84 return createInverse(r);
\r