test_class.declarator: topicmap
test_class.modifier: protected
test_class.original_string: protected TopicMapIF        topicmap;
test_class.type: TopicMapIF
test_class.var_name: topicmap
test_class.declarator: builder
test_class.modifier: protected
test_class.original_string: protected TopicMapBuilderIF builder;
test_class.type: TopicMapBuilderIF
test_class.var_name: builder
test_class.file: ontopia-engine/src/test/java/net/ontopia/topicmaps/utils/DuplicateSuppressionUtilsTest.java
test_class.identifier: DuplicateSuppressionUtilsTest
test_case.body: @Test
    public void testVariantRemoval() {
      TopicIF topic = builder.makeTopic();
      TopicNameIF bn = builder.makeTopicName(topic, "");
      VariantNameIF vn = builder.makeVariantName(bn, "duplicate");
      vn = builder.makeVariantName(bn, "duplicate");
  
      DuplicateSuppressionUtils.removeDuplicates(bn);
  
      Assert.assertTrue("duplicate variant names were not removed",
             bn.getVariants().size() == 1);
    }
test_case.class_method_signature: DuplicateSuppressionUtilsTest.testVariantRemoval()
test_case.full_signature: @Test public void testVariantRemoval()
test_case.identifier: testVariantRemoval
test_case.invocations: makeTopic makeTopicName makeVariantName makeVariantName removeDuplicates assertTrue size getVariants
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testVariantRemoval()
focal_class.file: ontopia-engine/src/main/java/net/ontopia/topicmaps/utils/DuplicateSuppressionUtils.java
focal_class.identifier: DuplicateSuppressionUtils
focal_class.class_method_signature: DuplicateSuppressionUtils.removeDuplicates(TopicMapIF topicmap)
focal_class.full_signature: public static void removeDuplicates(TopicMapIF topicmap)
focal_class.identifier: removeDuplicates
focal_class.modifiers: public static
focal_class.parameters: (TopicMapIF topicmap)
focal_class.return: void
focal_class.signature: void removeDuplicates(TopicMapIF topicmap)
focal_class.class_method_signature: DuplicateSuppressionUtils.prefetchTopics(TopicMapIF topicmap, Collection<TopicIF> batch)
focal_class.full_signature: private static void prefetchTopics(TopicMapIF topicmap, Collection<TopicIF> batch)
focal_class.identifier: prefetchTopics
focal_class.modifiers: private static
focal_class.parameters: (TopicMapIF topicmap, Collection<TopicIF> batch)
focal_class.return: void
focal_class.signature: void prefetchTopics(TopicMapIF topicmap, Collection<TopicIF> batch)
focal_class.class_method_signature: DuplicateSuppressionUtils.prefetchAssociations(TopicMapIF topicmap, Collection<AssociationIF> batch)
focal_class.full_signature: private static void prefetchAssociations(TopicMapIF topicmap, Collection<AssociationIF> batch)
focal_class.identifier: prefetchAssociations
focal_class.modifiers: private static
focal_class.parameters: (TopicMapIF topicmap, Collection<AssociationIF> batch)
focal_class.return: void
focal_class.signature: void prefetchAssociations(TopicMapIF topicmap, Collection<AssociationIF> batch)
focal_class.class_method_signature: DuplicateSuppressionUtils.removeDuplicates(TopicIF topic)
focal_class.full_signature: public static void removeDuplicates(TopicIF topic)
focal_class.identifier: removeDuplicates
focal_class.modifiers: public static
focal_class.parameters: (TopicIF topic)
focal_class.return: void
focal_class.signature: void removeDuplicates(TopicIF topic)
focal_class.class_method_signature: DuplicateSuppressionUtils.removeDuplicateTopicNames(Collection<TopicNameIF> basenames)
focal_class.full_signature: public static void removeDuplicateTopicNames(Collection<TopicNameIF> basenames)
focal_class.identifier: removeDuplicateTopicNames
focal_class.modifiers: public static
focal_class.parameters: (Collection<TopicNameIF> basenames)
focal_class.return: void
focal_class.signature: void removeDuplicateTopicNames(Collection<TopicNameIF> basenames)
focal_class.class_method_signature: DuplicateSuppressionUtils.removeDuplicateOccurrences(Collection<OccurrenceIF> occurs)
focal_class.full_signature: public static void removeDuplicateOccurrences(Collection<OccurrenceIF> occurs)
focal_class.identifier: removeDuplicateOccurrences
focal_class.modifiers: public static
focal_class.parameters: (Collection<OccurrenceIF> occurs)
focal_class.return: void
focal_class.signature: void removeDuplicateOccurrences(Collection<OccurrenceIF> occurs)
focal_class.class_method_signature: DuplicateSuppressionUtils.removeDuplicateAssociations(Collection<AssociationIF> assocs)
focal_class.full_signature: public static void removeDuplicateAssociations(Collection<AssociationIF> assocs)
focal_class.identifier: removeDuplicateAssociations
focal_class.modifiers: public static
focal_class.parameters: (Collection<AssociationIF> assocs)
focal_class.return: void
focal_class.signature: void removeDuplicateAssociations(Collection<AssociationIF> assocs)
focal_class.class_method_signature: DuplicateSuppressionUtils.removeDuplicates(TopicNameIF basename)
focal_class.full_signature: public static void removeDuplicates(TopicNameIF basename)
focal_class.identifier: removeDuplicates
focal_class.modifiers: public static
focal_class.parameters: (TopicNameIF basename)
focal_class.return: void
focal_class.signature: void removeDuplicates(TopicNameIF basename)
focal_class.class_method_signature: DuplicateSuppressionUtils.removeDuplicates(AssociationIF assoc)
focal_class.full_signature: public static void removeDuplicates(AssociationIF assoc)
focal_class.identifier: removeDuplicates
focal_class.modifiers: public static
focal_class.parameters: (AssociationIF assoc)
focal_class.return: void
focal_class.signature: void removeDuplicates(AssociationIF assoc)
focal_class.class_method_signature: DuplicateSuppressionUtils.removeDuplicateAssociations(TopicIF topic)
focal_class.full_signature: public static Map<AssociationIF, Set<AssociationIF>> removeDuplicateAssociations(TopicIF topic)
focal_class.identifier: removeDuplicateAssociations
focal_class.modifiers: public static
focal_class.parameters: (TopicIF topic)
focal_class.return: Map<AssociationIF, Set<AssociationIF>>
focal_class.signature: Map<AssociationIF, Set<AssociationIF>> removeDuplicateAssociations(TopicIF topic)
focal_class.class_method_signature: DuplicateSuppressionUtils.copySourceLocators(TMObjectIF target, TMObjectIF source)
focal_class.full_signature: private static void copySourceLocators(TMObjectIF target, TMObjectIF source)
focal_class.identifier: copySourceLocators
focal_class.modifiers: private static
focal_class.parameters: (TMObjectIF target, TMObjectIF source)
focal_class.return: void
focal_class.signature: void copySourceLocators(TMObjectIF target, TMObjectIF source)
focal_method.body: public static void removeDuplicates(TopicMapIF topicmap) {
  
      // remove duplicate topic characteristics
      int batchSize = 50;
      Iterator<TopicIF> it = topicmap.getTopics().iterator();
      while (it.hasNext()) {
        List<TopicIF> batch = CollectionUtils.nextBatch(it, batchSize);
        prefetchTopics(topicmap, batch);
        Iterator<TopicIF> iter = batch.iterator();
        while (iter.hasNext()) {
          removeDuplicates(iter.next());
        }
      }
      
      // remove duplicate associations (do one association type at a time)
      ClassInstanceIndexIF cindex = (ClassInstanceIndexIF)topicmap.getIndex("net.ontopia.topicmaps.core.index.ClassInstanceIndexIF");
      Collection<AssociationIF> assocs;
      Iterator<TopicIF> atypes = new ArrayList<TopicIF>(cindex.getAssociationTypes()).iterator();
      while (atypes.hasNext()) {
        TopicIF atype = atypes.next();
        assocs = cindex.getAssociations(atype);
        if (!assocs.isEmpty())
          removeDuplicateAssociations(assocs);
      }
      // remove duplicate untyped associations
      assocs = cindex.getAssociations(null);
      if (!assocs.isEmpty())
        removeDuplicateAssociations(assocs);
    }
focal_method.class_method_signature: DuplicateSuppressionUtils.removeDuplicates(TopicMapIF topicmap)
focal_method.full_signature: public static void removeDuplicates(TopicMapIF topicmap)
focal_method.identifier: removeDuplicates
focal_method.invocations: iterator getTopics hasNext nextBatch prefetchTopics iterator hasNext removeDuplicates next getIndex iterator getAssociationTypes hasNext next getAssociations isEmpty removeDuplicateAssociations getAssociations isEmpty removeDuplicateAssociations
focal_method.modifiers: public static
focal_method.parameters: (TopicMapIF topicmap)
focal_method.return: void
focal_method.signature: void removeDuplicates(TopicMapIF topicmap)