Z39.50客户端源代码(C#)

再VB、Delphi时代,实现z39.50客户端有一个yaz vbzoom的工具包,利用第三方开发包我们可以很快的实现。本文介绍如何使用c#实现Z39.50客户端,当然是纯源码方式不依赖第三方。如果您是一个开发人员要求不但熟练C# soket编程,而且要了解Z39.50协议以及基本流程。

建立z39服务器连接

这里只需要z39.50服务器IP地址与端口2个参数。建立soket连接 new TcpClient(this.m_strHostName, this.m_nPort);如果连接失败捕获异常并返回。

Z39.50初始化Initial

这里需要包含的参数就是常见的 用户名、 密码、 组号、认证方式(公开 or 需要密码验证),把这些参数 赋值给 INIT_REQUEST 类并打包发送出去

Z39.50检索Search

这里是关键的一步了,客户端把检索需要的参数封装到SEARCH_REQUEST类并打包发送出去。这里需要注意几个参数:

  • PreferredRecordSyntax 数据格式

常见的值有:

//1.2.840.10003.5.1 -- UNIMARC
//1.2.840.10003.5.10 -- MARC21
//1.2.840.10003.5.101 -- SUTRS
//1.2.840.10003.5.109.10 -- XML

 Query-type and Query. The parameter Query-type identifies the type of query, i.e the syntax of parameter Query. Six types are defined:

Type-0 may be used only when the origin and target have a priori agreement outside of the standard.
Type-1 is the Reverse Polish Notation (RPN) query specified in 3.7.
Type-2 is the ISO8777 type query, specified in ISO 8777.
Type-100 is the Z39.58 type query, specified in ANSI Z39.58.
Type-101 is the extended RPN (ERPN) query, an extension to the type-1 query to allow proximity searching and restriction of result sets by attributes. It is specified in 3.7. Note: The type-101 query is identical to the type-1 query with the following exception: For type-1, proximity and restriction are valid only when version 3 is in force. For type-101, proximity and restriction are valid both for version 3 and version 2 as well. (The definition of the type-101 query is independent of version.)
Type-102 is the Ranked List query, to be defined in a later version of this standard.

如果检索命中了记录,就会返回命中结果数ResultCount

返回命中记录Present

如果命中了记录我们就要取回指定的记录这里参数注意包括

数据格式 PreferredRecordSyntax

元素集名 ElementSetName (F/B)  F -- Full (MARC and OPAC records)   B -- Brief(MARC records)

结果集名称 ResultSetName默认default
返回数量  PreferedEachCount

以上就是z39.50客户端的主要流程,当然里面很多细节也需要注意,比如编码 因为有外文原版图书著录,必然会涉及到小语种,所以marc编码我们采用的是UTF-8编码存储,避免产生乱码。


如果你想再自己的图书管理软件加上z39.50客户端功能,但编程能力有限,您可以购买源码我们会提供demo 源码帮助说明如何使用。必要的话进行技术指导。


原文链接 石家庄文图软件

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值