FACTOID # 118: Australians lead the world in hours worked and membership in many voluntary organizations. How do they find the energy?
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > XML query language

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).


  Results from FactBites:
 
Cover Pages: XML and Query Languages (16638 words)
Queries are specified using XQL, a de facto standard for querying XML documents that is nearly identical to the simplified form of XPath.
Query languages, including XML query languages, still tend to be designed either for documents or for data.
XML data, on the other hand, may be 'sparse'...; (5) In a relational database, the rows of a table are not considered to have an ordering other than the orderings that can be derived from their values.
XQuery - Wikipedia, the free encyclopedia (516 words)
XQuery is a query language (with some programming language features) that is designed to query collections of XML data.
XQuery 1.0 is being developed by the XML Query working group of the W3C.
The language is based on a tree-structured model of the information content of an XML document, containing seven kinds of node: document nodes, elements, attributes, text nodes, comments, processing instructions, and namespaces.
  More results at FactBites »


 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.