001package de.deepamehta.core; 002 003import de.deepamehta.core.model.AssociationModel; 004import de.deepamehta.core.model.RoleModel; 005import de.deepamehta.core.model.TopicRoleModel; 006 007import java.util.List; 008 009 010 011/** 012 * ### FIXDOC: Specification of an association -- A n-ary connection between topics and other associations. 013 * 014 * @author <a href="mailto:jri@deepamehta.de">Jörg Richter</a> 015 */ 016public interface Association extends DeepaMehtaObject { 017 018 Role getRole1(); 019 020 Role getRole2(); 021 022 // --- 023 024 DeepaMehtaObject getPlayer1(); 025 026 DeepaMehtaObject getPlayer2(); 027 028 // --- 029 030 /** 031 * @teturn this association's topic which plays the given role. 032 * If there is no such topic, null is returned. 033 * <p> 034 * If there are 2 such topics an exception is thrown. 035 */ 036 Topic getTopic(String roleTypeUri); 037 038 /** 039 * @teturn this association's topic which has the given type. 040 * If there is no such topic, null is returned. 041 * <p> 042 * If there are 2 such topics an exception is thrown. 043 */ 044 Topic getTopicByType(String topicTypeUri); 045 046 // --- 047 048 /** 049 * Returns this association's role which refers to the same object as the given role model. 050 * The role returned is found by comparing topic IDs, topic URIs, or association IDs. 051 * The role types are <i>not</i> compared. 052 * <p> 053 * If the object refered by the given role model is not a player in this association an exception is thrown. 054 */ 055 Role getRole(RoleModel roleModel); 056 057 boolean isPlayer(TopicRoleModel roleModel); 058 059 // --- 060 061 void update(AssociationModel model); 062 063 // --- 064 065 Association loadChildTopics(); 066 Association loadChildTopics(String assocDefUri); 067 068 // --- 069 070 AssociationModel getModel(); 071}