All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gov.nasa.pds.citool.ri.ReferenceRIChecker Maven / Gradle / Ivy

Go to download

The Catalog Tool provides functionality for ingesting PDS3 catalog files into the the PDS4 infrastructure including the Registry and Storage Services.

There is a newer version: 2.2.0
Show newest version
// Copyright 2009, by the California Institute of Technology.
// ALL RIGHTS RESERVED. United States Government sponsorship acknowledged.
// Any commercial use must be negotiated with the Office of Technology Transfer
// at the California Institute of Technology.
//
// This software is subject to U. S. export control laws and regulations
// (22 C.F.R. 120-130 and 15 C.F.R. 730-774). To the extent that the software
// is subject to U.S. export control laws and regulations, the recipient has
// the responsibility to obtain export licenses or other export authority as
// may be required before exporting such information to foreign countries or
// providing access to foreign nationals.
//
// $Id$

package gov.nasa.pds.citool.ri;

import gov.nasa.pds.citool.diff.DiffException;
import gov.nasa.pds.citool.diff.DiffRecord;
import gov.nasa.pds.citool.diff.ValueDiff;
import gov.nasa.pds.citool.util.Utility;
import gov.nasa.pds.tools.LabelParserException;
import gov.nasa.pds.tools.constants.Constants;
import gov.nasa.pds.tools.label.AttributeStatement;
import gov.nasa.pds.tools.label.Label;
import gov.nasa.pds.tools.label.ObjectStatement;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.io.IOUtils;

/**
 * Class to do referential integrity checking on references.
 *
 * @author mcayanan
 *
 */
public class ReferenceRIChecker extends RIChecker {
    private Map idToDescriptions;
    private List refFiles;
    private List parentIDs;
    private final String ID = "REFERENCE_KEY_ID";
    private final String DESCRIPTION = "REFERENCE_DESC";

    /**
     * Constructor
     *
     */
    public ReferenceRIChecker() {
        idToDescriptions = new HashMap();
        parentIDs = new ArrayList();
        refFiles = new ArrayList();
    }

    /**
     * Determines whether the supplied list of catalog files has referential
     * integrity when compared to the REF.CAT file.
     *
     * @param parentLabels A set of catalog files containing the REFERENCE
     * object.
     * @param childLabels A set of catalog files that do not contain the
     * REFERENCE object.
     */
    public void performCheck(List




© 2015 - 2025 Weber Informatics LLC | Privacy Policy