Class FunctionalAnalyzer
java.lang.Object
de.gwdg.metadataqa.marc.analysis.functional.FunctionalAnalyzer
- Direct Known Subclasses:
Marc21FunctionalAnalyzer,PicaFunctionalAnalyzer,UnimarcFunctionalAnalyzer
Analyzes a record and counts the FRBR functions. In other words, it counts how many FRBR user tasks are
supported by the provided record.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FrbrFunctionListerprotected Map<FRBRFunction,FunctionValue> The map with the counts of the FRBR functions (user tasks) in one single record. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFunctionalAnalyzer(FrbrFunctionLister frbrFunctionLister) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRecordCounterToCollector(Map<FRBRFunction, FunctionValue> recordCounter) Adds the recordCounter to the collector.voidaddRecordCounterToHistogram(Map<FRBRFunction, FunctionValue> recordCounter) protected abstract voidanalyzeRecord(BibliographicRecord bibliographicRecord) Should be implemented to analyze a record and count the FRBR functions.voidcalculatePercentage(Map<FRBRFunction, FunctionValue> recordCounter) Calculates the percentage of each function in the recordCounter map compared to the total count of functions possible in the schema, represented by the baselineCounter of the frbrFunctionLister.voidconsumeRecord(BibliographicRecord bibliographicRecord) Consumes a bibliographic record.protected abstract voidcountDataField(DataFieldDefinition definition, DataField dataField, Map<FRBRFunction, FunctionValue> recordCounter) protected final voidcountDataFields(Map<FRBRFunction, FunctionValue> functionCounter, List<DataField> dataFields, Map<DataFieldDefinition, Boolean> cache) static voidcountFunctions(List<FRBRFunction> functions, Map<FRBRFunction, FunctionValue> recordCounter) Receives a list of functions (presumably from a data field, subfield or indicator) and counts them in the recordCounter map.protected final Map<FRBRFunction,FunctionValue> Used to initialize a counter map with all FRBR functions and their respective values.percentOf(int total) protected void
-
Field Details
-
recordCounter
The map with the counts of the FRBR functions (user tasks) in one single record. -
frbrFunctionLister
-
-
Constructor Details
-
FunctionalAnalyzer
-
-
Method Details
-
consumeRecord
Consumes a bibliographic record. Calls the abstract method analyzeRecord() to analyze the record and count the FRBR functions. Then, it adds the recordCounter to the collector and histogram maps.- Parameters:
bibliographicRecord- The record to be analyzed and counted.
-
analyzeRecord
Should be implemented to analyze a record and count the FRBR functions. It should create the recordCounter map and return it. It is used in the method consumeRecord().- Parameters:
bibliographicRecord- The record to be analyzed and counted.
-
countDataField
protected abstract void countDataField(DataFieldDefinition definition, DataField dataField, Map<FRBRFunction, FunctionValue> recordCounter) -
countDataFields
protected final void countDataFields(Map<FRBRFunction, FunctionValue> functionCounter, List<DataField> dataFields, Map<DataFieldDefinition, Boolean> cache) -
initializeCounter
Used to initialize a counter map with all FRBR functions and their respective values. This is intended to be used for the recordCounter and collector maps.- Returns:
- A map with all FRBR functions and their respective values.
-
prepareHistogram
protected void prepareHistogram() -
countFunctions
public static void countFunctions(List<FRBRFunction> functions, Map<FRBRFunction, FunctionValue> recordCounter) Receives a list of functions (presumably from a data field, subfield or indicator) and counts them in the recordCounter map.- Parameters:
functions- The list of functions to be counted.recordCounter- The map where the functions will be counted. Format: Function -> FunctionValue (count and percentage).
-
calculatePercentage
Calculates the percentage of each function in the recordCounter map compared to the total count of functions possible in the schema, represented by the baselineCounter of the frbrFunctionLister.- Parameters:
recordCounter- The map with the counts of the FRBR functions of the current record.- See Also:
-
addRecordCounterToCollector
Adds the recordCounter to the collector. The collector is a map that stores counts from all records.- Parameters:
recordCounter- The map with the counts of the FRBR functions.
-
addRecordCounterToHistogram
-
percentOf
-
getCollector
-
getHistogram
-
getFrbrFunctionLister
-