org.mmbase.applications.xmlimporter
Class BasicFinder

java.lang.Object
  extended by org.mmbase.applications.xmlimporter.BasicFinder
All Implemented Interfaces:
SimilarObjectFinder

public abstract class BasicFinder
extends Object
implements SimilarObjectFinder

A basic implementation of SimilarObjectFinder.

Since:
MMBase-1.5
Version:
$Id: BasicFinder.java 35335 2009-05-21 08:14:41Z michiel $

Constructor Summary
BasicFinder()
          Creates new BasicFinder
 
Method Summary
protected static List<Integer> findPersistentObjects(MMObjectBuilder builder, String criterium)
          Convenience method: finds MMBase id's for all objects in the persistent cloud of a given type and satisfying a criterium.
 List<TmpObject> findSimilarObject(Transaction transaction, TmpObject tmpObj)
          Searches for similar object.
abstract  Collection<Integer> getClosePersistentObjects(TmpObject tmpObj)
          Gets MMBase id's for all objects from persistent cloud that might produce a qualifying match with the given object (possibly including the object itself).
abstract  Collection<Integer> getExactPersistentObjects(TmpObject tmpObj)
          Gets MMBase id's for all objects from persistent cloud that produce an exact match with the given object (possibly including the object itself).
 void init(HashMap<String,String> params)
          Initializes this instance.
abstract  float scoreNode(TmpObject tmpObj1, TmpObject tmpObj2)
          Calculates matching rate for two objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicFinder

public BasicFinder()
Creates new BasicFinder

Method Detail

findPersistentObjects

protected static List<Integer> findPersistentObjects(MMObjectBuilder builder,
                                                     String criterium)
Convenience method: finds MMBase id's for all objects in the persistent cloud of a given type and satisfying a criterium.

Parameters:
builder - The builder for this type.
criterium - The criterium: SQL where-clause, but without the "where ".
Returns:
List of (Integer) MMBase id's.

init

public void init(HashMap<String,String> params)
Initializes this instance.

Specified by:
init in interface SimilarObjectFinder
Parameters:
params - The initialization parameters, provided as name/value pairs (both String).

findSimilarObject

public List<TmpObject> findSimilarObject(Transaction transaction,
                                         TmpObject tmpObj)
                                  throws TransactionHandlerException
Searches for similar object. Objects found in the persistent cloud will be accessed in the transaction.

Specified by:
findSimilarObject in interface SimilarObjectFinder
Parameters:
transaction - The transaction.
tmpObj - The object to search for.
Returns:
List of the similar objects found.
Throws:
TransactionHandlerException - If a failure occurred.

scoreNode

public abstract float scoreNode(TmpObject tmpObj1,
                                TmpObject tmpObj2)
Calculates matching rate for two objects. e.g. the rate in which tmpObj1 matches tmpObj2, represented by a value ranging from 0 to 1:

Parameters:
tmpObj1 - The object for which the matching rate is wanted.
tmpObj2 - The object to match with.
Returns:
Matching rate.

getExactPersistentObjects

public abstract Collection<Integer> getExactPersistentObjects(TmpObject tmpObj)
Gets MMBase id's for all objects from persistent cloud that produce an exact match with the given object (possibly including the object itself). This can be used to prevent a more extensive search for close matches when exact matches are possible.

Parameters:
tmpObj - The object to match with.
Returns:
Collection of (Integer) MMBase id's for objects from the persistent cloud that produce an exact match with the given object.

getClosePersistentObjects

public abstract Collection<Integer> getClosePersistentObjects(TmpObject tmpObj)
Gets MMBase id's for all objects from persistent cloud that might produce a qualifying match with the given object (possibly including the object itself). When looking for a fuzzy match, this can be used to make a pre-selection from all the objects in the persistent cloud, to reduce the total number of objects to be inspected closer.

Parameters:
tmpObj - The object to match with.
Returns:
Collection of (Integer) MMBase id's for objects from the persistent cloud that might produce a qualifying match with the given object.


MMBase 2.0-SNAPSHOT - null