NASA - National Aeronautics and Space Administration

+ NASA Homepage
+ NASA en Español
+ Contact NASA
Go
Planetary Data System - Engineering Node Banner

Operation

The following topics can be found in this section:

Note: The command-line examples in this section have been broken into multiple lines for readability. The commands should be reassembled into a single line prior to execution.

Tool Execution

Harvest Tool can be executed in various ways. This section describes how to run the tool, as well as its behaviors and caveats.

Command-Line Options

The following table describes the command-line options available:

Command-Line OptionDescription
-u, --usernameSpecify a username for authentication with the PDS Security Service.
-p, --passwordSpecify a password associated with the username.
-k, --keystore-passSpecify a keystore password associated with the keystore file being passed into the tool.
-l, --log-fileSpecify a log file name. Default is standard out.
-P, --portSpecify a port number to use if running the tool in persistence mode. See the Persistence Mode section for more details.
-w, --waitSpecify the time, in seconds, to wait in between the crawls if running the tool in persistence mode. See the Persistence Mode section for more details.
-V, --versionDisplay the release number and copyright information.
-h, --helpDisplay Harvest usage.

Execute Harvest Tool

This section demonstrates execution of the tool using the command-line options. The examples below execute the tool via the batch/shell script.

The Harvest Tool operates with a policy file to register product metadata. Details on how to create this policy file can be found in the Harvest Policy File section.

The following command demonstrates how to run the Harvest Tool against a policy file, policy.xml, using a valid username, password and keystore password, with the output going to standard out:

% Harvest policy.xml -u {username} -p {password} -k {keystorePassword}
        

The following command demonstrates how to run the Harvest Tool with the output going to a log file, log.txt instead of standard out:

% Harvest policy.xml -u {username} -p {password} -k {keystorePassword} -l log.txt
        

When registering product metadata to a non-secured instance of the Registry (such as one running on your local machine), the -u and -p command-line option flags do not need to be passed into the tool. The following command demonstrates how to run the Harvest Tool to register product metadata to a non-secured instance of the Registry Service, with the output going to a log file:

% Harvest policy.xml -l log.txt
        

Persistence Mode

The Harvest Tool can be run in persistence mode through an XML-RPC accessible web service called a daemon. Under this scenario, the Harvest Tool wakes up periodically, inspects a target directory or directories, and registers the latest products. This section details how to set this up.

In order to run the tool through the daemon, the command-line option flags -P and -w need to be used. This tells the Harvest Tool the port number to use and how long to sleep in between crawls, respectively. When the daemon is running, it can be accessed through the following url: http://localhost:{port number}/xmlrpc. The following command demonstrates launching the Harvest Tool through the daemon on port 9000, where it will wait 120 seconds in between crawls:

% Harvest policy.xml -u {username} -p {password} -k {keystorePassword} -l log.txt -P 9000 -w 120
        

After running the above command, the daemon will be accessible at http://localhost:9000/xmlrpc.

In order to stop the daemon from running, a daemon controller is needed. The bin/ directory of the Harvest Tool release package contains a shell script, HarvestController, and a batch file, HarvestController.bat, which are used to gracefully shut down the daemon service on a UNIX-like and Windows system, respectively. In addition, they can provide a few additional statistics about the crawling.

The following table describes the command-line options available for the HarvestController:

Command-Line OptionDescription
--urlSpecify the URL of the daemon service running the Harvest Tool.
--operationSpecify a single operation to perform. List of valid operations can be found in the next table.

The following table describes the operation names available to pass with the --operation command-line option:

Operation OptionDescription
--stopSpecify this operation to shut down the daemon service.
--isRunningGives an indication whether the daemon service is running.
--getNumCrawlsReturns the number of crawls that have occurred.
--getWaitIntervalReturns the time, in seconds, that the crawler has to wait in between crawls.
--getMilisCrawlingReturns the amount of milliseconds spent crawling.
--getAverageCrawlTimeReturns the average amount of time, in milliseconds, spent during each crawl.

The following examples demonstrate how to run the HarvestController using a few of the different operations. For demonstration purposes, assume that the daemon service is located at the following url: http://localhost:9000/xmlrpc.

Determine the Status of the Daemon Service

The following command is used to find out if the daemon service is still running:

% HarvestController --url http://localhost:9000/xmlrpc --operation --isRunning
        

Shutdown the Daemon Service

The following command demonstrates shutting down the daemon service:

% HarvestController --url http://localhost:9000/xmlrpc --operation --stop
        

