org.tmapi.core
Interface AssociationRole

All Superinterfaces:
TopicMapObject

public interface AssociationRole
extends TopicMapObject

Represents the topic map member construct (known as association role in HyTM). This class represents a normalised association member. In normalising the members of an association, one member must be created for each of the role players of the association. For example the following (XTM) association would result in three Member objects.

   <association>
     <member>
       <instanceOf><topicRef xlink:href="#parent"/></instanceOf>
       <topicRef xlink:href="#homer"/>
     </member>
     <member>
       <instanceOf><topicRef xlink:href="#child"/></instanceOf>
       <topicRef xlink:href="#bart"/>
       <topicRef xlink:href="#lisa"/>
     </member>
   </association>
 


Method Summary
 Association getAssociation()
          Returns the association to which this AssociationRole belongs.
 Topic getPlayer()
          Returns the player of this AssociationRole.
 Topic getReifier()
          Returns the Topic that reifies this association role.
 Topic getType()
          Returns the topic which defines the type of this AssociationRole
 void remove()
          Removes this AssociationRole from the collection of AssociationRoles managed by the parent Association.
 void setPlayer(Topic player)
          Sets the player of this AssociationRole.
 void setType(Topic type)
          Sets the topic which defines the type of this AssociationRole.
 
Methods inherited from interface org.tmapi.core.TopicMapObject
addSourceLocator, equals, getObjectId, getSourceLocators, getTopicMap, hashCode, removeSourceLocator
 

Method Detail

getAssociation

public Association getAssociation()
Returns the association to which this AssociationRole belongs.


setPlayer

public void setPlayer(Topic player)
Sets the player of this AssociationRole. player overwrites any previous value.

Parameters:
player - The topic which plays this role in the association, or null if no topic plays this role.

getPlayer

public Topic getPlayer()
Returns the player of this AssociationRole.

Returns:
The Topic which plays this role in the association, or null if there is no role player.

getType

public Topic getType()
Returns the topic which defines the type of this AssociationRole

Returns:
The Topic object which defines the type of this association role, or null if there is no role-defining topic.

setType

public void setType(Topic type)
Sets the topic which defines the type of this AssociationRole. Overwrites any existing role type.

Parameters:
type - The Topic which defines the type of this AssociationRole, or null to remove any existing role-defining topic.

getReifier

public Topic getReifier()
Returns the Topic that reifies this association role.

Returns:
A Topic instance or null if the association role is not reified.

remove

public void remove()
            throws TMAPIException
Removes this AssociationRole from the collection of AssociationRoles managed by the parent Association. The Topics reference by the player and type properties are not affected by this method.

Specified by:
remove in interface TopicMapObject
Throws:
TMAPIException - if the object cannot be removed from the container. Derived interfaces may define specific circumstances under which a subclass of TMAPIException must be raised. Implementations MUST NOT use a TMAPIException to wrap a failure raised in the underlying engine - such errors must always be wrapped in a TMAPIRuntimeException.