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

Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using RoomNelson Glauber Leal
 
Hd insight programming
Hd insight programmingHd insight programming
Hd insight programmingCasear 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 jQuerydeimos
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutesSimon Willison
 
History of jQuery
History of jQueryHistory of jQuery
History of jQueryjeresig
 
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 2016Ben Lesh
 
Amazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkAmazon Cloud Services and Zend Framework
Amazon Cloud Services and Zend FrameworkShahar Evron
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for CassandraEdward Capriolo
 
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 2015StampedeCon
 
A Short Introduction To jQuery
A Short Introduction To jQueryA Short Introduction To jQuery
A Short Introduction To jQuerySudar Muthu
 
Cassandra and materialized views
Cassandra and materialized viewsCassandra and materialized views
Cassandra and materialized viewsGrzegorz Duda
 
Deep Dive: AWS Command Line Interface
Deep Dive: AWS Command Line InterfaceDeep Dive: AWS Command Line Interface
Deep Dive: AWS Command Line InterfaceAmazon Web Services
 
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 JetpackNelson Glauber Leal
 
jQuery Fundamentals
jQuery FundamentalsjQuery Fundamentals
jQuery FundamentalsGil Fink
 

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

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 LifePhillip Jeffrey
 
Performance and Creativity
Performance and CreativityPerformance and Creativity
Performance and CreativityPhillip Jeffrey
 
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, PhotographyPhillip Jeffrey
 
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?lisbk
 
Thinking The Unthinkable: Introduction
Thinking The Unthinkable: IntroductionThinking The Unthinkable: Introduction
Thinking The Unthinkable: Introductionlisbk
 
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 2017Stefan Kolle
 
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 MongoDBWilliam Candillon
 
10 things to make you think
10 things to make you think10 things to make you think
10 things to make you thinkStefan Kolle
 

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

Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web developmentJohannes Brodwall
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejsNick Lee
 
NoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love StoryNoSQL and JavaScript: a Love Story
NoSQL and JavaScript: a Love StoryAlexandre Morgaut
 
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 platformsAyush Sharma
 
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 MVCpootsbook
 
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_2012ghnash
 
Spring data iii
Spring data iiiSpring data iii
Spring data iii명철 강
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation FrameworkCaserta
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For BeginnersJonathan Wage
 
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 jQueryTatsuhiko Miyagawa
 
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 HourPeter Friese
 
G*ワークショップ in 仙台 Grails(とことん)入門
G*ワークショップ in 仙台 Grails(とことん)入門G*ワークショップ in 仙台 Grails(とことん)入門
G*ワークショップ in 仙台 Grails(とことん)入門Tsuyoshi Yamamoto
 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologyDaniel Knell
 
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 .NETJames Johnson
 
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 FrameworkIndicThreads
 

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

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Recently uploaded (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

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!