1 / 18

A Graphical Environment to Query XML Data with XQuery

A Graphical Environment to Query XML Data with XQuery. campi@elet.polimi.it. XML data from the W3C Use Cases.

marvin
Download Presentation

A Graphical Environment to Query XML Data with XQuery

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Graphical Environment to Query XML Data with XQuery campi@elet.polimi.it

  2. XML data from the W3C Use Cases <bib> <book year="1994"> <title> TCP/IP Illustrated </title> <author> <last> Stevens </last> <first> W. </first> </author> <publisher> Addison-Wesley </publisher> <price> 65.95 </price> </book> <book year="1992"> <title> Advanced Programming in the Unix...</title> <author> <last> Stevens </last> <first> W. </first> </author> <publisher> Addison-Wesley </publisher> <price> 78.99 </price> </book></bib>

  3. XQuery List books published by Addison-Wesley after 1991, including their year and title <bib> { for $b in document("www.bn.com/bib.xml")/bib/book where $b/publisher="Addison-Wesley" and $b/@year>1991 return <book year="{ $b/@year }"> { $b/title } </book> } </bib>

  4. XQBE (XQuery By Example) • XQBE, a visual dialect of XQuery inspired by QBE paradigm (Zloof 77). • The availability of simpler XQuery “dialects” could contribute to its success, especially for users with a very limited experience of query languages. • To fit the XML data model, XQBE uses hierarchical structures to denote the data taken in input and generated as output. Such structures are annotated to express selection predicates, while explicit bindings visualize the input/output mappings.

  5. Motivation and design principles • XQBE was designed with the objectives of being • intuitive • easy to map directly to XQuery • capable of running on top of any existing XQuery engine • XQBE includes most of the expressive power of XPath • XQBE allows for arbitrarily deep nesting of XQuery FLWOR expressions • XQBE supports the construction of new XML elements and permits to restructure existing documents

  6. Visual querying paradigm • A vertical linedivides the source(left) partfrom the construct (right) part. • The query has a natural reading order from left to right. Source data Result data Data Flow Bindings • The left part describes the data to be matched to construct the result, the right one specifies which parts will be retained in the result,together with (optional) newly generated items.

  7. XQBE

  8. For each book in the bibliography, list the title and authors, grouped inside a result element Element projection and renaming

  9. Element projection and renaming For each book list only the title and the surnames of the authors

  10. Join between two documents For each book found at both www.bn.com and www.amazon.com, list the title of the book and its price from each source

  11. Document restructuring Create a flat list of all the title-author pairs, with each pair enclosed in a result element

  12. Filtering nodes in the construct part Make a list of all the books with their title, including the editors only if they are affiliated to CITI

  13. Sorting List books published by Addison-Wesley after 1991, including their year and title, sorting the retrieved books in lexicographic order

  14. Nesting and negation List all the books not published by Addison-Wesley and with an author whose first name is Jack. Rename each of these books in <Jack-s-book>, and only retain the title and the full name of the authors whose first name is Jack

  15. Translation principles • A query translates to one XQuery FLWR expression • It can be contained into an arbitrary number of node constructors • The for clause of the outmost FLWR expression contains a list of variable bindings, each of which corresponds to a binding edge • Where clauses have a fixed structure • existential quantifier (some...satisfies)

  16. The tool in action

  17. Future works • Extend the set of supported core functions and add the capability of querying the document order • Specialize XQBE with capabilities specific to some applicative domain • An XQBE for digital libraries • Produce the XQBE view of a given XQuery statement

  18. Conclusions • XQBE is a graphical query language that offers a visual interface to query XML documents. • We have presented a prototype that implements our proposed interface and translates graphical queries into XQuery, so that it can be used in conjunction with any XQuery engine.

More Related