230 likes | 378 Views
BBQ : B lended B rowsing and Q uerying of XML in a Lazy Mediator System. Kevin D. Munroe Bertram Ludäscher Yannis Papakonstantinou University of California, San Diego. Overview. Introduction: BBQ and MIXm BBQ: The Interface Browsing and Querying with BBQ The BBQ API Discussion.
E N D
BBQ: Blended Browsing and Querying of XML in a Lazy Mediator System Kevin D. Munroe Bertram Ludäscher Yannis Papakonstantinou University of California, San Diego
Overview • Introduction: BBQ and MIXm • BBQ: The Interface • Browsing and Querying with BBQ • The BBQ API • Discussion
Introduction (preaching to the choir) • XML as a universal data exchange format and model • MIX (Mediation of Information using XML) project at UCSD/SDSC • MIX mediator (MIXm) • integrated views of XML data sources • XMAS query language • lazy query evaluation with DOM-VXD (EDBT 2000) • Features of a MIXm client • simplify query construction • intuitive XML browsing • flexible interface
BBQ 2.0 • BBQ = User Interface + API package • BBQ Interface features • Schema-driven browsing of XML • Intuitive drag-and-drop query formulation • Iterative Query refinement • History • BBQ API • cross-platform (Java) • based on well-known Java 2 APIs
BBQ and MIXm XML Data Source XML Data Source BBQ Interface Interface X BBQ API BBQ API XML Document XMAS Query DOM-VXD Interface Source DTD MIX Mediator Source DTD
The BBQ Interface • DTDs are represented by trees • non leaf nodes= elements • leaf nodes = character content • Nodes are rendered based on type • Wildcards are also displayed
BBQ Interface, cont’d • Example BBQ Tree <!DOCTYPE Interns [ <!ELEMENT Interns (Intern)*> <!ELEMENT Intern (name, supervisor, sponsor)> <!ELEMENT name (#PCDATA) > <!ELEMENT supervisor (#PCDATA) > <!ELEMENT sponsor (CAIDA | NPACI |UCSD)> <!ELEMENT CAIDA (ANY)> <!ELEMENT NPACI (ANY)> <!ELEMENT UCSD (ANY)> ]>
BBQ Interface, cont’d • Query Body Panel • contains multiple data sources • Query Head Panel • has a “hook” for building up projected elements Query Body Panel Query Head Panel
BBQ Interface, cont’d • Can browse data as DTD-driven list or XML tree DTD-Driven List XML Tree
A BBQ Query Session • Query Sessions consist of one or more query cycles • A query cycle is delineated by executing a query • BBQ maintains history across query cycles • XMAS queries • syntax: CONSTRUCT head WHERE body
BBQ Query Session, cont’d • Begin by opening XML data source • Select data source from list • BBQ application can open arbitrary data sources • Browse data source by DTD or XML tree • If document has no DTD, BBQ derives one • DDbE from IBM AlphaWorks • XML data source is sample data
BBQ Query Session, cont’d • Setting Conditions • “Set-Required”- requires existence • Binary operations • applied to leaf nodes • operators are in pulldown list; set one or more conditions • Setting Joins • Copy/Paste one leaf node onto the other • Join format • equality • other binary operators (theta-join)
BBQ Query Session, cont’d • Constructing the Head • Use Data Source Elements • Drag/Drop elements from Query Body Panel to Query Head Panel • XMAS semantics requires at most one top-level element • Set a group-by • Simple Group-by - group by the selected node • Complex Group-by - group by other nodes in the body Created in Query Head Panel Paste from Query Body Panel
BBQ Session, cont’d • Executing Query and browsing result • Preview Query... • UI => XMAS query string • “Power Users” can modify the string • ...Then Execute • Result view displayed in Query Body Pane • Answer tree => result view DTD • If error occurs • BBQ reverts to state prior to Execute • No results? • BBQ saves XMAS query string so users can debug
BBQ Query Session- Complete • Browse the result view • BBQ Derives text DTD for view • View contents materialized using DOM-VXD interface • Views can be constructed on top of result view
The BBQ API • BBQ API = package of Java classes • BBQ Interface is a client of BBQ API • API client is handed the same data structures that BBQ manipulates internally • XML/DTD data structures based on TreeNode class. • Clients keep local copies of data structures
BBQ API, cont’d • A Select-From-Where query using BBQ API • The DTD: <!ELEMENT employees (employee+)> <!ELEMENT employee (name, salary)> • The Query: CONSTRUCT <overpaid> [ $N ] </> WHERE <employees><employee> $N:<name/> <salary> $OP </> </> </> AND $OP > 30000
BBQ API, cont’d function simpleBBQClient() { boolean required = true; bbqSession <- new BBQSession(); bbqSession.connect(); String []list = bbqSession.getListOfDataSources(); src = bbqSession.openDataSource(list[employees]); bbqSession.setSourceConstraint(salary,’>’, “30000”); ans = bbqSession.getAnswerTree(); bbqSession.addNewAnswerTreeNode(ans, BBQSession.kNodeTypeElement, null, “overpaid”); bbqSession.addAnswerTreeNode(ans.child(0), name, required); bbqSession.setGroupBySimple(ans.child(0),required); answer = bbqSession.executeXMASQuery( bbqSession.createXMASQuery()) }
BBQ API, cont’d function simpleBBQClient() { boolean required = true; bbqSession <- new BBQSession(); bbqSession.connect(); String []list = bbqSession.getListOfDataSources(); src = bbqSession.openDataSource(list[employees]); bbqSession.setSourceConstraint(salary,’>’, “30000”); ans = bbqSession.getAnswerTree(); bbqSession.addNewAnswerTreeNode(ans, BBQSession.kNodeTypeElement, null, “overpaid”); bbqSession.addAnswerTreeNode(ans.child(0), name, required); bbqSession.setGroupBySimple(ans.child(0),required); answer = bbqSession.executeXMASQuery( bbqSession.createXMASQuery()) }
BBQ API, cont’d function simpleBBQClient() { boolean required = true; bbqSession <- new BBQSession(); bbqSession.connect(); String []list = bbqSession.getListOfDataSources(); src = bbqSession.openDataSource(list[employees]); bbqSession.setSourceConstraint(salary,’>’, “30000”); ans = bbqSession.getAnswerTree(); bbqSession.addNewAnswerTreeNode(ans, BBQSession.kNodeTypeElement, null, “overpaid”); bbqSession.addAnswerTreeNode(ans.child(0), name, required); bbqSession.setGroupBySimple(ans.child(0),required); answer = bbqSession.executeXMASQuery( bbqSession.createXMASQuery()) }
BBQ API, cont’d function simpleBBQClient() { boolean required = true; bbqSession <- new BBQSession(); bbqSession.connect(); String []list = bbqSession.getListOfDataSources(); src = bbqSession.openDataSource(list[employees]); bbqSession.setSourceConstraint(salary,’>’, “30000”); ans = bbqSession.getAnswerTree(); bbqSession.addNewAnswerTreeNode(ans, BBQSession.kNodeTypeElement, null, “overpaid”); bbqSession.addAnswerTreeNode(ans.child(0), name, required); bbqSession.setGroupBySimple(ans.child(0),required); answer = bbqSession.executeXMASQuery( bbqSession.createXMASQuery()) }
BBQ API, cont’d function simpleBBQClient() { boolean required = true; bbqSession <- new BBQSession(); bbqSession.connect(); String []list = bbqSession.getListOfDataSources(); src = bbqSession.openDataSource(list[employees]); bbqSession.setSourceConstraint(salary,’>’, “30000”); ans = bbqSession.getAnswerTree(); bbqSession.addNewAnswerTreeNode(ans, BBQSession.kNodeTypeElement, null, “overpaid”); bbqSession.addAnswerTreeNode(ans.child(0), name, required); bbqSession.setGroupBySimple(ans.child(0),required); answer = bbqSession.executeXMASQuery( bbqSession.createXMASQuery()) }
Further Information • MIX project • http://www.npaci.edu/DICE/MIX/ • BBQ • http://www.npaci.edu/DICE/MIX/BBQ