dp2Catalog 的 dp2检索窗功能增强后,可以直接将 ISO2709 文件内容导入到这个窗口,然后利用定制的 MarcQuery 脚本进行修改加工。修改后的记录内容,可以导出到另一个 ISO2709 文件,或保存到 dp2系统的数据库中。
什么是 MarcQuery? 这是数字平台创造的一种处理 MARC 数据的函数库,能非常方便地对 MARC 记录、字段、子字段进行各种变换修改。
下面将示范一个 MarcQuery 脚本文件,可以直接对 ISO2709 文件中的字段内容加拼音。
using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
using System.Text;
using System.Xml;
using dp2Catalog;
using DigitalPlatform.Marc;
using DigitalPlatform.Xml;
using DigitalPlatform.Script;
public class MyMarcQueryHost : MarcQueryHost
{
// 新的加拼音字段配置。$9
string PinyinCfgXml = "<root>"
+ "<item name='200' from='a' to='9' />"
+ "<item name='510' from='a' to='9' />"
+ "<item name='512' from='a' to='9' />"
+ "<item name='513' from='a' to='9' />"
+ "<item name='514' from='a' to='9' />"
+ "<item name='515' from='a' to='9' />"
+ "<item name='516' from='a' to='9' />"
+ "<item name='517' from='a' to='9' />"
+ "<item name='520' from='a' to='9' />"
+ "<item name='530' from='a' to='9' />"
+ "<item name='532' from='a' to='9' />"
+ "<item name='540' from='a' to='9' />"
+ "<item name='541' from='a' to='9' />"
+ "<item name='701' indicator='@[^A].' from='a' to='9' />"
+ "<item name='711' from='a' to='9' />"
+ "<item name='702' indicator='@[^A].' from='a' to='9' />"
+ "<item name='712' from='a' to='9' />"
+ "<item name='721' from='a' to='9' />"
+ "<item name='722' from='a' to='9' />"
+ "</root>";
// 老的加拼音配置。$A等
string OldPinyinCfgXml = "<root>"
+ "<item name='200' from='aefhi' to='AEFHI' />"
+ "<item name='510' from='aei' to='AEI' />"
+ "<item name='512' from='aei' to='AEI' />"
+ "<item name='513' from='aei' to='AEI' />"
+ "<item name='514' from='aei' to='AEI' />"
+ "<item name='515' from='aei' to='AEI' />"
+ "<item name='516' from='aei' to='AEI' />"
+ "<item name='517' from='aei' to='AEI' />"
+ "<item name='520' from='aei' to='AEI' />"
+ "<item name='530' from='a' to='A' />"
+ "<item name='532' from='a' to='A' />"
+ "<item name='540' from='a' to='A' />"
+ "<item name='541' from='aei' to='AEI' />"
+ "<item name='700' from='a' to='A' />"
+ "<item name='701' indicator='@[^A].' from='a' to='A' />"
+ "<item name='711' from='a' to='A' />"
+ "<item name='702' indicator='@[^A].' from='a' to='A' />"
+ "<item name='712' from='a' to='A' />"
+ "<item name='720' from='a' to='A' />"
+ "<item name='721' from='a' to='A' />"
+ "<item name='722' from='a' to='A' />"
+ "</root>";
public override void OnRecord(object sender, StatisEventArgs e)
{
this.MainForm.RemovePinyin(
this.MarcRecord,
this.OldPinyinCfgXml);
this.MainForm.RemovePinyin(
this.MarcRecord,
this.PinyinCfgXml);
this.MainForm.AddPinyin(
this.MarcRecord,
this.PinyinCfgXml,
PinyinStyle.None);
this.Changed = true;
}
}