Harvest Policy File

The Harvest policy file is an XML-based configuration file that the tool uses to find products and register their metadata. The schema for the policy file can be found in the Harvest Policy Schema section. If viewing this document in PDF form, see the appendix for details. This section details how to setup the policy file to do PDS data product registration.

PDS4 Data Product Registration

The following is an example of a policy file to perform registration of PDS4 data products:

<?xml version="1.0" encoding="UTF-8"?>
<policy>
   <bundles>
      <file>/home/pds4/context-bundle/bundle.xml</file>
   </bundles>
   <collections>
      <file>/home/pds4/insthost/collection_instrument_host.xml</file>
   </collections>
   <directories>
      <path>/home/user/pds4/geo/product_files</path>
      <filePattern>*.xml</filePattern>
   </directories>
   <validation>
      <enabled>true</enabled>
   </validation>
   <storageIngestion>
      <serverUrl>http://localhost:9000</serverUrl>
   </storageIngestion>
   <accessUrls>
      <baseUrl>http://pds.nasa.gov/pds4</baseUrl>
      <baseUrl>file://pds4</baseUrl>
   </accessUrls>
   <candidates>
      <namespace prefix="geo" uri="http://pds.nasa.gov/schema/pds4/geo"/>
      <productMetadata objectType="character_table">
         <xPath>//geo:Product_Identification_Area/geo:creation_date_time</xPath>
         <xPath>//geo:Subject_Area/geo:instrument_name</xPath>
         <xPath>//Subject_Area/observing_system_name</xPath>
      </productMetadata>
      <productMetadata objectType="Product_Target">
         <xPath>//alternate_title</xPath>
         <xPath>//creation_date_time</xPath>
         <xPath>//identifier</xPath>
         <xPath>//Subject_Area/target_name</xPath>
      </productMetadata>
   </candidates>
</policy>
       

This policy file is made up of the following complex type elements: bundles, collections, directories, validation, storageIngestion, accessUrls, candidates, and productMetadata.

bundles

Specify this element to tell the Harvest Tool to register and crawl a bundle file. The following table describes the elements that are allowed:

Element NameDescription
fileSpecify a bundle file. Specify this element tag more than once to point to multiple bundle files.

In the example above, the Harvest Tool will register the bundle file named /home/pds4/context-bundle/bundle.xml. It will then crawl the bundle file, looking for collection files to register and process.

collections

Specify this element to tell the Harvest Tool to register and crawl a collection file. Crawling only occurs when the collection file is a primary collection. This is indicated by a value of true in the is_primary_collection element tag within the collection.

The following table describes the elements that are allowed:

Element NameDescription
fileSpecify a collection file. Specify this element tag more than once to point to multiple collection files.

In the example above, the Harvest Tool will register the collection file named /home/pds4/insthost/collection_instrument_host.xml. It will then crawl the file, looking for products to register if it is a primary collection.

directories

Specify this element to tell the Harvest Tool where to crawl for data products. The following table describes the elements that are allowed:

Element NameDescription
pathSpecify a directory path to start crawling. Specify this element tag more than once to point to multiple directories to crawl.
filePatternSpecify a file pattern to look for specific files. If omitted, the default is to get all files within a directory.

In the example above, the Harvest tool will crawl the directory location, /home/user/pds4/geo/product_files, looking for files that have a .xml file extension. The default is to touch all files in the directory if the filePattern element is omitted from the policy file.

validation

Specify this element to tell the Harvest Tool to validate a data product before registering it. If the data product does not pass the validation step, the data product will not be registered. The following table describes the elements that are allowed:

Element NameDescription
enabledSpecify a boolean value to tell the Harvest Tool whether or not to validate a data product.
modelVersionSpecify a model version to use during validation. By default, validation will be performed against the latest released PDS4 data model.

By default, if the validation element is not specified in the policy file, validation is turned on.

storageIngestion

Specify this element to tell the Harvest Tool to ingest data products to the PDS Storage. The following table describes the elements that are allowed:

Element NameDescription
serverUrlSpecify the url to the PDS Storage Service.

In the example above, the Harvest Tool will ingest data products to the PDS Storage Service at http://localhost:9000. When a data product is ingested to the PDS Storage, it returns a product id which is a reference to the ingested product. This id is placed as a slot in the registry under the slot name storageServiceProductId.

accessUrls

Specify this element to provide links to the physical data products. The links will be placed in the registry as slots under the slot name accessUrl. The following table describes the elements that are allowed:

