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.query;
14 import java.io.InputStream;
16 import org.simantics.db.ObjectResourceIdMap;
17 import org.simantics.db.Resource;
18 import org.simantics.db.Session;
19 import org.simantics.db.VirtualGraph;
20 import org.simantics.db.exception.DatabaseException;
21 import org.simantics.db.exception.ResourceNotFoundException;
22 import org.simantics.db.impl.ClusterSupport;
23 import org.simantics.db.impl.graph.ReadGraphImpl;
25 public interface QuerySupport extends ResourceTranslator {
29 ClusterSupport getClusterSupport();
31 ObjectResourceIdMap<String> createChildMap();
33 boolean isImmutable(int id);
34 long getClusterId(int id);
35 int getId(Resource resource);
36 Resource getResource(int id);
38 boolean resume(ReadGraphImpl graph);
39 void dirtyPrimitives();
42 int getSingleInstance(int subject);
43 int getSingleSuperrelation(int subject);
44 int getFunctionalObject(int subject, int predicate);
45 boolean getObjects(ReadGraphImpl graph, int subject, int predicate, IntProcedure procedure) throws DatabaseException;
47 org.simantics.db.DirectStatements getStatements(ReadGraphImpl graph, final int subject, QueryProcessor processor, boolean ignoreVirtual);
49 void getPredicates(ReadGraphImpl graph, int subject, IntProcedure procedure) throws DatabaseException;
50 byte[] getValue(ReadGraphImpl graph, int resource);
51 InputStream getValueStream(ReadGraphImpl graph, int resource);
53 void requestCluster(ReadGraphImpl graph, long clusterId, Runnable r);
55 void ensureLoaded(final ReadGraphImpl graph, final int subject, final int predicate);
56 void ensureLoaded(final ReadGraphImpl graph, final int subject);
57 boolean isLoaded(int subject);
59 int getBuiltin(String uri);
61 @Deprecated // Use SerialisationSupport instead
62 int getRandomAccessReference(String id) throws ResourceNotFoundException;
65 void ceased(int thread);
68 VirtualGraph getProvider(int subject, int predicate, int object);
69 VirtualGraph getProvider(int subject, int predicate);
70 VirtualGraph getValueProvider(int subject);
72 void exit(Throwable t);