Search in sources :

Example 1 with SimpleStatIndicator

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

the class ColumnSetAnalysisDetailsPage method refreshIndicatorsSection.

/**
 * refresh the Indicators Section.
 */
public void refreshIndicatorsSection() {
    // when there have pattern, show allmatchindicator
    ModelElementIndicator[] modelElementIndicator = treeViewer.getModelElementIndicator();
    if (modelElementIndicator != null) {
        for (ModelElementIndicator modelElementInd : modelElementIndicator) {
            Indicator[] inds = modelElementInd.getPatternIndicators();
            for (Indicator ind : inds) {
                if (ind instanceof RegexpMatchingIndicator) {
                    indicatorsViewer.setInput(simpleStatIndicator, allMatchIndicator);
                    return;
                }
            }
        }
    }
    indicatorsViewer.setInput(simpleStatIndicator);
}
Also used : RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) AllMatchIndicator(org.talend.dataquality.indicators.columnset.AllMatchIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) Indicator(org.talend.dataquality.indicators.Indicator) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 2 with SimpleStatIndicator

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

the class ColumnSetAnalysisDetailsPage method recomputeIndicators.

public void recomputeIndicators() {
    columnSetAnalysisHandler = new ColumnSetAnalysisHandler();
    columnSetAnalysisHandler.setAnalysis(getCurrentModelElement());
    stringDataFilter = columnSetAnalysisHandler.getStringDataFilter();
    analyzedColumns = columnSetAnalysisHandler.getAnalyzedColumns();
    if (columnSetAnalysisHandler.getSimpleStatIndicator() == null || columnSetAnalysisHandler.getSimpleStatIndicator().eIsProxy()) {
        ColumnsetFactory columnsetFactory = ColumnsetFactory.eINSTANCE;
        simpleStatIndicator = columnsetFactory.createSimpleStatIndicator();
        simpleStatIndicator.setRowCountIndicator(IndicatorsFactory.eINSTANCE.createRowCountIndicator());
        simpleStatIndicator.setDistinctCountIndicator(IndicatorsFactory.eINSTANCE.createDistinctCountIndicator());
        simpleStatIndicator.setDuplicateCountIndicator(IndicatorsFactory.eINSTANCE.createDuplicateCountIndicator());
        simpleStatIndicator.setUniqueCountIndicator(IndicatorsFactory.eINSTANCE.createUniqueCountIndicator());
    } else {
        simpleStatIndicator = (SimpleStatIndicator) columnSetAnalysisHandler.getSimpleStatIndicator();
    }
    if (columnSetAnalysisHandler.getAllmatchIndicator() == null) {
        ColumnsetFactory columnsetFactory = ColumnsetFactory.eINSTANCE;
        allMatchIndicator = columnsetFactory.createAllMatchIndicator();
        DefinitionHandler.getInstance().setDefaultIndicatorDefinition(allMatchIndicator);
    } else {
        allMatchIndicator = (AllMatchIndicator) columnSetAnalysisHandler.getAllmatchIndicator();
    }
    initializeIndicator(simpleStatIndicator);
    List<ModelElementIndicator> meIndicatorList = new ArrayList<ModelElementIndicator>();
    ModelElementIndicator currentIndicator = null;
    for (ModelElement element : analyzedColumns) {
        // MOD yyi 2011-02-16 17871:delimitefile
        MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(element);
        TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
        if (tdColumn == null && mdColumn == null) {
            continue;
        }
        if (tdColumn == null && mdColumn != null) {
            currentIndicator = ModelElementIndicatorHelper.createDFColumnIndicator(RepositoryNodeHelper.recursiveFind(mdColumn));
        } else if (tdColumn != null) {
            RepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(tdColumn);
            if (recursiveFind == null) {
                recursiveFind = RepositoryNodeHelper.createRepositoryNode(tdColumn);
            }
            currentIndicator = ModelElementIndicatorHelper.createModelElementIndicator(recursiveFind);
        }
        DataminingType dataminingType = MetadataHelper.getDataminingType(element);
        MetadataHelper.setDataminingType(dataminingType == null ? DataminingType.NOMINAL : dataminingType, element);
        Collection<Indicator> indicatorList = columnSetAnalysisHandler.getRegexMathingIndicators(element);
        if (null != currentIndicator) {
            currentIndicator.setIndicators(indicatorList.toArray(new Indicator[indicatorList.size()]));
            meIndicatorList.add(currentIndicator);
        }
    }
    currentModelElementIndicators = meIndicatorList.toArray(new ModelElementIndicator[meIndicatorList.size()]);
}
Also used : DataminingType(org.talend.dataquality.indicators.DataminingType) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) ColumnSetAnalysisHandler(org.talend.dq.analysis.ColumnSetAnalysisHandler) TdColumn(org.talend.cwm.relational.TdColumn) ArrayList(java.util.ArrayList) ColumnsetFactory(org.talend.dataquality.indicators.columnset.ColumnsetFactory) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) AllMatchIndicator(org.talend.dataquality.indicators.columnset.AllMatchIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) Indicator(org.talend.dataquality.indicators.Indicator) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 3 with SimpleStatIndicator

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

