SlideShare a Scribd company logo
1 of 38
Download to read offline
28   msec
            XQuery 3 Rocks
            http://www.zorba-xquery.com
            William Candillon - FOSDEM 2012
Harnessing Flexible Data
{
    "photos": {
      "page": 1,
      "pages": 94276,
      "total": "1414129",
      "photo": [{
        "id": "3891667770",
        "owner": "354683133120"

<kml>
  <Placemark>
    <name>Simple placemark</name>
    <Point>
<coordinates>-122.0822035425683,37.422289901
40251,0</coordinates>
{
        "photos": {
          "page": 1,
          "pages": 94276,
          "total": "1414129",
          "photo": [{
            "id": "3891667770",
            "owner": "354683133120"

    <kml>




✔
      <Placemark>
        <name>Simple placemark</name>
        <Point>
    <coordinates>-122.0822035425683,37.422289901
    40251,0</coordinates>
{
        "photos": {
          "page": 1,
          "pages": 94276,
          "total": "1414129",
          "photo": [{
            "id": "3891667770",
            "owner": "354683133120"




                                           ?
    <kml>




✔
      <Placemark>
        <name>Simple placemark</name>
        <Point>
    <coordinates>-122.0822035425683,37.422289901
    40251,0</coordinates>




?                                          ?
Meet XQuery
XQuery



   •   Family of Specification from w3c

   •   Most Complex Complete Data Model

   •   Talks Natively to Web

   •   Query, Store, Index, Update, Full-Text

   •   Unified Framework

   •   Optimization & Parallelization
Meet Zorba

         Open Source XQuery Processor
         Contributors: Oracle, 28msec, FLWOR


   All Flavors Available      Runs Everywhere


   Rich Module Libraries      Developer Tools


   Pluggable Store            Fun & Productive
Zorba
<div id=”entries”>{
  for $entry in $entries
  let $title := string($entry/@title)
  where $entry/@author = “anonymous”
  order by $entry/@datetime
  return <h1>{$title}</h1>
}</div>
insert node <entry>Hello World</entry>
       into $entries
let $x := <m>breakfast of champions</m>
return $x contains text "meal"
  using thesaurus at
    "http://wordnet.princeton.edu"
  relationship "narrower term"
let $handler :=
  function($request){
    let $world := $request/text()
    return
      <h1>Hello {$world}!</h1>
  }
return mongoose:start($handler, 80);

mongoose:cin();
declare
%http:get(“/hello/{$world}”)
function html:hello($world)
{
   <h1>Hello {$world}!</h1>
};
Client                                         Server

<script type="application/xquery">
declare sequential function local:submit($loc,     declare sequential function guestbook:add(
$evtObj)                                              $author as xs:string, $entry as xs:string
{                                                  ){
                                                      let $date   := fn:current-dateTime()
     let $name    := s:id("author")/data(@value)      let $entry := <entry author="{$author}"
     let $text    := s:id("text")/text()                        datetime="{$date}">{$text}</entry>
     return                                           return
       guestbook:add($name, $text);                      xqddf:insert-nodes-last($entries, $entry);
};                                                 };

b:addEventListener(s:id("submit"),                 declare sequential function guestbook:list() {
                  "onclick",                          <entries>{
                   local:submit#2);                     xqddf:collection($entries)
                                                      }</entries>;
guestbook:list();                                  };
</script>
Client                                         Server

<script type="application/xquery">
declare sequential function local:submit($loc,     declare sequential function guestbook:add(
$evtObj)                                              $author as xs:string, $entry as xs:string
{                                                  ){
                                                      let $date   := fn:current-dateTime()
     let $name    := s:id("author")/data(@value)      let $entry := <entry author="{$author}"
     let $text    := s:id("text")/text()                        datetime="{$date}">{$text}</entry>
     return                                           return
       guestbook:add($name, $text);                      xqddf:insert-nodes-last($entries, $entry);
};                                                 };

b:addEventListener(s:id("submit"),                 declare sequential function guestbook:list(){
                  "onclick",                          <entries>{
                   local:submit#2);                     xqddf:collection($entries)
                                                      }</entries>;
guestbook:list();                                  };
</script>




         Seamless Invocations
AWS Libraries (2011)

                                       Java               XQuery

                    8589
    Lines of code




                                          2905
                                                              2309
                                1469

                                                    572                    455


                           S3                 SimpleDB               SNS
AWS Libraries (2011)

                Java            XQuery

                 13803




                                         Lines of Codes
Lines of code




                                             - 80%
                               2496




                         AWS
AWS Libraries (2011)

                PHP             XQuery

                 6531




                                         Lines of Codes
Lines of code




                              2496
                                             - 62%

                        AWS
<html>
  <head>
    <script type='text/javascript'>
    function buy(e) {
       newElement = document.createElement("p");
       elementText = document.createTextNode
                  (e.target.getAttribute(id));
       newElement.appendChild(elementText);
       var res = document.evaluate(
         "//div[@id='shoppingcart']",
         document, null,
         XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
                                                              HTML
         null);
       res.snapshotItem(0).appendChild("newElement");}
    </script>                                               JavaScript
  </head>
  <body>
    <div>Shopping cart</div>
    <div id="shoppingcart"></div>
    <%
                                                             XPath
       // Code establishing connection
       ResultSet results =
       statement.executeQuery ("SELECT * FROM PRODUCTS");
       while (results.next()) {
         out.println("<div>");
                                                               Java
         String prodName = results.getString(1);
         out.println(prodName);

                                                              SQL
         out.println("<input type='button' value='Buy'");
         out.println("id='"+prodName+"'");
         out.println("onclick='buy(event)'/>").
         out.println("</div>");
       }
       results.close();
       // Code closing connection
    %>
  </body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
    <script type='application/xquery'>
declare updating function local:buy($evt, $obj) {
   insert node <p>{$obj/@id}</p> as first
     into //div[@id="shoppingcart"]
};
b:addEventListener(b:dom()//input,
                     "onclick",
                     xs:Qname("local:buy"));
</script>
   </head>
   <body>
     <div>Shopping cart</div>
     <div id="shoppingcart">{
                                                    XQuery Everywhere
       for $p in doc("products.xml")//*:product
       return
          <div>
            {$p/*:name}
            <input type='button'
                   value='Buy'
                   id='{$p/*:name}'/>
          </div>
     }</div>
   </body>
</html>
let $stats := [ { "response_time":
0.05 ... } ...]
for $stat in j:values($stats)
let $url := $stat("http_action")
order by $url
return
{
  "url": $url,
  "avg": avg($stat("response_time"))
}
$zorba -q jsoniq.xq -f
{ "url" : "GET /docs/spec/en-US/html-
single/index.html", "avg" : 0.05 }
Take away


   • Powerful Data Model
   • Flexible Programming Model
   • Productivity
   • Performance
28   msec
            Thank you!

More Related Content

What's hot

Hd insight programming
Hd insight programmingHd insight programming
Hd insight programming
Casear Chu
 
Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuery
deimos
 
Amazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkAmazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend Framework
Shahar Evron
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
Edward Capriolo
 

What's hot (19)

Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using Room
 
Hd insight programming
Hd insight programmingHd insight programming
Hd insight programming
 
Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuery
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
History of jQuery
History of jQueryHistory of jQuery
History of jQuery
 
jQuery
jQueryjQuery
jQuery
 
Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016
 
Amazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkAmazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend Framework
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 
Cassandra 3.0 - JSON at scale - StampedeCon 2015
Cassandra 3.0 - JSON at scale - StampedeCon 2015Cassandra 3.0 - JSON at scale - StampedeCon 2015
Cassandra 3.0 - JSON at scale - StampedeCon 2015
 
Drupal 8: Fields reborn
Drupal 8: Fields rebornDrupal 8: Fields reborn
Drupal 8: Fields reborn
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuery
 
Cassandra and materialized views
Cassandra and materialized viewsCassandra and materialized views
Cassandra and materialized views
 
Deep Dive: AWS Command Line Interface
Deep Dive: AWS Command Line InterfaceDeep Dive: AWS Command Line Interface
Deep Dive: AWS Command Line Interface
 
Min-Maxing Software Costs
Min-Maxing Software CostsMin-Maxing Software Costs
Min-Maxing Software Costs
 
Fatc
FatcFatc
Fatc
 
Aplicações Assíncronas no Android com Coroutines e Jetpack
Aplicações Assíncronas no Android com Coroutines e JetpackAplicações Assíncronas no Android com Coroutines e Jetpack
Aplicações Assíncronas no Android com Coroutines e Jetpack
 
JavaScript JQUERY AJAX
JavaScript JQUERY AJAXJavaScript JQUERY AJAX
JavaScript JQUERY AJAX
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery Fundamentals
 

Viewers also liked

Viewers also liked (11)

The Role of Facebook in Everyday Student Life
The Role of Facebook in Everyday Student LifeThe Role of Facebook in Everyday Student Life
The Role of Facebook in Everyday Student Life
 
Performance and Creativity
Performance and CreativityPerformance and Creativity
Performance and Creativity
 
My Summer of Code
My Summer of CodeMy Summer of Code
My Summer of Code
 
The Tao of Sharing: Social Media, Games, Photography
The Tao of Sharing: Social Media, Games, PhotographyThe Tao of Sharing: Social Media, Games, Photography
The Tao of Sharing: Social Media, Games, Photography
 
Amplified Events, Seminars, Conferences, ...: What? Why? How?
Amplified Events, Seminars, Conferences, ...: What? Why? How?Amplified Events, Seminars, Conferences, ...: What? Why? How?
Amplified Events, Seminars, Conferences, ...: What? Why? How?
 
Thinking The Unthinkable: Introduction
Thinking The Unthinkable: IntroductionThinking The Unthinkable: Introduction
Thinking The Unthinkable: Introduction
 
Facebook
FacebookFacebook
Facebook
 
Extending and scripting PDT
Extending and scripting PDTExtending and scripting PDT
Extending and scripting PDT
 
7 pragmatic initiatives to improve your CX in 2017
7 pragmatic initiatives to improve your CX in  20177 pragmatic initiatives to improve your CX in  2017
7 pragmatic initiatives to improve your CX in 2017
 
Scalable XQuery Processing with Zorba on top of MongoDB
Scalable XQuery Processing with Zorba on top of MongoDBScalable XQuery Processing with Zorba on top of MongoDB
Scalable XQuery Processing with Zorba on top of MongoDB
 
10 things to make you think
10 things to make you think10 things to make you think
10 things to make you think
 

Similar to XQuery Rocks

Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
IndicThreads
 

Similar to XQuery Rocks (20)

Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web development
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
NoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love StoryNoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love Story
 
Play!ng with scala
Play!ng with scalaPlay!ng with scala
Play!ng with scala
 
Jquery
JqueryJquery
Jquery
 
Flask and Angular: An approach to build robust platforms
Flask and Angular:  An approach to build robust platformsFlask and Angular:  An approach to build robust platforms
Flask and Angular: An approach to build robust platforms
 
Backbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVCBackbone.js — Introduction to client-side JavaScript MVC
Backbone.js — Introduction to client-side JavaScript MVC
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012
 
Spring data iii
Spring data iiiSpring data iii
Spring data iii
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation Framework
 
Broadleaf Presents Thymeleaf
Broadleaf Presents ThymeleafBroadleaf Presents Thymeleaf
Broadleaf Presents Thymeleaf
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
jQuery
jQueryjQuery
jQuery
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 Hour
 
G*ワークショップ in 仙台 Grails(とことん)入門
G*ワークショップ in 仙台 Grails(とことん)入門G*ワークショップ in 仙台 Grails(とことん)入門
G*ワークショップ in 仙台 Grails(とことん)入門
 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technology
 
A Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NETA Rich Web Experience with jQuery, Ajax and .NET
A Rich Web Experience with jQuery, Ajax and .NET
 
Overview Of Lift Framework
Overview Of Lift FrameworkOverview Of Lift Framework
Overview Of Lift Framework
 
Overview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web FrameworkOverview of The Scala Based Lift Web Framework
Overview of The Scala Based Lift Web Framework
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

XQuery Rocks

  • 1. 28 msec XQuery 3 Rocks http://www.zorba-xquery.com William Candillon - FOSDEM 2012
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 11. { "photos": { "page": 1, "pages": 94276, "total": "1414129", "photo": [{ "id": "3891667770", "owner": "354683133120" <kml> <Placemark> <name>Simple placemark</name> <Point> <coordinates>-122.0822035425683,37.422289901 40251,0</coordinates>
  • 12. { "photos": { "page": 1, "pages": 94276, "total": "1414129", "photo": [{ "id": "3891667770", "owner": "354683133120" <kml> ✔ <Placemark> <name>Simple placemark</name> <Point> <coordinates>-122.0822035425683,37.422289901 40251,0</coordinates>
  • 13. { "photos": { "page": 1, "pages": 94276, "total": "1414129", "photo": [{ "id": "3891667770", "owner": "354683133120" ? <kml> ✔ <Placemark> <name>Simple placemark</name> <Point> <coordinates>-122.0822035425683,37.422289901 40251,0</coordinates> ? ?
  • 15. XQuery • Family of Specification from w3c • Most Complex Complete Data Model • Talks Natively to Web • Query, Store, Index, Update, Full-Text • Unified Framework • Optimization & Parallelization
  • 16. Meet Zorba Open Source XQuery Processor Contributors: Oracle, 28msec, FLWOR All Flavors Available Runs Everywhere Rich Module Libraries Developer Tools Pluggable Store Fun & Productive
  • 17. Zorba
  • 18. <div id=”entries”>{ for $entry in $entries let $title := string($entry/@title) where $entry/@author = “anonymous” order by $entry/@datetime return <h1>{$title}</h1> }</div>
  • 19. insert node <entry>Hello World</entry> into $entries
  • 20. let $x := <m>breakfast of champions</m> return $x contains text "meal" using thesaurus at "http://wordnet.princeton.edu" relationship "narrower term"
  • 21. let $handler := function($request){ let $world := $request/text() return <h1>Hello {$world}!</h1> } return mongoose:start($handler, 80); mongoose:cin();
  • 23.
  • 24. Client Server <script type="application/xquery"> declare sequential function local:submit($loc, declare sequential function guestbook:add( $evtObj) $author as xs:string, $entry as xs:string { ){ let $date := fn:current-dateTime() let $name := s:id("author")/data(@value) let $entry := <entry author="{$author}" let $text := s:id("text")/text() datetime="{$date}">{$text}</entry> return return guestbook:add($name, $text); xqddf:insert-nodes-last($entries, $entry); }; }; b:addEventListener(s:id("submit"), declare sequential function guestbook:list() { "onclick", <entries>{ local:submit#2); xqddf:collection($entries) }</entries>; guestbook:list(); }; </script>
  • 25. Client Server <script type="application/xquery"> declare sequential function local:submit($loc, declare sequential function guestbook:add( $evtObj) $author as xs:string, $entry as xs:string { ){ let $date := fn:current-dateTime() let $name := s:id("author")/data(@value) let $entry := <entry author="{$author}" let $text := s:id("text")/text() datetime="{$date}">{$text}</entry> return return guestbook:add($name, $text); xqddf:insert-nodes-last($entries, $entry); }; }; b:addEventListener(s:id("submit"), declare sequential function guestbook:list(){ "onclick", <entries>{ local:submit#2); xqddf:collection($entries) }</entries>; guestbook:list(); }; </script> Seamless Invocations
  • 26.
  • 27.
  • 28.
  • 29. AWS Libraries (2011) Java XQuery 8589 Lines of code 2905 2309 1469 572 455 S3 SimpleDB SNS
  • 30. AWS Libraries (2011) Java XQuery 13803 Lines of Codes Lines of code - 80% 2496 AWS
  • 31. AWS Libraries (2011) PHP XQuery 6531 Lines of Codes Lines of code 2496 - 62% AWS
  • 32. <html> <head> <script type='text/javascript'> function buy(e) { newElement = document.createElement("p"); elementText = document.createTextNode (e.target.getAttribute(id)); newElement.appendChild(elementText); var res = document.evaluate( "//div[@id='shoppingcart']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, HTML null); res.snapshotItem(0).appendChild("newElement");} </script> JavaScript </head> <body> <div>Shopping cart</div> <div id="shoppingcart"></div> <% XPath // Code establishing connection ResultSet results = statement.executeQuery ("SELECT * FROM PRODUCTS"); while (results.next()) { out.println("<div>"); Java String prodName = results.getString(1); out.println(prodName); SQL out.println("<input type='button' value='Buy'"); out.println("id='"+prodName+"'"); out.println("onclick='buy(event)'/>"). out.println("</div>"); } results.close(); // Code closing connection %> </body> </html>
  • 33. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type='application/xquery'> declare updating function local:buy($evt, $obj) { insert node <p>{$obj/@id}</p> as first into //div[@id="shoppingcart"] }; b:addEventListener(b:dom()//input, "onclick", xs:Qname("local:buy")); </script> </head> <body> <div>Shopping cart</div> <div id="shoppingcart">{ XQuery Everywhere for $p in doc("products.xml")//*:product return <div> {$p/*:name} <input type='button' value='Buy' id='{$p/*:name}'/> </div> }</div> </body> </html>
  • 34. let $stats := [ { "response_time": 0.05 ... } ...] for $stat in j:values($stats) let $url := $stat("http_action") order by $url return { "url": $url, "avg": avg($stat("response_time")) }
  • 35. $zorba -q jsoniq.xq -f { "url" : "GET /docs/spec/en-US/html- single/index.html", "avg" : 0.05 }
  • 36. Take away • Powerful Data Model • Flexible Programming Model • Productivity • Performance
  • 37.
  • 38. 28 msec Thank you!