Question: I would like to understand the basics of how to write and execute XQuery program on Linux OS. Can you explain it with a simple example?
Answer: In this article, let us review very quickly how to write a basic Hello World XQuery program and execute XQuery program on Linux or Unix OS.
1. Write a Hello World XQuery Program
Create the helloworld program using a Vim editor as shown below.
$ vim helloworld (: Hello World with XQuery :) let $i := "Hello World!" return $i
A very simple version of hello world
$ vim helloworld-simple "Hello World!"
Note: Comment in XQuery starts with “(:”, and ends with “:)”.
2. Make sure XQuery Interpreter is installed on your system
Make sure XQuery interpreter xqilla is installed on your system as shown below.
$ which xqilla /usr/bin/xqilla
Installing XQilla interpreter
If you don’t have XQuery interpreter, install it as shown below.
$ sudo apt-get install xqilla
3. Execute the XQuery Program
You can execute using xqilla helloworld.
$ xqilla helloworld Hello World! ( or ) $ xqilla helloworld-simple Hello World!
Note: As XQuery is an interpreted language, you don’t have the compilation step similar to the C program.
4. Additional XQuery Resources
Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.Get the Linux Sysadmin Course Now!
If you enjoyed this article, you might also like..
|
|
|
|






My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about
{ 1 comment… read it below or add one }
Thank you for information about xqilla, I’ll try that to learn XQuery script.