1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.impl.graph;
14 import org.simantics.db.MetadataI;
15 import org.simantics.db.Resource;
16 import org.simantics.db.VirtualGraph;
17 import org.simantics.db.WriteGraph;
18 import org.simantics.db.exception.DatabaseException;
19 import org.simantics.db.exception.ServiceException;
20 import org.simantics.db.request.Write;
21 import org.simantics.db.request.WriteOnly;
22 import org.simantics.db.request.WriteResult;
23 import org.simantics.db.request.WriteTraits;
24 import org.simantics.db.service.ByteReader;
26 public interface WriteSupport extends MetadataI {
28 void claim(VirtualGraph provider, int subject, int predicate, int object)
29 throws ServiceException;
31 void claim(VirtualGraph provider, Resource subject, Resource predicate, Resource object)
32 throws ServiceException;
34 boolean removeStatement(VirtualGraph provider, Resource subject, Resource predicate, Resource object)
35 throws ServiceException;
37 void claimValue(VirtualGraph provider, int resource, byte[] value, int length) throws DatabaseException;
38 void claimValue(VirtualGraph provider, Resource resource, byte[] value) throws DatabaseException;
39 void claimValue(VirtualGraph provider, Resource resource, ByteReader reader, int amount) throws DatabaseException;
41 void denyValue(VirtualGraph provider, Resource resource) throws ServiceException;
43 void setValue(VirtualGraph provider, Resource resource, byte[] value) throws ServiceException;
45 Resource createResource(VirtualGraph provider)
46 throws DatabaseException;
48 Resource createResource(VirtualGraph provider, long clusterId)
49 throws DatabaseException;
51 Resource createResource(VirtualGraph provider, Resource clusterSet)
52 throws DatabaseException;
54 void createClusterSet(VirtualGraph provider, Resource clusterSet)
55 throws DatabaseException;
57 boolean hasClusterSet(VirtualGraph provider, Resource clusterSet)
58 throws ServiceException;
60 Resource setDefaultClusterSet(Resource clusterSet)
61 throws ServiceException;
63 void performWriteRequest(WriteGraph graph, Write request) throws DatabaseException;
64 <T> T performWriteRequest(WriteGraph graph, WriteResult<T> request) throws DatabaseException;
65 void performWriteRequest(WriteGraph graph, WriteOnly request) throws DatabaseException;
69 void flush(boolean intermediate);
71 void flushCluster(Resource r);
75 void commitDone(WriteTraits writeTraits, long csid);
76 void clearUndoList(WriteTraits writeTraits);
79 * @return size of meta data before clearing.