the class IndicatorsComp method setInput.

// input composite indicator
public void setInput(Object... obj) {
    List<ColumnSetIndicatorUnit> indicatortList = new ArrayList<ColumnSetIndicatorUnit>();
    for (Object indicatorObj : obj) {
        // for SimpleStatIndicator, CountAvgNullIndicator, MinMaxDateIndicator, WeakCorrelationIndicator
        if (indicatorObj instanceof SimpleStatIndicator || indicatorObj instanceof CountAvgNullIndicator || indicatorObj instanceof MinMaxDateIndicator || indicatorObj instanceof WeakCorrelationIndicator) {
            columnSetIndicator = (ColumnSetMultiValueIndicator) indicatorObj;
            for (Indicator indicator : IndicatorHelper.getIndicatorLeavesBySingleNode(columnSetIndicator)) {
                IndicatorEnum indicatorEnum = IndicatorEnum.findIndicatorEnum(indicator.eClass());
                indicatortList.add(new ColumnSetIndicatorUnit(indicatorEnum, indicator));
            }
        // MOD msjian TDQ-8860: we always show the allMatchIndicator in the Indicators section
        } else if (indicatorObj instanceof AllMatchIndicator) {
            // for AllMatchIndicator
            AllMatchIndicator allMatchIndicator = (AllMatchIndicator) indicatorObj;
            indicatortList.add(new ColumnSetIndicatorUnit(IndicatorEnum.AllMatchIndicatorEnum, allMatchIndicator));
        // TDQ-8860~
        }
    // ~
    }
    setElements(indicatortList.toArray(new ColumnSetIndicatorUnit[indicatortList.size()]));
}
Also used : WeakCorrelationIndicator(org.talend.dataquality.indicators.columnset.WeakCorrelationIndicator) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) AllMatchIndicator(org.talend.dataquality.indicators.columnset.AllMatchIndicator) ArrayList(java.util.ArrayList) MinMaxDateIndicator(org.talend.dataquality.indicators.columnset.MinMaxDateIndicator) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator) CountAvgNullIndicator(org.talend.dataquality.indicators.columnset.CountAvgNullIndicator) ColumnSetMultiValueIndicator(org.talend.dataquality.indicators.columnset.ColumnSetMultiValueIndicator) MinMaxDateIndicator(org.talend.dataquality.indicators.columnset.MinMaxDateIndicator) CountAvgNullIndicator(org.talend.dataquality.indicators.columnset.CountAvgNullIndicator) Indicator(org.talend.dataquality.indicators.Indicator) WeakCorrelationIndicator(org.talend.dataquality.indicators.columnset.WeakCorrelationIndicator) AllMatchIndicator(org.talend.dataquality.indicators.columnset.AllMatchIndicator) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator) ColumnSetIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit)

Example 4 with SimpleStatIndicator

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

the class DrillDownEditorInput method getColumnSetIndicatorResultSize.

/**
 * DOC talend Comment method "getColumnSetIndicatorResultSize".
 *
 * @param itemsSize
 * @return
 */
