Merging Objects Cookbook


Table of Contents

1. Introduction
2. SimilarObjectFinder
3. ObjectMerger
4. Tips
5. Performance issues
6. Documentation

The most important new concept introduced by XML Importer is merging objects. The XML Importer code will handle most of the details for you, and in order to put this to work, all you will have to do is provide implementations for these interfaces:

The XML Importer provides basic implementations for both of these, but some additional work will be necessary to meet your needs.

In this document we'll have a look at some of the issues involved, and give some guidelines.

When we have populated a transaction with (access and input) objects, we can merge all objects of a given type. In order to do so, the XML Importer performs these actions:

The SimilarObjectFinder is needed to implement step 2. One fairly general way to do this is implemented by BasicFinder, which makes a distinction between exact matches (i.e. indistinguishable) and non-exact matches (e.g. different, but considered to be the same, based on some specified criteria - i.e. fuzzy comparison):

This strategy has these characteristics:

For examples of implementation based on BasicFinder, see MoviesFinder and PersonsFinder in the XML Importer examples code.

The ObjectMerger is needed to implement merging two objects to a single object. In order to do so, the XML Importer performs these actions:

A fairly general implementation is provided by BasicMerger, which has these characteristics:

Merging objects can put a heavy stress on the MMBase server and database, so it is important to be aware of the following perfomance issues.

For a full understanding of the XML Importer, it is recommended to read the following documents, available on the MMBase website

  1. TCP 1.0 documentation (see Temporary Cloud Project).
  2. XML Importer overview (see XML Importer Project).
  3. The javadoc documentation of the org.mmbase.applications.xmlimporter package.

This is part of the MMBase documentation.

For questions and remarks about this documentation mail to: [email protected]