Class MatchCaseCompoundQueryBuilder


  • public class MatchCaseCompoundQueryBuilder
    extends AQBPCompoundQueryBuilder
    This class implements a compound query builder based on the Match Case query. The match cases are defined by a MatchCaseBuilderConfig configuration object. This defines a matching query that is a set of match cases. The same set of features is applied to each match case. Each feature corresponds to a query against fields from a single table of the compound record.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.netrics.likeit.ANetricsCompoundQueryBuilder

        com.netrics.likeit.ANetricsCompoundQueryBuilder.FeatureDef
    • Field Summary

      • Fields inherited from class com.netrics.likeit.ANetricsCompoundQueryBuilder

        features
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.netrics.likeit.NetricsQuery getQuery()
      Generate the match case compound matching query.
      com.netrics.likeit.NetricsQuery getQuery​(com.netrics.likeit.NetricsQuery[] features_real)
      Generate the match case compound matching query for a given set of features.
      java.lang.Object setConfiguration​(java.io.File config_file)
      Configure this object from a configuration file.
      java.lang.Object setConfiguration​(java.io.InputStream config_stream)
      Configure this object from an input stream.
      void setConfiguration​(java.lang.Object config_object)
      Configure this match case query generator from an external configuration object.
      protected void setConfiguration​(java.lang.Object config_object, java.util.List<com.netrics.likeit.ANetricsCompoundQueryBuilder.FeatureDef> ext_features, AQBPLogger logger)
      Configure this object from an external configuration object and a set of features.
      java.lang.Object setConfiguration​(java.lang.String config_src)
      Configure this object from a configuration source.
      • Methods inherited from class com.netrics.likeit.ANetricsCompoundQueryBuilder

        addDefaultItem, changeItemName, getCurInputFieldNames, getCurItemName, getCurJoinedFieldNames, getCurJoinedFieldNames, getCurOutputFieldNames, getCurrentInputTableNames, getCurrentOutputTableNames, getDefaultItemNames, getDefaultTableNames, getDfltInputNames, getDfltOutputNames, getFeatureQueryletLists, getFeatureQuerylets, getJoinConfig, getUsedItemTypes, setDefaultValue, setFeatures, setFieldValuesFromList, setFieldValuesFromMap, setFieldValuesFromRecord, setInputFieldName, setInputFieldNames, setInputFieldOrdering, setInputTableName, setInputTableNames, setOutputFieldName, setOutputFieldNames, setOutputTableName, setQueryConfiguration, setSearchOpts, setTables
      • Methods inherited from class java.lang.Object

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

      • MatchCaseCompoundQueryBuilder

        public MatchCaseCompoundQueryBuilder()
    • Method Detail

      • setConfiguration

        public java.lang.Object setConfiguration​(java.io.InputStream config_stream)
                                          throws java.lang.IllegalArgumentException,
                                                 java.lang.UnsupportedOperationException,
                                                 java.lang.IllegalStateException
        Configure this object from an input stream. This is called to initialize an object created with the default constructor. It expects to read from the input stream a valid MatchCaseBuilderConfig element.
        Overrides:
        setConfiguration in class com.netrics.likeit.ANetricsCompoundQueryBuilder
        Parameters:
        config_stream - this must be an open stream containing a valid XML MatchCaseBuilderConfig element.
        Throws:
        java.lang.IllegalArgumentException - if config_stream is null, or does not contain a valid MatchCaseBuilderConfig element as the top level item.
        java.lang.IllegalStateException - if this object is already initialized.
        java.lang.UnsupportedOperationException
      • setConfiguration

        public java.lang.Object setConfiguration​(java.lang.String config_src)
                                          throws java.lang.IllegalArgumentException,
                                                 java.lang.UnsupportedOperationException,
                                                 java.lang.IllegalStateException
        Configure this object from a configuration source. This is called to initialize an object created with the default constructor. It reads configuration data from a named source. The source is opened with the current file manager. The default manager expects a source to be a standard file name or path.
        Overrides:
        setConfiguration in class com.netrics.likeit.ANetricsCompoundQueryBuilder
        Parameters:
        config_src - this must be source containing a valid MatchCaseBuilderConfig XML element.
        Throws:
        java.lang.IllegalArgumentException - if config_src is null, is not an existing, readable source, or does not contain an MatchCaseBuilderConfig XML element as the top level item.
        java.lang.IllegalStateException - if this object is already initialized.
        java.lang.UnsupportedOperationException
      • setConfiguration

        protected void setConfiguration​(java.lang.Object config_object,
                                        java.util.List<com.netrics.likeit.ANetricsCompoundQueryBuilder.FeatureDef> ext_features,
                                        AQBPLogger logger)
                                 throws AQBPLogger.QBPConfigException,
                                        java.lang.IllegalStateException
        Configure this object from an external configuration object and a set of features. This method is used by the GeneralCompoundQueryBuilder class to link this builder to the GeneralCompoundQueryBuilder object's set of features. This configures this compound query builder from a MatchCaseBuilderConfig object. This config object is generated from the query builder XML configuration. This call does not attempt to instantiate the actual feature classes. Instead it uses the features from the given list.
        Specified by:
        setConfiguration in class AQBPCompoundQueryBuilder
        Parameters:
        config_object - this must be a valid MatchCaseBuilderConfig object.
        ext_features - the features for this object. The list must match the length of the features defined in the config_object.
        logger - to log all errors, if null a default logger is used that always throws an exception.
        Throws:
        java.lang.IllegalStateException - if this object is already initialized.
        AQBPLogger.QBPConfigException - if config_object is null, not a MatchCaseBuilderConfig object, or is not a valid configuration.
      • setConfiguration

        public void setConfiguration​(java.lang.Object config_object)
                              throws java.lang.UnsupportedOperationException,
                                     java.lang.IllegalArgumentException,
                                     java.lang.IllegalStateException
        Configure this match case query generator from an external configuration object. This configures this compound query generator from a MatchCaseBuilderConfig object. This object is generated from the query builder XML configuration (as generated from the XSD by JAXB).
        Overrides:
        setConfiguration in class com.netrics.likeit.ANetricsCompoundQueryBuilder
        Parameters:
        config_object - this must be a valid MatchCaseBuilderConfig object.
        Throws:
        java.lang.IllegalStateException - if this object is already initialized.
        java.lang.IllegalArgumentException - if config_object is null, not a MatchCaseBuilderConfig object, or is not a valid configuration.
        java.lang.UnsupportedOperationException
      • setConfiguration

        public java.lang.Object setConfiguration​(java.io.File config_file)
                                          throws java.lang.IllegalArgumentException,
                                                 java.lang.UnsupportedOperationException,
                                                 java.lang.IllegalStateException
        Configure this object from a configuration file. This is called to initialize an object created with the default constructor.
        Overrides:
        setConfiguration in class com.netrics.likeit.ANetricsCompoundQueryBuilder
        Parameters:
        config_file - this must be an XML file containing a valid MatchCaseBuilderConfig description.
        Throws:
        java.lang.IllegalArgumentException - if config_file is null, is not an existing, readable file, or does not contain a MatchCaseBuilderConfig XML element as the top level item.
        java.lang.IllegalStateException - if this object is already initialized.
        java.lang.UnsupportedOperationException
      • getQuery

        public com.netrics.likeit.NetricsQuery getQuery​(com.netrics.likeit.NetricsQuery[] features_real)
                                                 throws java.lang.IllegalStateException,
                                                        java.lang.Exception
        Generate the match case compound matching query for a given set of features. This is used by the GeneralCompoundQueryBuilder class to generate the query based on its own set of feature queries. The top level of the query generated is an OR of all of the match cases. (If there is only one match case it is returned directly.) The first match case uses the real feature queries, the rest use a reference to the feature queries. The real feature queries are passed in as an argument.
        Specified by:
        getQuery in class AQBPCompoundQueryBuilder
        Parameters:
        features_real - array of query objects for features. This must match the feature list for this builder.
        Returns:
        the complete compound query.
        Throws:
        java.lang.IllegalArgumentException - if features_real is null or the incorrect length.
        java.lang.IllegalStateException - if this object is not initialized.
        java.lang.Exception - if this object is corrupted.
      • getQuery

        public com.netrics.likeit.NetricsQuery getQuery()
                                                 throws java.lang.IllegalStateException,
                                                        java.lang.Exception
        Generate the match case compound matching query. The top level query is an OR of all of the match cases (if there is only one match case it is returned directly). The first match case uses the real feature queries, the rest use a reference to the feature queries. The features are an OR of queries, one for each associated record in the input compound record.
        Specified by:
        getQuery in class com.netrics.likeit.ANetricsCompoundQueryBuilder
        Throws:
        java.lang.IllegalStateException - if this object is not initialized, or the field data is not set.
        java.lang.Exception - if this object is corrupted.