not your grandma's xquery

73
Not Your Grandma’s XQuery Key Features & Perspectives William Candillon { [email protected] } XML Amsterdam 2011 28 msec

Upload: william-candillon

Post on 16-Jan-2015

14.890 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Not your Grandma's XQuery

Not Your Grandmarsquos XQueryKey Features amp Perspectives

William Candillon candillon28mseccomXML Amsterdam 2011

28 msec

ldquoWhat I saw in your five-minutes talk hardly looks at all like the XQuery I saw back thenrdquo

- Daniel Weinred Google

Not Your Grandmarsquos XQuery

Download the CoreSDK

Deploy in one-click

Automatic Scaling

bull

Client JavaScript

Middleware Java

Content Management

Lucene

Database MySQL

Application Stack

Client JavaScript

XQueryMiddleware Java

XQueryContent

ManagementLucene

XQuery

Database MySQL

XQuery

Application Stack

Application Stack

Client

XQuery

in the Browser

Middleware

XQueryScripting

Content Management

XQueryFull-Text

Database

XQuery

Data Definition Facility

XQuery Data Definition Facility

bull Open Specification (httpgooglXzK8p)

bull Implemented by Zorba (httpgoogl4huso)

bull Extending XQuery with

- Collections

- Indexes

- Integrity Contraints

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 2: Not your Grandma's XQuery

ldquoWhat I saw in your five-minutes talk hardly looks at all like the XQuery I saw back thenrdquo

- Daniel Weinred Google

Not Your Grandmarsquos XQuery

Download the CoreSDK

Deploy in one-click

Automatic Scaling

bull

Client JavaScript

Middleware Java

Content Management

Lucene

Database MySQL

Application Stack

Client JavaScript

XQueryMiddleware Java

XQueryContent

ManagementLucene

XQuery

Database MySQL

XQuery

Application Stack

Application Stack

Client

XQuery

in the Browser

Middleware

XQueryScripting

Content Management

XQueryFull-Text

Database

XQuery

Data Definition Facility

XQuery Data Definition Facility

bull Open Specification (httpgooglXzK8p)

bull Implemented by Zorba (httpgoogl4huso)

bull Extending XQuery with

- Collections

- Indexes

- Integrity Contraints

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 3: Not your Grandma's XQuery

Not Your Grandmarsquos XQuery

Download the CoreSDK

Deploy in one-click

Automatic Scaling

bull

Client JavaScript

Middleware Java

Content Management

Lucene

Database MySQL

Application Stack

Client JavaScript

XQueryMiddleware Java

XQueryContent

ManagementLucene

XQuery

Database MySQL

XQuery

Application Stack

Application Stack

Client

XQuery

in the Browser

Middleware

XQueryScripting

Content Management

XQueryFull-Text

Database

XQuery

Data Definition Facility

XQuery Data Definition Facility

bull Open Specification (httpgooglXzK8p)

bull Implemented by Zorba (httpgoogl4huso)

bull Extending XQuery with

- Collections

- Indexes

- Integrity Contraints

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 4: Not your Grandma's XQuery

Download the CoreSDK

Deploy in one-click

Automatic Scaling

bull

Client JavaScript

Middleware Java

Content Management

Lucene

Database MySQL

Application Stack

Client JavaScript

XQueryMiddleware Java

XQueryContent

ManagementLucene

XQuery

Database MySQL

XQuery

Application Stack

Application Stack

Client

XQuery

in the Browser

Middleware

XQueryScripting

Content Management

XQueryFull-Text

Database

XQuery

Data Definition Facility

XQuery Data Definition Facility

bull Open Specification (httpgooglXzK8p)

bull Implemented by Zorba (httpgoogl4huso)

bull Extending XQuery with

- Collections

- Indexes

- Integrity Contraints

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 5: Not your Grandma's XQuery

Deploy in one-click

Automatic Scaling

bull

Client JavaScript

Middleware Java

Content Management

Lucene

Database MySQL

Application Stack

Client JavaScript

XQueryMiddleware Java

XQueryContent

ManagementLucene

XQuery

Database MySQL

XQuery

Application Stack

Application Stack

Client

XQuery

in the Browser

Middleware

XQueryScripting

Content Management

