SlideShare uma empresa Scribd logo
1 de 32
Web Services,
Mashups, & QueryPath
     Drupal Camp WI, 2009
Matt Butcher
     First web app: 1995

  About a dozen languages

Five books, dozens of articles

     Milkshake problem
2009
2004
What We’ll Cover

• QueryPath: What it is and how it works.
• Web services and QueryPath
• QueryPath in Drupal
• Mashing Stuff Up
A PHP library designed to make working with
           XML, HTML, and HTTP
         simple, powerful, and robust
What are people doing
 with QueryPath?
Designer/Developer
         Dilemma
•   Designers create HTML
    that is pixel perfect

•   Developers are charged
    with taking design and
    turning it into a web
    tool.

•   But developers don’t
    have the designer’s
    skillset.
TweetyPants.com
Bridge Layers

• Data silos are bad, repositories are good
• Import and export
• Information is shared using XML
Parsing ODT Files
<?php
require 'QueryPath/QueryPath.php';

$odt = 'zip://o.odt#content.xml';

foreach(qp($odt, 'text|h') as $i) {
  print $i->text() . quot;nquot;;
}
Web Services
Flickr, YouTube, Amazon, Twitter, e-
   Commerce providers, Calias,
       OpenAmplify, DBPedia,
     MusicBrainz, Technorati...

 REST, SOAP, XML-RPC, Linked
        Data, SPARQL...
Simplicity
The Task
    Find all
  <a></a>
tags who have
 the ancestor
<div></div>
The DOM API
•   At least seventeen
    classes, each with dozens
    of methods.

•   Complex data structure.

•   Checkered history in
    PHP.

•   VERY powerful.
SimpleXML

•   One class, about a dozen
    functions and methods.

•   Turns XML into basic
    objects.

•   Makes easy stuff easy,
    and makes everything
    else insanely hard.
                  Same size as DOM
                      Example
SAX / Expat
               Same size,
             fewer features


•   Event based.

•   Write your own parser
    handler.

•   One per XML format.

•   Only reliable “legacy”
    library.
QueryPath
•   Compact library.

•   Functions are short and
    mnemonic.
                                    [This space intentionally left blank ]
•   The power of DOM, but
    simpler than SimpleXML

•   (Shhh... don’t tell, but it’s
    built on the DOM.)
Anatomy of a
 QueryPath
Powerful
The Features
•   Query a document         •   Access remote data

    •   With XPath           •   Extensions for...

    •   CSS selectors            •   Advanced XML
                                     manipulation (XSLT,
•   Move around inside the           XSD, PI)
    document
                                 •   SQL database access
•   Modify the document
                                 •   Templates
•   Access local files
CSS 3 Selectors


               Source: “Using the QueryPath PHP Library.” Matt Butcher. IBM developerWorks. Mar. 28, 2009




Use CSS Selectors (like in stylesheets) or XPath queries
Traversing an
HTML or XML
  Document
   There are over a dozen
  functions for traversing a
         document.

These are similar to jQuery’s
    traversal functions.
Manipulating a
 Document
          •   Get and set text,
              elements,
              attributes, etc.

          •   Move, clone,
              delete.

          •   Build arbitrary
              XML or HTML.
Work with local or
      remote sources
•   HTML              •   SPARQL

•   SVG images        •   SOAP

•   RSS or Atom       •   Open Office docs

•   Flickr            •   DBPedia

•   Twitter           •   MusicBrainz

•   RDF/Linked Data   •   ...
Extensibility
•   One library cannot
    provide everything.

•   But it can provide an
    extension mechanism.

•   Developers can integrate
    their own code easily.

•   You provide the kitchen
    sink.
Built-in Extensions

• QPDB: QueryPath SQL Database layer
• QPTPL: Template support for QueryPath
• QPXML: Extensions for serious XML
  hacking
• More...
Twitter Search



           Ten Lines of Code
Drupal Module
The Kewpie Demo

 •   QueryPath module

 •   QP Cache module

 •   Amplify module

 •   QP Services module
Demos
             Instant Portal video:
http://www.youtube.com/watch?v=GBBKPIva1tM

        Twitter Rating (TweetyPants):
           http://tweetypants.com
Learn More
• QueryPath.org
• Technosophos.com
• IBM developerWorks
• Drupal.org/project/...
 • querypath
 • amplify
 • qpservices
Questions?

           Matt Butcher
