XQuery Java API的设计与实现
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
XQuery Java API是一种用来从XQuery查询中执行和提取结果的Java API。用户可以准备XQuery查询、绑定XQuery查询字符串、执行XQuery查询,类似JDBC API,它也提供了XQueryResultSet类,用来获得执行XQuery查询结果的XML文档信息。XQuery Java API的核心是已经实现的XQuery编译器,它具有一些局限性:只能查询有Schema类型说明的XML文档,而在现实世界中,并非所有XML文档都有类型说明,所以,我们对XQuery编译器进行扩展,使得它对没有类型说明的XML文档也可以进行查询;同样,为使查询更具有通用性,增加网络查询功能,实现对以URL地址表示的XML文档的查询;另外,不可能事先构造所有文档的数据模型,所以对XQuery查询实现的基础——数据模型应采取动态构造的方法:当需要查询某文档时才构造它。
     XQuery Java API还可以屏蔽数据源的异构性,提供给用户一个使用多种数据源的统一接口,只要用户提供满足查询要求的XQuery查询字符串,就可以使用该接口达到查询目的。XQuery语言本身并不能实现该功能,所以我们对它进行扩展,增加嵌套SQL语句的sqlquery表达式,使用JDBC来查询SQL语句,而将产生的结果转换为XML文档,再使用XQuery编译器来实现查询要求,达到集成关系数据库的目的。
     另外,我们还提出并实现了XQuery视图机制,仿照关系数据库的视图,由查询来定义其内容,使得不同用户对XML文档具有不同的查看能力,保证查询安全、可靠。
     在本文的最后,我们还给出使用XQuery Java API查询XML文档和关系数据库的实例,并针对存在的一些问题,提出今后进一步的工作。
XQuery Java API is a Java API which can execute query and get results from query. Users can first prepare XQuery search, then kidnap XQuery search strings, and then execute it, last, it can get results of XML files by XQueryResultSet class like JDBC API. Its core is XQuery's Compiler which has some deficiencies. It can only query XML files which have schema. But in real life not all the XML files have schema, so we extend its function so that it can query no Schema XML files; furthermore, we add network function that can query URL files on the web; last, because it is impossible to construct data models of all the XML files, we adopt dymanic construction.
    XQuery Java API can also shied heterogenous data sources and supply users with a unified interface which can query a number of data sources. Users can achieve query aims by writing XQuery search strings. XQuery itself does not implement such function. So we extent its function by adding sqlquery expressions which contain SQL. It gets results from queries by JDBC API and convert it into XML format. Then it uses XQuery complier to query in succession in order to integrate related databases.
    Furthmore, we supply users with XQuery view t o query XML files safely and reliably from different views. It defines its contents with query like views of the related databases.
    At the end of this paper, we will give some examples of querying XML files and related databases. And according to some existing problems further works and developments will also be given.
