use of org.apache.sis.metadata.iso.lineage.DefaultSource in project sis by apache.
the class MetadataReader method read.
/**
* Creates an ISO {@code Metadata} object from the information found in the netCDF file.
*
* @return the ISO metadata object.
* @throws IOException if an I/O operation was necessary but failed.
* @throws DataStoreException if a logical error occurred.
*/
public Metadata read() throws IOException, DataStoreException {
addResourceScope(ScopeCode.DATASET, null);
Set<InternationalString> publisher = addCitation();
addIdentificationInfo(publisher);
for (final String service : SERVICES) {
final String name = stringValue(service);
if (name != null) {
addResourceScope(ScopeCode.SERVICE, name);
}
}
addAcquisitionInfo();
addContentInfo();
/*
* Add the dimension information, if any. This metadata node
* is built from the netCDF CoordinateSystem objects.
*/
for (final GridGeometry cs : decoder.getGridGeometries()) {
if (cs.getSourceDimensions() >= Variable.MIN_DIMENSION && cs.getTargetDimensions() >= Variable.MIN_DIMENSION) {
addSpatialRepresentationInfo(cs);
}
}
addFileIdentifier();
/*
* Add history in Metadata.dataQualityInfo.lineage.statement as specified by UnidataDD2MI.xsl.
* However Metadata.resourceLineage.statement could be a more appropriate place.
* See https://issues.apache.org/jira/browse/SIS-361
*/
final DefaultMetadata metadata = build(false);
for (final String path : searchPath) {
decoder.setSearchPath(path);
DefaultLineage lineage = null;
String value = stringValue(HISTORY);
if (value != null) {
lineage = new DefaultLineage();
lineage.setStatement(new SimpleInternationalString(value));
}
value = stringValue(SOURCE);
if (value != null) {
if (lineage == null)
lineage = new DefaultLineage();
addIfAbsent(lineage.getSources(), new DefaultSource(value));
}
if (lineage != null) {
final DefaultDataQuality quality = new DefaultDataQuality(ScopeCode.DATASET);
quality.setLineage(lineage);
addIfAbsent(metadata.getDataQualityInfo(), quality);
}
}
decoder.setSearchPath(searchPath);
metadata.setMetadataStandards(Citations.ISO_19115);
addCompleteMetadata(createURI(stringValue(METADATA_LINK)));
return metadata;
}
Aggregations