Web Services Interfaces Michalis Petropoulos Alin Deutsch Yannis Papakonstantinou Vasilis Vassalos Scott Mitchell UNIVERSITY OF CALIFORNIA, SAN DIEGO Microsoft Research, July 2003 Exporting DBMSs on the Web Web Service Mediator XML DATABASE APPLICATIONS End-User HTML Forms & Reports – Web Services (Function Signatures) XML • Integrating Web Applications XQuery Web Service Web Service XML View XML View Source Source • Exporting Query Capabilities on the Web XML Schema – Use Web Services – Export Query Capabilities Themselves • HTML Web Interfaces (Forms & Reports) DATABASE SERVER Overview • Query Set Specification Language (QSSL) – Describes Parameterized Tree Pattern (TP) Queries • Data Services – Web Services for Query Capabilities • Forms & Reports for Semistructured Data – The QURSED system • Authoring Interfaces Motivation for QSSL • Web Services published as function signatures: – Fixed number of input and output parameters – Do not capture the functionality of databases – Large number of web services needed – One function signature for every parameterized query – Do not capture the semantic connections the available functions have with each other and with the underlying databases • JDBC Interfaces – All possible queries – Difficult to export schema information Query Set Specification Language Goals flights airline + name flight * from to day + leg + from to aircraft ? • Any combination of the following conditions on: – the name of the airline company – the origin and destination of one or more flights (optional) – a day of the week – the origin of zero or more legs (optional) – the destination of zero or more legs (optional) – the aircraft used for zero or more legs (optional) • The queries may return “airline” or “flight” elements Query Set Specification Language Query Language • Tree Pattern Queries: – Acyclic XPath expressions consisting of: – – – – node tests child axis ‘/’ descendant axis ‘//’ predicates ‘[]’ – Widely used in current applications – Building blocks of XQuery – Excellent visual paradigm for GUIs flights airline name =‘Delta’ flight from =‘JFK’ to =‘LAX’ day =‘MON’ leg to =‘LAS’ flights/airline[name=‘Delta’]/flight[from=‘JFK’][to=‘LAX’][day=‘MON’][leg[to=‘LAS’]] Query Set Specification Language Query Set Specification f1 f2 + f3 ? f4 f5 ? f6 ? f8 flights flights airline airline name=#1 name =#1 =‘Delta’ flight flight from =#2 from =#2 =‘JFK’ to =#3 to =#3 =‘LAX’ day =#4 day =#4 =‘MON’ leg leg to =#6 to =#6 =‘LAS’ flight day =#7 Query Set Specification Language Query Set Specification f1 flights airline + name flight * from to day + leg + from to aircraft ? flights f2 airline f2 name=#1 f2 f3 flight + f3 f4 flights airline f1 from =#2 to =#3 f5 day =#4 f6 leg * name=#1 flight f4 ? ? f7 from =#5 ? f8 to =#6 ? f9 aircraft =#7 ? f3 + f5 f4 from=#2 to =#3 f5 day =#4 f6 * leg f6 f7 ? f8 ? f7 from=#5 f8 to =#6 f9 aircraft =#7 • Similar to extended context-free grammars f9 ? Query Set Specification Language Recursive XML Schemas f1 f2 familyTree familyTree person person ? f3 name =#1 name =#1 ? f4 place=#2 place =#2 ? f5 spouse ? spouse ? f6 name =#3 ? f7 place=#4 ? f8 children ? * person * f2 children person person spouse name =#5 place =#6 Query Set Specification Language Recursive XML Schemas f1 f2 f1 familyTree familyTree f2 person f3 name =#1 ? f4 place=#2 ? f5 spouse ? f6 name =#3 ? f7 place=#4 ? f8 children ? f2 * • QSS of fixed size person f2 f3 ? f4 ? f3 name=#1 f4 place=#2 f5 ? spouse f5 f6 ? f7 ? f6 name=#3 f7 place=#4 f8 children f2 * f8 ? Data Services Input Message View XML Schema Data Source Data Service WSDL Agent Output Message • • • • Data Service = WSDL + QSS A QSS deployed as a web service Exports the XML Schema of an XML view Connects the WSDL calls with the underlying database • Receives queries that are encoded by QSS • Explicit relationship between input and output Data Services Input Message TPX View XML Schema WSDL Input Message Type Data Source Data Service QSSX Agent Output Message Type XML Schema Output Message XML • QSS is translated to XML Schema (QSSX) • TP queries that are encoded as XML (TPX) • Query result is described by an XML Schema Data Services Reasoning 1. 2. 3. 4. Membership of a query in a data service Subsumption of data services Totality of a data service Overlap of data services • These problems (except 1) are undecidable for context-free grammars • QSS can be translated to an equivalent topdown nondeterministic unranked tree automaton • Problems become decidable Future Work Capability-Based Rewriting Mediator User Query TPX Rewriting Processor Candidate Queries Plan Processor Containing Result Remainder Query Execution Engine Data Service Data Source • Capability-based rewriting problem – Partial rewritings Query Result XML Data Services Authoring Interface Query Forms and Reports Requirements • Handle semistructureness – Powerful query forms and reports • Be declarative – Separate logic from presentation • Visual interface for the developer – Programming should NOT be a requirement Query Forms and Reports Query Forms and Reports QURSED Approach End-User Query Form Page HTML QURSED Editor QSS XML Schema – Separation of content & presentation Report Pages QURSED Engine XQuery XHTML XQuery Engine • XML Schema-driven • Declarative! • Editor – Visual actions to declarative specifications – Automatic construction of report pages • Query Set Specification (QSS) – Large set of parameterized queries – Compact representation • Engine – Automatic query formulation – Direct result construction Developing Query Forms from the XML Schema Developing Reports from the XML Schema QURSED Editor Building Query/Visual Association Condition Fragment List Data Path Form Control Predicate QURSED Editor Building Reports Group By Mapping Element Mapping Elements to Appear on Report More Features • • • • • • • Structural disjunction Dependencies Sort-by options Template-driven construction of report pages Report customization Dynamic projection Online demo: http://www.db.ucsd.edu/qursed/ Related work • Data intensive Web site generators – Strudel End-User Web Site – Forms as functions on edges/links Site Generator Presentation Templates SITE GRAPH Web Site Content and Structure – Araneus – Autoweb Semistructured Queries (Mediated) View SCHEMA SEMISTRUCTURED DATA • Declarative • Separation of content, structure and presentation Related work • Web-based Form and Report Generators – Macromedia Ultradev, Coldfusion, Microsoft Visual InterDev – Excellent for flat uniform relational tables – Visual query formulation paradigm allows the specification of projections, sort-bys, simple conditions – However, the development of form and report pages for semistructured data requires substantial programming effort • Visual Querying Interfaces – EquiX, BBQ, VQBD, Lorel’s DataGuide-driven GUI, PESTO – Excellent visual paradigm for the formulation of fairly complex queries – The goal is the development of a query or a query template – User needs to be familiar with database models and schemas Questions and Answers ? Query Set Specification Language Example Derivation f1 ⇒ flights airline f2 ⇒ f3 + ⇒ flights airline flight name=#1 f4 ? f5 flights airline name=#1 f6 * flight from=#2 to =#3 day =#4 f7 ? ⇒ flights airline name=#1 flight from=#2 to =#3 day =#4 leg to =#6 leg f8 ? f9 ? Related Work Capability-Based Rewriting • Capabilities described as binding patterns – Adornments on view attributes – Negative approach • Expansions of Datalog programs – Recursive programs Infinite queries – Positive approach • Capability-based rewriting problem – Total rewritings only QURSED System Architecture Web Designer End-User WYSIWYG XHTML Editor XHTML Query Form Page BROWSER Query Form Page Developer Report Pages Query Set Specification APP SERVER (Optional) XHTML Template Report Page (Optional) Custom Predicates QURSED Editor Query Form Page Query/Visual Association XML Schema QURSED Compiler Deployment Dynamic Server Pages QURSED Run Time Engine XQuery Expressions XML/XHTML XQuery Engine