Element NameDescription
baseUrlSpecify a base url. This element can be specified more than once if providing more than one link.

The provided base urls will be prepended to the path of the registered data product. As an example, if a data product is located in /data/product/label.xml, using the base urls from the policy example above, the following access urls will be formed: http://pds.nasa.gov/pds4/data/product/label.xml and file://pds4/data/product/label.xml.

candidates

Specify this element to tell the Harvest Tool what product types to register and what metadata to extract from a data product. This is a required element in the policy file. The following table describes the elements that are allowed:

Element NameDescription
namespaceSpecify to allow the Harvest Tool to extract metadata that is in a namespace other than the default PDS namespace.
productMetadataSpecify to tell the tool what object types and what metadata to register.

By default, the Harvest Tool defines the default namespace to be the PDS namespace, http://pds.nasa.gov/schema/pds4/pds/v04. To override this default, specify the default attribute in the namespace element and give it a value of true. The following makes the geo namespace the default namespace:

<candidates>
  <namespace prefix="geo" uri="http://pds.nasa.gov/schema/pds4/geo" default="true"/>
          ...
       

Namespaces need to be defined in the Harvest policy file only if the metadata to be extracted exists in a namespace other than the PDS namespace. In the example above, a namespace with the prefix geo and uri http://pds.nasa.gov/schema/pds4/geo has been defined. This means that any xPath expressions defined in the policy file will be able to use the geo prefix to be able to extract metadata that are within the geo namespace. xPaths will be explained in greater detail in the productMetadata section.

productMetadata

Specify this element to tell the Harvest Tool what metadata to register. It requires an attribute called objectType that tells the Harvest Tool what product types to register. The following table describes the elements that are allowed:

Element NameDescription
xPathSpecify an XPath expression to extract metadata.

In the example above, the policy file tells the Harvest Tool to look for and register the character_table and Product_Target object types.

Also in the example is a set of xPath elements found under each productMetadata element. This defines what metadata to extract from the different products. XPath is a query language that uses path expressions to select nodes in an XML document. These path expressions look very much like expressions in a traditional computer file system. In its simplest form, prepending a // before a name will find the element no matter where it is in the XML file.

The following XPath expression will find the creation_date_time element within the default namespace, no matter where this element is located in the file:

//creation_date_time
       

The following XPath expression will find the creation_date_time element within the geo namespace, no matter where this element is located in the file:

//geo:creation_date_time
       

The following XPath expression will find all target_name elements that are children of Subject_Area within the default namespace:

//Subject_Area/target_name
       

The following XPath expression will find all target_name elements that are children of Subject_Area and that have a value of MARS:

//Subject_Area/target_name[text()="MARS"]
       

For a more detailed explanation on XPath, go to your favorite search engine and type XPath tutorial.

PDS3 Product Registration

By default, the tool registers discovered PDS3 products under the Product_Proxy_PDS3 objectType in the registry. Additionally, the tool has to dynamically create certain metadata in order to support ingestion of PDS3 data products into the registry. The Harvesting of PDS3 Data Products section details how the Harvest Tool behaves when registering PDS3 data products. If viewing this document in PDF form, see the appendix for details.

The following is an example of a policy file to perform product registration of PDS3 data products:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Example of a Harvest policy configuration file that will do PDS3 data
    product registration  -->
<policy>
  <!-- Specify a single directory containing the PDS3 data products to
    register -->
  <pds3Directory>
    <path>/data/pds3/dataset</path>
    <filePattern>*.LBL</filePattern>
  </pds3Directory>
  <candidates>
    <!-- Harvest will register PDS3 data products under the objectType
      'Product_Proxy_PDS3' -->
    <pds3ProductMetadata>
        <!-- Prefix to add to the LID of a PDS3 product registration -->
        <lidPrefix>URN:JPL:PDS:ENGINEERING</lidPrefix>
        <!-- Associations to register with discovered PDS3 products -->
        <associations>
          <!-- Specify either a LID or LIDVID reference -->
          <association>
            <referenceType>has_Target</referenceType>
            <lidVidReference>URN:NASA:PDS:target.MARS::1.0</lidVidReference>
          </association>
          <association>
            <referenceType>has_Mission</referenceType>
            <lidReference>URN:NASA:PDS:mission.MER</lidReference>
          </association>
        </associations>
        <!-- Register any additional metadata. They will be registered as
          slots with their element names in lowercase form. Default is to
          register metadata defined in the identification area of the
          Product_Proxy_PDS3 schema. -->
        <ancillaryMetadata>
          <elementName>START_DATE_TIME</elementName>
          <elementName>STOP_DATE_TIME</elementName>
        </ancillaryMetadata>
        <includePaths>
          <path>/data/pds3/label</path>
        </includePaths>
    </pds3ProductMetadata>
  </candidates>
