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.structural2.modelingRules;
14 import java.util.Collection;
17 import org.simantics.db.ReadGraph;
18 import org.simantics.db.Resource;
19 import org.simantics.db.WriteGraph;
20 import org.simantics.db.exception.DatabaseException;
23 * @see <a href="https://www.simantics.org/wiki/index.php/Diagram_ontology#Connection_typing_and_constraints">Ontology documentation</a>
24 * @author Hannu Niemistö
26 public interface IModelingRules {
28 * Returns true if the component type can be populated to the diagram.
30 boolean canPopulate(ReadGraph g,
31 Resource componentType) throws DatabaseException;
34 * Tells if connecting the given connection points is possible
35 * and what the connection type would be.
37 ConnectionJudgement judgeConnection(ReadGraph g,
38 Collection<IConnectionPoint> connectionPoints)
39 throws DatabaseException;
42 * Computes a connection type the the given connection
44 Resource computeConnectionType(ReadGraph g,
45 Collection<IConnectionPoint> connectionPoints)
46 throws DatabaseException;
49 * Gets attachment relations of already existing connection.
51 IAttachmentRelationMap getAttachmentRelations(ReadGraph g,
52 Resource connection) throws DatabaseException;
55 * Writes the connection type of the connection to graph.
57 void setConnectionType(WriteGraph g,
59 Resource connectionType) throws DatabaseException;
62 * Reads the connection type of the connection.
64 Resource getConnectionType(ReadGraph g,
65 Resource connection) throws DatabaseException;
67 Set<CPTerminal> resolveTerminals(ReadGraph g,
68 Collection<IConnectionPoint> connectionPoints) throws DatabaseException;