《xml和资料处理(五)》由会员分享,可在线阅读,更多相关《xml和资料处理(五)(57页珍藏版)》请在金锄头文库上搜索。
1、XML和資料處理(五): XQL(eXtensible Query Language),國立台灣師範大學 資訊教育系 葉耀明,XML as Data Namespace,RDF,Schema, XLink,Xpoint,Xpath,XQL,XSLT XML-RPC,SOAP,WML,XML家族,XML Core XML Syntax, DTD, Parser(DOM/SAX),XML Visual Representation CSS,XSL,WML,XML Vocabulary XHTML, SMIL, MathML, CDF, SVG, DrawML, Rossetanet, BizTal
2、k,內容大綱,Query Language的發展 Relational Database和XML Documents的差異 XQL Query Hierarchy Query Strings Sequential Relationship Queries Find an Attribute XQL Methods DBMS如何使用XML 總結,XML Query Language 的發展,SQL Relational Database Standard Query Language 1974 SEQUEL by Chamberlin and Boyce; ISO XML-QL: by IBM(
3、Notes;1998/8/19) 查詢方式類似SQL的語法 XSLT and XPath 結構化文件(樹狀)的查詢方式 Recommendation XQL:by Microsoft(Notes;1998/11/6) 結構化文件(樹狀)的查詢方式(XSLT-XPath的擴充) XSQL:by Oracle XML-Query Data Model Working Draft ;2000/5/11,SQL範例,SELECT Book.Title, RecSubjCategories.Category FROM Book INNER JOIN RecSubjCategories ON Book.B
4、ookID=RecSubjCategories.BookID WHERE Book.Author=“Kevin Williams”,Book,RecSubjCategories,XML-QL範例,CONSTRUCT WHERE $t IN “http:/ CONSTRUCT $t , IE5 XML Programmers Reference Designing Distributed Applications ,Result Document,Relational Database和XML Documents的差異,SQL rows have unique identifiers. SQL
5、rows dont imply sequence. SQL structures dont provide hierarchical encapsulation. XML confounds attributes and text-only content. XML allows a mixed content model for elements.,XQL,A general-purpose query language thats designed as an extension of XSL. Notes by Microsoft leaded Group Additional Abil
6、ity of XQL Index the order of element siblings. Work with an irregular number of fields. Describe parent / child and ancestor / descendant relationships.,What is an XQL Query?,Search Context One or more XML document. Must be well-formed. Query A single node type Or adding qualifiers and filter. Resu
7、lt Set Most implementation return them as a well-formed XML document.,XQL Example ( I ), - - Raising Arizona Ethan Coen Joel Coen Ethan Coen Joel Coen Nicolas Cage Holly Hunter John Goodman A classic one-of-a-kind screwball love story. - Midnight Run George Gallo Martin Brest Martin Brest Robert De
8、Niro Charles Grodin The quintessential road comedy. ,XQL Example ( II ),- The Usual Suspects Christopher McQuarrie Bryan Singer Michael McDonnell Bryan Singer Stephen Baldwin Gabriel Byrne Benicio Del Toro Chazz Palminteri Kevin Pollak Kevin Spacey A crime mystery with incredibly intricate plot twis
9、ts. - The Abyss James Cameron Gale Anne Hurd James Cameron Ed Harris Mary Elizabeth Mastrantonio A very engaging underwater odyssey. ,Hierarchy Query Strings ( I ),Parent/Child Queries ( / ) Example : movie/title Result : Raising Arizone Midnight Run The Usual Suspects The Abyss ,Hierarchy Query Str
10、ings (II),Ancestor/Descendant ( / ) Example : movies/title Result : Raising Arizone Midnight Run The Usual Suspects The Abyss ,Hierarchy Query Strings (III),Wildcards( * ) Example : movies/*/title Result : Raising Arizone Midnight Run The Usual Suspects The Abyss ,Sequential Relationship Queries ( I
11、 ),Immediately Precedes Example : producer;producer Result : Michael McDonnell ,Sequential Relationship Queries (II),Precedes Example : producer ; producer Result : Michael McDonnell ,Querying to Find an Attribute ( I ),Syntax nodenameattributename Example : movietype = “comedy”/title Result : Raisi
12、ng Arizone Midnight Run ,Querying to Find an Attribute (II),Returning Attributes Example : movie/type Result : It will return all attribute of movie and with its value.,Querying to Find an Attribute (III),Handling White Space XQL are designed to be useable without white space. Example movie / title
13、= movie/title,Using Filters,Nodename filter syntax Example : movietype = SciFi/title Result : The Abyss ,Boolean Statements,$and$ ( AND or & ) $or$ (OR or | ) $not$ (NOT or ! ),Comparision,XQL Methods,text() value() nodeType() nodeName() index() end(),Using Parentheses in Queries ( I ),Example Query
14、 1 = movie/actorend() Result : John Goodman Charles Grodin Kevin Spacey Mary Elizabeth Mastrantonio ,Using Parentheses in Queries (II),Example Query 2 = (movie/actor)end() Result : Mary Elizabeth Mastrantonio ,Namespace Querying Methods,baseName ( ) namespace ( ) prefix ( ),Collection Methods,textNo
15、de ( ) comment ( ) pi ( ) element (name) attribute (name) node ( ) count ( ),Limitation of XQL,XQL cannot provide distinct information. XQL cannot pivot relationships.,XQL (Implementations),http:/xml.darmstadt.gmd.de/xql/ http:/ of File System,Size Concurrency The Right Tool for the Job Versioning S
16、ecurity Integration ( Centralization and Repetition),XML and Database,Size Databases can cope with extremely large amounts of information. Concurrency Database supports more than one user of access information. The Right Tool for the Job Database are usually back-end products. Versioning OO databases support for versioning. Security Dat