http://twitter.com/technosophos
    http://technosophos.com

Mais conteúdo relacionado

Mais procurados

JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011
Charles Nutter
 
Yapc10 Cdt World Domination
Yapc10   Cdt World DominationYapc10   Cdt World Domination
Yapc10 Cdt World Domination
cPanel
 

Mais procurados (20)

Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for Dummies
 
Ruby Xml Mapping
Ruby Xml MappingRuby Xml Mapping
Ruby Xml Mapping
 
JRuby and You
JRuby and YouJRuby and You
JRuby and You
 
Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1Your First Scala Web Application using Play 2.1
Your First Scala Web Application using Play 2.1
 
Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013Beyond JVM - YOW! Sydney 2013
Beyond JVM - YOW! Sydney 2013
 
From Ruby to Scala
From Ruby to ScalaFrom Ruby to Scala
From Ruby to Scala
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 
JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in Scala
 
Laravel and Django and Rails, Oh My!
Laravel and Django and Rails, Oh My!Laravel and Django and Rails, Oh My!
Laravel and Django and Rails, Oh My!
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9
 
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw  est prêt à tuer le classpathSoft-Shake 2016 : Jigsaw  est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
 
Code lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf LinzCode lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf Linz
 
Clojure in real life 17.10.2014
Clojure in real life 17.10.2014Clojure in real life 17.10.2014
Clojure in real life 17.10.2014
 
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
 ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in... ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
ABRIDGED VERSION - Joys & frustrations of putting 34,000 lines of Haskell in...
 
Yapc10 Cdt World Domination
Yapc10   Cdt World DominationYapc10   Cdt World Domination
Yapc10 Cdt World Domination
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
Spring into rails
Spring into railsSpring into rails
Spring into rails
 
Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUG
 

Semelhante a Mashups with Drupal and QueryPath

Flickr Architecture Presentation
Flickr Architecture PresentationFlickr Architecture Presentation
Flickr Architecture Presentation
web25
 
My Sql And Search At Craigslist
My Sql And Search At CraigslistMy Sql And Search At Craigslist
My Sql And Search At Craigslist
MySQLConference
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
oscon2007
 
Flickr and PHP - Cal Henderson
Flickr and PHP - Cal HendersonFlickr and PHP - Cal Henderson
Flickr and PHP - Cal Henderson
kangaro10a
 
Flickr Architecture Presentation
Flickr Architecture PresentationFlickr Architecture Presentation
Flickr Architecture Presentation
eraz
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
Tomas Doran
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
drewz lin
 
Facebook的架构
Facebook的架构Facebook的架构
Facebook的架构
yiditushe
 

Semelhante a Mashups with Drupal and QueryPath (20)

QueryPath, Mash-ups, and Web Services
QueryPath, Mash-ups, and Web ServicesQueryPath, Mash-ups, and Web Services
QueryPath, Mash-ups, and Web Services
 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracket
 
Markup As An Api
Markup As An ApiMarkup As An Api
Markup As An Api
 
Flickr Architecture Presentation
Flickr Architecture PresentationFlickr Architecture Presentation
Flickr Architecture Presentation
 
My Sql And Search At Craigslist
My Sql And Search At CraigslistMy Sql And Search At Craigslist
My Sql And Search At Craigslist
 
Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289Rest Vs Soap Yawn2289
Rest Vs Soap Yawn2289
 
Painless OO XML with XML::Pastor
Painless OO XML with XML::PastorPainless OO XML with XML::Pastor
Painless OO XML with XML::Pastor
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
 
Flickr and PHP - Cal Henderson
Flickr and PHP - Cal HendersonFlickr and PHP - Cal Henderson
Flickr and PHP - Cal Henderson
 
Flickr Architecture Presentation
Flickr Architecture PresentationFlickr Architecture Presentation
Flickr Architecture Presentation
 
Not only SQL
Not only SQL Not only SQL
Not only SQL
 
Why ruby and rails
Why ruby and railsWhy ruby and rails
Why ruby and rails
 
ReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... YawnReST Vs SOA(P) ... Yawn
ReST Vs SOA(P) ... Yawn
 
Streamlining assessment, feedback, and archival with auto-multiple-choice
Streamlining assessment, feedback, and archival with auto-multiple-choiceStreamlining assessment, feedback, and archival with auto-multiple-choice
Streamlining assessment, feedback, and archival with auto-multiple-choice
 
