• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pkiraly / metadata-qa-marc / #1527

22 Aug 2025 02:21PM UTC coverage: 90.345%. Remained the same
#1527

push

pkiraly
Improve timeline handling

5191 of 6416 new or added lines in 219 files covered. (80.91%)

886 existing lines in 78 files now uncovered.

36717 of 40641 relevant lines covered (90.34%)

0.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/main/java/de/gwdg/metadataqa/marc/analysis/functional/UnimarcFunctionalAnalyzer.java
1
package de.gwdg.metadataqa.marc.analysis.functional;
2

3
import de.gwdg.metadataqa.marc.MarcSubfield;
4
import de.gwdg.metadataqa.marc.dao.DataField;
5
import de.gwdg.metadataqa.marc.dao.record.BibliographicRecord;
6
import de.gwdg.metadataqa.marc.dao.record.UnimarcRecord;
7
import de.gwdg.metadataqa.marc.definition.FRBRFunction;
8
import de.gwdg.metadataqa.marc.definition.structure.DataFieldDefinition;
9
import de.gwdg.metadataqa.marc.utils.FunctionValue;
10

11
import java.util.HashMap;
12
import java.util.Map;
13
import java.util.logging.Logger;
14

15
/**
16
 * Analyzes a UNIMARC record and counts the FRBR functions. In other words, it counts how many FRBR user tasks are
17
 * supported by the provided record.
18
 */
19
public class UnimarcFunctionalAnalyzer extends FunctionalAnalyzer {
20

21
  private static final Logger logger = Logger.getLogger(UnimarcFunctionalAnalyzer.class.getCanonicalName());
1✔
22

23
  public UnimarcFunctionalAnalyzer(FrbrFunctionLister frbrFunctionLister) {
24
    super(frbrFunctionLister);
1✔
25
  }
1✔
26

27
  @Override
28
  protected void analyzeRecord(BibliographicRecord bibliographicRecord) {
29

30
    if (!(bibliographicRecord instanceof UnimarcRecord)) {
1✔
NEW
31
      logger.severe("The provided record is not a UNIMARC record. The analysis will not be performed.");
×
NEW
32
      return;
×
33
    }
34

35
    UnimarcRecord unimarcRecord = (UnimarcRecord) bibliographicRecord;
1✔
36

37
    Map<DataFieldDefinition, Boolean> cache = new HashMap<>();
1✔
38

39
    // Count functions for the data fields
40
    countDataFields(recordCounter, unimarcRecord.getDatafields(), cache);
1✔
41

42
  }
1✔
43

44
  @Override
45
  protected void countDataField(DataFieldDefinition definition,
46
                                DataField dataField,
47
                                Map<FRBRFunction, FunctionValue> recordCounter) {
48

49
    for (MarcSubfield subfield : dataField.getSubfields()) {
1✔
50
      String key = dataField.getTag() + "$" + subfield.getCode();
1✔
51
      if (frbrFunctionLister.getFunctionByPath().containsKey(key)) {
1✔
52
        countFunctions(frbrFunctionLister.getFunctionByPath().get(key), recordCounter);
1✔
53
      }
54
    }
1✔
55
  }
1✔
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc