XQuery
From Wikibooks, the open-content textbooks collection
[edit] XQuery Examples Collection
Welcome to the XQuery Examples Collection Wikibook! XQuery is a World Wide Web Consortium recommendation for selecting data from documents and databases.
[edit] Current Status
A new release of eXist (1.4) is currently installed and under test. Please note any problems with these examples in the discussion
[edit] New and Revised Articles
- World Temperature records
- Digest Authentication
- Pachube feed
- Lucene_Search
- Lorum Ipsum text
- Navigating Collections
- Synchronizing Remote Collections
[edit] About this Project
This is a collaborative project and we encourage everyone who is using XQuery to contribute their XQuery examples. All example programs must conform to the creative-commons-2.5 share-alike with attribution license agreement [1].
Execution of examples use an eXist demo server.
- Instructors: please sign our Guest Registry if you are using this book for learning or teaching XQuery
- Contributors: please see our Naming Conventions to ensure your examples are consistent with the textbook
- Learners: If you are looking for a specific example program, please feel free to use the Examples Wanted section if you are looking for specific example programs
[edit] Introduction
- Background - A brief history and motivation for the XQuery standard.
[edit] Beginning Examples
Examples that do not assume knowledge of functions and modules.
- HelloWorld - A simple test to see if XQuery is installed correctly.
Assumes knowledge of functions and modules.
- Using XQuery Functions - How to read XQuery function documents and user XQuery functions
- Creating XQuery Functions - How to create your own local XQuery functions
- Returning the Longest String - A function to find the longest string from a list of strings
- Net Working Days - How to calculate the number of working days between two dates
- Introduction to XML Search - An overview of XML search terminology
- Navigating Collections - an example of an AJAX browser
[edit] Creating Custom Views
These examples use reflection on the structure of an XML document using name() to implement generic functions for XML transformations.
- HTML Table View - A generic HTML table representation
- Tree View - A generic HTML tree representation
- Grouping Items - how to group items in a report
[edit] Paginated Reports
Unlike HTML pages, paginated reports use the concept of text flows between pages. These examples show you how to convert raw XML into high-quality PDF files suitable for printing. The examples use a markup standard called XSLFO for "Formatted Objects"
- Generating PDF from XSL-FO files - Converting XML-FO to PDF files
- Typeswitch Tranformations Using the typeswitch function to transform an XML document {stage short|25%|Febuary 7th, 2010}}
[edit] Notification
When an event gets trigged there are several ways to notify users. Sending an e-mail message or creating an entry in an atom feed are to examples of notification services.
- Sending E-mail - How to send an e-mail message from within an XQuery
- URL Rewriting Basics How to make your URLs look nice
- Updates and Namespaces - How updates can change serialization
[edit] XML Differencing
- Compare two XML files - using the eXist compare() function to test to see if two XML files are exactly the same
- Time Comparison with XQuery - Using XQuery to Compare Dated Items
- XQuery from SQL - Using XQuery to access a classic Relational database - Employee/Department/Salary
- XML to SQL
- XQuery and XSLT
- XQuery and Python
[edit] Wikibook applications
[edit] Page Scraping
Page scraping is the process of extracting well-formed XML data from any HTML web page. When creating mashup applications this is also known as the harvesting process.
- Google Geocoding
- /String Analysis#Location_Mapping/ Mapping Car Registrations
- Flickr GoogleEarth
- Nationalgrid and Google Maps
- SMS tracker
[edit] Timelines
- Creating a Timeline - Creating a simple timeline view of events
- DBpedia with SPARQL - Football teams
- DBpedia with SPARQL and Simile Timeline - Album Chronology Creating a timeline of album releases using data from Wikipedia
-
- Adder - Creating a web service that adds two numbers.
- Basic Session Management - the basics of session management including getting a setting session variables
- Using Triggers to Log Events - how to set up a trigger to log store, update and remove events on a collection
- Sitemap for Content Management System XQuery functions can easily perform many common web site content management functions
- Validating a document - Validate a document with an XML Schema
- Graph Visualization
- Dataflow diagrams
- Sequence Diagrams
- Example Sequencer - Step-by-step tutorial
- Google Charts
- GoogleChart example - A demonstration of how to create a chart using the Google Charts API
- Histogram of File Sizes - An XQuery report that generates a histogram of file sizes
[edit] Puzzles, Maths and Games
[edit] Case Studies
- World Temperature records - conversion of text data formats to XML, indexing and data presentation
[edit] eXist db specific Functions
[edit] Modules and Functions
[edit] Appendixes
[edit] Systems that Support XQuery
Using native and hybrid XML databases that implement XQuery
[edit] Crib Sheets
[edit] Debugging XQuery
[edit] Other sources
[edit] Function Libraries
- FunctX XQuery Function Library by Priscilla Walmsley
[edit] Discussion Groups
[edit] Indexes
- Page index - generated
- Index of XQuery features - edited
- Index of Application Areas - edited
- Index of eXist modules and features - edited
Key to symbols:
indicates an XQuery/Best practice