AWS (Hadoop) Meetup 30.04.09
AWS (Hadoop) Meetup 30.04.09AWS (Hadoop) Meetup 30.04.09
AWS (Hadoop) Meetup 30.04.09
 
Drupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQueryDrupal 6 JavaScript and jQuery
Drupal 6 JavaScript and jQuery
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
 
Facebook的架构
Facebook的架构Facebook的架构
Facebook的架构
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 

Mashups with Drupal and QueryPath

  • 1. Web Services, Mashups, & QueryPath Drupal Camp WI, 2009
  • 2. Matt Butcher First web app: 1995 About a dozen languages Five books, dozens of articles Milkshake problem
  • 4. What We’ll Cover • QueryPath: What it is and how it works. • Web services and QueryPath • QueryPath in Drupal • Mashing Stuff Up
  • 5. A PHP library designed to make working with XML, HTML, and HTTP simple, powerful, and robust
  • 6. What are people doing with QueryPath?
  • 7. Designer/Developer Dilemma • Designers create HTML that is pixel perfect • Developers are charged with taking design and turning it into a web tool. • But developers don’t have the designer’s skillset.
  • 9. Bridge Layers • Data silos are bad, repositories are good • Import and export • Information is shared using XML
  • 10. Parsing ODT Files <?php require 'QueryPath/QueryPath.php'; $odt = 'zip://o.odt#content.xml'; foreach(qp($odt, 'text|h') as $i) { print $i->text() . quot;nquot;; }
  • 11. Web Services Flickr, YouTube, Amazon, Twitter, e- Commerce providers, Calias, OpenAmplify, DBPedia, MusicBrainz, Technorati... REST, SOAP, XML-RPC, Linked Data, SPARQL...
  • 13. The Task Find all <a></a> tags who have the ancestor <div></div>
  • 14. The DOM API • At least seventeen classes, each with dozens of methods. • Complex data structure. • Checkered history in PHP. • VERY powerful.
  • 15. SimpleXML • One class, about a dozen functions and methods. • Turns XML into basic objects. • Makes easy stuff easy, and makes everything else insanely hard. Same size as DOM Example
  • 16. SAX / Expat Same size, fewer features • Event based. • Write your own parser handler. • One per XML format. • Only reliable “legacy” library.
  • 17. QueryPath • Compact library. • Functions are short and mnemonic. [This space intentionally left blank ] • The power of DOM, but simpler than SimpleXML • (Shhh... don’t tell, but it’s built on the DOM.)
  • 18. Anatomy of a QueryPath
  • 20. The Features • Query a document • Access remote data • With XPath • Extensions for... • CSS selectors • Advanced XML manipulation (XSLT, • Move around inside the XSD, PI) document • SQL database access • Modify the document • Templates • Access local files
  • 21. CSS 3 Selectors Source: “Using the QueryPath PHP Library.” Matt Butcher. IBM developerWorks. Mar. 28, 2009 Use CSS Selectors (like in stylesheets) or XPath queries
  • 22. Traversing an HTML or XML Document There are over a dozen functions for traversing a document. These are similar to jQuery’s traversal functions.
  • 23. Manipulating a Document • Get and set text, elements, attributes, etc. • Move, clone, delete. • Build arbitrary XML or HTML.
  • 24. Work with local or remote sources • HTML • SPARQL • SVG images • SOAP • RSS or Atom • Open Office docs • Flickr • DBPedia • Twitter • MusicBrainz • RDF/Linked Data • ...
  • 25. Extensibility • One library cannot provide everything. • But it can provide an extension mechanism. • Developers can integrate their own code easily. • You provide the kitchen sink.
  • 26. Built-in Extensions • QPDB: QueryPath SQL Database layer • QPTPL: Template support for QueryPath • QPXML: Extensions for serious XML hacking • More...
  • 27. Twitter Search Ten Lines of Code
  • 29. The Kewpie Demo • QueryPath module • QP Cache module • Amplify module • QP Services module
  • 30. Demos Instant Portal video: http://www.youtube.com/watch?v=GBBKPIva1tM Twitter Rating (TweetyPants): http://tweetypants.com
  • 31. Learn More • QueryPath.org • Technosophos.com • IBM developerWorks • Drupal.org/project/... • querypath • amplify • qpservices
  • 32. Questions? Matt Butcher http://twitter.com/technosophos http://technosophos.com

Notas do Editor