</policy>
      

This policy file is made up of the following complex type elements: pds3Directory, pds3ProductMetadata, association, ancillaryMetadata, includePaths.

pds3Directory

Specify this element to tell the Harvest Tool the directory location to crawl. The following table describes the elements that are allowed:

Element NameDescription
pathSpecify a directory location containing the PDS3 data products to register. Only one directory location is allowed per executable run.
filePatternSpecify a file pattern to look for specific files. If omitted, the default is to get all files within a directory.

In the example above, the Harvest Tool will crawl for PDS3 data products starting at the location /data/pds3/dataset, looking for files with a .LBL file extension.

pds3ProductMetadata

Specify this element to tell the Harvest Tool what metadata to ingest into the registry when registering PDS3 data products. This element must be specified within the candidates tag as shown in the example. The following table describes the elements that are allowed:

Element nameDescription
lidPrefixSpecify a prefix to add to the logical identifier.
associationsSpecify one or more associations.
ancillaryMetadataSpecify ancillary metadata to ingest into the registry for every discovered PDS3 data product.

In the example above, the logical identifiers of every discovered PDS3 data product will be prefixed with URN:JPL:PDS:ENGINEERING.

association

Specify this element to tell the Harvest Tool what associations belong to each discovered PDS3 data product. Specifying one or more association elements is allowed and they must be within the associations tag as shown in the example. The following table describes the elements that are allowed:

Element nameDescription
referenceTypeSpecify the association type.
lidVidReferenceSpecify a lidvid reference.
lidReferenceSpecify a lid reference.

Note that lidVidReference and lidReference cannot be used together within the same association tag. Only one can be chosen.

In the example above, each discovered PDS3 product will have two associations: one with a LIDVID of URN:NASA:PDS:target.MARS::1.0 and association type of has_Target, and one with a LID of URN:NASA:PDS:mission.MER and association type of has_Mission.

ancillaryMetadata

Specify this element to tell the Harvest tool what additional metadata to register. The following table describes the elements that are allowed:

Element nameDescription
elementNameSpecify an element name found in the PDS3 data product label.

In the example above, the values from the following elements will be extracted from a PDS3 product label: START_DATE_TIME and STOP_DATE_TIME. If they are found in the label, they will be registered as slots in the registry, using their element names in lowercase form as the slot names. In this case, start_date_time and stop_date_time will be used as slot names in the registry.

includePaths

Specify this element to tell the Harvest tool the locations of where to find file references specified in a label. By default, the tool will look for the file reference in the location of the label file. The following table describes the elements that are allowed:

Element nameDescription
pathSpecify the directory location of where to find the file references in a label. This element can be specified more than once to specify multiple search paths.

In the example above, the tool will look at the /data/pds3/label directory for file references if they cannot be found in the same location as the label file.

Report Format

This section describes the contents of the Harvest Tool report. At this time, the Harvest Tool only outputs a series of log messages. The log will report the success or failure of a discovered product attempting to be registered. Additionally, any syntactical errors in a discovered product are reported. A log consists of a severity level, file name, and a message. The following is an example of some of the log messages that can be expected from the Harvest Tool:

PDS Harvest Tool Log

Version                     Version 0.5.0-dev
Time                        Fri, Oct 14 2011 at 08:15:53 AM
Registry Location           http://localhost:8080/registry
Registry Package Name       Harvest-Package_20111014081552
Registration Package GUID   urn:uuid:f4cb8733-b86f-4877-ad47-c7fbacf44574