XQueryFull-Text

Database

XQuery

Data Definition Facility

XQuery Data Definition Facility

bull Open Specification (httpgooglXzK8p)

bull Implemented by Zorba (httpgoogl4huso)

bull Extending XQuery with

- Collections

- Indexes

- Integrity Contraints

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 6: Not your Grandma's XQuery

Automatic Scaling

bull

Client JavaScript

Middleware Java

Content Management

Lucene

Database MySQL

Application Stack

Client JavaScript

XQueryMiddleware Java

XQueryContent

ManagementLucene

XQuery

Database MySQL

XQuery

Application Stack

Application Stack

Client

XQuery

in the Browser

Middleware

XQueryScripting

Content Management

XQueryFull-Text

Database

XQuery

Data Definition Facility

XQuery Data Definition Facility

bull Open Specification (httpgooglXzK8p)

bull Implemented by Zorba (httpgoogl4huso)

bull Extending XQuery with

- Collections

- Indexes

- Integrity Contraints

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 7: Not your Grandma's XQuery

bull

Client JavaScript

Middleware Java

Content Management

Lucene

Database MySQL

Application Stack

Client JavaScript

XQueryMiddleware Java

XQueryContent

ManagementLucene

XQuery

Database MySQL

XQuery

Application Stack

Application Stack

Client

XQuery

in the Browser

Middleware

XQueryScripting

Content Management

XQueryFull-Text

Database

XQuery

Data Definition Facility

XQuery Data Definition Facility

bull Open Specification (httpgooglXzK8p)

bull Implemented by Zorba (httpgoogl4huso)

bull Extending XQuery with

- Collections

- Indexes

- Integrity Contraints

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 8: Not your Grandma's XQuery

Client JavaScript

Middleware Java

Content Management

Lucene

Database MySQL

Application Stack

Client JavaScript

XQueryMiddleware Java

XQueryContent

ManagementLucene

XQuery

Database MySQL

XQuery

Application Stack

Application Stack

Client

XQuery

in the Browser

Middleware

XQueryScripting

Content Management

XQueryFull-Text

Database

XQuery

Data Definition Facility

XQuery Data Definition Facility

bull Open Specification (httpgooglXzK8p)

bull Implemented by Zorba (httpgoogl4huso)

bull Extending XQuery with

- Collections

- Indexes

- Integrity Contraints

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 9: Not your Grandma's XQuery

Client JavaScript

XQueryMiddleware Java

XQueryContent

ManagementLucene

XQuery

Database MySQL

XQuery

Application Stack

Application Stack

Client

XQuery

in the Browser

Middleware

XQueryScripting

Content Management

XQueryFull-Text

Database

XQuery

Data Definition Facility

XQuery Data Definition Facility

bull Open Specification (httpgooglXzK8p)

bull Implemented by Zorba (httpgoogl4huso)

bull Extending XQuery with

- Collections

- Indexes

- Integrity Contraints

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 10: Not your Grandma's XQuery

Application Stack

Client

XQuery

in the Browser

Middleware

XQueryScripting

Content Management

XQueryFull-Text

Database

XQuery

Data Definition Facility

XQuery Data Definition Facility

bull Open Specification (httpgooglXzK8p)

bull Implemented by Zorba (httpgoogl4huso)

bull Extending XQuery with

- Collections

- Indexes

- Integrity Contraints

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 11: Not your Grandma's XQuery

XQuery Data Definition Facility

bull Open Specification (httpgooglXzK8p)

bull Implemented by Zorba (httpgoogl4huso)

bull Extending XQuery with

- Collections

- Indexes

- Integrity Contraints

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 12: Not your Grandma's XQuery

declare collection fforecasts as element(forecast)

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 13: Not your Grandma's XQuery

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 14: Not your Grandma's XQuery

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Properties

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 15: Not your Grandma's XQuery

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Name

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 16: Not your Grandma's XQuery

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Domain Expression

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 17: Not your Grandma's XQuery

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring

Index Key

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 18: Not your Grandma's XQuery

declare automatic value-equality non-unique index fforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by site-id as xsstring city as xsstring

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 19: Not your Grandma's XQuery