引文
[1] World Wide Web Consortium. Extensible Markup Language(XML)[EB/OL]. http://www.w3.org/XML/.
    [2] World Wide Web. Hyper Text Markup Language(HTML)[EB/OL]. http://www.w3.org/MarkUp/.
    [3] ISO8879.Standard Generalize Markup Language(SGML)[EB/OL]. http://www.iso.cl/cate/d16387.html.
    [4] Ann Navrro等.XML从入门到精通[M].北京:电子工业出版社,2002-4-5.
    [5] World Wide Web Consortium. XML Query (XQuery) [EB/OL]. http://www.w3c.org/XML/Query.
    [6] Jonathan Robie,etc all.Quilt[EB/OL]. http://www.almaden.ibm.com/cs/people/chamberlin/quilt.html.
    [7] World Wide Web Consortium.XML Path Language[EB/OL]. http://www.w3.org/TR/xpath.
    [8] Jonathan Robie,etc all.XQL:XML Query Language[EB/OL]. http://www.ibiblio.org/xql/.
    [9] Alin Deutsch,etc all.XML-QL:A Query Language for XML[EB/OL]. http://www.w3.org/TR/NOTE-xml-ql/.
    [10] World Wide Web Consortiun. XML Query (XQuery) Requirements [EB/OL]. http://www.w3.org/TR/xquery-requirements/.
    [11] World Wide Web Consortium. XML Query Use Cases [EB/OL]. http://www.w3.org/TR/xquery-use-cases/.
    [12] World Wide Web Consortium. XQuery 1.0: An XML Query Language [EB/OL]. http://www.w3.org/TR/xquery/.
    [13] World Wide Web Consortium. XQuery 1.0 and XPath 2.0 Data Model [EB/OL]. http://www.w3c.org/TR/xpath-datamodel/.
    [14] World Wide Web Consortium. XQuery 1.0 and XPath 2.0 Formal Semantics [EB/OL]. http://www.w3c.org/TR/xquery-semantics/.
    [15] World Wide Web Consortium. XML Syntax for XQuery 1.0 (XQueryX) [EB/OL], http://www.w3.org/TR/xqueryx/.
    [16] World Wide Web Constortium. XQuery 1.0 and XPath 2.0 Functions and
    
    Operators [EB/OL].http://www.w3.org/TR/xpath-functions/.
    [17] World Wide Web Consortium. XML Path Language (XPath) 2.0 [EB/OL], http://www.w3.org/TR/xpath20/.
    [18] World Wide Web Consortium. XPath Requirements Version 2.0 [EB/OL], http://www.w3.org/TR/xpath20req/.
    [19] World Wide Web Consortium. XSLT 2.0 and XQuery 1.0 Serialization [EB/OL], http://www.w3.org/TR/xslt-xquery-serialization/.
    [20] World Wide Web Consortium. XQuery and XPath Full-Text Requirements Version 2.0 [EB/OL], http://www.w3c.org/TR/xquery-full-text-requirements/.
    [21] World Wide Web Consortium. XQuery and XPath Full-Text Use Cases Version 2.0 [EB/OL], http://www.w3.org/TR/xmlquery-full-text-use-cases/.
    [22] 曾毅.XQuery——XML时代的革命性数据查询语言.http://www.microsoft.com/china/community/Column/46.mspx.
    [23] 高明、宋瀚涛,异构数据源集成应用模型及其查询处理方法,计算机工程第29卷第1期2003年9月,P91-93.
    [24] David DeHaan、David Toman、Mariano P.Consens、M.Tamer Ozsu, A Comprehensive XQuery to SQL Translation using Dynamic Interval Encoding, International Conference on Management of Data and Symposium on Principles of Database Systems June 9-12,2003,pages:623-634.
    [25] Jerry Kiernan、Jeffrey Naughton、Igor Tatarinov, A General Technique for Querying XML Documents using a Relational Database System, ACM SIGMOD Record, Vol.30, No.3, September 2001,pages:20-26.
    [26] Jayavel Shanmugasundaram、Jerry Kiernan、Eugene Shekita、Catalina Fan、John Funderburk, Querying XML Views of Relational Data, Proceedings of the 27th VLDB Conference,Roma,Italy,2001,pages:261-270.
    [27] 谢铉洋.XML查询语言XQuery的编译实现[D].合肥,安徽大学计算机系,2002.
    [28] 李明顺.爆破数据库.http://www.chinabyte.com/20020617/1616147.shtml.
    [29] 隆华软件工作室.《Microsoft SQL Server 2000程序设计》.清华大学.2001年10月1日.
    [30] MYSQL学习指南. http://tech.china.com/zh_cn/netschool/homepage/MySQL/.
    [31] VFP教程.http://www.myfl.net/jiaocai/.
    
    
    [32] Maria G. Chinwala.Algebraic Languages for XML Databases[D]. GEORGIA:University of Georgia,2001.
    [33] Murali Mani,Nell Sundaresan .Query Processing Using QuiXote[R].IBM:Research Report of Computer Science,2000.
    [34] Jerome Simeon,Mary Fernanadez,Philip Wadler, etc all.Galax:XML Algebra & XQuery Processor [EB/OL].http://db.bell-labs.corn/galax/.
    [35] Xerces2 Java Parser. http://xml.apache.org/xerces2-j/index.html.
    [36] Mary Fernandez、Atsuyuki Morishima、Dan Suciu、Wang-Chiew Tan, Publishing Relational Data in XML:the SilkRoute Approach, June 1, 2001.
    [37] 梁陈剑、张威.JDBC3.0数据库开发与设计.北京希望电子出版社.2003年3月.
    [38] JSP数据库连接池的必要性.http://vip.6to23.com/wocienyoug/in/g3.htm.
    [39] 陈光.Tomcat4的数据库连接池配置.http://www.zdnet.com.cn/developer/code/story/0,2000081534,39134180-1,00.htm
    [40] 朱亮.Native XML数据库技术.2003年2月.http://www-900.ibm.com/developerWorks/cn/xml/x-nxd/index.shtml.
    [41] Mary Fernandez、Atsuyuki Morishima、Dan Suciu、Wang-Chiew Tan. Publishing Relational Data in XML:the SilkRoute Approach.June 1.2001.
    [42] Jayavel Shanmugasundaram、Jerry Kiernan、Eugene Shekita、Catalina Fan、John Funderburk.Querying XML Views of Relational Data.Proceedings of the 27th VLDB Conference,Roma, Italy,2001.
    [43] OJXQI-The Oracle Java XQuery API. http://otn.oracle.com/sample_code/tech/xml/xmldb/jxqi.html.
    [44] Maged EL-Sayed、Ling Wang、Luping Ding、Elke A.Rundensteiner.An Algebraic Approach for Incremental Maintenance of Materialized XQuery Views.Feb 2003.

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700