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