Skip to content

Commit

Permalink
Extend migration of MARC authority record definition to Avram (#370) (#…
Browse files Browse the repository at this point in the history
…380)

* Avram schema: Rename 'leader' to 'LDR' (#370)

* Avram schema: Remove 'static' (#370)

* Avram schema: Rename 'value' to 'code' (#370)
  • Loading branch information
nichtich authored Dec 11, 2023
1 parent a2920c0 commit 72c30d8
Show file tree
Hide file tree
Showing 2 changed files with 1,746 additions and 3,382 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public class AvramMarc21SchemaReader {
private static final Map<String, Integer> knownFieldProperties = Map.of(
"label", 1, "repeatable", 1, "indicators", 1, "subfields", 1, "positions", 1);
private static final Map<String, Integer> knownSubfieldProperties = Map.of(
"label", 1, "repeatable", 1, "static", 1, "codes", 1);
"label", 1, "repeatable", 1, "codes", 1);
private static final Map<String, Integer> knownSubfieldCodeProperties = Map.of(
"label", 1, "value",1);
"label", 1, "code",1);
private static final Map<String, Integer> knownIndicatorProperties = Map.of(
"label", 1, "codes",1);
private JSONParser parser = new JSONParser(JSONParser.MODE_RFC4627);
Expand Down Expand Up @@ -85,8 +85,11 @@ private void process(JSONObject jsonObject) throws IOException, ParseException,
if (!knownFieldProperties.containsKey(property))
logger.warning("unhandled field property: " + property);
}
if (id.equals("008") || id.equals("leader"))
if (id.equals("008") || id.equals("LDR")) {
tag = new DefaultControlFieldDefinition((Marc21DataFieldDefinition) tag);
if (id.equals("LDR"))
id = "leader";
}

if (!map.containsKey(id))
map.put(id, tag);
Expand Down Expand Up @@ -211,8 +214,8 @@ private List<EncodedValue> processStaticValues(Object staticValuesObject) {
String code = codeEntry.getKey();
if (codeEntry.getValue() instanceof JSONObject) {
JSONObject property = (JSONObject) codeEntry.getValue();
if (!code.equals(property.get("value")))
logger.warning(String.format("code is different to code value: %s vs %s", code, (String)property.get("value")));
if (!code.equals(property.get("code")))
logger.warning(String.format("code is different to code value: %s vs %s", code, (String)property.get("coden")));
else
list.add(new EncodedValue(code, (String) property.get("label")));
for (String key : property.keySet()) {
Expand Down
Loading

0 comments on commit 72c30d8

Please sign in to comment.