XQuery 3 0 Rocks
Candillon, William
XQuery has been designed by the W3C as a general purpose XML processing language. Although XQuery is mainly known as a query language for XML collections, it is a fully fledged programming language useful in a variety of architectures and environments. With an extremely powerful support for database queries, scripting, and full-text search, XQuery is providing a unified framework for building web applications. The aim of this talk is to briefly introduce some of the new language features in XQuery 3.0 and demo how XQuery & HTML5 can work together to build applications that are 300% awesome.
 the Zorba website. This is Zorba website, Zorba-xquery.com. And you see here you have to scroll down to read the description of the project. And with two lines of xquery code, you get everything a little bit cleaned up. And more concretely, this is a different kind of data you can find in the nature. Relational data, semi-structured data, structured documents, structured data. And the question is, how do you provide a single framework to deal with this heterogeneity of data? So for relational data, it's pretty much mystery solved. But what about everything else? And that's exactly the problem we address with xquery. We want to provide the same functional characteristics from relational database to any kind of data. So a couple of words about xquery. It's a family of specification from W3C. The language has an extremely powerful support for queries, updates, full text search, and scripting. It is a unified framework for all layers of a traditional software architecture, database, content management, middleware. Last but not least, it is a functional programming language that can be optimized and parallelized. So the Zorba project is an open source. Oracle is contributing to it. 28Msec, we're a startup company, and the Flora Foundation, which is a nonprofit organization that supports open source projects in the XML area. A couple of words about the internal of the project. One thing we are trying to do is to be up to date as much as possible with the W3C specification. So when implementing xquery 1.0, xquery 3.0, update facility, scripting extension, full text, we're also trying to provide a rich programming experience by providing a lot of module libraries, auto authentication, PDF generation, image processing, emails, REST, APIs, you name it. And since you can command your database management from xquery, one thing we are doing is providing a pluggable store so you can use any kind of storage behind xquery. So you can use PostgreSQL, the file system, 28Msec, we're using MongoDB. And on top of that, you can use it from different kinds of APIs, C++, Java, PHP. And since xquery is our favorite programming language, we also use xquery as a most language for xquery. Very quickly, a couple of cut snippets. This is the main expression in xquery. It's called a flower expression. It is an acronym for four let's where, order by, return. So here I'm selecting entry nodes where the author is anonymous, ordering by time, and I return the title. This is an update expression here. I'm inserting a LOR node into the entries variables. This is a full text expression. So I'm going to match the word meal in the phrase breakfast of champion using one net tether. So this expression is going to return true because of the relationship in our term. So meal is a, breakfast is in our term of meal. This is how you start a web server with Zorba. So you can pass a closure as parameter which is a new feature in xquery.zero. And so for each incoming HTTP request on the port 80, it's going to call the handler function receiving the HTTP request as parameter. You can also declare annotations to your functions much like in Java annotations. And we provide a reflection API so you can read annotation names and values to functions. So here I'm going to use a reflection API to match HTTP request to xquery function invocation. So let me show you a small application I built in xquery. So this is a small guest book so I can add an entry. Okay. So that seems to work. A couple of interesting things about this application. First, if you look at the source code, it does not run any lines of JavaScript. So client side we execute also xquery. We embed the xquery processor into a, in JavaScript and we execute the code. So it provides a strong language to deal with HTML. And what happens here, for instance, is that I catch an event on the submit button which is going to call the submit function and I'm going to seamlessly invoke xquery functions that are defined in the server. So to go back to the application, we have a little search box which leverages the full text feature of xquery. So I can look for the world fish. Okay. So you have this quote from Nemo. And I can use the till operator to match now our terms of fish. So here you see there's this new entry that has been matched by the full text expression. You can use also logical operators. They can look for fish or pig. And I can also, okay. And I can also exclude the world food. Yeah, that's pretty much it. And last year a student from Manna wrote AWS client library in xquery. And once it was done, it compares the number of lines of code to write the same library in xquery compared to the Java client library. And for the same level of functionality, it took 80% less code to build the library in xquery. This is PHP comparison. And if you look at this code snippet, you can get a feeling of why xquery is so much productive. Here you have Java code, SQL expression, X pass expression, Java script HTML. And with xquery, we're going to use a single programming language on all layers. So that was a lot of angle brackets you've seen. And what about JSON? In the Zorba development rank, we're providing a first class support for JSON expression. We're extending the Xquery data model to support the JSON data model. So let me show you an example. So here you see in this query, I have some JSON data. And the language supports a first class support for JSON constructions. So I have a couple of statistic data in JSON format. And for each statistic, I'm going to do a group by URL. And I'm going to compute the average response time. Let's execute the query. Yeah, it works. So we get 005. And so the take away message, we think that xquery has the most powerful data model you can find. And as you've seen, it has a first class support for XML, JSON, text. And it's also a unified framework for all layers of traditional software architecture. And as it turns out, this flexibility is extremely productive for building applications. And because it's a declarative programming language, it has a lot of opportunities for optimization and parallelization and for really high speed performance. So there is a young man named Dimitri. And he was quite the internet sensation in 2011. And let's see his take on xquery. So that's it. I hope you check it out at Zorba-xquery.com. Thank you very much. Thanks.
 the Zorba website. This is Zorba website, Zorba-xquery.com. And you see here you have  to scroll down to read the description of the project. And with two lines of xquery  code, you get everything a little bit cleaned up. And more concretely, this is a different  kind of data you can find in the nature. Relational data, semi-structured data, structured documents,  structured data. And the question is, how do you provide a single framework to deal with  this heterogeneity of data? So for relational data, it's pretty much mystery solved. But  what about everything else? And that's exactly the problem we address with xquery. We want  to provide the same functional characteristics from relational database to any kind of data. So  a couple of words about xquery. It's a family of specification from W3C. The language has an  extremely powerful support for queries, updates, full text search, and scripting. It is a unified  framework for all layers of a traditional software architecture, database, content management,  middleware. Last but not least, it is a functional programming language that can be optimized and  parallelized. So the Zorba project is an open source. Oracle is contributing to it. 28Msec,  we're a startup company, and the Flora Foundation, which is a nonprofit organization that supports  open source projects in the XML area. A couple of words about the internal of the project. One  thing we are trying to do is to be up to date as much as possible with the W3C specification. So  when implementing xquery 1.0, xquery 3.0, update facility, scripting extension, full text, we're  also trying to provide a rich programming experience by providing a lot of module libraries,  auto authentication, PDF generation, image processing, emails, REST, APIs, you name it. And  since you can command your database management from xquery, one thing we are doing is providing a  pluggable store so you can use any kind of storage behind xquery. So you can use PostgreSQL,  the file system, 28Msec, we're using MongoDB. And on top of that, you can use it from different  kinds of APIs, C++, Java, PHP. And since xquery is our favorite programming language, we also use  xquery as a most language for xquery. Very quickly, a couple of cut snippets. This is the main  expression in xquery. It's called a flower expression. It is an acronym for four let's  where, order by, return. So here I'm selecting entry nodes where the author is anonymous, ordering  by time, and I return the title. This is an update expression here. I'm inserting a  LOR node into the entries variables. This is a full text expression. So I'm going to match the word  meal in the phrase breakfast of champion using one net tether. So this expression is going to  return true because of the relationship in our term. So meal is a, breakfast is in our  term of meal. This is how you start a web server with Zorba. So you can pass a closure as  parameter which is a new feature in xquery.zero. And so for each incoming HTTP request on the  port 80, it's going to call the handler function receiving the HTTP request as parameter. You  can also declare annotations to your functions much like in Java annotations. And we provide  a reflection API so you can read annotation names and values to functions. So here I'm  going to use a reflection API to match HTTP request to xquery function invocation. So let  me show you a small application I built in xquery. So this is a small guest book so I  can add an entry. Okay. So that seems to work. A couple of interesting things about this  application. First, if you look at the source code, it does not run any lines of JavaScript.  So client side we execute also xquery. We embed the xquery processor into a, in JavaScript  and we execute the code. So it provides a strong language to deal with HTML. And what  happens here, for instance, is that I catch an event on the submit button which is going  to call the submit function and I'm going to seamlessly invoke xquery functions that  are defined in the server. So to go back to the application, we have a little search box  which leverages the full text feature of xquery. So I can look for the world fish. Okay. So  you have this quote from Nemo. And I can use the till operator to match now our terms of  fish. So here you see there's this new entry that has been matched by the full text expression.  You can use also logical operators. They can look for fish or pig. And I can also, okay.  And I can also exclude the world food. Yeah, that's pretty much it. And last year a student  from Manna wrote AWS client library in xquery. And once it was done, it compares the number  of lines of code to write the same library in xquery compared to the Java client library.  And for the same level of functionality, it took 80% less code to build the library in  xquery. This is PHP comparison. And if you look at this code snippet, you can get a feeling  of why xquery is so much productive. Here you have Java code, SQL expression, X pass  expression, Java script HTML. And with xquery, we're going to use a single programming language  on all layers. So that was a lot of angle brackets you've seen. And what about JSON?  In the Zorba development rank, we're providing a first class support for JSON expression.  We're extending the Xquery data model to support the JSON data model. So let me show you an  example. So here you see in this query, I have some JSON data. And the language supports  a first class support for JSON constructions. So I have a couple of statistic data in JSON  format. And for each statistic, I'm going to do a group by URL. And I'm going to compute  the average response time. Let's execute the query. Yeah, it works. So we get 005.  And so the take away message, we think that xquery has the most powerful data model you  can find. And as you've seen, it has a first class support for XML, JSON, text. And it's  also a unified framework for all layers of traditional software architecture. And as  it turns out, this flexibility is extremely productive for building applications. And  because it's a declarative programming language, it has a lot of opportunities for optimization  and parallelization and for really high speed performance. So there is a young man named  Dimitri. And he was quite the internet sensation in 2011. And let's see his take on xquery.  So that's it. I hope you check it out at Zorba-xquery.com. Thank you very much. Thanks.