INFO:   XML extractor set to the following default namespace: http://pds.nasa.gov/schema/pds4/pds/v04
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] Begin processing.
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] \
Setting LID-based association, 'urn:nasa:pds:Collection_Context.personnel.affil', under slot name 'has_context_collection'.
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] \
Setting LID-based association, 'urn:nasa:pds:Collection_Context.dataset', under slot name 'has_context_collection'.
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] \
Setting LID-based association, 'urn:nasa:pds:Collection_Context.personnel.guest', under slot name 'has_context_collection'.
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] \
Setting LID-based association, 'urn:nasa:pds:Collection_Context.instrument_host', under slot name 'has_context_collection'.
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] \
Setting LID-based association, 'urn:nasa:pds:Collection_Context.instrument', under slot name 'has_context_collection'.
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] \
Setting LID-based association, 'urn:nasa:pds:Collection_Context.mission', under slot name 'has_context_collection'.
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] \
Setting LID-based association, 'urn:nasa:pds:Collection_Context.node', under slot name 'has_context_collection'.
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] \
Setting LID-based association, 'urn:nasa:pds:Collection_Context.resource', under slot name 'has_context_collection'.
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] \
Setting LID-based association, 'urn:nasa:pds:Collection_Context.target', under slot name 'has_context_collection'.
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] Captured file information for Product_Bundle_Context.xml
SUCCESS:   [/pds4/context_bundle/Product_Bundle_Context.xml] Successfully registered product: urn:nasa:pds:context_bundle::1.0
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] Product has the following GUID: urn:uuid:25f3043e-0655-4d2c-9205-8406a254ec70
SUCCESS:   [/pds4/context_bundle/Product_Bundle_Context.xml] \
Successfully registered product: urn:nasa:pds:context_bundle:Product_Bundle_Context_20111012.xml::1.0
INFO:   [/pds4/context_bundle/Product_Bundle_Context.xml] Product has the following GUID: urn:uuid:554175b2-30d6-4465-adf3-795c1c59cf27
INFO:   [/pds4/context_bundle/context_dataset/collection_context_dataset.xml] Begin processing.
INFO:   [/pds4/context_bundle/context_dataset/collection_context_dataset.xml] No associations found.
INFO:   [/pds4/context_bundle/context_dataset/collection_context_dataset.xml] Captured file information for collection_context_dataset_20111012.xml
INFO:   [/pds4/context_bundle/context_dataset/collection_context_dataset.xml] Capturing file object metadata for manifest_data_set_20111012.tab
SUCCESS:   [/pds4/context_bundle/context_dataset/collection_context_dataset.xml] \
Successfully registered product: urn:nasa:pds:Collection_Context.dataset::1.0
INFO:   [/pds4/context_bundle/context_dataset/collection_context_dataset.xml] Product has the following GUID: urn:uuid:fd5eeaf9-2de7-4022-b440-88a2ac4a694b
SUCCESS:   [/pds4/context_bundle/context_dataset/collection_context_dataset.xml] \
Successfully registered product: urn:nasa:pds:Collection_Context.dataset:collection_context_dataset_20111012.xml::1.0
INFO:   [/pds4/context_bundle/context_dataset/collection_context_dataset.xml] Product has the following GUID: urn:uuid:6f180715-ccde-4a3d-9404-e5a1128a3ce7
SUCCESS:   [/pds4/context_bundle/context_dataset/collection_context_dataset.xml] \
Successfully registered product: urn:nasa:pds:Collection_Context.dataset:manifest_data_set_20111012.tab::1.0
INFO:   [/pds4/context_bundle/context_dataset/collection_context_dataset.xml] Product has the following GUID: urn:uuid:21a13088-b552-4df6-b855-28532c5e4a70

    ....
       
Summary:

14362 of 14362 file(s) processed, 0 skipped
28669 of 28701 products registered.
89025 of 89061 associations registered, 0 skipped


End of Log
     

Common Errors

Execution of the Harvest Tool may result in the following message appearing in the log:

INFO:   XML extractor set to the following default namespace: \
http://pds.nasa.gov/schema/pds4/pds
INFO:   [/pds4/VG2PLS_archive/Product_Archive_Bundle.xml] Begin processing.
SKIP:   [/pds4/VG2PLS_archive/Product_Archive_Bundle.xml] No product_class \
element found.
      

The message above is normally the result of a namespace mismatch between the Harvest Tool configuration and the product labels being registered. See the PDS4 Data Product Registration section above for details on specifying the namespace in the configuration file. By the way, the message could be telling the truth where the product label does not contain the <product_class> element. If this is the case, then the file is not a valid PDS product label.


FirstGov Logo
+ Freedom of Information Act
+ NASA 2003 Strategic Plan
+ NASA Privacy Statement, Disclaimer, and
   Accessiblity Certification

+ Copyright/Image Use Policy
NASA Logo
Curator: Emily.S.Law
Webmaster: Maryia Sauchanka-Davis
NASA Official: William Knopf
Last Updated:
+ Comments and Questions