Xquery - SemTech 2011


Xquery - SemTech 2011

But This Is aSEMANTICSConference?!• XQuery? Is that like jQuery?• What Does XQuery Have toDo With Semantics?• Are You Trying to Sell Me Soomething?!• I Don't Like that t XML !• Where are the Triples and Turtles?• Databases? Who Said Anythhing About Databases?!• Where's the Free Drinks?

In the Beginniing Was DOM• The Document Object Modeel (DOM) is great for buildinglow level hierarchically linkeed data structures.• DOM is lousy at navigating−−−Too verboseLots of low leveel codethose same structuresRequires too much info about structure• DOM was meant as a way to integrate other languages toXML, but is often used at tooo high a level in the stack.• Programmers generally hate it, usually with reason.

Potholes inthe XPath• XPath DOM Interfaces were cumbersome andstandardized very late in theprocess.• XPath only works on single document trees, not “forests”• Web browsers didn't adopt until later, while XML“backlash” grew.• You couldn't program in XPath, only select.• The primary user of XPath was XSLT, a paragon ofterseness and understandability (sarcasm here).• Features such as sorting, using external functions, highermath, etc., weren't quite there yet.

Repavingthe XPath• For XPath 2.0, data model and use cases were heavilyre-examined.• A new language, XQuery 1.0, was conceived to make iteasier to use XPath withoutt wrapping in XML.• Support for datatypes was integrated into the system.• XPath could now be used across multiple documents.• Functional extensibility support was standardized.• XPath 2.0 is now used with:−XQuery, XSLT2, XForms 1.2, Xproc, XMLSchema 1.2 andmore

Introducinng XQuery• XQuery is a language designed to not only work with XMLdocument sets to filter and sort content, but also tomanipulate it and generate new content (not necessarilyXML based).• Xquery adds control structuures (for loops, let statements,conditionals) to Xpath 2.• Xquery can be used to definne new functions and librariesof functions, and can take advantage of externalfunctionality (from HTTP or mail servers to geospatiallibraries, media manipulatioon, compression and SQL calls).• Xquery can work across millions or even billions ofdocuments, or can work witthout any documents at all

Xquery is aProgramming LanguageIt is as expressive,in its own way, asRuby/Python/PERL/Java/.NET/PHP/JavaScriptand in the right context can augment oreven replace thhese languagesIt is NOT just for SearchThe W3C makes great standards,but gives them truly lousy names.

Where XQueryIs Found Today• XML Databases• Standalone Processors• Data Bridges• Editors• Command Shell Processors (xmlsh)• XQuery In the Browser• Invocable From Other Languages• Mobile Environments

4 th Generation XML Databases• XML Databases provide the strongest use case for Xquery.• Beyond search capabilities, moodularization from Xquery makesit possible to do everything frominvoke advanced mathematicaland geospatial functionality to send email, perform semanticanalysis, manage the databasee, create and modify graphicsand more.• Contemporary XML Databasess are also usually able to eitherhost or provide connections to HTTP servers, such that Xqueryscripts can be called via RESTful interfaces, making it apowerful web development plaatform.• XRX – Xquery|REST|XML Clients – can radically simplify richweb application development.

StandaloneProcessors,Tools and APIS• Saxon 9.x provides advanced Xquery capabilities• Zorba is C++ based Xquery prrocessor, used in multiple arenas• Xquery for Java (XQJ) [JSR-225] makes it possible to useXquery from within Java.• XML Shell (xmlsh) is a Java based command line shell forcreating Xquery scripts that have access to system functions.• DataDirect's Xquery (part of DD Integration Suite) providesXquery support bridge for file and data systems• OxygenXML, XML Spy and Stylus Studio all support Xquerydevelopment.

Xquery In thhe Browser• XQuery In the Browser (XQIB) project is a Javascript librarycompiled from Zorba for suppoort Xquery as a scripting languagegwithin contemporary web browsers as an adjunct or alternativeto JavaScript.• Saxon Client Edition i (SaxonCE) – is a Javascript librarycompiled from Saxon 9 to provide XSLT2 and some XQuerysupport within browsers.• Both make it possible to bind events as well as elements,making both attractive for building XML end to end solutions.• Both are still in alpha, but should be released by early 2012.

Mobile XQuery• The conversion to JavaScript of these tools also makes Xqueryin Mobile applications more of a reality• Both XQIB and SaxonCE can work within the primary browserson Android and iOS-based phones (and may work on Windows7 Mobile), and increasingly i may be used for mobile appdevelopment.• Xquery databases and XQueryare also optimally designed forserving mobile content, as their focus is on fastquery/processing/presentation of a range of potential outputtypes, and they work well withboth largescale l documentsystems and streaming content.

Xquery annd Sparql II• XML Databases such as MarkLogic can be used as a triplestore for holding an assertion database (perhaps p with eachdocument maintaining an external set of assertions)• SPARQL queries can then be converted internally to Xquerycalls and invoked on the triplestore, returning a set ofdocuments to the calling Xquery script for additional processing.• Additionally, because 4 th Gen XDBs can make http callsthemselves, SPARQL calls could also be made to externalSemWeb databases and returnmatching URLs, which can thenbe loaded d into the XML Databaase for additional processing orpresentation.

Xquery and Other SemWeb• Xquery extension modules canalso be used to better supportdocument entity enrichment and text analytics,• Xquery can provide the necessary processing infrastructure togo from enriched content to formal semantic content, which inmany cases is the last mile to broad semantic adoption.• Xquery can also establish a formal framework for advancedtext and faceted searches, which still provides a great deal ofthe generalized search infrastructure, and along withXquery/Sparql intermixing, makes it possible to combinesemantic queries with text t analytic ones.

Next Generaation XQuery• So What's Next?−−−−−Widespread adopttion of Xquery Full TextsearchAdoption of Xquerry Update Framework(XQUF) for consistent data updatingregardless of datastore.Streaming XML Support and Support for EXI(Efficient XML Inteerchange)Standardization ofXquery/Sparql interchangeJSON Integration

Xquery Bussiness Case• Xquery standardizes search and processing of semi-structureddata (not necessarily always XML) in the same way that SQLsupports relational data• Xquery is easily extensible, making it adaptable to a widevariety of environments, and making it easier for a communityof users to emerge.• Xquery is, unlike XSLT, similarenough to traditionalprogramming languages that itcan be relatively easily pickedup by traditional programmers.• For many classes of applications, Xquery can provide a 50-80%reduction in development time compared to Java for similarfunctionality.

Xquery Busiiness Case II• Enterprise adoption of XML content systems is exploding,especially as converters for extracting legacy office documentsinto XML become mainstream.Xquery makes management ofthese feasible.• Xquery is a complementary technology, one which h can play wellwith others. This in turn makesit a natural for acting as a gluelayer between other data systeems, while providing moreextensive processing ability than SQL-based systems do.• While secondary standards arestill evolving, the coretechnologies around Xquery have become both stable and welltested enough for both enterprise and corporate use.• For this reason, 2011 has seensignificant uptake in Xquery-based large scale deployments.

Summmary• The Xquery market is beginning to mature, providing analternative for handling the 80-90% of all data content thatdoesn't fit well in relational databases.• Xquery is a complementary technology rather than acompetitive ii one – its flexibilityand web-aware design make itideal as a standard for workingwith XML and other dataformats.• While Xquery's name would suggest that it is just a language forsearch, it is in fact a remarkably flexible language that couldreplace far more complex andrigid id ones, such as Java-relatedenterprise buses.• As with XML itself, Xquery is making inroads all across thecomputing spectrum.

More magazines by this user
Similar magazines