Your SlideShare is downloading. ×
Mashups with Drupal and QueryPath
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Mashups with Drupal and QueryPath

4,308
views

Published on

QueryPath provides a jQuery-like tool in PHP. Use it to work with local files, or with remote web services. This presentation illustrates how QueryPath can be used to build elaborate multi-source …

QueryPath provides a jQuery-like tool in PHP. Use it to work with local files, or with remote web services. This presentation illustrates how QueryPath can be used to build elaborate multi-source mash-ups in Drupal.

Published in: Technology

0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,308
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
45
Comments
0
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
































  • Transcript

    • 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
    • 3. 2009 2004
    • 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.
    • 8. TweetyPants.com
    • 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...
    • 12. Simplicity
    • 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
    • 19. Powerful
    • 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
    • 28. Drupal Module
    • 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