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

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

Go to download

The Legacy Catalog Tool provides functionality for ingesting PDS3 catalog files into the PDS4 infrastructure including the Registry Service.

There is a newer version: 3.1.0
Show newest version
package gov.nasa.pds.citool.ri;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import gov.nasa.pds.tools.label.AttributeStatement;
import gov.nasa.pds.tools.label.GroupStatement;
import gov.nasa.pds.tools.label.Label;
import gov.nasa.pds.tools.label.ObjectStatement;
import gov.nasa.pds.tools.label.Statement;

/**
 * Class that finds statements in a PDS label that matches a user supplied
 * list of keywords.
 *
 * @author mcayanan
 *
 */
public class StatementFinder {

    /**
     * Recursively searches down a PDS label to find attributes that matches
     * a user supplied keyword.
     *
     * @param label A PDS label file.
     * @param identifier An identifier to search for in the labels.
     *
     * @return A list of attributes that match the supplied identifier.
     */
    public static List getStatementsRecursively(Label label, String identifier) {
        List identifiers = new ArrayList();
        List statements = new ArrayList();
        identifiers.add(identifier);
        Map> results = getStatementsRecursively(label, identifiers);
        List list = results.get(identifier);
        if(list != null)
            statements.addAll(list);

        return statements;
    }

    /**
     * Recursively searches down a PDS label to find attributes that match
     * a user supplied list of keywords.
     *
     * @param labels A list of PDS label files.
     * @param identifier An identifier to search for in the labels.
     *
     * @return A list of attributes that match the supplied identifier.
     */
    public static List getStatementsRecursively(List




© 2015 - 2024 Weber Informatics LLC | Privacy Policy