private Long getColumnSetIndicatorResultSize() {
    Long itemsSize = 0l;
    SimpleStatIndicator simpleStatIndicator = null;
    // Find simpleStatIndicator from result of analysis
    for (Indicator indicator : analysis.getResults().getIndicators()) {
        if (SimpleStatIndicator.class.isInstance(indicator)) {
            simpleStatIndicator = (SimpleStatIndicator) indicator;
            break;
        }
    }
    // Get the Result from simpleStatIndicator by currIndicator
    if (simpleStatIndicator != null) {
        if (DuplicateCountIndicator.class.isInstance(currIndicator)) {
            itemsSize = simpleStatIndicator.getDuplicateCount();
        } else if (DistinctCountIndicator.class.isInstance(currIndicator)) {
            itemsSize = simpleStatIndicator.getDistinctCount();
        } else if (UniqueCountIndicator.class.isInstance(currIndicator)) {
            itemsSize = simpleStatIndicator.getUniqueCount();
        } else if (RowCountIndicator.class.isInstance(currIndicator)) {
            itemsSize = simpleStatIndicator.getCount();
        }
    }
    return itemsSize;
}
Also used : DistinctCountIndicator(org.talend.dataquality.indicators.DistinctCountIndicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator) UniqueCountIndicator(org.talend.dataquality.indicators.UniqueCountIndicator) DatePatternFreqIndicator(org.talend.dataquality.indicators.DatePatternFreqIndicator) Indicator(org.talend.dataquality.indicators.Indicator) LengthIndicator(org.talend.dataquality.indicators.LengthIndicator) DistinctCountIndicator(org.talend.dataquality.indicators.DistinctCountIndicator) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator) DuplicateCountIndicator(org.talend.dataquality.indicators.DuplicateCountIndicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator)

Example 5 with SimpleStatIndicator

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

the class DrillDownEditorInput method getDesignatedData.

/**
 * DOC zshen Comment method "getDesignatedData".
 *
 * @return make column mapping with data
 */
private List<Object[]> getDesignatedData(List<Object[]> dataList) {
    ModelElement analysisElement = currIndicator.getAnalyzedElement();
    List<Object[]> returnDataList = new ArrayList<Object[]>();
    if (dataList == null || dataList.size() < 0) {
        return returnDataList;
    }
    if (DrillDownUtils.judgeMenuType(this.getMenuType(), DrillDownUtils.MENU_VALUE_TYPE)) {
        int offset = 0;
        // MOD qiongli 2011-3-3 feature 19192 drill down for columnSet with jave engine.
        if (analysisElement == null && currIndicator.eContainer() instanceof SimpleStatIndicator) {
            returnDataList = dataList;
        } else {
            if (analysisElement instanceof MetadataColumn) {
                MetadataTable mTable = ColumnHelper.getColumnOwnerAsMetadataTable((MetadataColumn) analysisElement);
                List<MetadataColumn> columnElementList = mTable.getColumns();
                offset = columnElementList.indexOf(analysisElement);
            }
            // Added yyin 20120608 TDQ-3589
            if (currIndicator instanceof DuplicateCountIndicator) {
                for (Object obj : ((DuplicateCountIndicator) currIndicator).getDuplicateValues()) {
                    Object[] newObj = new Object[1];
                    newObj[0] = obj;
                    returnDataList.add(newObj);
                }
                return returnDataList;
            }
            // ~
            for (Object[] obj : dataList) {
                Object[] newObj = new Object[1];
                newObj[0] = obj[offset];
                returnDataList.add(newObj);
            }
        }
    } else {
        returnDataList = dataList;
    }
    return returnDataList;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) DuplicateCountIndicator(org.talend.dataquality.indicators.DuplicateCountIndicator) ArrayList(java.util.ArrayList) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) EObject(org.eclipse.emf.ecore.EObject) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator)

Aggregations

SimpleStatIndicator (org.talend.dataquality.indicators.columnset.SimpleStatIndicator)13 Indicator (org.talend.dataquality.indicators.Indicator)12 ArrayList (java.util.ArrayList)8 AllMatchIndicator (org.talend.dataquality.indicators.columnset.AllMatchIndicator)8 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)6 DuplicateCountIndicator (org.talend.dataquality.indicators.DuplicateCountIndicator)5 CompositeIndicator (org.talend.dataquality.indicators.CompositeIndicator)4 DistinctCountIndicator (org.talend.dataquality.indicators.DistinctCountIndicator)4 RowCountIndicator (org.talend.dataquality.indicators.RowCountIndicator)4 UniqueCountIndicator (org.talend.dataquality.indicators.UniqueCountIndicator)4 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)3 TdColumn (org.talend.cwm.relational.TdColumn)3 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)3 RegexpMatchingIndicator (org.talend.dataquality.indicators.RegexpMatchingIndicator)3 EObject (org.eclipse.emf.ecore.EObject)2 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)2 Analysis (org.talend.dataquality.analysis.Analysis)2 AnalyzedDataSet (org.talend.dataquality.analysis.AnalyzedDataSet)2 DatePatternFreqIndicator (org.talend.dataquality.indicators.DatePatternFreqIndicator)2 LengthIndicator (org.talend.dataquality.indicators.LengthIndicator)2