--- /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.structural2.modelingRules;\r
+\r
+import java.util.Collection;\r
+import java.util.Set;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+\r
+/**\r
+ * @see <a href="https://www.simantics.org/wiki/index.php/Diagram_ontology#Connection_typing_and_constraints">Ontology documentation</a>\r
+ * @author Hannu Niemistö\r
+ */\r
+public interface IModelingRules {\r
+ /**\r
+ * Returns true if the component type can be populated to the diagram.\r
+ */\r
+ boolean canPopulate(ReadGraph g, \r
+ Resource componentType) throws DatabaseException;\r
+\r
+ /**\r
+ * Tells if connecting the given connection points is possible\r
+ * and what the connection type would be.\r
+ */\r
+ ConnectionJudgement judgeConnection(ReadGraph g, \r
+ Collection<IConnectionPoint> connectionPoints)\r
+ throws DatabaseException;\r
+\r
+ /**\r
+ * Computes a connection type the the given connection\r
+ */\r
+ Resource computeConnectionType(ReadGraph g,\r
+ Collection<IConnectionPoint> connectionPoints)\r
+ throws DatabaseException;\r
+ \r
+ /**\r
+ * Gets attachment relations of already existing connection.\r
+ */\r
+ IAttachmentRelationMap getAttachmentRelations(ReadGraph g, \r
+ Resource connection) throws DatabaseException;\r
+ \r
+ /**\r
+ * Writes the connection type of the connection to graph.\r
+ */\r
+ void setConnectionType(WriteGraph g,\r
+ Resource connection,\r
+ Resource connectionType) throws DatabaseException;\r
+ \r
+ /**\r
+ * Reads the connection type of the connection.\r
+ */\r
+ Resource getConnectionType(ReadGraph g, \r
+ Resource connection) throws DatabaseException;\r
+ \r
+ Set<CPTerminal> resolveTerminals(ReadGraph g,\r
+ Collection<IConnectionPoint> connectionPoints) throws DatabaseException;\r
+ \r
+}\r