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 testAssociationReifiers() {
      TopicIF type = builder.makeTopic();
      TopicIF role1 = builder.makeTopic();
      TopicIF role2 = builder.makeTopic();
      TopicIF player1 = builder.makeTopic();
      TopicIF player2 = builder.makeTopic();
      
      AssociationIF assoc = builder.makeAssociation(type);
      AssociationRoleIF role = builder.makeAssociationRole(assoc, role1, player1);
      role = builder.makeAssociationRole(assoc, role2, player2);
      TopicIF r1 = builder.makeTopic();
      assoc.setReifier(r1);
      builder.makeTopicName(r1, "r1");
  
      assoc = builder.makeAssociation(type);
      role = builder.makeAssociationRole(assoc, role1, player1);
      role = builder.makeAssociationRole(assoc, role2, player2);
      TopicIF r2 = builder.makeTopic();
      assoc.setReifier(r2);
      builder.makeTopicName(r2, "r2");
  
      DuplicateSuppressionUtils.removeDuplicates(topicmap);
  
      Assert.assertTrue("duplicate association was not removed",
                 topicmap.getAssociations().size() == 1);
  
      assoc = (AssociationIF) topicmap.getAssociations().iterator().next();
      Assert.assertTrue("reifier was lost", assoc.getReifier() != null);
      Assert.assertTrue("reifiers were not merged",
                 assoc.getReifier().getTopicNames().size() == 2);
    }
test_case.class_method_signature: DuplicateSuppressionUtilsTest.testAssociationReifiers()
test_case.full_signature: @Test public void testAssociationReifiers()
test_case.identifier: testAssociationReifiers
test_case.invocations: makeTopic makeTopic makeTopic makeTopic makeTopic makeAssociation makeAssociationRole makeAssociationRole makeTopic setReifier makeTopicName makeAssociation makeAssociationRole makeAssociationRole makeTopic setReifier makeTopicName removeDuplicates assertTrue size getAssociations next iterator getAssociations assertTrue getReifier assertTrue size getTopicNames getReifier
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAssociationReifiers()
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)