Search in sources :

Example 16 with RecordMatchingIndicator

use of org.talend.dataquality.indicators.columnset.RecordMatchingIndicator in project tdq-studio-se by Talend.

the class GroupStatisticsSection method createSubChart.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.dataquality.record.linkage.ui.section.AbstractMatchAnaysisTableSection#createSubChart(org.eclipse.
     * swt.widgets.Composite)
     */
@Override
protected void createSubChart(Composite sectionClient) {
    RecordMatchingIndicator recordMatchingIndicator = MatchRuleAnlaysisUtils.getRecordMatchIndicatorFromAna(analysis);
    Composite chartComposite = toolkit.createComposite(sectionClient);
    GridLayout tableLayout = new GridLayout(1, Boolean.TRUE);
    chartComposite.setLayout(tableLayout);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    chartComposite.setLayoutData(gridData);
    matchRuleChartComp = new MatchRuleDataChart(chartComposite, recordMatchingIndicator.getGroupSize2groupFrequency());
    if (!TOPChartUtil.getInstance().isTOPChartInstalled()) {
        return;
    }
    createHideGroupComposite(chartComposite);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) MatchRuleDataChart(org.talend.dataquality.record.linkage.ui.composite.chart.MatchRuleDataChart) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator)

Example 17 with RecordMatchingIndicator

use of org.talend.dataquality.indicators.columnset.RecordMatchingIndicator in project tdq-studio-se by Talend.

the class DuplicateRecordStatisticsSection method computeMergedRecords.

/**
 * DOC zhao Comment method "computeMergedRecords".
 *
 * @return
 */
private Long computeMergedRecords() {
    RecordMatchingIndicator recordMatchingIndicator = MatchRuleAnlaysisUtils.getRecordMatchIndicatorFromAna(analysis);
    Map<Object, Long> g2f = recordMatchingIndicator.getGroupSize2groupFrequency();
    Iterator<Object> groupSizeIterator = g2f.keySet().iterator();
    Long mergedRecordsCount = 0l;
    while (groupSizeIterator.hasNext()) {
        Object groupSize = groupSizeIterator.next();
        if (Long.valueOf(groupSize.toString()) > 1) {
            Long groupFreq = g2f.get(groupSize);
            // Merged records
            mergedRecordsCount += groupFreq;
        }
    }
    return mergedRecordsCount;
}
Also used : RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator)

Example 18 with RecordMatchingIndicator

use of org.talend.dataquality.indicators.columnset.RecordMatchingIndicator in project tdq-studio-se by Talend.

the class MatchingKeySection method hideGroups.

public void hideGroups() {
    RecordMatchingIndicator recordMatchingIndicator = (RecordMatchingIndicator) analysis.getResults().getIndicators().get(1);
    matchRuleChartComp.refresh(recordMatchingIndicator.getGroupSize2groupFrequency());
}
Also used : RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator)

Example 19 with RecordMatchingIndicator

use of org.talend.dataquality.indicators.columnset.RecordMatchingIndicator in project tdq-studio-se by Talend.

the class MatchingKeySection method refreshChart.

