Search in sources :

Example 1 with DefaultDomainConsistency

use of org.apache.sis.metadata.iso.quality.DefaultDomainConsistency in project sis by apache.

the class CustomAttribute method quality.

/**
 * Evaluates the quality of this attribute with a custom rule.
 */
@Override
public DataQuality quality() {
    final DefaultDataQuality quality = (DefaultDataQuality) super.quality();
    final DefaultDomainConsistency report = new DefaultDomainConsistency();
    final DefaultQuantitativeResult result = new DefaultQuantitativeResult();
    result.setErrorStatistic(new SimpleInternationalString(ADDITIONAL_QUALITY_INFO));
    report.setMeasureIdentification(new NamedIdentifier(getName()));
    report.setResults(singleton(result));
    quality.setReports(singleton(report));
    return quality;
}
Also used : DefaultDomainConsistency(org.apache.sis.metadata.iso.quality.DefaultDomainConsistency) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) DefaultDataQuality(org.apache.sis.metadata.iso.quality.DefaultDataQuality) DefaultQuantitativeResult(org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult)

Example 2 with DefaultDomainConsistency

use of org.apache.sis.metadata.iso.quality.DefaultDomainConsistency in project sis by apache.

the class Validator method addViolationReport.

/**
 * Adds a report for a constraint violation. If the given {@code report} is {@code null}, then this method creates
 * a new {@link DefaultDomainConsistency} instance with the measure identification set to the property name.
 *
 * <div class="note"><b>Note:</b>
 * setting {@code measureIdentification} to the property name may look like a departure from ISO intent,
 * since the former should be an identification of the <em>quality measurement</em> rather then the measure itself.
 * (setting {@code measureDescription} to {@code type.getDescription()} would probably be wrong for that reason).
 * However {@code measureIdentification} is only an identifier, not a full description of the quality measurement
 * We are not strictly forbidden to use the same identifier for both the quality measurement than the measurement
 * itself. However strictly speaking, maybe we should use a different scope.</div>
 *
 * @param  report       where to add the result, or {@code null} if not yet created.
 * @param  type         description of the property for which a constraint violation has been found.
 * @param  explanation  explanation of the constraint violation.
 * @return the {@code report}, or a new report if {@code report} was null.
 */
private AbstractElement addViolationReport(AbstractElement report, final AbstractIdentifiedType type, final InternationalString explanation) {
    if (report == null) {
        final GenericName name = type.getName();
        report = new DefaultDomainConsistency();
        // Do not invoke report.setMeasureDescription(type.getDescription()) - see above javadoc.
        report.setMeasureIdentification(name instanceof Identifier ? (Identifier) name : new NamedIdentifier(name));
        report.setEvaluationMethodType(EvaluationMethodType.DIRECT_INTERNAL);
        quality.getReports().add(report);
    }
    report.getResults().add(new DefaultConformanceResult(null, explanation, false));
    return report;
}
Also used : GenericName(org.opengis.util.GenericName) DefaultDomainConsistency(org.apache.sis.metadata.iso.quality.DefaultDomainConsistency) NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) Identifier(org.opengis.metadata.Identifier) NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) DefaultConformanceResult(org.apache.sis.metadata.iso.quality.DefaultConformanceResult)

Aggregations

DefaultDomainConsistency (org.apache.sis.metadata.iso.quality.DefaultDomainConsistency)2 NamedIdentifier (org.apache.sis.referencing.NamedIdentifier)2 DefaultConformanceResult (org.apache.sis.metadata.iso.quality.DefaultConformanceResult)1 DefaultDataQuality (org.apache.sis.metadata.iso.quality.DefaultDataQuality)1 DefaultQuantitativeResult (org.apache.sis.metadata.iso.quality.DefaultQuantitativeResult)1 SimpleInternationalString (org.apache.sis.util.iso.SimpleInternationalString)1 Identifier (org.opengis.metadata.Identifier)1 GenericName (org.opengis.util.GenericName)1