declare automatic value-range indexfforecasts-index on nodes cdmlcollection(xsQName(fforecasts)) by temperature as xsdecimal

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 20: Not your Grandma's XQuery

$ sausalito backup dataBackup data for project at UserstestforecastProject URI httpwwwexamplecom

Starting backup for collection data OKBackup successful

$ sausalito restore data -f forecasttargzRestored data

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 21: Not your Grandma's XQuery

Full-Text

bull XQuery and XPath Full Text 10

bull Thesaurus

bull Stemming

bull Complete access to the full text internalsfttokenize($node $lang)fttokenizer-properties()

ftthesaurus-lookup($uri $phrase)

ftstem($work)

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 22: Not your Grandma's XQuery

$dataelement()[ contains text $search-term]

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 23: Not your Grandma's XQuery

let $x = ltmsggtbreakfast of championsltmsggtreturn $x contains text meal using thesaurus at httpwordnetprincetonedu relationship narrower term

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 24: Not your Grandma's XQuery

ftstem( flavoring xslanguage(en) )

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 25: Not your Grandma's XQuery

let $doc = doc(ldquodocxmlrdquo)for $token in fttokenize($doc)return concat($tokenvalue ldquo at rdquo $tokenparagraph $tokensentence )

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 26: Not your Grandma's XQuery

Scripting

bull Open Specification

bull Implemented by Zorba

bull Friendly syntax for imperative programming

bull Semantic for side-effects

bull Specification at httpgooglkTYuf

bull Tutorial at httpgooglF23je

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 27: Not your Grandma's XQuery

let $handler = function($request) let $world = $requesthttpbodytext() return lth1gtHello $worldlth1gt return mongoosestart($handler 8080)mongoosecin()

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 28: Not your Grandma's XQuery

while(true()) variable $request = serverlisten(localhost 8080) variable $response = apiprocess($request) apiserialize($response)

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 29: Not your Grandma's XQuery

if(count($result) lt count($collection)) then httpset-header(x-truncated true) httpset-header(x-next apistart=7b5c28c0) else httpset-header(x-truncated false)$result

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 30: Not your Grandma's XQuery

in the Browser

bull Open Source Project from ETH

bull httpxqiborg

bull XQuery in the browser without a plug-in

bull Processor compiled to JavaScript

bull DOM as the processor store

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 31: Not your Grandma's XQuery

ltscript type=rdquoapplicationxqueryrdquogtbaddEventListener(bdom()button onclick function($ev $obj) balert(ldquoClickedrdquo) )ltscriptgt

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 32: Not your Grandma's XQuery

ltscript type=textjavascriptgtfoo = function (arg) return the text was + argltscriptgt

ltscript type=applicationxquerygt let $x = bjs-call(windowfoo ldquoFoordquo) return balert($x)ltscriptgt

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 33: Not your Grandma's XQuery

ltscript type=applicationxquerygtbjs-eval(windowalert(eval))ltscriptgt

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 34: Not your Grandma's XQuery

declare variable $uieasing = (0 002 008 019 033 05 067 081 092 098 1)

declare sequential function uifade() declare $con = bdom()[id = entries] declare $opacity = bgetStyle($con opacity) if($opacity lt 1) then ( bsetStyle($con opacity $uieasing[ gt $opacity][1]) btimer(100 uifade0) ) else bsetStyle($con opacity 1)

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 35: Not your Grandma's XQuery

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 36: Not your Grandma's XQuery

ltscript type=applicationxquerygtdeclare sequential function localsubmit($loc $evtObj)

let $name = sid(author)data(value) let $text = sid(text)text() return guestbookadd($name $text) baddEventListener(sid(submit) onclick localsubmit2)

guestbooklist()ltscriptgt

declare sequential function guestbookadd( $author as xsstring $entry as xsstring) let $date = fncurrent-dateTime() let $entry = ltentry author=$author datetime=$dategt$textltentrygt return xqddfinsert-nodes-last($entries $entry)

declare sequential function guestbooklist() ltentriesgt xqddfcollection($entries) ltentriesgt

Client Server

Seamless Invocations

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 37: Not your Grandma's XQuery

Pubzone (2009)

Java XQuery

1210900

1830

4100

450

3100

Line

s of

cod

eModel ViewControler

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 38: Not your Grandma's XQuery