public void refreshChart(boolean needCompute) {
    if (!hasMatchKey(true)) {
        MessageDialogWithToggle.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("BlockingKeySection.RefreshChartError"), // $NON-NLS-1$ //$NON-NLS-2$
        DefaultMessagesImpl.getString("MatchMasterDetailsPage.NoMatchKey"));
        return;
    }
    ReturnCode checkResultStatus = checkResultStatus();
    if (!checkResultStatus.isOk()) {
        MessageDialogWithToggle.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("BlockingKeySection.RefreshChartError"), // $NON-NLS-1$
        checkResultStatus.getMessage());
        return;
    }
    listeners.firePropertyChange(MatchAnalysisConstant.NEED_REFRESH_DATA, true, false);
    List<Object[]> results;
    // MOD TDQ-9741: "chart" button will compute, "hide group" will not compute
    if (needCompute) {
        TypedReturnCode<RecordMatchingIndicator> computeMatchResult = computeMatchResult();
        if (!computeMatchResult.isOk()) {
            if (computeMatchResult.getMessage() != null && !computeMatchResult.getMessage().equals(StringUtils.EMPTY)) {
                MessageDialogWithToggle.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("RunAnalysisAction.runAnalysis"), // $NON-NLS-1$
                computeMatchResult.getMessage());
            }
            return;
        }
        RecordMatchingIndicator recordMatchingIndicator = computeMatchResult.getObject();
        matchRuleChartComp.refresh(recordMatchingIndicator.getGroupSize2groupFrequency());
        // sort the result before refresh
        results = MatchRuleAnlaysisUtils.sortResultByGID(recordMatchingIndicator.getMatchRowSchema(), this.getTableResult());
    } else {
        // for "hide group" , get the result from the last "chart" directly.
        matchRuleChartComp.refresh(getChartResult());
        results = getTableResult();
    }
    // refresh related table
    MatchRuleAnlaysisUtils.refreshDataTable(analysis, results);
    // Clear the match row data.
    matchRows.clear();
}
Also used : TypedReturnCode(org.talend.utils.sugars.TypedReturnCode) ReturnCode(org.talend.utils.sugars.ReturnCode) RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator)

Example 20 with RecordMatchingIndicator

use of org.talend.dataquality.indicators.columnset.RecordMatchingIndicator in project tdq-studio-se by Talend.

the class MatchRuleAnlaysisUtils method getNeedIndicatorFromAna.

/**
 * Get recording matching indicator and Blocking Indicator from analysis
 *
 * @param analysis
 * @return the index 0 will be RecordMatchingIndicator and index 1 will be BlockKeyIndicator
 */
public static Object[] getNeedIndicatorFromAna(Analysis analysis) {
    Object[] returnList = new Object[2];
    EList<Indicator> indicators = analysis.getResults().getIndicators();
    for (Indicator ind : indicators) {
        if (ind instanceof RecordMatchingIndicator) {
            returnList[0] = ind;
        } else if (ind instanceof BlockKeyIndicator) {
            returnList[1] = ind;
        }
    }
    // If match rule definition is null, create a default.
    if (returnList[0] == null) {
        returnList[0] = ColumnsetPackage.eINSTANCE.getColumnsetFactory().createRecordMatchingIndicator();
    }
    // If blocking key indicator is nul, create a default.
    if (returnList[1] == null) {
        returnList[1] = ColumnsetPackage.eINSTANCE.getColumnsetFactory().createBlockKeyIndicator();
    }
    return returnList;
}
Also used : BlockKeyIndicator(org.talend.dataquality.indicators.columnset.BlockKeyIndicator) RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator) RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator) Indicator(org.talend.dataquality.indicators.Indicator) BlockKeyIndicator(org.talend.dataquality.indicators.columnset.BlockKeyIndicator)

Aggregations

RecordMatchingIndicator (org.talend.dataquality.indicators.columnset.RecordMatchingIndicator)32 ArrayList (java.util.ArrayList)9 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)8 MatchRuleDefinition (org.talend.dataquality.rules.MatchRuleDefinition)8 BlockKeyIndicator (org.talend.dataquality.indicators.columnset.BlockKeyIndicator)7 MatchGroupResultConsumer (org.talend.dataquality.record.linkage.grouping.MatchGroupResultConsumer)7 BlockKeyDefinition (org.talend.dataquality.rules.BlockKeyDefinition)7 HashMap (java.util.HashMap)6 AlgorithmDefinition (org.talend.dataquality.rules.AlgorithmDefinition)6 MatchRule (org.talend.dataquality.rules.MatchRule)6 Test (org.junit.Test)5 Indicator (org.talend.dataquality.indicators.Indicator)5 MatchKeyDefinition (org.talend.dataquality.rules.MatchKeyDefinition)5 ExecuteMatchRuleHandler (org.talend.dq.analysis.match.ExecuteMatchRuleHandler)5 ReturnCode (org.talend.utils.sugars.ReturnCode)3 TypedReturnCode (org.talend.utils.sugars.TypedReturnCode)3 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 Analysis (org.talend.dataquality.analysis.Analysis)2 KeyDefinition (org.talend.dataquality.rules.KeyDefinition)2