Class GenericCompoundQueryBuilder

  • All Implemented Interfaces:
    QueryBuilder<KeyedNetricsRecord>

    public class GenericCompoundQueryBuilder
    extends java.lang.Object
    implements QueryBuilder<KeyedNetricsRecord>
    Wrap ANetricsCompoundQueryBuilder as a QueryBuilder. This allows any implementation of ANetricsCompoundQueryBuilder to be wrapped as an implementation of QueryBuilder<KeyedNetricsRecord>. This allows any implementation of ANetricsCompoundQueryBuilder to be plugged into the deduplication framework as the record matching query.

    Objects of this class are not thread safe. They should not be used in more than one deduplicator at the same time.

    • Constructor Summary

      Constructors 
      Constructor Description
      GenericCompoundQueryBuilder​(com.netrics.likeit.ANetricsCompoundQueryBuilder our_builder, int exception_limit)
      Wrap a generic compound builder for use in deduplication framework.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      KeyedQuery buildQuery​(KeyedNetricsRecord record)
      Generate and return the dedupe framework query.
      java.lang.Double getCutoff()
      Get the current cutoff score.
      void setCutoff​(java.lang.Double new_cutoff)
      Set the cutoff used in finding pairs.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GenericCompoundQueryBuilder

        public GenericCompoundQueryBuilder​(com.netrics.likeit.ANetricsCompoundQueryBuilder our_builder,
                                           int exception_limit)
                                    throws java.lang.IllegalArgumentException
        Wrap a generic compound builder for use in deduplication framework.
        Parameters:
        our_builder - a fully initialized compound query builder. This is used to generate the record matching queries.
        exception_limit - Query processing is halted if more than this number of unexpected exceptions is encountered when building queries. If this is zero or negative the default value of 100 is used.
        Throws:
        java.lang.IllegalArgumentException - if our_builder is null.
    • Method Detail

      • setCutoff

        public void setCutoff​(java.lang.Double new_cutoff)
        Set the cutoff used in finding pairs. This cutoff score establishes the minimum score value that is considered to indicate a match.

        The cutoff score given here overrides any cutoff score set by the query builder. If the query builder does not set a cutoff score this method must be used to establish the cutoff score.

        Parameters:
        new_cutoff - the cutoff score to use. If null the cutoff score set by the query builder, if any, is used.
      • getCutoff

        public java.lang.Double getCutoff()
        Get the current cutoff score.
        Returns:
        the current cutoff score, null if none.
      • buildQuery

        public KeyedQuery buildQuery​(KeyedNetricsRecord record)
                              throws QueryBuildException
        Generate and return the dedupe framework query.
        Specified by:
        buildQuery in interface QueryBuilder<KeyedNetricsRecord>
        Parameters:
        record - this must contain an instance of NetricsCompoundRecord. A ClassCastException is thrown if it is not.
        Returns:
        the keyed query for matching this record.
        Throws:
        QueryBuildException - action is halt if our builder is in invalid state or if the exception limit is exceeded, action is continue otherwise.