Xquery Terms in XML
Common XQuery Terms in XML
Here are essential XQuery terms and concepts you should know when working with XML:
| Term | Description |
|---|---|
| XQuery | A language to query and transform XML data. |
| XPath | A language to navigate and select nodes from XML documents; used inside XQuery. |
| FLWOR | An acronym for For, Let, Where, Order by, Return – core XQuery expression structure for querying data. |
| Variable | Identified by a $ prefix, stores values or nodes during queries. |
| Sequence | An ordered collection of zero or more items (nodes or atomic values). |
| Node | An element, attribute, text, comment, or processing instruction in XML. |
| Atomic Value | A simple data value like string, integer, boolean, date, etc. |
| Function | Built-in or user-defined routines to manipulate data (e.g., fn:string()). |
| Predicate | A condition inside square brackets [ ] used to filter nodes in XPath/XQuery. |
| Expression | A piece of XQuery code that evaluates to a sequence or value. |
| Constructed Node | XML elements or attributes created as output by XQuery expressions. |
| Namespace | A URI used to uniquely identify XML vocabularies in documents and queries. |
| Prolog | The part at the beginning of an XQuery script declaring namespaces and variables. |
| Context Item | The current node or value that XPath/XQuery expressions operate on. |
| Static Type | The compile-time type of an expression, e.g., xs:string, element(). |
| Dynamic Type | The runtime type of the value returned by an expression. |
| Doc() Function | Retrieves an XML document by URI for querying. |
| FLWOR Clauses | Parts of the FLWOR expression: for, let, where, order by, return. |
Example: Using Some Terms
declare namespace ns = "http://example.com/ns";for $book in doc("library.xml")/ns:library/ns:book (: Variable $book, Doc() function, Namespace :)where $book/ns:year > 2000 (: Predicate in where clause :)order by $book/ns:title (: Order by clause :)return $book/ns:title (: Return clause :)Let me know if you want explanations or examples for any specific XQuery term!