XQuery_3_0_Rocks_VbFzcQT1qio_2_0_4019.png XQuery_3_0_Rocks_VbFzcQT1qio_2_4020_6599.png XQuery_3_0_Rocks_VbFzcQT1qio_2_6600_6647.png XQuery_3_0_Rocks_VbFzcQT1qio_2_6648_7175.png XQuery_3_0_Rocks_VbFzcQT1qio_2_7176_9419.png XQuery_3_0_Rocks_VbFzcQT1qio_2_9420_13559.png XQuery_3_0_Rocks_VbFzcQT1qio_2_13560_13799.png XQuery_3_0_Rocks_VbFzcQT1qio_2_13800_15338.png
the Zorba website. This is Zorba website, Zorba-xquery.com. And you see here you have to scroll down to read the description of the project. And with two lines of xquery code, you get everything a little bit cleaned up. And more concretely, this is a different kind of data you can find in the nature. Relational data, semi-structured data, structured documents, structured data. And the question is, how do you provide a single framework to deal with this heterogeneity of data? So for relational data, it's pretty much mystery solved. But what about everything else? And that's exactly the problem we address with xquery. We want to provide the same functional characteristics from relational database to any kind of data. So a couple of words about xquery. It's a family of specification from W3C. The language has an extremely powerful support for queries, updates, full text search, and scripting. It is a unified framework for all layers of a traditional software architecture, database, content management, middleware. Last but not least, it is a functional programming language that can be optimized and parallelized. So the Zorba project is an open source. Oracle is contributing to it. 28Msec, we're a startup company, and the Flora Foundation, which is a nonprofit organization that supports open source projects in the XML area. A couple of words about the internal of the project. One thing we are trying to do is to be up to date as much as possible with the W3C specification. So when implementing xquery 1.0, xquery 3.0, update facility, scripting extension, full text, we're also trying to provide a rich programming experience by providing a lot of module libraries, auto authentication, PDF generation, image processing, emails, REST, APIs, you name it. And since you can command your database management from xquery, one thing we are doing is providing a pluggable store so you can use any kind of storage behind xquery. So you can use PostgreSQL, the file system, 28Msec, we're using MongoDB. And on top of that, you can use it from different kinds of APIs, C++, Java, PHP. And since xquery is our favorite programming language, we also use xquery as a most language for xquery. Very quickly, a couple of cut snippets. This is the main expression in xquery. It's called a flower expression. It is an acronym for four let's where, order by, return. So here I'm selecting entry nodes where the author is anonymous, ordering by time, and I return the title. This is an update expression here. I'm inserting a LOR node into the entries variables. This is a full text expression. So I'm going to match the word meal in the phrase breakfast of champion using one net tether. So this expression is going to return true because of the relationship in our term. So meal is a, breakfast is in our term of meal. This is how you start a web server with Zorba. So you can pass a closure as parameter which is a new feature in xquery.zero. And so for each incoming HTTP request on the port 80, it's going to call the handler function receiving the HTTP request as parameter. You can also declare annotations to your functions much like in Java annotations. And we provide a reflection API so you can read annotation names and values to functions. So here I'm going to use a reflection API to match HTTP request to xquery function invocation. So let me show you a small application I built in xquery. So this is a small guest book so I can add an entry. Okay. So that seems to work. A couple of interesting things about this application. First, if you look at the source code, it does not run any lines of JavaScript. So client side we execute also xquery. We embed the xquery processor into a, in JavaScript and we execute the code. So it provides a strong language to deal with HTML. And what happens here, for instance, is that I catch an event on the submit button which is going to call the submit function and I'm going to seamlessly invoke xquery functions that are defined in the server. So to go back to the application, we have a little search box which leverages the full text feature of xquery. So I can look for the world fish. Okay. So you have this quote from Nemo. And I can use the till operator to match now our terms of fish. So here you see there's this new entry that has been matched by the full text expression. You can use also logical operators. They can look for fish or pig. And I can also, okay. And I can also exclude the world food. Yeah, that's pretty much it. And last year a student from Manna wrote AWS client library in xquery. And once it was done, it compares the number of lines of code to write the same library in xquery compared to the Java client library. And for the same level of functionality, it took 80% less code to build the library in xquery. This is PHP comparison. And if you look at this code snippet, you can get a feeling of why xquery is so much productive. Here you have Java code, SQL expression, X pass expression, Java script HTML. And with xquery, we're going to use a single programming language on all layers. So that was a lot of angle brackets you've seen. And what about JSON? In the Zorba development rank, we're providing a first class support for JSON expression. We're extending the Xquery data model to support the JSON data model. So let me show you an example. So here you see in this query, I have some JSON data. And the language supports a first class support for JSON constructions. So I have a couple of statistic data in JSON format. And for each statistic, I'm going to do a group by URL. And I'm going to compute the average response time. Let's execute the query. Yeah, it works. So we get 005. And so the take away message, we think that xquery has the most powerful data model you can find. And as you've seen, it has a first class support for XML, JSON, text. And it's also a unified framework for all layers of traditional software architecture. And as it turns out, this flexibility is extremely productive for building applications. And because it's a declarative programming language, it has a lot of opportunities for optimization and parallelization and for really high speed performance. So there is a young man named Dimitri. And he was quite the internet sensation in 2011. And let's see his take on xquery. So that's it. I hope you check it out at Zorba-xquery.com. Thank you very much. Thanks.
specification from W3C. The language has an extremely powerful support for queries, updates, full text search, and scripting. It is a unified doing is providing a pluggable store so you can as parameter which is a new feature in functions that are defined in the server. So to has been matched by the full text expression. You So here you see in this query, I have some JSON first class support for XML, JSON, text. And it's also a unified framework for all layers of productive for building applications. And because it's a declarative programming language, it has a