PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

XQuery

XQuery

XQuery is a pl created in 2007.

#105on PLDB 15Years Old 1.4kUsers
2Books 15Papers 2kRepos

XQuery (XML Query) is a query and functional programming language that queries and transforms collections of structured and unstructured data, usually in the form of XML, text and with vendor-specific extensions for other data formats (JSON, binary, etc.). The language is developed by the XML Query working group of the W3C. The work is closely coordinated with the development of XSLT by the XSL Working Group; the two groups share responsibility for XPath, which is a subset of XQuery. Read more on Wikipedia...


Example from hello-world:
let $hello := "Hello World" return $hello
Example from the Hello World Collection:
(: Hello World with XQuery :) let $i := "Hello World" return $i
Example from Linguist:
(: ------------------------------------------------------------------------------------- xproc.xqm - core xqm contains entry points, primary eval-step function and control functions. ---------------------------------------------------------------------------------------- :) xquery version "3.0" encoding "UTF-8"; module namespace xproc = "http://xproc.net/xproc"; (: declare namespaces :) declare namespace p="http://www.w3.org/ns/xproc"; declare namespace c="http://www.w3.org/ns/xproc-step"; declare namespace err="http://www.w3.org/ns/xproc-error"; (: module imports :) (: import module namespace util = "http://xproc.net/xproc/util" at "util1.xqm"; :) import module namespace const = "http://xproc.net/xproc/const" at "const.xqm"; import module namespace parse = "http://xproc.net/xproc/parse" at "parse.xqm"; import module namespace u = "http://xproc.net/xproc/util" at "util.xqm"; (: declare options :) declare boundary-space preserve; declare option saxon:output "indent=yes"; (: declare functions :) declare variable $xproc:run-step := xproc:run#6; declare variable $xproc:parse-and-eval := (); declare variable $xproc:declare-step := (); declare variable $xproc:choose := (); declare variable $xproc:try := (); declare variable $xproc:catch := (); declare variable $xproc:group := (); declare variable $xproc:for-each := (); declare variable $xproc:viewport := (); declare variable $xproc:library := (); declare variable $xproc:pipeline := (); declare variable $xproc:variable := (); (: list all declared namespaces :) (: -------------------------------------------------------------------------- :) declare function xproc:enum-namespaces($pipeline){ (: -------------------------------------------------------------------------- :) <namespace name="{$pipeline/@name}">{u:enum-ns(<dummy>{$pipeline}</dummy>)}</namespace> }; (: entry point :) (: -------------------------------------------------------------------------- :) declare function xproc:run($pipeline,$stdin,$dflag,$tflag,$bindings,$options){ (: -------------------------------------------------------------------------- :) (: STEP I: preprocess :) let $validate := () let $namespaces := xproc:enum-namespaces($pipeline) let $parse := parse:explicit-bindings( parse:AST(parse:explicit-name(parse:explicit-type($pipeline)))) let $ast := element p:declare-step {$parse/@*, parse:pipeline-step-sort( $parse/*, () ) } (: STEP II: eval AST :) let $eval_result := () (: STEP III: serialize and return results :) let $serialized_result := $pipeline return $serialized_result };
Example from Wikipedia:
<html><body> { for $act in doc("hamlet.xml")//ACT let $speakers := distinct-values($act//SPEAKER) return <div> <h1>{ string($act/TITLE) }</h1> <ul> { for $speaker in $speakers return <li>{ $speaker }</li> } </ul> </div> } </body></html>

Language features

Feature Supported Example Token
Integers
Floats
Strings
"Hello world"
"
Comments
(: Hello World with XQuery :)
Semantic Indentation ϴ
Line Comments ϴ

Books about XQuery from ISBNdb

title authors year publisher
XML: A Beginner's Guide: Go Beyond the Basics with Ajax, XHTML, XPath 2.0, XSLT 2.0 and XQuery Holzner, Steven 2009 McGraw-Hill Education
XML: A Beginner's Guide: Go Beyond the Basics with Ajax, XHTML, XPath 2.0, XSLT 2.0 and XQuery Holzner, Steven 2009 McGraw-Hill Education

Publications about XQuery from Semantic Scholar

title authors year citations influentialCitations
XQuery Reloaded Roger Bamford and Vinayak R. Borkar and M. Brantner and Peter M. Fischer and D. Florescu and David A. Graf and D. Kossmann and Tim Kraska and D. Muresan and Sorin Nasoi and Markos Zacharioudaki 2009 36 1
XML programming with SQL/XML and XQuery J. Funderburk and S. Malaika and B. Reinwald 2002 30 2
Design and implementation of a graphical interface to XQuery Enrico Augurusa and Daniele Braga and A. Campi and S. Ceri 2003 29 3
Highly distributed XQuery with DXQ M. Fernández and T. Jim and Kristi Morton and Nicola Onose and Jérôme Siméon 2007 28 2
Compiling XSLT 2.0 into XQuery 1.0 Achille Fokoue and K. Rose and Jérôme Siméon and L. Villard 2005 18 2
XQuery in the browser G. Fourny and Markus Pilman and D. Florescu and D. Kossmann and Tim Kraska and D. McBeath 2009 17 0
An Encoding of XQuery in Prolog J. Almendros-Jiménez 2009 17 1
Developing an Enterprise Web Application in XQuery Martin Kaufmann and D. Kossmann 2009 15 0
Integrating XQuery and Logic Programming J. Almendros-Jiménez and A. Becerra-Terón and F. J. Enciso-Baños 2009 14 0
Eliminating dead-code from XQuery programs P. Genevès and Nabil Layaïda 2010 12 0
XQuery in the browser G. Fourny and D. Kossmann and Tim Kraska and Markus Pilman and D. Florescu 2008 7 1
Function inlining in XQuery 3.0 optimization Leonard Wörteler and Michael Grossniklaus and C. Grün and M. Scholl 2015 5 0
Unleashing XQuery for Data-Independent Programming Sebastian Bächle and Caetano Sauer 2014 4 0
Programming the KDD Process using XQuery A. Romei and F. Turini 2011 3 0
An expressive bidirectional transformation language for XQuery view update (Special issue : Advanced Programming Techniques for Construction of Robust, Generic and Evolutionary Programs) Dongxi Liu and Zhenjiang Hu and M. Takeichi 2013 1 0
asp.html · xquery.html · nginx-config.html

View source

PLDB - Build the next great programming language · v2022 · Day 28 · Docs · Build · Acknowledgements · Traffic Today · Traffic Trends · Mirrors · GitHub · feedback@pldb.com