Class InvertedIndexProcessor
java.lang.Object
org.dspace.importer.external.metadatamapping.contributor.AbstractJsonPathMetadataProcessor
org.dspace.importer.external.metadatamapping.contributor.InvertedIndexProcessor
- All Implemented Interfaces:
JsonPathMetadataProcessor
.
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.logging.log4j.LoggerProvides the logger for logging errors and messages.protected StringgetPath()Returns the JSONPath expression used for extracting values from JSON.protected StringgetStringValue(com.fasterxml.jackson.databind.JsonNode node) Extracts and processes metadata from a JSON node.voidMethods inherited from class org.dspace.importer.external.metadatamapping.contributor.AbstractJsonPathMetadataProcessor
processMetadata
-
Constructor Details
-
InvertedIndexProcessor
public InvertedIndexProcessor()
-
-
Method Details
-
getStringValue
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:
getStringValuein classAbstractJsonPathMetadataProcessor- 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:AbstractJsonPathMetadataProcessorProvides the logger for logging errors and messages. The implementation of this method must be provided by subclasses.- Specified by:
getLoggerin classAbstractJsonPathMetadataProcessor- Returns:
- A
Loggerinstance.
-
getPath
Description copied from class:AbstractJsonPathMetadataProcessorReturns the JSONPath expression used for extracting values from JSON. The implementation of this method must be provided by subclasses.- Specified by:
getPathin classAbstractJsonPathMetadataProcessor- Returns:
- A string representing the JSONPath expression.
-
setPath
-