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;
}
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;
}
Aggregations