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