Interface SMTableDataClass

All Superinterfaces:
SimilarityMeasure
All Known Implementing Classes:
SMTableDataClassImpl

public interface SMTableDataClass extends SimilarityMeasure
This similarity measure is used in class DataClass and is used if no other similarity measure fits to both object. To compare uncomparable objects, the data classes are compared, in general, this is null. But, there are some special cases where this do not must be the case. For example, the comparison of void and an integer object will result here. If the query is void and the case the integer object, the result should be in general 1.0 and in the opposite case it should be 0.0.

This behaviour can be defined in this similarity measure. Several aspects can be defined:

  1. Define the default similarity value -- the default is 0.0 which is desired in most cases.
  2. Define exceptions for the default similarity. Therefor set
    • query class name
    • case class name
    • weight
  3. Define if the exceptions are symmetric -- the default is false.

The behaviour is that first the exceptions are checked and if an exception fits the corresponding weight will be returned. If not and if symmetric interpretation is true, query and case are swapped and the exceptions are checked again. If this also fails, the default similarity value will be returned.

Author:
Rainer Maximini
  • Field Details

    • NAME

      static final String NAME
      Name of similarity measure is "TableDataClass".
      See Also:
    • DEFAULT_SIMILARITY

      static final double DEFAULT_SIMILARITY
      The default similarity value is 0.0.
      See Also:
    • DEFAULT_SYMMETRIC

      static final boolean DEFAULT_SYMMETRIC
      The default for symmetric interpretation is false.
      See Also:
  • Method Details

    • addSimilarity

      void addSimilarity(DataClass queryDataClass, DataClass caseDataClass, double similarity)
      Adds a similarity value for the given data classes.
      Parameters:
      caseDataClass - The data class for the case.
      queryDataClass - The data class for the query.
      similarity - The similarity value.
    • getCaseDataClasses

      DataClass[] getCaseDataClasses(DataClass forQuery)
      Returns:
      All case data classes for that and the given query data class name a similarity value is defined.
    • getDefaultSim

      double getDefaultSim()
      Returns:
      The default similarity value.
    • setDefaultSim

      void setDefaultSim(double defaultSim)
      Sets the default similarity value that is used if no similarity value for the given query and case is defined.
    • getQueryDataClasses

      DataClass[] getQueryDataClasses()
      Returns:
      All query data class names for that a similarity value is defined.
    • getSimilarity

      Similarity getSimilarity(DataClass queryClass, DataClass caseClass)
      Returns:
      The defined similarity value for the query and case data class. If no mapping for this classes is defined the null value will be returned and NOT the default similarity value.
    • isSymmetric

      boolean isSymmetric()
      Returns:
      true if the similarity definitions are symmetric.
    • setSymmetric

      void setSymmetric(boolean symmetric)
    • removeSimilarity

      void removeSimilarity(DataClass queryClass, DataClass caseClass)
      Removes the similarity value for the given query and case class name. If no similarity value is defined nothing will be removed.
      Parameters:
      caseClass - the case class to be removed
      queryClass - the query class to be removed