|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.hpi.fgis.dude.similarityfunction.AbstractSimilarityFunction de.hpi.fgis.dude.similarityfunction.contentbased.ContentBasedSimilarityFunction<T>
T
- The type of similarity function. This type is used as a return type for any fluent interface method.public abstract class ContentBasedSimilarityFunction<T extends ContentBasedSimilarityFunction<T>>
ContentBasedSimilarityFunction
is a skeleton implementation with common functionality that is used by any content-based
SimilarityFunction
. These functions are based on the concrete values of an attribute.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface de.hpi.fgis.dude.similarityfunction.SimilarityFunction |
---|
SimilarityFunction.SimilarityValidationState |
Constructor Summary | |
---|---|
protected |
ContentBasedSimilarityFunction()
Internal constructor for Jsonable deserialization. |
|
ContentBasedSimilarityFunction(int attrIndex,
String... defaultAttr)
Initializes a ContentBasedSimilarityFunction with the passed default attribute. |
|
ContentBasedSimilarityFunction(String... defaultAttr)
Initializes a ContentBasedSimilarityFunction with the passed default attribute. |
Method Summary | |
---|---|
void |
addAttribute(DataSource source,
String... attributePath)
Adds a DataSource -related attribute to this ContentBasedSimilarityFunction . |
protected double |
calculateSimilarity(DuDeObject obj1,
DuDeObject obj2)
Calculates the similarity of the passed DuDeObject s. |
double |
calculateSimilarity(JsonValue val1,
JsonValue val2)
Calculates the similarity of the two passed JsonValue s. |
protected abstract double |
compareAtomicValues(JsonAtomic value1,
JsonAtomic value2)
Calculates the similarity of the two passed JsonAtomic s. |
boolean |
equals(Object obj)
|
protected String[] |
getAttribute(DuDeObject obj)
Returns the attribute path that is valid for the passed DuDeObject . |
int |
hashCode()
|
T |
ignoreCapitalization()
Enables ignoring capitalization. |
protected boolean |
ignoringCapitalizationEnabled()
Checks whether this ContentBasedSimilarityFunction shall make a distinction between lower case and upper case or not. |
void |
setCompareArrayArrayStrategy(CalculationStrategy<JsonArray,JsonArray> strategy)
Sets a new strategy for comparing JsonArray s. |
void |
setCompareArrayAtomicStrategy(CalculationStrategy<JsonArray,JsonAtomic> strategy)
Sets a new strategy for comparing JsonArray s and atomic values. |
void |
setCompareArrayRecordStrategy(CalculationStrategy<JsonArray,JsonRecord> strategy)
Sets a new strategy for comparing JsonArray s and JsonRecord s. |
void |
setCompareRecordAtomicStrategy(CalculationStrategy<JsonRecord,JsonAtomic> strategy)
Sets a new strategy for comparing JsonRecord s and atomic values. |
void |
setCompareRecordRecordStrategy(CalculationStrategy<JsonRecord,JsonRecord> strategy)
Sets a new strategy for comparing JsonRecord s. |
Methods inherited from class de.hpi.fgis.dude.similarityfunction.AbstractSimilarityFunction |
---|
getLastValidationState, getSimilarity, setValidationState |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ContentBasedSimilarityFunction()
Jsonable
deserialization.
public ContentBasedSimilarityFunction(String... defaultAttr)
ContentBasedSimilarityFunction
with the passed default attribute. This attribute is used for any DuDeObject
whose DataSource
was not set with for a special attribute. If the requested attribute holds an array, the whole content will be
compared.
defaultAttr
- The default attribute.public ContentBasedSimilarityFunction(int attrIndex, String... defaultAttr)
ContentBasedSimilarityFunction
with the passed default attribute. This attribute is used for any DuDeObject
whose DataSource
was not set with for a special attribute.
attrIndex
- The index of the default attribute. This parameter is used to select specific values of an array, iff the selected attribute is an
array containing multiple values. The first index will be 0
. The whole array will be checked, if a value smaller than
0
is passed.defaultAttr
- The default attribute.Method Detail |
---|
public T ignoreCapitalization()
protected boolean ignoringCapitalizationEnabled()
ContentBasedSimilarityFunction
shall make a distinction between lower case and upper case or not.
true
, if the cases shall be ignored; otherwise false
.public void addAttribute(DataSource source, String... attributePath)
DataSource
-related attribute to this ContentBasedSimilarityFunction
.
source
- The DataSource
to which the passed attribute path belongs.attributePath
- The path of the attribute. This path describes the location of the requested attribute (e.g. addAttribute(..., "dateOfBirth",
"year") describes the "year" attribute within the "dateOfBirth" attribute).protected String[] getAttribute(DuDeObject obj)
DuDeObject
.
obj
- The DuDeObject
of which the attribute path shall be returned. This path depends on the source identifier of the passed
object.
protected double calculateSimilarity(DuDeObject obj1, DuDeObject obj2)
AbstractSimilarityFunction
DuDeObject
s. This similarity has to be within the range of [0; 1].
calculateSimilarity
in class AbstractSimilarityFunction
obj1
- The first DuDeObject
.obj2
- The second DuDeObject
.
DuDeObjects
.public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public double calculateSimilarity(JsonValue val1, JsonValue val2)
JsonValue
s.
val1
- The first value.val2
- The second value.
JsonValue
s.protected abstract double compareAtomicValues(JsonAtomic value1, JsonAtomic value2)
JsonAtomic
s.
value1
- The first atomic value.value2
- The second atomic value.
public void setCompareArrayArrayStrategy(CalculationStrategy<JsonArray,JsonArray> strategy)
JsonArray
s.
strategy
- The new strategy for comparing JsonArray
s.public void setCompareArrayAtomicStrategy(CalculationStrategy<JsonArray,JsonAtomic> strategy)
JsonArray
s and atomic values.
strategy
- The new strategy for comparing JsonArray
s and atomic values.public void setCompareArrayRecordStrategy(CalculationStrategy<JsonArray,JsonRecord> strategy)
JsonArray
s and JsonRecord
s.
strategy
- The new strategy for comparing JsonArray
s and JsonRecord
s.public void setCompareRecordRecordStrategy(CalculationStrategy<JsonRecord,JsonRecord> strategy)
JsonRecord
s.
strategy
- The new strategy for comparing JsonRecord
s.public void setCompareRecordAtomicStrategy(CalculationStrategy<JsonRecord,JsonAtomic> strategy)
JsonRecord
s and atomic values.
strategy
- The new strategy for comparing JsonRecord
s and atomic values.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |