Class InvertedIndexProcessor

java.lang.Object
org.dspace.importer.external.metadatamapping.contributor.AbstractJsonPathMetadataProcessor
org.dspace.importer.external.metadatamapping.contributor.InvertedIndexProcessor
All Implemented Interfaces:
JsonPathMetadataProcessor

public class InvertedIndexProcessor extends AbstractJsonPathMetadataProcessor
. The InvertedIndexProcessor is a JsonPathMetadataProcessor implementation that processes JSON metadata by extracting an inverted index of words based on their positions in a given JSON structure. The words are then concatenated into a single string, ordered by their positional values.

It extends AbstractJsonPathMetadataProcessor to utilize JSONPath-based extraction and integrates with DSpace metadata handling.

Usage:

 
 <bean id="someProcessor" class="org.dspace.importer.external.openalex.metadatamapping.InvertedIndexProcessor">
     <property name="path" value="/some/json/path"/>
 </bean>
 
 
Author:
Adamo Fapohunda (adamo.fapohunda at 4science.com)
  • Constructor Details

    • InvertedIndexProcessor

      public InvertedIndexProcessor()
  • Method Details

    • getStringValue

      protected String getStringValue(com.fasterxml.jackson.databind.JsonNode node)
      Extracts and processes metadata from a JSON node. This method retrieves a mapping of words to their respective positions, sorts them based on their position, and returns a concatenated string representing the correctly ordered sequence of words.
      Specified by:
      getStringValue in class AbstractJsonPathMetadataProcessor
      Parameters:
      node - the JSON node containing metadata
      Returns:
      a space-separated string of words ordered by position, or an empty string if input is null/empty
    • getLogger

      protected org.apache.logging.log4j.Logger getLogger()
      Description copied from class: AbstractJsonPathMetadataProcessor
      Provides the logger for logging errors and messages. The implementation of this method must be provided by subclasses.
      Specified by:
      getLogger in class AbstractJsonPathMetadataProcessor
      Returns:
      A Logger instance.
    • getPath

      protected String getPath()
      Description copied from class: AbstractJsonPathMetadataProcessor
      Returns the JSONPath expression used for extracting values from JSON. The implementation of this method must be provided by subclasses.
      Specified by:
      getPath in class AbstractJsonPathMetadataProcessor
      Returns:
      A string representing the JSONPath expression.
    • setPath

      public void setPath(String path)