AWS Libraries

S3 SimpleDB SNS

455572

1469

23092905

8589

Line

s of

cod

eJava XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 39: Not your Grandma's XQuery

AWS Libraries

AWS

2496

13803

Line

s of

cod

eJava XQuery

Lines of Codes- 80

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 40: Not your Grandma's XQuery

AWS Libraries

AWS

2496

6531

Line

s of

cod

ePHP XQuery

Lines of Codes- 62

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 41: Not your Grandma's XQuery

lthtmlgt ltheadgt ltscript type=textjavascriptgt function buy(e) newElement = documentcreateElement(p) elementText = documentcreateTextNode (etargetgetAttribute(id)) newElementappendChild(elementText) var res = documentevaluate( div[id=shoppingcart] document null XPathResultUNORDERED_NODE_SNAPSHOT_TYPE null) ressnapshotItem(0)appendChild(newElement) ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgtltdivgt lt Code establishing connection ResultSet results = statementexecuteQuery (SELECT FROM PRODUCTS) while (resultsnext()) outprintln(ltdivgt) String prodName = resultsgetString(1) outprintln(prodName) outprintln(ltinput type=button value=Buy) outprintln(id=+prodName+) outprintln(onclick=buy(event)gt) outprintln(ltdivgt) resultsclose() Code closing connection gt ltbodygtlthtmlgt

HTMLJavaScript

XPath

Java

SQL

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 42: Not your Grandma's XQuery

lthtml xmlns=httpwwww3org1999xhtmlgt ltheadgt ltscript type=applicationxquerygtdeclare updating function localbuy($evt $obj) insert node ltpgt$objidltpgt as first into div[id=shoppingcart]baddEventListener(bdom()input onclick xsQname(localbuy))ltscriptgt ltheadgt ltbodygt ltdivgtShopping cartltdivgt ltdiv id=shoppingcartgt for $p in doc(productsxml)product return ltdivgt $pname ltinput type=button value=Buy id=$pnamegt ltdivgt ltdivgt ltbodygtlthtmlgt

XQuery Everywhere

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 43: Not your Grandma's XQuery

Wadlers theorem of language adoption

ldquoA programming language will be adopted if and only if it permits its users to do something that cannot be done in any other wayrdquo

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 44: Not your Grandma's XQuery

SQLJavaJavaScript

GO

Mapping

Glue

Mapping

Glue

XQuery

SeamlessInvocations

XQuery

GO

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 45: Not your Grandma's XQuery

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 46: Not your Grandma's XQuery

SQLJavaJavaScript

GO

Mapping

Glue

LocalStore

Sync Sync

XQuery

GO

LocalStore

XQuery

Seamless Synchronisation

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 47: Not your Grandma's XQuery

Demo Offline XQuery App

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 48: Not your Grandma's XQuery

XQuery in Mobile Apps

bull 2 XQuery Stores- DOM- HTML5 Local Storage

bullWhen Offline - Each update is applied to local store - Pending Update Lists are stored in the local store

bullWhen Online - PULs are aggregated and sent to the Cloud - PULs are applied to the Cloud

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 49: Not your Grandma's XQuery

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 50: Not your Grandma's XQuery

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs ltinsert src=rdquordquo target=rdquordquo gt

1 Apply PUL Store PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 51: Not your Grandma's XQuery

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOs lttodo done=rdquotruerdquogt

PULs

2 Send PUL

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 52: Not your Grandma's XQuery

insert node attribute done ldquotruerdquo into xqddfcollection($todos)[id = $id]

Local Store

TODOS lttodo done=rdquotruerdquogt

PULs

3 Apply PUL

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 53: Not your Grandma's XQuery

Operators on Updates

bull Aggregationbull Integration (+ detecting conflicts)bull Reconciliation of conflictsbull Reductionbull Inversion

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 54: Not your Grandma's XQuery

Spacial Axis

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 55: Not your Grandma's XQuery

Time Axis

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 56: Not your Grandma's XQuery

$tempB$tempA

avg( $tempAfuture-or-current intersect $tempBpast-or-current)

68deg 70deg 65deg 69deg 72deg

Text

Time

Thank you28 msec

Page 57: Not your Grandma's XQuery

Thank you28 msec