Operation (PDS4)
This document describes how to operate the Harvest Tool software for use with PDS4 data product registration. The following topics can be found in this document:
Overview
Harvest Tool is a highly configurable flexible tool for ingesting metadata from PDS4 labels and products. However, due to it's highly configurable nature it is also very complex and has a fairly significant learning curve. This section will provide an overview of what is needed in order to get started.
Tutorial
The PDS Engineering Node website has a procedure for Data Releases at Discipline Nodes, which contains an example set for walking through the ingestion of some data into the Registry get a sense of how it works. If you would like to dive right in, continue on through the more detailed configuration and execution of the tool.
Quick Start
Move onto the Quick Start Guide for a background on configuring the policy files and executing Harvest.
Add New Search Fields to 'data' collection
Harvest and the Registry can be configured to add additional fields to the searchable "data" collection. The process can be cumbersome, so feel free to reach out to Engineering Node for assistance:
- Add a new slot to the applicable policy candidate
- Add a new field to the applicable Search API Config File
- Add a new field to the data schema throug the Solr Schema API or
Quick Start
This section is intended to give a quick and easy way to set up the Harvest policy configuration file and run the tool. For a more detailed explanation on other ways to set up the policy configuration file as well as other ways of running the tool, go to the Harvest Policy File and Advanced Usage sections.
Setup
Included in the Harvest package is a master policy example configuration file for PDS4 product registration. Go to the examples/ folder, make a copy of the harvest-policy-master.xml file and modify it as necessary.
Next, you can continue on to the Walk-Through to learn about the various sections of the config and how to modify them.
Or you can head to the Minimal Config section to make some minor mods to the config to get started testing.
Walk-Through
Collections
<collections> <file>$HOME/dph_example_archive_VG2PLS/browse/Collection_browse.xml</file> <file>$HOME/dph_example_archive_VG2PLS/context/Collection_context.xml</file> <file>$HOME/dph_example_archive_VG2PLS/data/Collection_data.xml</file> <file>$HOME/dph_example_archive_VG2PLS/document/Collection_document.xml</file> <file>$HOME/dph_example_archive_VG2PLS/xml_schema/Collection_xml_schema.xml</file> </collections>
Specify collection products here. This allows Harvest to be able to distinguish between primary members and secondary members of a collection while traversing a target directory.
Directories
<directories> <path>$HOME/dph_example_archive_VG2PLS</path> <fileFilter> <include>*.xml</include> </fileFilter> </directories>
Specify the top level directory for Harvest to crawl for products to register.
Access URLs
<accessUrls harvest:registerFileUrls="false"> <accessUrl> <baseUrl>http://starbase.jpl.nasa.gov</baseUrl> <offset>$HOME</offset> </accessUrl> </accessUrls>
Specify the base URL of where the physical data products are located. This allows Harvest to provide links to the physical data products in the slots of each registered product in the Registry.
For the example above, if a bundle is online at http://starbase.jpl.nasa.gov/dph_example_archive_VG2PLS/
And on the machine you are running Harvest, the path to that bundle is $HOME/dph_example_archive_VG2PLS/
In order for Harvest to registry this product with this URL, we need to specify what path offset
should be replaced with the baseUrl. In this case, the offset = $HOME, and the baseUrl is
http://starbase.jpl.nasa.gov .
Checksums
<checksums harvest:generate="true"> <manifest harvest:basePath="$HOME/dph_example_archive_VG2PLS"> $HOME/dph_example_archive_VG2PLS/bundle_checksums.txt </manifest> </checksums>
Specify a Checksum Manifest file. The basePath attribute is used to resolve relative file references, if found, within a Manifest file. If this attribute is not specified in the policy configuration file, the default behavior is to use the target directory as the base path. If there are multiple target directories specified, then it is required to explicitly specify a base path value in the policy.
With this configuration, Harvest will generate checksums for each file object to be registered and compare against the supplied checksums in the data product label as well as the manifest file.
Candidate Products
<candidates> ... <productMetadata harvest:objectType="Product_Browse"> <xPath harvest:slotName="information_model_version"> //Identification_Area/information_model_version </xPath> ... <candidates>
Specify any additional product types for Harvest to register here. Note that Harvest reads in an internal global policy config which already includes the following product types:
- Product_Attribute_Definition
- Product_Bundle
- Product_Class_Definition
- Product_Collection
- Product_Context
- Product_Data_Set_PDS3
- Product_Instrument_Host_PDS3
- Product_Instrument_PDS3
- Product_Mission_PDS3
- Product_Subscription_PDS3
- Product_Target_PDS3
- Product_Volume_PDS3
- Product_Volume_Set_PDS3
Additionally, the candidates section in this policy config example already specifies the following product types:
- Product_Browse
- Product_Document
- Product_File_Text
- Product_Observational
- Product_XML_Schema
For the Product_Observational area:
<productMetadata harvest:objectType="Product_Observational"> <!-- Identification_Area --> <xPath harvest:slotName="information_model_version"> //Identification_Area/information_model_version </xPath> <xPath harvest:slotName="product_class"> //Identification_Area/product_class </xPath> <xPath harvest:slotName="alternate_id"> //Identification_Area/Alias_List/Alias/alternate_id </xPath> <xPath harvest:slotName="alternate_title"> //Identification_Area/Alias_List/Alias/alternate_title </xPath> <xPath harvest:slotName="citation_author_list"> //Identification_Area/Citation_Information/author_list </xPath> ... </productMetadata>
add XPaths, as well as a meaningful slot name, for the <Discipline_Area> and <Mission_Area> metadata of interest to be included for every Product_Observational registration.
Note that the XPaths already defined in the example policy should not be modified as it allows the Registry to be populated with a consistent set of metadata for every product that is registered.
Namespaces
It is highly encouraged to define this in the policy when specifying XPaths to metadata that reside in a namespace other than the default PDS namespace. Doing so will make the policy more readable.
As an example, check out this PDS4 data product label here, which contains metadata within the <Discipline_Area> and <Mission_Area> sections that reside in namespaces other than the default PDS namespace. To extract metadata from these sections, do the following:
Set the namespaces in the candidates section of the policy config file:
<candidates> <namespace harvest:prefix="disp" harvest:uri="http://pds.nasa.gov/pds4/disp/v1"/> <namespace harvest:prefix="sp" harvest:uri="http://pds.nasa.gov/pds4/sp/v1"/> <namespace harvest:prefix="geom" harvest:uri="http://pds.nasa.gov/pds4/geom/v0"/> <namespace harvest:prefix="sbn" harvest:uri="http://pds.nasa.gov/pds4/sbn/v0"/> <namespace harvest:prefix="epoxi" harvest:uri="http://pds.nasa.gov/pds4/mission/epoxi/v0"/> ... </candidates>
Then add the additional XPaths to extract metadata within the <Discipline_Area> and <Mission_Area> sections from Product_Observational products:
<productMetadata harvest:objectType="Product_Observational"> ... <!-- Mission_Area metadata --> <xPath harvest:slotName="spacecraft_clock_start_count"> //Mission_Area/epoxi:EPOXI_Attributes/epoxi:Observation_Parameters/epoxi:spacecraft_clock_start_count </xPath> <xPath harvest:slotName="spacecraft_clock_stop_count"> //Mission_Area/epoxi:EPOXI_Attributes/epoxi:Observation_Parameters/epoxi:spacecraft_clock_stop_count </xPath> <xPath harvest:slotName="total_integration_time"> //Mission_Area/epoxi:EPOXI_Attributes/epoxi:Observation_Parameters/epoxi:total_integration_time </xPath> <!-- Discipline_Area metadata --> <xPath harvest:slotName="start_julian_date"> //Discipline_Area/sbn:Times/sbn:start_Julian_date </xPath> <xPath harvest:slotName="display_settings_local_reference_type"> //Discipline_Area/disp:Display_Settings/disp:Local_Internal_Reference/disp:local_reference_type </xPath> <xPath harvest:slotName="special_characteristics_local_identifier_reference"> //Discipline_Area/sp:Spectral_Characteristics/sp:local_identifier_reference </xPath> <xPath harvest:slotName="geometry_vertical_display_direction"> //Discipline_Area/geom:Geometry/geom:Image_Display_Geometry/geom:Display_Direction/disp:vertical_display_direction </xPath> </productMetadata> </candidates>
Note that the XPaths are utilizing the prefix values from the namespaces defined in the policy.
Minimal Config
To get data ingested into the Registry as soon as possible to start testing out the system, the only portion of your custom harvest-policy-master.xml file mentioned in the Setup section is the directories section. Modify that to point at a bundle/collection and you can test ingestion:
<directories> <path>$HOME/dph_example_archive_VG2PLS</path> <fileFilter> <include>*.xml</include> </fileFilter> </directories>
Running The Tool
The following command demonstrates the recommended way to run Harvest:
%> ./harvest -c ../conf/harvest/harvest-policy-master.xml -o $REGISTRY_HOME/../registry-data/solr-docs
Example summary output:
Summary: 15 of 15 file(s) processed, 3 other file(s) skipped 0 error(s), 0 warning(s) Product Labels: 15 Successfully registered 0 Failed to register Search Service Solr Documents: 15 Successfully created 0 Failed to get created XPath Solr Documents (Quick Look Only, Ignore Failed Ingestions): 15 Successfully registered 0 Failed to register Product Types Handled: 1 Product_Observational 5 Product_Collection 2 Product_Document 1 Product_Browse 3 Product_File_Text 2 Product_Context 1 Product_Bundle Registry Package Id: a942ad0d-ad42-4007-9733-d12c3e53049f End of Log
What Just Happened?
The above command will register the full product label and some associated archival metadata into the registry collection, and
all the XPaths of the label in the xpath collection.
What Next?
Next, ingest the metadata in the search-friendly, data collection using the Report Manager Tool (report-mgr).
For more information on the Registry and it's metadata stores (or collections), see the Registry Documentation.
Command-Line Options
The following table describes the command-line options available:
./harvest --help usage: harvest <options> -c,--harvest-config <file> Specify the harvest policy configuration file to set the tool behavior. (This flag is required) -C,--doc-config <dir> Specify the directory location where the document generation configuration files reside. The default is to look in the 'search-conf' directory that resides in the tool package -D,--ignore-dir <patterns> Specify patterns to look for when crawling a target directory for sub-directories to ignore. Each pattern should be surrounded by quotes. (i.e. -i "CATALOG") -e,--regexp <patterns> Specify file patterns to look for when crawling a target directory. Each pattern should be surrounded by quotes. (i.e. -e "*.xml") -h,--help Display usage. -l,--log-file <file name> Specify a log file name. Default is standard out. -o,--output-dir <dir> Specify a directory location to tell the tool where to output the Solr documents. The default is to write to the current working directory. -P,--port <number> Specify a port number to use if running the tool in persistance mode. -pds3,--is-pds3-dir Specify this flag to indicate that the target passed into the command-line is a PDS3 directory. The default assumes that any targets passed into the command line are PDS4 directories. -v,--verbose <level> Specify the severity level and above to include in the log: (0=Debug, 1=Info, 2=Warning, 3=Error). Default is Info and above (level 1). -V,--version Display application version. -w,--wait <seconds> Specify the wait time in seconds in between crawls if running in persistance mode
Advanced Usage
This section describes more advanced ways to run the tool, as well as its behaviors and caveats.
Tool Execution
The Harvest Tool operates with a policy file to register and index product metadata. Details on how to create this policy file can be found in the Harvest Policy File section.
This section demonstrates some of the other ways that the tool can be executed:
- Indexing more metadata
- Registering Products From Targets Specified In The Policy File
- Registering Products From a Single Target
- Registering Products From Multiple Targets
- Excluding Sub-Directories To Traverse From a Target
Indexing more metadata
What gets indexed into the Registry and Search indexes is determined by a set of document generation configuration files. In the majority of use-case scenarios, the default set of configuration files provided in the conf/search/defaults directory is sufficient and is included by default, however you can also specify other config to pass into the tool using the -C, --doc-config flag option like so:
% harvest $HOME/directory -e "*.xml" -c ../conf/harvest/harvest-policy-master.xml -l harvest.log
The Harvest Tool package provides examples of how other document generation configuration files were set up to ingest bundles from various missions. They can be found in the conf/search directory. The following command demonstrates registering and indexing the MAVEN NGIMS bundle and post to the data collection:
% ./harvest -c ../conf/harvest/harvest-policy-maven-ngims.xml -C ../conf/search/maven-ngims \ -o $REGISTRY_HOME/../registry-data -l ../harvest-maven-ngims.log % registry-mgr $REGISTRY_HOME/../registry-data
For more details on document generation configuration files, see the Search API Config Files Section.
Registering Products From Targets Specified In The Policy File
Targets can either be specified on the command-line or in in the policy file. Any targets specified on the command-line will overwrite any targets specified in the policy file. The following command demonstrates registering products based on targets specified in the policy file, policy.xml:
% ./harvest -c policy.xml
Registering Products From a Single Target
The following command demonstrates how to register products to a non-secured registry instance from a target directory, $HOME/directory, where only files that end with a .xml file extension, will be processed:
% ./harvest $HOME/directory -e "*.xml" -c policy.xml
Registering Products From Multiple Targets
The following command demonstrates how to register products to a non-secured registry instance from two target directories, $HOME/directory1 and $HOME/directory2, using the policy file, policy.xml. Only files that end with a .xml file extension will be processed. The output will go to a log file, log-file.txt:
% ./harvest $HOME/directory1, $HOME/directory2 -e "*.xml" -c policy.xml -l log-file.txt
Excluding Sub-Directories To Traverse From a Target
The following command demonstrates registering products from a target directory, $HOME/directory, where the tool will not traverse the sub-directory CONTEXT:
% ./harvest $HOME/directory -c policy.xml -D "CONTEXT"
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 9001, where it will wait 120 seconds in between crawls:
% ./harvest -c policy.xml -l log.txt -P 9001 -w 120
After running the above command, the daemon will be accessible at http://localhost:9001/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, harvest-ctrl, and a batch file, harvest-ctrl.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 harvest-ctrl:
Command-Line Option | Description |
---|---|
--url | Specify the URL of the daemon service running the Harvest Tool. |
--operation | Specify 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 Option | Description |
---|---|
--stop | Specify this operation to shut down the daemon service. |
--isRunning | Gives an indication whether the daemon service is running. |
--getNumCrawls | Returns the number of crawls that have occurred. |
--getWaitInterval | Returns the time, in seconds, that the crawler has to wait in between crawls. |
--getMilisCrawling | Returns the amount of milliseconds spent crawling. |
--getAverageCrawlTime | Returns the average amount of time, in milliseconds, spent during each crawl. |
The following examples demonstrate how to run harvest-ctrl using a few of the different operations. For demonstration purposes, assume that the daemon service is located at the following url: http://localhost:9001/xmlrpc.
Determine the Status of the Daemon Service
The following command is used to find out if the daemon service is still running:
% harvest-ctrl --url http://localhost:9001/xmlrpc --operation --isRunning
Shutdown the Daemon Service
The following command demonstrates shutting down the daemon service:
% harvest-ctrl --url http://localhost:9001/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. This section describes the valid elements that are available to setup the policy file to do PDS4 data product registration.
PDS4 Data Product Registration
The following is an example of a policy file to perform registration of PDS4 data products:
<policy> <registryPackage> <name>Harvest Package Example</name> <description>This is an example of a Harvest run.</description> </registryPackage> <collections> <file>$HOME/VG2PLS_archive/data/Collection_Data.xml</file> <file>$HOME/VG2PLS_archive/document/Collection_document.xml</file> </collections> <directories> <path>$HOME/VG2PLS_archive</path> <fileFilter> <include>*.xml</include> </fileFilter> <directoryFilter> <exclude>CONTEXT</exclude> </directoryFilter> </directories> <accessUrls harvest:registerFileUrls="true"> <accessUrl> <baseUrl>http://pds.nasa.gov/pds4</baseUrl> <offset>$HOME</offset> </accessUrl> </accessUrls> <checksums harvest:generate="true"> <manifest>$HOME/VG2PLS_archive/vg2pls_archive.md5</manifest> </checksums> <storageIngestion> <serverUrl>http://localhost:9000</serverUrl> </storageIngestion> <candidates> <namespace harvest:prefix="dph" harvest:uri="http://pds.nasa.gov/schema/pds4/dph/v01"/> <productMetadata objectType="Product_Document"> <xPath sharvest:lotName="information_model_version"> //Identification_Area/information_model_version </xPath> <xPath harvest:slotName="product_class"> //Identification_Area/product_class </xPath> <xPath harvest:slotName="alternate_id"> //Identification_Area/Alias_List/Alias/alternate_id </xPath> <xPath harvest:slotName="alternate_title"> //Identification_Area/Alias_List/Alias/alternate_title </xPath> <xPath harvest:slotName="citation_author_list"> //Identification_Area/Citation_Information/author_list </xPath> <xPath harvest:slotName="citation_editor_list"> //Identification_Area/Citation_Information/editor_list </xPath> <xPath harvest:slotName="citation_publication_year"> //Identification_Area/Citation_Information/publication_year </xPath> <xPath harvest:slotName="citation_keywords"> //Identification_Area/Citation_Information/keywords </xPath> <xPath harvest:slotName="citation_description"> //Identification_Area/Citation_Information/description </xPath> <xPath harvest:slotName="modification_date"> //Identification_Area/Modification_History/Modification_Detail/modification_date </xPath> <xPath harvest:slotName="modification_version_id"> //Identification_Area/Modification_History/Modification_Detail/version_id </xPath> <xPath harvest:slotName="modification_description"> //Identification_Area/Modification_History/Modification_Detail/description </xPath> <xPath harvest:slotName="external_reference_description"> //Reference_List/External_Reference/description </xPath> <xPath harvest:slotName="document_revision_id"> //Document_Description/revision_id </xPath> <xPath harvest:slotName="document_name"> //Document_Description/document_name </xPath> <xPath harvest:slotName="document_doi"> //Document_Description/doi </xPath> <xPath harvest:slotName="document_author_list"> //Document_Description/author_list </xPath> <xPath sharvest:lotName="document_editor_list"> //Document_Description/editor_list </xPath> <xPath harvest:slotName="document_acknowledgement_text"> //Document_Description/acknowledgement_text </xPath> <xPath harvest:slotName="document_copyright"> //Document_Description/copyright </xPath> <xPath harvest:slotName="document_description"> //Document_Description/description </xPath> <xPath harvest:slotName="document_publication_date"> //Document_Description/publication_date </xPath> </productMetadata> <productMetadata objectType="Product_Observational"> <xPath harvest:slotName="information_model_version"> //Identification_Area/information_model_version </xPath> <xPath harvest:slotName="product_class"> //Identification_Area/product_class </xPath> <xPath harvest:slotName="alternate_id"> //Identification_Area/Alias_List/Alias/alternate_id </xPath> <xPath harvest:slotName="alternate_title"> //Identification_Area/Alias_List/Alias/alternate_title </xPath> <xPath harvest:slotName="citation_author_list"> //Identification_Area/Citation_Information/author_list </xPath> <xPath harvest:slotName="citation_editor_list"> //Identification_Area/Citation_Information/editor_list </xPath> <xPath harvest:slotName="citation_publication_year"> //Identification_Area/Citation_Information/publication_year </xPath> <xPath harvest:slotName="citation_keywords"> //Identification_Area/Citation_Information/keywords </xPath> <xPath harvest:slotName="citation_description"> //Identification_Area/Citation_Information/description </xPath> <xPath harvest:slotName="modification_date"> //Identification_Area/Modification_History/Modification_Detail/modification_date </xPath> <xPath slotName="modification_version_id"> //Identification_Area/Modification_History/Modification_Detail/version_id </xPath> <xPath harvest:slotName="modification_description"> //Identification_Area/Modification_History/Modification_Detail/description </xPath> <xPath harvest:slotName="observation_comment"> //Observation_Area/comment </xPath> <xPath harvest:slotName="observation_start_date_time"> //Observation_Area/Time_Coordinates/start_date_time </xPath> <xPath harvest:slotName="observation_stop_date_time"> //Observation_Area/Time_Coordinates/stop_date_time </xPath> <xPath harvest:slotName="observation_local_mean_solar_time"> //Observation_Area/Time_Coordinates/local_mean_solar_time </xPath> <xPath harvest:slotName="observation_local_true_solar_time"> //Observation_Area/Time_Coordinates/local_true_solar_time </xPath> <xPath harvest:slotName="observation_solar_longitute"> //Observation_Area/Time_Coordinates/solar_longitude </xPath> <xPath harvest:slotName="primary_result_type"> //Observation_Area/Primary_Result_Description/type </xPath> <xPath harvest:slotName="primary_result_purpose"> //Observation_Area/Primary_Result_Description/purpose </xPath> <xPath harvest:slotName="primary_result_data_regime"> //Observation_Area/Primary_Result_Description/data_regime </xPath> <xPath harvest:slotName="primary_result_reduction_level"> //Observation_Area/Primary_Result_Description/reduction_level </xPath> <xPath harvest:slotName="primary_result_description"> //Observation_Area/Primary_Result_Description/description </xPath> <xPath harvest:slotName="investigation_name"> //Observation_Area/Investigation_Area/name </xPath> <xPath harvest:slotName="investigation_type"> //Observation_Area/Investigation_Area/type </xPath> <xPath harvest:slotName="observing_system_name"> //Observation_Area/Observing_System/name </xPath> <xPath harvest:slotName="observing_system_description"> //Observation_Area/Observing_System/description </xPath> <xPath harvest:slotName="observing_system_component_name"> //Observation_Area/Observing_System/Observing_System_Component/name </xPath> <xPath harvest:slotName="observing_system_component_description"> //Observation_Area/Observing_System/Observing_System_Component/description </xPath> <xPath harvest:slotName="observing_system_component_type"> //Observation_Area/Observing_System/Observing_System_Component/\ observing_system_component_type </xPath> <xPath harvest:slotName="target_name"> //Observation_Area/Target_Identification/name </xPath> <xPath harvest:slotName="target_alternate_designation"> //Observation_Area/Target_Identification/alternate_designation </xPath> <xPath harvest:slotName="target_type"> //Observation_Area/Target_Identification/type </xPath> <xPath harvest:slotName="target_description"> //Observation_Area/Target_Identification/description </xPath> <xPath harvest:slotName="spacecraft_clock_start_count"> //Observation_Area/Mission_Area/dph:spacecraft_clock_start_count </xPath> <xPath harvest:slotName="spacecraft_clock_stop_count"> //Observation_Area/Mission_Area/dph:spacecraft_clock_stop_count </xPath> <xPath harvest:slotName="external_reference_description"> //Reference_List/External_Reference/description </xPath> </productMetadata> </candidates> </policy>
The policy file is made up of the following complex type elements: registryPackage, collections, directories, checksums, storageIngestion, accessUrls, candidates, and productMetadata.
registryPackage
Each time the Harvest Tool runs, it creates a package in the registry to group the product registrations together. Specify this element to give a registry package a name and/or description. The following table describes the elements that are allowed:
Element Name | Description |
---|---|
name | Specify a package name. If this element is not specified, the default is to create a package with the name Harvest-Package_<current datetimestamp>. |
description | Specify a package description. If this element is not specified, the default is to create a description that lists the targets that were specified in the policy config file. |
collections
Specify this element to tell the Harvest Tool to register the collections first before crawling a target directory. This is required if the target directory contains collections that are co-located with its members and in order to distinguish primary versus secondary members.
The following table describes the elements that are allowed:
Element Name | Description |
---|---|
file | Specify 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 following collections before crawling the target directory:
- $HOME/VG2PLS_archive/data/Collection_Data.xml
- $HOME/VG2PLS_archive/document/Collection_document.xml
Once these collections are registered, the primary and secondary members are cached in memory and as the Harvest Tool crawls through a target directory, any secondary members will be identified and will not be registered. In addition, a SKIP message will be issued in the log report to indicate that the tool has identified a non-primary member.
In the case where the target directory consists of a hierarchy structure where the collection product is located one-level above its members, much like the PDS context bundle, then there is no need to specify the collections in the Harvest policy config file. Under this scenario, the collections will be registered first before the Harvest Tool traverses down the sub-directory containing the members.
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 Name | Description |
---|---|
path | Specify a directory path to start crawling. Specify this element tag more than once to point to multiple directories to crawl. |
fileFilter | Specify one or more include elements, where each element value contains a pattern to look for when crawling a target directory for files to register. If omitted, the default is to get all files within a directory. |
directoryFilter | Specify one or more exclude elements, where each element value contains a pattern to look for when crawling a target directory for sub-directories to ignore. |
In the example above, the Harvest tool will crawl the directory location, $HOME/VG2PLS_archive, 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. In addition, the CONTEXT directory will be ignored while traversing the target directory.
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. An optional attribute can be specified named registerFileUrls, which if set to true, will create file url links.
The accessUrls element can contain multiple accessUrl element tags. The following table describes the elements that are allowed within the accessUrl tag:
Element Name | Description |
---|---|
baseUrl | Specify a base url. |
offset | Optionally specify an offset to nix from the absolute path of each product before appending it to the base url. Can be specified more than once. |
In the policy example above, the Harvest Tool will nix any absolute path of a product starting with $HOME before appending it to the starting base url of http://pds.nasa.gov/pds4. The following example demonstrates what the resulting access url will be for a registered product located at $HOME/VG2PLS_archive/browse/Collection_Browse.xml:
http://pds.nasa.gov/pds4/VG2PLS_archive/browse/Collection_Browse.xml
checksums
Checksum generation is turned off by default in the Harvest Tool. In order to turn this on, set the generate attribute to true. The following table describes the elements that are allowed within the checksum tag:
Element Name | Description |
---|---|
manifest | Specify a checksum manifest file. Can be specified more than once. |
The following describes the tool behavior based on the different checksum settings:
Checksum Manifest File Provided and Generate Flag Set To true
Harvest will generate a checksum for each file encountered and verify it against the supplied checksum file. If the data file checksum was supplied in the label, Harvest will verify it as well. A warning message will be issued in the log report if a mismatch occurs. In any case, the generated checksum value is included in the associated Product_File_Repository product.
Checksum Manifest File Provided and Generate Flag Set To False (or not set at all)
Harvest will not generate checksums, but will use the value from the checksum manifest file to populate the associated Product_File_Repository product. If a data file checksum was supplied in the label, compare the value from the manifest against the value supplied in the label and issue a warning if there is a mismatch.
Checksum Manifest File Not Provided and Generate Flag Set To True
Harvest will generate a checksum for each file encountered and verify it against an optional checksum supplied in the label. If there is a mismatch, a warning message will be issued in the log report. The generated value is included in the associated Product_File_Repository product.
Checksum Manifest File Not Provided and Generate Flag Set To False
Harvest will not generate checksums. If the data file checksum was supplied in the label, populate the associated Product_File_Repository product with that value.
storageIngestion
Specify this element to tell the Harvest Tool to ingest data products to the PDS Storage Service. The following table describes the elements that are allowed:
Element Name | Description |
---|---|
serverUrl | Specify 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.
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 Name | Description |
---|---|
namespace | Specify to allow the Harvest Tool to extract metadata that is in a namespace other than the default PDS namespace. |
productMetadata | Specify 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. To override this default, specify the default attribute in the namespace element and give it a value of true. The following sets the dph namespace to be the default namespace in Harvest:
<candidates> <namespace harvest:prefix="dph" harvest:uri="http://pds.nasa.gov/schema/pds4/dph/v01" harvest: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 dph and uri http://pds.nasa.gov/schema/pds4/dph/v01 has been defined. This means that any xPath expressions defined in the policy file will be able to use the dph prefix to be able to extract metadata that are within the dph 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 Name | Description |
---|---|
xPath | Specify an XPath expression to extract metadata. |
In the example above, the policy file tells the Harvest Tool to look for and register the Product_Document and Product_Observational 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 start_date_time element within the default namespace, no matter where this element is located in the file:
//start_date_time
The following XPath expression will find the spacecraft_clock_start_count element within the dph namespace, no matter where this element is located in the file:
//dph:spacecraft_clock_start_count
The following XPath expression will find all information_model_version elements that are children of Identification_Area within the default namespace:
//Identification_Area/information_model_version
The following XPath expression will find all name elements that are children of Target_Identification and that have a value of MARS:
//Target_Identification/name[text()="MARS"]
For a more detailed explanation on XPath, go to your favorite search engine and type XPath tutorial.
The slotName attribute within the xPath element allows the renaming of metadata element names when they are registered as slots in the registry. By default, the slot name is set to the element name that results from an xpath expression. For example, for the xpath expression, //Target_Identification/name, the slot name will be set to name.
The following demonstrates setting the policy file to find any name elements that are children of Target_Identification and setting the slot name to target_identification_name:
<xPath harvest:slotName="target_identification_name">//Target_Identification/name</xPath>
Search API Config Files
The Search API XML configuration files include query information, data source specifications, and the fields to be included in the index. The following sections will outline the basic schema for creating a configuration file. Once a configuration file has been created, you can specify its location using the -C command-line option.
Defaults
Default configurations are provided for the following data types (assumes Harvest is installed at /usr/local/harvest, if not, update the file paths as needed):
File Name | Product Class |
---|---|
PDS4 Products (/usr/local/harvest/conf/search/defaults/pds/pds4) | |
attribute.xml | Product_Attribute_Definition |
bundle.xml | Product_Bundle |
class.xml | Product_Class_Definition |
collection.xml | Product_Collection |
context.xml | Product_Context |
document.xml | Product_Document |
observational.xml | Product_Observational |
service.xml | Product_Service |
Format
The following is an example snippet of one of the Search Core configuration files:
<?xml version="1.0" encoding="UTF-8"?> <product> <specification> <title>PDS4-Observational</title> <query> <registryPath>objectType</registryPath> <value>Product_Observational</value> </query> <query> <registryPath>status</registryPath> <value>Approved</value> </query> <checkAssociations>true</checkAssociations> </specification> <indexFields> <!-- Identifier Fields --> <field name="search_id" type="required"> <outputString format="text">pds4:{lid}</outputString> </field> <field name="identifier" type="required"> <registryPath>lid</registryPath> </field> <field name="version_id" type="string"> <registryPath>version_id</registryPath> </field> ... </indexFields> </product>
Specifying Resources
The resources/ folder in the Harvest Tool Release Package contains a JSON-formatted file that represents a snapshot of the Resource Products currently registerd at the PDS Engineering Node. This file is read in at execution time so that the tool can populate the resource.* fields set in the Search Core configuration files. Below is an example of how a resource is formatted in this file:
"urn:nasa:pds:context:resource:resource.a17fuvs_online": { "resource_name": "Apollo 17 Far-Ultraviolet Spectrometer (FUVS) Data Graphs Bundle Archive Online", "resource_url": "http://pds-geosciences.wustl.edu/lunar/urn-nasa-pds-a17fuvs/" }
urn:nasa:pds:context:resource:resource.a17fuvs_online represents the LID of the Resource, while resource_name and resource_url is the name to give to the Resource and the URL, respectively. In the event that your particular resource does not exist, simply edit the resources/registered_resources.json file and add to the existing list in ths above format.
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.4.0 Time Thu, Feb 07 2019 at 10:27:08 AM Target(s) [/Users/mcayanan/pds4/V1900/dph_example_archive] File Inclusions [*.xml] Severity Level INFO Config directory ../conf/search/defaults Output directory /Users/mcayanan/harvest-0.4.0-dev/bin/solr-docs INFO: XML extractor set to the following default namespace: http://pds.nasa.gov/pds4/pds/v1 INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/data_eetable/collection_eetable_inventory.xml] \ Begin processing. INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/data_eetable/collection_eetable_inventory.xml] \ Mapping reference type 'inventory_has_member_product' to 'member_ref'. INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/data_eetable/collection_eetable_inventory.xml] \ line 42: Mapping reference type 'collection_to_investigation' to 'investigation_ref'. INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/data_eetable/collection_eetable_inventory.xml] \ line 52: Mapping reference type 'is_instrument_host' to 'instrument_host_ref'. . . . INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/data_imagecube/collection_imagecube_inventory.xml] \ Setting LIDVID-based association, 'urn:nasa:pds:izenberg_pdart14_meap:data_imagecube:virs_cube_64ppd_h02nw::1.0', under slot name 'member_ref'. INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/data_imagecube/collection_imagecube_inventory.xml] \ Setting LIDVID-based association, 'urn:nasa:pds:izenberg_pdart14_meap:data_imagecube:virs_cube_64ppd_h02se::1.0', under slot name 'member_ref'. INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/data_imagecube/collection_imagecube_inventory.xml] \ Setting LIDVID-based association, 'urn:nasa:pds:izenberg_pdart14_meap:data_imagecube:virs_cube_64ppd_h02sw::1.0', under slot name 'member_ref'. INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/data_imagecube/collection_imagecube_inventory.xml] \ Setting LIDVID-based association, 'urn:nasa:pds:izenberg_pdart14_meap:data_imagecube:virs_cube_64ppd_h03ne::1.0', under slot name 'member_ref'. INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/bundle_izenberg_pdart14_meap.xml] \ line 40: Mapping reference type 'bundle_to_investigation' to 'investigation_ref'. INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/bundle_izenberg_pdart14_meap.xml] \ line 50: Mapping reference type 'is_instrument_host' to 'instrument_host_ref'. INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/bundle_izenberg_pdart14_meap.xml] \ line 58: Mapping reference type 'is_instrument' to 'instrument_ref'. . . . Setting LID-based association, 'urn:nasa:pds:context:target:planet.mercury', under slot name 'target_ref'. INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/document/meap_spec.xml] \ Capturing file information for meap_spec.xml INFO: [/Users/mcayanan/pds4/V1900/dph_example_archive/document/meap_spec.xml] \ Capturing file object metadata for meap_spec.pdf . . . Summary: 16 of 16 file(s) processed, 1 other file(s) skipped 0 error(s), 0 warning(s) Product Labels: 16 Successfully registered 0 Failed to register Search Service Solr Documents: 16 Successfully created 0 Failed to get created Product Types Handled: 4 Product_Collection 5 Product_Observational 6 Product_Document 1 Product_Bundle Registry Package Id: e297e819-1fb9-4e96-96d3-ce0c6bce3565 End of Log
Common Errors
Namespace Mismatch Error
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_Bundle.xml] Begin processing. SKIP: [/pds4/VG2PLS_archive/Product_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.
Illegal Reflective Access Operation Warning
Execution of the Harvest Tool may result in the following message appearing after execution starts:
WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.sun.xml.bind.v2.runtime.reflect.opt.Injector$1 (file:/Users/jpadams/test/harvest-2.0.0/lib/jaxb-impl-2.2.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) WARNING: Please consider reporting this to the maintainers of com.sun.xml.bind.v2.runtime.reflect.opt.Injector$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release
These WARNING messages appear if the software is run with Java versions 9+. Although they are nuisance, they will not negatively impact your Harvest run.
Failed XPath Ingestion
Execution of the Harvest Tool may result in the following message appearing in the log:
TBD
TBD