Interface SMTableDataObject

All Superinterfaces:
SimilarityMeasure
All Known Implementing Classes:
SMTableDataObjectImpl

public interface SMTableDataObject extends SimilarityMeasure
Despite of dealing with symmetric table similarity measures asymmetric exceptions can be defined. In this case, the measure is still declared as symmetric because of partial symmetric.

For utilising any methods for setting new similarities it is necessary to build a new object in each case. Overwritings respecting the setNativeObject-methods are not supported.

If no similarity for a query and case is defined the default value DEFAULT_SIMILARITY will be used. But attention, the default value is "0.0" thus the similarity between the same DataObject as query and case result in "0.0". This is in general not the result a user would expected. The user has to take care that the same object for query and case is "1.0", for example. This can easily be done with the following code:


 AtomicObject ao = ...
 SMTableDataObject sm = simModel.createSimilarityMeasure(SMTableDataObject.NAME, ao);
 InstanceEnumerationPredicate iep = ao.getAtomicClass().getInstancePredicate();
 AtomicObject values[] = iep.getValues();
 for(int i=0; i<values.length; i++)
  sm.addSimilarity(values[i], values[i], 1.0);
 
Author:
Rainer Maximini
  • Field Details

    • DEFAULT_SIMILARITY

      static final double DEFAULT_SIMILARITY
      If no similarity value is defined between query and case, this default value 0.0 will be used.
      See Also:
    • NAME

      static final String NAME
      Name of similarity measure is "TableDataObject".
      See Also:
    • SYMMETRIC_DEFAULT

      static final boolean SYMMETRIC_DEFAULT
      The default symmetric value is true.
      See Also:
  • Method Details

    • addSimilarity

      void addSimilarity(AtomicObject queryObject, AtomicObject caseObject, double similarity)
      Adds a similarity measure for the query and case object.
      Parameters:
      queryObject - The query object.
      caseObject - The case object.
      similarity - The similarity value.
    • getCaseObjects

      DataObjectIterator getCaseObjects(AtomicObject forQuery)
    • getQueryObjects

      DataObjectIterator getQueryObjects()
      Returns:
      An iterator over all query objects for that an similarity value exists.
    • getSimilarity

      Similarity getSimilarity(AtomicObject queryObject, AtomicObject caseObject)
      Parameters:
      queryObject - The query object for that the similarity value is defined.
      caseObject - The case object for that the similarity value is defined.
      Returns:
      The similarity value for the given query and case object. If no value exists, null will be returned.
    • isSymmetric

      boolean isSymmetric()
      Returns:
      true if the similarty value table is symetric.
    • setSymmetric

      void setSymmetric(boolean symmetric)
      The similarity table can be interpreted as a symmetric table. That means, that in general sim(query,case) is equal to sim(case,query) if a mapping to query/case or case/query is defined. If a mapping for both is defined it will be interpreted as exception of the symetry.
      Parameters:
      symmetric - If the table should be interpreted as symmetric table.
    • removeSimilarity

      void removeSimilarity(AtomicObject queryObject, AtomicObject caseObject)
      Removes the similarity value for the given query and case object. If no similarity value is defined nothing will be removed.
      Parameters:
      queryObject - The query object for that the similarity value should be removed.
      caseObject - The case object for that the similarity value should be removed.