--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.db.layer0.adapter;\r
+\r
+import java.util.List;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.utils.datastructures.Pair;\r
+\r
+public interface GenericRelation {\r
+\r
+ /**\r
+ * Tests whether a tuple belongs to the relation.\r
+ */\r
+ boolean contains(ReadGraph graph, Object[] tuple) throws DatabaseException;\r
+ \r
+ /**\r
+ * Tells if realize-method is implemented.\r
+ */\r
+ boolean isRealizable();\r
+ /**\r
+ * Returns the contents of the relation as a list.\r
+ */\r
+ List<Object[]> realize(ReadGraph graph) throws DatabaseException; \r
+ \r
+ /**\r
+ * Selects and projects the relation by given binding pattern and constants.\r
+ * The binding pattern is a string of 'b' and 'f' characters. The length\r
+ * of constants array has to be the number of 'b' letters in binding pattern.\r
+ */\r
+ public GenericRelation select(String bindingPattern, Object[] constants);\r
+ \r
+ /**\r
+ * Restricts the relation by given constraint.\r
+ */\r
+ public GenericRelation selectByRelation(String bindingPattern, GenericRelation constraint);\r
+ \r
+ /**\r
+ * Tells the names and types of the fields of the relation.\r
+ */\r
+ Pair<String, String>[] getFields();\r
+ \r
+ //<T> T getInterface(Class<T> clazz);\r
+ \r
+}\r