org.tm4j.topicmap.utils.extractors
Class AssociationNameExtractor

java.lang.Object
  extended byorg.tm4j.topicmap.utils.extractors.ExtractorBase
      extended byorg.tm4j.topicmap.utils.extractors.AssociationNameExtractor
All Implemented Interfaces:
uk.co.jezuk.mango.BinaryFunction, uk.co.jezuk.mango.UnaryFunction

public class AssociationNameExtractor
extends ExtractorBase
implements uk.co.jezuk.mango.BinaryFunction

This class implements both a BinaryFunction and a UnaryFunction that return a name string for an Association instance.

The UnaryFunction implementation returns an arbitrary base name string from the Association's typing topic.

The BinaryFunction implementation takes the Association instance as the first parameter, and a Topic instance as the second parameter where the Topic instance MUST be a role player in the Association. The function then returns a base name string from the Association's typing topic that is scoped by the topic that defines the type of the role played by the Topic in the other parameter.

For example, given a TopicMap that includes the following (in XTM syntax):

Born In Birthplace Of ]]>

A call to this extractor with the association as the only parameter will return the unscoped base name string "Born In". A call to this extractor with the association as the first parameter and the topic "joe-strummer" as the second parameter will return the unscoped base name string "Born In". A call to this extractor with the association as the first parameter and the topic "ankara" as the second parameter will return the base name string "Birthplace Of" as it is scoped by the topic that types the role played by "ankara" in the association (i.e. the topic "place").


Constructor Summary
AssociationNameExtractor()
           
 
Method Summary
 java.lang.Object _extract(java.lang.Object in)
           
 java.lang.Object fn(java.lang.Object in, java.lang.Object arg)
           
 java.lang.String getName(Association in, Topic dominantPlayer)
           
 
Methods inherited from class org.tm4j.topicmap.utils.extractors.ExtractorBase
fn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssociationNameExtractor

public AssociationNameExtractor()
Method Detail

_extract

public java.lang.Object _extract(java.lang.Object in)
Specified by:
_extract in class ExtractorBase

getName

public java.lang.String getName(Association in,
                                Topic dominantPlayer)
                         throws TopicMapProcessingException
Throws:
TopicMapProcessingException

fn

public java.lang.Object fn(java.lang.Object in,
                           java.lang.Object arg)
Specified by:
fn in interface uk.co.jezuk.mango.BinaryFunction