This document discusses using Zorba, an open source XQuery processor, to enable high performance XQuery processing in PHP applications. It provides an overview of Zorba's features such as supporting XQuery 1.0 and related specifications. The document also includes examples of how to install Zorba for PHP, perform basic XQuery queries, filter and manipulate XML data, and interface with REST and JSON data sources. It concludes by noting Zorba can help build cutting edge data processing applications in PHP by enabling more efficient queries over large datasets compared to traditional PHP XML processing methods.
Benchx: An XQuery benchmarking web application Andy Bunce
A system to record query performance of XQuery statements running on the BaseX http:basex.org XML database. It uses Angular on the client side and RESTXQ on the server.
Benchx: An XQuery benchmarking web application Andy Bunce
A system to record query performance of XQuery statements running on the BaseX http:basex.org XML database. It uses Angular on the client side and RESTXQ on the server.
Datagrids with Symfony 2, Backbone and Backgrideugenio pombi
These are the slides of the code-centered presentation I did with Giorgio Cefaro at the Javascript UserGroup Roma and the PHP User Group Roma.
In this presentation we try to show many powerful features of symfony2 and its bundles to work as a backend system for single page applications.
On the client side we describe how we made a javascript editable grid using Backbone.js and its plugin for grids Backgrid.js.
HTML5 is all the rage with the cool kids, and although there's a lot of focus on the new language, there's lots of interesting new JavaScript APIs both in the HTML5 spec and separated out. This presentation will take you through demos and code behind the new JavaScript APIs, and explore where these features can be used
A quick introduction to node.js in order to have good basics to build a simple website.
This slide covers:
- node.js (you don't say?)
- express
- jade
- mongoDB
- mongoose
Quando uma aplicação começa a ficar grande e complexa, fazer buscas nos seus models torna-se uma tarefa complicada. Efetuar as buscas diretamente no banco de dados é um processo lento, ineficiente e que permite pouca ou nenhuma maleabilidade sobre a forma com que a busca é feita. Surge então o ElasticSearch, uma engine de busca utilizada por empresas como Github, Twitter e 4square para indexar e buscar literalmente milhões de documentos em tempo real. Nessa palestra, explicarei quando, como e porque utilizar o ElasticSearch para facilmente indexar e efetuar buscas complexas nos seus models.
Sprockets is an easy solution to managing large JavaScript codebases by letting you structure it, bundle it with related assets, and consolidate it as one single file, with pre-baked command-line tooling, CGI front and Rails plugin. It's a framework-agnostic open-source solution that makes for great serving performance while helping you structure and manage your codebase better.
This is my talk from Rails Israel 2014. I'm talking about web components, how they work, what libraries exist and how to use web components with Ruby on Rails.
Datagrids with Symfony 2, Backbone and Backgrideugenio pombi
These are the slides of the code-centered presentation I did with Giorgio Cefaro at the Javascript UserGroup Roma and the PHP User Group Roma.
In this presentation we try to show many powerful features of symfony2 and its bundles to work as a backend system for single page applications.
On the client side we describe how we made a javascript editable grid using Backbone.js and its plugin for grids Backgrid.js.
HTML5 is all the rage with the cool kids, and although there's a lot of focus on the new language, there's lots of interesting new JavaScript APIs both in the HTML5 spec and separated out. This presentation will take you through demos and code behind the new JavaScript APIs, and explore where these features can be used
A quick introduction to node.js in order to have good basics to build a simple website.
This slide covers:
- node.js (you don't say?)
- express
- jade
- mongoDB
- mongoose
Quando uma aplicação começa a ficar grande e complexa, fazer buscas nos seus models torna-se uma tarefa complicada. Efetuar as buscas diretamente no banco de dados é um processo lento, ineficiente e que permite pouca ou nenhuma maleabilidade sobre a forma com que a busca é feita. Surge então o ElasticSearch, uma engine de busca utilizada por empresas como Github, Twitter e 4square para indexar e buscar literalmente milhões de documentos em tempo real. Nessa palestra, explicarei quando, como e porque utilizar o ElasticSearch para facilmente indexar e efetuar buscas complexas nos seus models.
Sprockets is an easy solution to managing large JavaScript codebases by letting you structure it, bundle it with related assets, and consolidate it as one single file, with pre-baked command-line tooling, CGI front and Rails plugin. It's a framework-agnostic open-source solution that makes for great serving performance while helping you structure and manage your codebase better.
This is my talk from Rails Israel 2014. I'm talking about web components, how they work, what libraries exist and how to use web components with Ruby on Rails.
Infrastructure-as-code: bridging the gap between Devs and OpsMykyta Protsenko
Ops are overwhelmed with support. Devs are mad because their cannot deploy the changes as fast as they want. Sounds familiar?
Infrastructure-as-code can make your life easier by empowering developers and reducing operations' routine toil. It can cut down the lead time for infrastructure provisioning from hours or even days to minutes.
This talk reviews several IaC tools and approaches, showing how to integrate them into continuous delivery pipeline. It covers the problems and challenges that engineers may face while working with infrastructure-as-code tools and provides a few hands-on recipes to address them.
Reviews the basis of using JavaScript within WordPress. How to load in scripts correctly and move PHP data into JavaScripts for later use. Presented at WordCamp LA 2012
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
apidays LIVE Australia 2020 - Building distributed systems on the shoulders o...apidays
apidays LIVE Australia 2020 - Building Business Ecosystems
Building distributed systems on the shoulders of giants
Dasith Wijesiriwardena, Telstra Purple (Readify)
Reviews the basis of using JavaScript within WordPress. How to load in scripts correctly and move PHP data into JavaScripts for later use. Presented at WordCamp Las Vegas 2013
Through the magic of virtualization technology (Vagrant) and Puppet, a companion Enterprise grade provisioning technology, we explore how to make the complex configuration game a walk in the park. Bring new team members up to speed in minutes, eliminate variances in configurations, and make integration issues a thing of the past.
Welcome to the new age of team development!
The first of its kind Web Technology Conference on Open Source Technology, WebOSS '07 was organised in Kolkata on Sat, 13th Oct 07 and I spoke at the event as one of the participants on "Building Applications using AJAX". Here I will share my presentation.
Wordpress y Docker, de desarrollo a produccionSysdig
Docker esta revolucionando cómo desplegamos nuestras aplicaciones. Desde el entorno de desarrollo hasta la puesta en producción.
Veremos las ventajas que nos aporta Docker para el desarrollo en WordPress, las herramientas y procesos desde el punto de vista de un desarrollador.
A la hora de mover nuestra aplicación WordPress a producción, presentaremos los retos que presenta y las ventajas que aportan herramientas de orquestación como Kubernetes.
Tanto si eres un desarrollador como si también tienes que gestionar los sistemas que alojan tu WordPress, saldrás de esta charla queriendo poner todos tus WordPress en contenedores.
How we used ruby to build locaweb's cloud (http://presentations.pothix.com/ru...Willian Molinari
**The slides are not correctly rendered. The HTML/Javascript version is here: http://presentations.pothix.com/rubyconf2013/**
This presentation shows what we have done with Ruby to create Locaweb's cloud computing product.
Come to this talk prepared to learn about the Doctrine PHP open source project. The Doctrine project has been around for over a decade and has evolved from database abstraction software that dates back to the PEAR days. The packages provided by the Doctrine project have been downloaded almost 500 million times from packagist. In this talk we will take you through how to get started with Doctrine and how to take advantage of some of the more advanced features.
Similar to High Performance XQuery Processing in PHP with Zorba by Vikram Vaswani (20)
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
2. Vikram Vaswani
Founder, Melonfire
● Product design and implementation with open source technologies
● 20+ products launched for customers worldwide
Author and active PHP community participant
● 7 books for McGraw-Hill USA
● 250+ tutorials for IBM dW, Zend Developer Zone and others
More information at http://vikram-vaswani.in
3. XML Support in PHP
● XML processing: SimpleXML and XMLReader
● XML transformation: XSLT and XML-DAS
● Event-based parsing: SAX
● Tree-based parsing: DOM
● Serialization: WDDX
● Dynamic documents: XMLWriter
5. Introducing Zorba
● General purpose XQuery processor for PHP 5.3+
● Supports XQuery v1.0 and related specifications
● Available for Windows, Linux, and Mac OS X
● Open source; Apache 2.0 License
● Project supported by FLWOR Foundation and
Oracle.
6. Supported XML Technologies
● XPath
● XQuery v1.0 and v3.0
● XQuery Scripting
● Xquery Data Definition
● XPath Full-Text 1.0
● XSLT 1.0
● XqueryX (limited)
7. PHP Installation
● Linux and MacOS X
● Libxml2: http://xmlsoft.org/
● Iconv: http://www.gnu.org/software/libiconv/
● libUUID: http://linux.die.net/man/3/libuuid
● ICU (C version): http://www.icu-project.org/
● Xerces (C version): http://xerces.apache.org/xerces-c/
● GCC and related make/cmake utilities
● Windows
● https://launchpad.net/zorba/+download
● API Wrapper
● http://zorba.s3.amazonaws.com/ZorbaPHP.zip
8. PHP Installation
● Linux and MacOS X
● Libxml2: http://xmlsoft.org/
● Iconv: http://www.gnu.org/software/libiconv/
● libUUID: http://linux.die.net/man/3/libuuid
● ICU (C version): http://www.icu-project.org/
● Xerces (C version): http://xerces.apache.org/xerces-c/
● GCC and related make/cmake utilities
● Windows
● https://launchpad.net/zorba/+download
● API Wrapper
● http://zorba.s3.amazonaws.com/ZorbaPHP.zip
9. Basic Usage
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
try {
$queryStr = <<<END
let $message := 'She sells sea shells by the sea shore'
return
<result>{$message}</result>
END;
$query = $zorba->importQuery($queryStr);
$result = $zorba->execute();
echo $result;
} catch (Exception $e) {
die('ERROR:' . $e->getMessage());
}
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
12. Arithmetic Operators
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
$queryStr = <<<END
declare variable $x := 30;
declare variable $y := 12;
let $r := $x + $y
return
<result> {$r} </result>
END;
$query = $zorba->importQuery($queryStr);
echo $zorba->execute();
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
13. Sequences
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
$queryStr = <<<END
let $dolls := ('Echo', 'Victor', 'Sierra', 'November', 'Alpha')
return
<results>
{
for $doll in $dolls
return
<name>{$doll}</name>
}
</results>
END;
$query = $zorba->importQuery($queryStr);
echo $zorba->execute();
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
14. String Functions
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
$queryStr = <<<END
let $dolls := ('Echo', 'Victor', 'Sierra', 'November', 'Alpha')
return
<results>
{string-join($dolls, ', ')}
</results>
END;
$query = $zorba->importQuery($queryStr);
echo $zorba->execute();
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
15. Math Functions
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
$queryStr = <<<END
let $set := (1 to 20)
return
<results>
{
for $i in $set
where ($i mod 2 eq 0)
return
<value> {$i} </value>
}
</results>
END;
$query = $zorba->importQuery($queryStr);
echo $zorba->execute();
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
16. Data Filtering
(XML source)
<?xml version="1.0"?>
<data>
<record>
<code>ABW</code>
<name>Aruba</name>
<continent>North America</continent>
<year></year>
<population>103000</population>
<gnp>828.00</gnp>
<capital>
<name>Oranjestad</name>
<population>29034</population>
</capital>
</record>
...
</data> Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
17. Data Filtering (Simple)
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
$dm = $zorba->getXmlDataManager();
$dm->loadDocument('data.xml', file_get_contents('data.xml'));
$queryStr = <<< END
for $record in doc('data.xml')//record
let $name := $record/name/text()
let $code := $record/code/text()
return
<name code="{$code}">{$name}</name>
END;
$query = $zorba->importQuery($queryStr);
echo $zorba->execute();
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
18. Data Filtering (Complex)
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
dm = $zorba->getXmlDataManager();
$dm->loadDocument('data.xml', file_get_contents('data.xml'));
$queryStr = <<< END
for $record in doc('data.xml')//record
let $name := $record/name/text()
let $code := $record/code/text()
let $population := $record/population/text()
where contains($record/continent/text(), 'Europe')
where (xs:integer($population) gt 1000000)
order by $population descending
return
<name code="{$code}" population="{$population}">{$name}</name>
END;
$query = $zorba->importQuery($queryStr);
echo $zorba->execute();
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
19. Node Manipulation
(XML source, before)
<?xml version='1.0'?>
<heroes>
<hero>
<name>Spiderman</name>
<alterego>Peter Parker</alterego>
</hero>
<hero>
<name>Superman</name>
<alterego>Clark Kent</alterego>
</hero>
<hero>
<name>The Flash</name>
<alterego>Wally West</alterego>
</hero>
</heroes>
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
20. Node Manipulation
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
$dm = $zorba->getXmlDataManager();
$dm->loadDocument('heroes.xml', file_get_contents('heroes.xml'));
$queryStr = <<< END
delete node doc('heroes.xml')//heroes/hero[last()],
replace node doc('heroes.xml')//heroes/hero[last()]
with
<hero>
<name>The Incredible Hulk</name>
<alterego>Bruce Banner</alterego>
</hero>
END;
$query = $zorba->importQuery($queryStr);
echo $zorba->execute();
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
21. Node Manipulation
(XML source, after)
<?xml version="1.0" encoding="UTF-8"?>
<heroes>
<hero>
<name>Spiderman</name>
<alterego>Peter Parker</alterego>
</hero>
<hero>
<name>Superman</name>
<alterego>Clark Kent</alterego>
</hero>
<hero>
<name>The Incredible Hulk</name>
<alterego>Bruce Banner</alterego>
</hero>
</heroes>
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
22. REST Parser
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
$queryStr = <<< END
import module namespace zorba-rest =
"http://www.zorba-xquery.com/zorba/rest-functions";
for $post in
zorba-rest:get("http://user:pass@api.del.icio.us/v1/posts/recent")//posts/post
where contains($post/@tag, 'book')
return
<result>
<href> {string($post/@href)} </href>
<description> {string($post/@description)} </description>
<tags> {string($post/@tag)} </tags>
</result>
END;
$query = $zorba->importQuery($queryStr);
echo $zorba->execute();
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
23. REST Parser
(After)
<?xml version="1.0" encoding="UTF-8"?>
<result>
<href>http://www.everythingphpmysql.com/</href>
<description>How to do Everything with PHP & MySQL - Vikram Vaswani</description>
<tags>book development php mysql web beginner</tags>
</result>
<result>
<href>http://www.mysql-tcr.com/</href>
<description>MySQL: The Complete Reference - Vikram Vaswani</description>
<tags>mysql php book</tags>
</result>
24. JSON Parser
(JSON source)
{
"books": [{
"title":"Phantom Prey",
"author":"John Sandford",
"price":"7.99"
}, {
"title":"A Most Wanted Man",
"author":"John le Carre",
"price":"8.99"
},{
"title":"Beach Babylon",
"author":"Imogen Edward-Jones",
"price":"12.99"
}]
}
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
25. JSON Parser
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
$queryStr = <<< END
import module namespace json =
"http://www.zorba-xquery.com/zorba/json-functions";
let $x := json:parse('{$json}')
for $i in $x//item
where (xs:decimal($i/pair[@name='price']/text()) lt 10.00)
return
<result> {$i/pair[@name='title']/text()} </result>
END;
$query = $zorba->importQuery($queryStr);
echo $zorba->execute();
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
26. JSON Parser
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
$queryStr = <<< END
import module namespace json =
"http://www.zorba-xquery.com/zorba/json-functions";
let $x := json:parse('{$json}')
for $i in $x//item
where (xs:decimal($i/pair[@name='price']/text()) lt 10.00)
return
<result> {$i/pair[@name='title']/text()} </result>
END;
$query = $zorba->importQuery($queryStr);
echo $zorba->execute();
Cre dit: Vikram Vaswani, " Building XQue ry-po we re d applicatio ns with PHP and Zo rba"
http: //www. ibm. co m/de ve lo pe rwo rks/library/x-zo rba/inde x. html
28. Scenario
● Data
● 1 day of forecast data in XML format: 727MB
● Workflow
● Process data for a specific site
● Send selected temperatures to clients
● Display chart
Cre dit: W illiam Candillo n, " Cutting Edg e Data Pro ce ssing with PHP & XQue ry"
http: //www. slide share . ne t/wcandillo n/cutting -e dg e -data-pro ce ssing -with-php-xque ry
29. SimpleXML
<?php
$siteId = 3;
$forecasts = simplexml_load_file('forecasts.xml');
$forecasts = $forecasts->xpath(
"/forecast-list/forecast[@site-id='$siteId']");
foreach($forecasts as$forecast) {
$time = $forecast->xpath("@time-step");
$value = $forecast->xpath(
"//weather-elements/weather-element"
."[@name = 'ScreenTemperature']/text()");
echo "<temperature time='" . $time[0] ."'value='" = . $value[0] . "' />n";
}
?>
Cre dit: W illiam Candillo n, " Cutting Edg e Data Pro ce ssing with PHP & XQue ry"
http: //www. slide share . ne t/wcandillo n/cutting -e dg e -data-pro ce ssing -with-php-xque ry
30. Zorba
<?php
require_once 'Zorba/XQueryProcessor.php';
$zorba = new XQueryProcessor();
$queryStr = <<<END
for $forecast inz:parse-xml(file:read-text("forecasts.xml"),
<opt:options>
<opt:parseExternalParsedEntity opt:skipRootNodes="1"/>
</opt:options>)
where $forecast/@site-id = "3"
let $time:= string($forecast/@time-step)
let $value:= $forecast/weather-elements/weather-element
[@name = 'ScreenTemperature']/text()
return
<temperaturetime="{$time}" value="{$value}" />
END;
$query = $zorba->importQuery($queryStr);
echo $zorba->execute();
Cre dit: W illiam Candillo n, " Cutting Edg e Data Pro ce ssing with PHP & XQue ry"
http: //www. slide share . ne t/wcandillo n/cutting -e dg e -data-pro ce ssing -with-php-xque ry
31. Results
10000
9000
9000
8000
Memory Consumption (MB)
7000
6000
5000
4000
3000
2000
1000
19
0
SimpleXML Zorba
PHP Extension
Cre dit: W illiam Candillo n, " Cutting Edg e Data Pro ce ssing with PHP & XQue ry"
http: //www. slide share . ne t/wcandillo n/cutting -e dg e -data-pro ce ssing -with-php-xque ry
32. AWS Libraries
10000
9000 8589
8000
7000
Lines of Code
6000
5000
Java
4000 XQuery
2905
3000
2309
2000 1469
1000 572 455
0
S3 SimpleDB SNS
AWS Libraries
Cre dit: W illiam Candillo n, " Cutting Edg e Data Pro ce ssing with PHP & XQue ry"
http: //www. slide share . ne t/wcandillo n/cutting -e dg e -data-pro ce ssing -with-php-xque ry