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.db.layer0.adapter;
\r
14 import java.util.List;
\r
16 import org.simantics.db.ReadGraph;
\r
17 import org.simantics.db.exception.DatabaseException;
\r
18 import org.simantics.utils.datastructures.Pair;
\r
20 public interface GenericRelation {
\r
23 * Tests whether a tuple belongs to the relation.
\r
25 boolean contains(ReadGraph graph, Object[] tuple) throws DatabaseException;
\r
28 * Tells if realize-method is implemented.
\r
30 boolean isRealizable();
\r
32 * Returns the contents of the relation as a list.
\r
34 List<Object[]> realize(ReadGraph graph) throws DatabaseException;
\r
37 * Selects and projects the relation by given binding pattern and constants.
\r
38 * The binding pattern is a string of 'b' and 'f' characters. The length
\r
39 * of constants array has to be the number of 'b' letters in binding pattern.
\r
41 public GenericRelation select(String bindingPattern, Object[] constants);
\r
44 * Restricts the relation by given constraint.
\r
46 public GenericRelation selectByRelation(String bindingPattern, GenericRelation constraint);
\r
49 * Tells the names and types of the fields of the relation.
\r
51 Pair<String, String>[] getFields();
\r
53 //<T> T getInterface(Class<T> clazz);
\r