|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.tm4j.topicmap.utils.XTMUtils
Utility class containing methods to reduce the number of objects in a TM4J topic map.
The static methods contained in this class implement one or more of the XTM duplicate suppression rules. This class also contains an implementation of the XTM topic merging rules.
The implementations in this class are safe to use with any TM4J backend.
Warning Many of the duplicate suppression algorithms are brute-force algorithms and may take some time to execute against large topic maps.
| Field Summary | |
protected static org.apache.commons.logging.Log |
m_log
|
| Constructor Summary | |
XTMUtils()
|
|
| Method Summary | |
protected static void |
flattenTopicRefs(TopicMap tm)
Performs a single pass through the topic map, replacing all topic references with a reference to the base topic of the merged topic set. |
static TopicMap |
makeConsistent(TopicMap tm)
Creates a "consistent" topic map representation by applying the duplicate suppression rules of XTM 1.0 Annex F (section 6) This means that 1) All topics which are merged together are replaced by a single topic having the characteristics of all the merged ones (XTM 1.0 F.5.1) 2) Duplicate subject indicators on the same topic are collapsed into a single subject indicator (XTM 1.0 F.6.1) 3) Duplicate names in the same scope on the same topic are collapsed into a single name (XTM 1.0 F.6.2) 4) Duplicate role players in associations are removed (XTM 1.0 F.6.4) 5) Duplicate associations are collapsed into a single association (XTM 1.0 F.6.3) Note that F.6.4 is applied before F.6.3 as the XTM definition of a duplicate association uses a definition of equivalence which is affected by the aplication as F.6.4. |
protected static void |
removeDuplicateAssociations(java.util.Collection assocs,
TopicMapUtils utils)
|
static void |
removeDuplicateAssociations(TopicMap tm)
|
static void |
removeDuplicateNames(Topic t)
|
static void |
removeDuplicateOccurrences(Topic t)
|
static void |
removeDuplicateSubjectIndicators(Topic t)
|
static Topic |
staticMerge(Topic t)
Takes all topics merged with t and adds their
characteristics to t. |
protected static Topic |
staticMerge(Topic t,
boolean swapTopics)
Internal implementation of the static merge algorithm. |
static void |
swapTopic(Topic from,
Topic to)
Exchanges all uses of the topic from |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final org.apache.commons.logging.Log m_log
| Constructor Detail |
public XTMUtils()
| Method Detail |
public static TopicMap makeConsistent(TopicMap tm)
throws TopicMapProcessingException,
java.beans.PropertyVetoException
tm - The topic map to be processed
TopicMapProcessingException - If errors are encountered
during merge or duplicate supression.
java.beans.PropertyVetoException - If a change to the topic map is
vetoed during merge or duplicate suppression.
public static Topic staticMerge(Topic t)
throws TopicMapProcessingException,
java.beans.PropertyVetoException
t and adds their
characteristics to t. These merged topics are
then also removed from the parent topic map.
t - The topic to be merged. This object may or may not
survive the processing of this method. Callers should always
use the returned Topic object in preference to the one passed in.
TopicMapProcessingException - If a processing error occurs
during the static merge of the topic.
java.beans.PropertyVetoException - If a change to the topic is vetoed
by a listener to the topic map.
protected static Topic staticMerge(Topic t,
boolean swapTopics)
throws TopicMapProcessingException,
java.beans.PropertyVetoException
swapTopics - If this parameter is set to true
then all refernecs to the merged topics
will be replaced with a reference to the
base topic.
TopicMapProcessingException - If a processing error occurs
during the static merge of the topic.
java.beans.PropertyVetoException - If a change to the topic is vetoed
by a listener to the topic map.
public static void swapTopic(Topic from,
Topic to)
throws TopicMapProcessingException,
java.beans.PropertyVetoException
from to use
the topic to. This includes usages as type,
as a theme in a scope, and as a roleSpec.
from and to must both belong to
the same TopicMap object.
NOTE: The current implementation of this method
uses the brute-force approach of enumerating all
of the objects in the topic map, and so may be very slow
for large topic maps.
- Parameters:
from - The topic to be swapped in all of its usesto - The topic to replace from.
- Throws:
TopicMapProcessingException - If a processing error occurs
while modifying the topic map.
java.beans.PropertyVetoException - If a swap of the topics is vetoed
by a listener to the topic map.
protected static void flattenTopicRefs(TopicMap tm)
throws java.beans.PropertyVetoException
java.beans.PropertyVetoException
public static void removeDuplicateSubjectIndicators(Topic t)
throws java.beans.PropertyVetoException
java.beans.PropertyVetoException
public static void removeDuplicateNames(Topic t)
throws java.beans.PropertyVetoException
java.beans.PropertyVetoException
public static void removeDuplicateOccurrences(Topic t)
throws java.beans.PropertyVetoException
java.beans.PropertyVetoException
public static void removeDuplicateAssociations(TopicMap tm)
throws java.beans.PropertyVetoException,
IntegrityViolationException
java.beans.PropertyVetoException
IntegrityViolationException
protected static void removeDuplicateAssociations(java.util.Collection assocs,
TopicMapUtils utils)
throws java.beans.PropertyVetoException,
IntegrityViolationException
java.beans.PropertyVetoException
IntegrityViolationException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||