diff --git a/bibliotheca/Taskfile.yml b/bibliotheca/Taskfile.yml index 11427e0..3cf3448 100644 --- a/bibliotheca/Taskfile.yml +++ b/bibliotheca/Taskfile.yml @@ -111,10 +111,10 @@ tasks: "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/ebooks.json > {{.LOG}} - > # spec_Z_02: Zeitschriften und Reihen löschen; siehe auch Spezifikation in CBS-Titeldaten Bibliotheca "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/zeitschriften.json > {{.LOG}} - - > # spec_B_T_32: MTM Überordnungen löschen, wenn keine Unterordnung mit BANDB/BANDN über NRPRE darauf verweist; erstellt Felder "ueber" und "unter"; siehe auch Spezifikation in CBS-Titeldaten Bibliotheca - "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/nrpre.json > {{.LOG}} - > # Bibliothekskürzel aus Import-Dateiname "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/file.json > {{.LOG}} + - > # spec_B_T_32: MTM Überordnungen löschen, wenn keine Unterordnung mit BANDB/BANDN über NRPRE darauf verweist; erstellt Felder "id", "ueber" und "unter"; siehe auch Spezifikation in CBS-Titeldaten Bibliotheca + "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/nrpre.json > {{.LOG}} - > # spec_B_T_01: PPNs in 0100 (K10plus) und 0110 (SWB); 8-stellige aus Dresden sind SWN ohne Prüfziffer, dort wird Prüfziffer ergänzt; Zuordnung 9-stellige abhängig von ersten Zeichen und M026 / M026k; Zuordnung 10-stellige abhängig von erstem Zeichen "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/0100-0110.json > {{.LOG}} - > # spec_B_T_49: Nummern aus Datenkonversion 2199 @@ -200,6 +200,12 @@ tasks: "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/3210.json > {{.LOG}} - > # spec_B_T_48: Lokale Systematik in 67XX (Exemplarsatz!) für BB, BZ, GC "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/67XX.json > {{.LOG}} + - > # spec_B_T_33: MTM: Leerexemplare in Überordnungen mit E0XX und 7100; abhängig von Feld "0500" aus spec_B_T_56_2 + "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/mtm-leerexemplare.json > {{.LOG}} + - > # spec_B_T_34: MTM: Anreicherungen der Unterordnungen mit 4150 und 4160; abhängig von Feld "ueber" aus spec_B_T_32 + "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/4150-4160.json > {{.LOG}} + - > # spec_B_T_35: Schriftrenreihen: GT-Felder für Reihenstücktitel in 4170 +#TODO "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/4170.json > {{.LOG}} # Die folgende Transformationsregel muss direkt vor dem Export stehen - > # Abschließend Titel ohne Exemplare löschen "$CLIENT" -P {{.PORT}} {{.PROJECT}} --apply config/main/abschluss.json > {{.LOG}} diff --git a/bibliotheca/config/main/3000-3010.json b/bibliotheca/config/main/3000-3010.json index 533d5a3..555f8ee 100644 --- a/bibliotheca/config/main/3000-3010.json +++ b/bibliotheca/config/main/3000-3010.json @@ -359,8 +359,8 @@ "expression": "grel:[ cells['M|VERF1'].value, cells['M|VERF2'].value, cells['M|VERF3'].value, cells['M|PERS1'].value, cells['M|PERS2'].value, cells['M|PERS3'].value, cells['M|PERS4'].value, cells['M|PERS5'].value ].join('␟')", "onError": "set-to-blank", "newColumnName": "tmp", - "columnInsertIndex": 103, - "description": "Create column tmp at index 103 based on column M|VERF1 using expression grel:[ cells['M|VERF1'].value, cells['M|VERF2'].value, cells['M|VERF3'].value, cells['M|PERS1'].value, cells['M|PERS2'].value, cells['M|PERS3'].value, cells['M|PERS4'].value, cells['M|PERS5'].value ].join('␟')" + "columnInsertIndex": 3, + "description": "Create column tmp at index 3 based on column M|VERF1 using expression grel:[ cells['M|VERF1'].value, cells['M|VERF2'].value, cells['M|VERF3'].value, cells['M|PERS1'].value, cells['M|PERS2'].value, cells['M|PERS3'].value, cells['M|PERS4'].value, cells['M|PERS5'].value ].join('␟')" }, { "op": "core/text-transform", @@ -385,8 +385,8 @@ "expression": "grel:forEach(value.split('␟').slice(0,1), v, if(v.contains(','), '\u001fa' + v.split(',')[0].trim() + '\u001fd' + v.split(',')[1].replace(/¬.*¬/,'').trim() + forNonBlank(v.find(/¬.+¬/)[0].replace('¬',''), x, '\u001fc' + x, ''), '\u001fP' + v)).join('␟')", "onError": "set-to-blank", "newColumnName": "3000", - "columnInsertIndex": 104, - "description": "Create column 3000 at index 104 based on column tmp using expression grel:forEach(value.split('␟').slice(0,1), v, if(v.contains(','), '\u001fa' + v.split(',')[0].trim() + '\u001fd' + v.split(',')[1].replace(/¬.*¬/,'').trim() + forNonBlank(v.find(/¬.+¬/)[0].replace('¬',''), x, '\u001fc' + x, ''), '\u001fP' + v)).join('␟')" + "columnInsertIndex": 3, + "description": "Create column 3000 at index 3 based on column tmp using expression grel:forEach(value.split('␟').slice(0,1), v, if(v.contains(','), '\u001fa' + v.split(',')[0].trim() + '\u001fd' + v.split(',')[1].replace(/¬.*¬/,'').trim() + forNonBlank(v.find(/¬.+¬/)[0].replace('¬',''), x, '\u001fc' + x, ''), '\u001fP' + v)).join('␟')" }, { "op": "core/column-addition", @@ -398,8 +398,8 @@ "expression": "grel:forEach(value.split('␟').slice(1), v, if(v.contains(','), '\u001fa' + v.split(',')[0].trim() + '\u001fd' + v.split(',')[1].replace(/¬.*¬/,'').trim() + forNonBlank(v.find(/¬.+¬/)[0].replace('¬',''), x, '\u001fc' + x, ''), '\u001fP' + v)).join('␟')", "onError": "set-to-blank", "newColumnName": "3010", - "columnInsertIndex": 104, - "description": "Create column 3010 at index 104 based on column tmp using expression grel:forEach(value.split('␟').slice(1), v, if(v.contains(','), '\u001fa' + v.split(',')[0].trim() + '\u001fd' + v.split(',')[1].replace(/¬.*¬/,'').trim() + forNonBlank(v.find(/¬.+¬/)[0].replace('¬',''), x, '\u001fc' + x, ''), '\u001fP' + v)).join('␟')" + "columnInsertIndex": 3, + "description": "Create column 3010 at index 3 based on column tmp using expression grel:forEach(value.split('␟').slice(1), v, if(v.contains(','), '\u001fa' + v.split(',')[0].trim() + '\u001fd' + v.split(',')[1].replace(/¬.*¬/,'').trim() + forNonBlank(v.find(/¬.+¬/)[0].replace('¬',''), x, '\u001fc' + x, ''), '\u001fP' + v)).join('␟')" }, { "op": "core/column-removal", diff --git a/bibliotheca/config/main/3110.json b/bibliotheca/config/main/3110.json index aa799ea..f904866 100644 --- a/bibliotheca/config/main/3110.json +++ b/bibliotheca/config/main/3110.json @@ -29,8 +29,8 @@ "expression": "grel:[ cells['M|URH1'].value, cells['M|URH2'].value, cells['M|URH3'].value ].join('␟')", "onError": "set-to-blank", "newColumnName": "3110", - "columnInsertIndex": 110, - "description": "Create column 3110 at index 110 based on column M|URH1 using expression grel:[ cells['M|URH1'].value, cells['M|URH2'].value, cells['M|URH3'].value ].join('␟')" + "columnInsertIndex": 3, + "description": "Create column 3110 at index 3 based on column M|URH1 using expression grel:[ cells['M|URH1'].value, cells['M|URH2'].value, cells['M|URH3'].value ].join('␟')" }, { "op": "core/text-transform", diff --git a/bibliotheca/config/main/4000h.json b/bibliotheca/config/main/4000h.json index c608346..1943a1a 100644 --- a/bibliotheca/config/main/4000h.json +++ b/bibliotheca/config/main/4000h.json @@ -29,7 +29,7 @@ "expression": "grel:value", "onError": "set-to-blank", "newColumnName": "4000h", - "columnInsertIndex": 54, - "description": "Create column 4000h at index 54 based on column M|VERFA using expression grel:value" + "columnInsertIndex": 3, + "description": "Create column 4000h at index 3 based on column M|VERFA using expression grel:value" } ] diff --git a/bibliotheca/config/main/4002.json b/bibliotheca/config/main/4002.json index 8202b63..24b4258 100644 --- a/bibliotheca/config/main/4002.json +++ b/bibliotheca/config/main/4002.json @@ -29,7 +29,7 @@ "expression": "grel:if(value.contains('¬'),with(value.split('¬'), v, v[0].trim() + ' @' + v[1].trim()),value)", "onError": "set-to-blank", "newColumnName": "4002", - "columnInsertIndex": 127, - "description": "Create column 4002 at index 127 based on column M|PST using expression grel:if(value.contains('¬'),with(value.split('¬'), v, v[0].trim() + ' @' + v[1].trim()),value)" + "columnInsertIndex": 3, + "description": "Create column 4002 at index 3 based on column M|PST using expression grel:if(value.contains('¬'),with(value.split('¬'), v, v[0].trim() + ' @' + v[1].trim()),value)" } ] diff --git a/bibliotheca/config/main/4150-4160.json b/bibliotheca/config/main/4150-4160.json new file mode 100644 index 0000000..022e8c6 --- /dev/null +++ b/bibliotheca/config/main/4150-4160.json @@ -0,0 +1,68 @@ +[ + { + "op": "core/column-addition", + "engineConfig": { + "facets": [ + { + "type": "list", + "name": "ueber", + "expression": "isBlank(value)", + "columnName": "ueber", + "invert": false, + "omitBlank": false, + "omitError": false, + "selection": [ + { + "v": { + "v": false, + "l": "false" + } + } + ], + "selectBlank": false, + "selectError": false + } + ], + "mode": "row-based" + }, + "baseColumnName": "ueber", + "expression": "grel:with(value.cross('bibliotheca','id')[0], r, forNonBlank(r.cells['M|HST'].value, v, '\u001fa' + v, '') + forNonBlank(r.cells['M|HSTZU'].value, v, '\u001fd' + v, '') + forNonBlank(r.cells['M|VERFA'].value, v, '\u001fh' + v, '') + forNonBlank(cells['M|BANDB'].value, v, '\u001fI' + v.replace(/\\.$/,'').replace('(','').replace(')',''), forNonBlank(cells['M|BANDN'].value, v, '\u001fI' + v, '')))", + "onError": "set-to-blank", + "newColumnName": "4150", + "columnInsertIndex": 3, + "description": "Create column 4150 at index 3 based on column ueber using expression grel:with(value.cross('bibliotheca','id')[0], r, forNonBlank(r.cells['M|HST'].value, v, '\u001fa' + v, '') + forNonBlank(r.cells['M|HSTZU'].value, v, '\u001fd' + v, '') + forNonBlank(r.cells['M|VERFA'].value, v, '\u001fh' + v, '') + forNonBlank(cells['M|BANDB'].value, v, '\u001fI' + v.replace(/\\.$/,'').replace('(','').replace(')',''), forNonBlank(cells['M|BANDN'].value, v, '\u001fI' + v, '')))" + }, + { + "op": "core/column-addition", + "engineConfig": { + "facets": [ + { + "type": "list", + "name": "ueber", + "expression": "isBlank(value)", + "columnName": "ueber", + "invert": false, + "omitBlank": false, + "omitError": false, + "selection": [ + { + "v": { + "v": false, + "l": "false" + } + } + ], + "selectBlank": false, + "selectError": false + } + ], + "mode": "row-based" + }, + "baseColumnName": "ueber", + "expression": "grel:with(value.cross('bibliotheca','id')[0], r, forNonBlank(r.cells['2199'].value, v, '\u001f7' + v, '') + forNonBlank(cells['M|BANDB'].value, v, '\u001fI' + v.replace(/\\.$/,'').replace('(','').replace(')',''), forNonBlank(cells['M|BANDN'].value, v, '\u001fI' + v, '')) + '\u001fx' + forNonBlank(cells['M|BANDN'].value, v, v, forNonBlank(cells['M|BANDB'].value, v, v.replace(/\\.$/,'').replace('(','').replace(')',''), forNonBlank(r.cells['M|HST'].value, v, v[0,2], ''))) + forNonBlank(cells['M|AUFL'].value[0], v, v + '.', '') + forNonBlank(cells['1100a'].value, v, v, ''))", + "onError": "set-to-blank", + "newColumnName": "4160", + "columnInsertIndex": 3, + "description": "Create column 4160 at index 3 based on column ueber using expression grel:with(value.cross('bibliotheca','id')[0], r, forNonBlank(r.cells['2199'].value, v, '\u001f7' + v, '') + forNonBlank(cells['M|BANDB'].value, v, '\u001fI' + v.replace(/\\.$/,'').replace('(','').replace(')',''), forNonBlank(cells['M|BANDN'].value, v, '\u001fI' + v, '')) + '\u001fx' + forNonBlank(cells['M|BANDN'].value, v, v, forNonBlank(cells['M|BANDB'].value, v, v.replace(/\\.$/,'').replace('(','').replace(')',''), forNonBlank(r.cells['M|HST'].value, v, v[0,2], ''))) + forNonBlank(cells['M|AUFL'].value[0], v, v + '.', '') + forNonBlank(cells['1100a'].value, v, v, ''))" + } +] diff --git a/bibliotheca/config/main/4170.json b/bibliotheca/config/main/4170.json new file mode 100644 index 0000000..95f8991 --- /dev/null +++ b/bibliotheca/config/main/4170.json @@ -0,0 +1,3 @@ +[ +{} +] diff --git a/bibliotheca/config/main/67XX.json b/bibliotheca/config/main/67XX.json index e219338..031f263 100644 --- a/bibliotheca/config/main/67XX.json +++ b/bibliotheca/config/main/67XX.json @@ -60,7 +60,7 @@ "expression": "grel:row.record.cells[columnName].value[0]", "onError": "set-to-blank", "newColumnName": "67XX", - "columnInsertIndex": 69, - "description": "Create column 67xx at index 69 based on column M|SYST using expression grel:row.record.cells[columnName].value[0]" + "columnInsertIndex": 3, + "description": "Create column 67XX at index 3 based on column M|SYST using expression grel:row.record.cells[columnName].value[0]" } ] diff --git a/bibliotheca/config/main/mtm-leerexemplare.json b/bibliotheca/config/main/mtm-leerexemplare.json new file mode 100644 index 0000000..8380144 --- /dev/null +++ b/bibliotheca/config/main/mtm-leerexemplare.json @@ -0,0 +1,170 @@ +[ + { + "op": "core/text-transform", + "engineConfig": { + "facets": [ + { + "type": "list", + "name": "0500", + "expression": "grel:value[1]", + "columnName": "0500", + "invert": false, + "omitBlank": false, + "omitError": false, + "selection": [ + { + "v": { + "v": "c", + "l": "c" + } + } + ], + "selectBlank": false, + "selectError": false + } + ], + "mode": "record-based" + }, + "columnName": "E0XXb", + "expression": "grel:forEach(cells['unter'].value.split(','), v, v.cross('bibliotheca','id')[0].cells['E0XXb'].value).uniques().join(',')", + "onError": "keep-original", + "repeat": false, + "repeatCount": 10, + "description": "Text transform on cells in column E0XXb using expression grel:forEach(cells['unter'].value.split(','), v, v.cross('bibliotheca','id')[0].cells['E0XXb'].value).uniques().join(',')" + }, + { + "op": "core/text-transform", + "engineConfig": { + "facets": [ + { + "type": "list", + "name": "0500", + "expression": "grel:value[1]", + "columnName": "0500", + "invert": false, + "omitBlank": false, + "omitError": false, + "selection": [ + { + "v": { + "v": "c", + "l": "c" + } + } + ], + "selectBlank": false, + "selectError": false + } + ], + "mode": "record-based" + }, + "columnName": "E0XX", + "expression": "grel:forEach(forEach(cells['unter'].value.split(','), v, v.cross('bibliotheca','id')[0].cells['E0XXb'].value).uniques(),x,'31-12-20').join(',')", + "onError": "keep-original", + "repeat": false, + "repeatCount": 10, + "description": "Text transform on cells in column E0XX using expression grel:forEach(forEach(cells['unter'].value.split(','), v, v.cross('bibliotheca','id')[0].cells['E0XXb'].value).uniques(),x,'31-12-20').join(',')" + }, + { + "op": "core/text-transform", + "engineConfig": { + "facets": [ + { + "type": "list", + "name": "0500", + "expression": "grel:value[1]", + "columnName": "0500", + "invert": false, + "omitBlank": false, + "omitError": false, + "selection": [ + { + "v": { + "v": "c", + "l": "c" + } + } + ], + "selectBlank": false, + "selectError": false + } + ], + "mode": "record-based" + }, + "columnName": "7100f", + "expression": "grel:forEach(cells['unter'].value.split(','), v, v.cross('bibliotheca','id')[0].cells['7100f'].value).uniques().join(',')", + "onError": "keep-original", + "repeat": false, + "repeatCount": 10, + "description": "Text transform on cells in column 7100f using expression grel:forEach(cells['unter'].value.split(','), v, v.cross('bibliotheca','id')[0].cells['7100f'].value).uniques().join(',')" + }, + { + "op": "core/text-transform", + "engineConfig": { + "facets": [ + { + "type": "list", + "name": "0500", + "expression": "grel:value[1]", + "columnName": "0500", + "invert": false, + "omitBlank": false, + "omitError": false, + "selection": [ + { + "v": { + "v": "c", + "l": "c" + } + } + ], + "selectBlank": false, + "selectError": false + } + ], + "mode": "record-based" + }, + "columnName": "7100j", + "expression": "grel:forEach(cells['unter'].value.split(','), v, v.cross('bibliotheca','id')[0].cells['7100j'].value).uniques().join(',')", + "onError": "keep-original", + "repeat": false, + "repeatCount": 10, + "description": "Text transform on cells in column 7100j using expression grel:forEach(cells['unter'].value.split(','), v, v.cross('bibliotheca','id')[0].cells['7100j'].value).uniques().join(',')" + }, + { + "op": "core/multivalued-cell-split", + "columnName": "E0XXb", + "keyColumnName": "M|MEDNR", + "mode": "separator", + "separator": ",", + "regex": false, + "description": "Split multi-valued cells in column E0XXb" + }, + { + "op": "core/multivalued-cell-split", + "columnName": "E0XX", + "keyColumnName": "M|MEDNR", + "mode": "separator", + "separator": ",", + "regex": false, + "description": "Split multi-valued cells in column E0XX" + }, + { + "op": "core/multivalued-cell-split", + "columnName": "7100f", + "keyColumnName": "M|MEDNR", + "mode": "separator", + "separator": ",", + "regex": false, + "description": "Split multi-valued cells in column 7100f" + }, + { + "op": "core/multivalued-cell-split", + "columnName": "7100j", + "keyColumnName": "M|MEDNR", + "mode": "separator", + "separator": ",", + "regex": false, + "description": "Split multi-valued cells in column 7100j" + } +] diff --git a/bibliotheca/config/main/nrpre.json b/bibliotheca/config/main/nrpre.json index 05add1b..b80abbc 100644 --- a/bibliotheca/config/main/nrpre.json +++ b/bibliotheca/config/main/nrpre.json @@ -1,4 +1,17 @@ [ + { + "op": "core/column-addition", + "engineConfig": { + "facets": [], + "mode": "record-based" + }, + "baseColumnName": "M|MEDNR", + "expression": "grel:cells['File'].value + value", + "onError": "set-to-blank", + "newColumnName": "id", + "columnInsertIndex": 3, + "description": "Create column id at index 3 based on column M|MEDNR using expression grel:cells['File'].value + value" + }, { "op": "core/column-addition", "engineConfig": { @@ -45,11 +58,11 @@ "mode": "row-based" }, "baseColumnName": "M|NRPRE", - "expression": "grel:forEach(value.cross('bibliotheca','M|MEDNR'),r,if(and(r.cells['File'].value == cells['File'].value, r.cells['M|ART'].value == 'G'), cells['M|NRPRE'].value, null)).join(',')", + "expression": "grel:with(cells['File'].value + value, v, forEach(v.cross('bibliotheca','id'), r, if(r.cells['M|ART'].value == 'G', r.cells['id'].value, null)).join(','))", "onError": "set-to-blank", "newColumnName": "ueber", - "columnInsertIndex": 72, - "description": "Create column ueber at index 72 based on column M|NRPRE using expression grel:forEach(value.cross('bibliotheca','M|MEDNR'),r,if(and(r.cells['File'].value == cells['File'].value, r.cells['M|ART'].value == 'G'), cells['M|NRPRE'].value, null)).join(',')" + "columnInsertIndex": 3, + "description": "Create column ueber at index 72 based on column M|NRPRE using expression grel:with(cells['File'].value + value, v, forEach(v.cross('bibliotheca','id'), r, if(r.cells['M|ART'].value == 'G', r.cells['id'].value, null)).join(','))" }, { "op": "core/column-addition", @@ -57,12 +70,12 @@ "facets": [], "mode": "row-based" }, - "baseColumnName": "M|MEDNR", - "expression": "grel:forEach(value.cross('bibliotheca','ueber'),r,if(r.cells['File'].value == cells['File'].value,r.cells['M|MEDNR'].value,null)).join(',')", + "baseColumnName": "id", + "expression": "grel:forEach(value.cross('bibliotheca','ueber'), r, r.cells['id'].value).join(',')", "onError": "set-to-blank", "newColumnName": "unter", - "columnInsertIndex": 1, - "description": "Create column unter at index 1 based on column M|MEDNR using expression grel:forEach(value.cross('bibliotheca','ueber'),r,if(r.cells['File'].value == cells['File'].value,r.cells['M|MEDNR'].value,null)).join(',')" + "columnInsertIndex": 3, + "description": "Create column unter at index 1 based on column M|MEDNR using expression grel:forEach(value.cross('bibliotheca','ueber'), r, r.cells['id'].value).join(',')" }, { "op": "core/row-removal", diff --git a/bibliotheca/config/main/template.txt b/bibliotheca/config/main/template.txt index 5fbeb31..cc11a1f 100644 --- a/bibliotheca/config/main/template.txt +++ b/bibliotheca/config/main/template.txt @@ -38,6 +38,9 @@ with( '4060', '4061', '4062', + '4150', + '4160', + '4170', '4204', '67XX', '7100j', diff --git a/pica+/config/template.txt b/pica+/config/template.txt index bdf1bd3..78596f5 100644 --- a/pica+/config/template.txt +++ b/pica+/config/template.txt @@ -29,6 +29,9 @@ if(row.index - row.record.fromRowIndex == 0, + forNonBlank(cells['4060'].value, v, '034D ' + 'a' + v + '\n', '') + forNonBlank(cells['4062'].value, v, '034I ' + 'a' + v + '\n', '') + forNonBlank(cells['4061'].value, v, '034M ' + 'a' + v + '\n', '') ++ forNonBlank(cells['4150'].value, v, '036C/00 ' + v + '\n', '') ++ forNonBlank(cells['4160'].value, v, '036D/00 ' + v + '\n', '') ++ forNonBlank(cells['4170'].value, v, '036E/00 ' + v + '\n', '') + forNonBlank(cells['4204'].value, v, '037C ' + 'a' + v + '\n', '') + forNonBlank(cells['0999'].value, v, '046W ' + 'a' + v + '\n', '') ,'')