use of org.talend.dataquality.rules.AlgorithmDefinition in project tdq-studio-se by Talend.
the class DefaultSurvivorShipTableViewer method createNewKeyDefinition.
@Override
protected DefaultSurvivorshipDefinition createNewKeyDefinition(String columnName) {
DefaultSurvivorshipDefinition skd = RulesFactory.eINSTANCE.createDefaultSurvivorshipDefinition();
skd.setDataType(DefaultSurvivorShipDataTypeEnum.getTypeByIndex(0).getValue());
AlgorithmDefinition createAlgorithmDefinition = RulesFactory.eINSTANCE.createAlgorithmDefinition();
createAlgorithmDefinition.setAlgorithmType(SurvivorShipAlgorithmEnum.getTypeByIndex(3).getComponentValueName());
skd.setFunction(createAlgorithmDefinition);
return skd;
}
use of org.talend.dataquality.rules.AlgorithmDefinition in project tdq-studio-se by Talend.
the class SurvivorShipTableViewer method createNewKeyDefinition.
/*
* (non-Javadoc) columnList.toArray(new String[0])
*
* @see org.talend.dataquality.record.linkage.ui.composite.tableviewer.AbstractMatchAnalysisTableViewer#
* createNewKeyDefinition(java.lang.String)
*/
@Override
protected SurvivorshipKeyDefinition createNewKeyDefinition(String columnName) {
SurvivorshipKeyDefinition skd = RulesFactory.eINSTANCE.createSurvivorshipKeyDefinition();
skd.setName(MatchAnalysisConstant.SURVIVORSHIP_KEY_DEFAULT_VALUE);
skd.setColumn(columnName);
AlgorithmDefinition createAlgorithmDefinition = RulesFactory.eINSTANCE.createAlgorithmDefinition();
createAlgorithmDefinition.setAlgorithmType(SurvivorShipAlgorithmEnum.getTypeByIndex(3).getComponentValueName());
skd.setFunction(createAlgorithmDefinition);
skd.setAllowManualResolution(true);
return skd;
}
use of org.talend.dataquality.rules.AlgorithmDefinition in project tdq-studio-se by Talend.
the class MatchRuleAnlaysisUtils method createDefaultMatchRow.
/**
* DOC zshen Comment method "createDefaultRow".
*
* @param columnName
* @return
*/
public static MatchKeyDefinition createDefaultMatchRow(String columnName) {
MatchKeyDefinition createMatchKeyDefinition1 = RulesFactory.eINSTANCE.createMatchKeyDefinition();
AlgorithmDefinition createAlgorithmDefinition1 = RulesFactory.eINSTANCE.createAlgorithmDefinition();
// by default the name of the match attribute rule is the name of the selected column
createMatchKeyDefinition1.setName(columnName);
createMatchKeyDefinition1.setColumn(columnName);
createMatchKeyDefinition1.setConfidenceWeight(1);
createMatchKeyDefinition1.setHandleNull(HandleNullEnum.NULL_MATCH_NULL.getValue());
createMatchKeyDefinition1.setTokenizationType(TokenizedResolutionMethod.NO.getComponentValue());
createAlgorithmDefinition1.setAlgorithmParameters(StringUtils.EMPTY);
createAlgorithmDefinition1.setAlgorithmType(AttributeMatcherType.values()[0].name());
createMatchKeyDefinition1.setAlgorithm(createAlgorithmDefinition1);
createMatchKeyDefinition1.setThreshold(1.0);
return createMatchKeyDefinition1;
}
use of org.talend.dataquality.rules.AlgorithmDefinition in project tdq-studio-se by Talend.
the class MatchRuleElementTreeSelectionDialog method getMatchRulesFromRules.
private List<Map<String, String>> getMatchRulesFromRules(MatchRuleDefinition matchRuleDefinition, boolean retrieveDisplayValue) {
if (matchRuleDefinition != null) {
List<Map<String, String>> ruleValues = new ArrayList<Map<String, String>>();
for (MatchRule matchRule : matchRuleDefinition.getMatchRules()) {
for (MatchKeyDefinition matchKey : matchRule.getMatchKeys()) {
Map<String, String> pr = new HashMap<String, String>();
pr.put(MatchRulesTableLabelProvider.MATCH_KEY_NAME, null == matchKey.getName() ? StringUtils.EMPTY : matchKey.getName());
String matchedColumnName = matchExistingColumnForKey(matchKey);
pr.put(MatchRulesTableLabelProvider.INPUT_COLUMN, null == matchedColumnName ? StringUtils.EMPTY : matchedColumnName);
if (getLookupColumnNames().size() > 0) {
for (String lookupColumnName : getLookupColumnNames()) {
if (isColumnNameEqualsWithKey(matchKey, lookupColumnName)) {
// $NON-NLS-1$
pr.put("LOOKUP_COLUMN", null == matchKey.getColumn() ? StringUtils.EMPTY : lookupColumnName);
break;
}
}
}
String algorithmType = matchKey.getAlgorithm().getAlgorithmType();
if (retrieveDisplayValue) {
pr.put(MatchRulesTableLabelProvider.MATCHING_TYPE, null == algorithmType ? StringUtils.EMPTY : AttributeMatcherType.valueOf(algorithmType).getLabel());
} else {
pr.put(MatchRulesTableLabelProvider.MATCHING_TYPE, null == algorithmType ? StringUtils.EMPTY : AttributeMatcherType.valueOf(algorithmType).getComponentValue());
}
// MOD sizhaoliu TDQ-8431 split the value by "||" and take the second part as custom class value
String algoParams = matchKey.getAlgorithm().getAlgorithmParameters();
if (algoParams != null) {
// $NON-NLS-1$
int idxSeparator = algoParams.indexOf("||");
if (idxSeparator > 0 && algoParams.length() > idxSeparator + 2) {
// $NON-NLS-1$ //$NON-NLS-2$
algoParams = "\"" + algoParams.substring(idxSeparator + 2) + "\"";
}
}
pr.put(MatchRulesTableLabelProvider.CUSTOM_MATCHER, null == algoParams ? StringUtils.EMPTY : algoParams);
pr.put(MatchRulesTableLabelProvider.CONFIDENCE_WEIGHT, String.valueOf(matchKey.getConfidenceWeight()));
if (retrieveDisplayValue) {
pr.put(MatchRulesTableLabelProvider.HANDLE_NULL, null == matchKey.getHandleNull() ? StringUtils.EMPTY : HandleNullEnum.getTypeByValue(matchKey.getHandleNull()).getLabel());
} else {
pr.put(MatchRulesTableLabelProvider.HANDLE_NULL, null == matchKey.getHandleNull() ? StringUtils.EMPTY : matchKey.getHandleNull());
}
// set threshold
pr.put(MatchRulesTableLabelProvider.THRESHOLD, String.valueOf(matchKey.getThreshold()));
pr.put(MatchRulesTableLabelProvider.TOKENIZATION_TYPE, String.valueOf(matchKey.getTokenizationType()));
// set survivorship function and parameter
AlgorithmDefinition algorithmDefinition = getSurvivorshipFunctionAlgorithm(matchKey, matchRuleDefinition);
pr.put(MatchRulesTableLabelProvider.SURVIVORSHIP_FUNCTION, algorithmDefinition != null && algorithmDefinition.getAlgorithmType() != null ? algorithmDefinition.getAlgorithmType() : StringUtils.EMPTY);
pr.put(MatchRulesTableLabelProvider.PARAMETER, algorithmDefinition != null && algorithmDefinition.getAlgorithmParameters() != null ? algorithmDefinition.getAlgorithmParameters() : StringUtils.EMPTY);
ruleValues.add(pr);
}
}
return ruleValues;
}
return null;
}
Aggregations