|
XQuery is a programming language under development by the W3C that's designed to query collections of XML data. XQuery provides a mechanism to extract and manipulate data from XML documents or any data source that can be viewed as XML such as relational databases or office documents. It is semantically similar to SQL. XQuery uses XPath syntax to address specific parts of an XML document. XSLT 2.0 and XQuery are being jointly developed by the XML Query working group. The World Wide Web Consortium (W3C) is a consortium that produces standards—recommendations, as they call them—for the World Wide Web. ...
The Extensible Markup Language (XML) is a W3C-recommended general-purpose markup language for creating special-purpose markup languages. ...
Semantic similarity, variously also called semantic closeness/proximity/nearness, is a concept whereby a set of documents or terms within term lists are assigned a metric based on the likeness of their meaning / semantic content. ...
Wikibooks has more about this subject: SQL Structured Query Language (SQL) is the most popular computer language used to create, modify and retrieve data from relational database management systems. ...
XPath (XML Path Language) is a terse (non-XML) syntax for addressing portions of an XML document. ...
...
XQuery provides a mechanism to pull XML content from multiple sources and dynamically generate new content using a declarative language. XML is a native data type of XQuery and can be used in queries directly without quoted strings or object calls. You separate XML elements from enclosed expressions using curly braces.
Examples The sample XQuery code below lists the unique speakers in each act of Shakespeare's play Hamlet. <html><head/><body> { for $act in doc("hamlet.xml")//ACT let $speakers := distinct-values($act//SPEAKER) return <span> <h1>{ $act/TITLE/text() }</h1> <ul> { for $speaker in $speakers return <li>{ $speaker }</li> } </ul> </span> } </body></html> XQuery is a "functional language" consisting entirely of expressions. There are no statements, even though some of the keywords imply statement-like behaviors. To execute a function, the expression within the body gets evaluated and its value returned. Thus to write a function to double an input value, you simply write: declare function local:doubler($x) { $x * 2 } To write a full query that says Hello World you write the expression: "Hello World" External links - W3C XML Query (XQuery) (http://www.w3.org/XML/Query)
- XQuery 1.0: An XML Query Language (http://www.w3.org/TR/xquery/)
- XQuery.com: Specifications, Articles, Mailing List, and Vendors (http://www.xquery.com)
- XQuery Developer Central (http://www.datadirect.com/developer/xquery/index.ssp)
Portions borrowed with permission from the book "XML Hacks" (O'Reilly). OReilly Media (formerly OReilly & Associates) is an American media company established by Tim OReilly, primarily focusing on books related to computer programming. ...
Previous version based on an article at the French language Wikipedia (http://fr.wikipedia.org/wiki/XML_Query). |