1 / 16

Teaching XML databases with eXist

Teaching XML databases with eXist. Chris Wallace Senior Lecturer School of Information Systems University of the West of England, Bristol, UK TLAD 2006 18 th July 2006. Outline. The teaching context The rationale for XML Databases eXist as a suitable Native XML database

berget
Download Presentation

Teaching XML databases with eXist

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. Teaching XML databases with eXist Chris Wallace Senior Lecturer School of Information Systems University of the West of England, Bristol, UK TLAD 2006 18th July 2006 Chris Wallace

  2. Outline • The teaching context • The rationale for XML Databases • eXist as a suitable Native XML database • Conceptual data modelling • Conceptual language modelling • Issues Chris Wallace

  3. The teaching Context • Multimedia Computing Programme • First year Java, HTML, web applications with Perl • Level 2 module “Data, Schemas and Applications” • Broad coverage of data structures • Tables • Tagged structures • Trees • Sequences • Web application development • Emphasis on transferable knowledge Chris Wallace

  4. The workplan • Semester 1 • Use ER models to capture understanding of Flickr, an online photo album • Groups of 3: Use PHP and MySQL to implement a baby Flickr • Semester • Use XML to structure data (Whisky data) • Use XQuery and eXist to develop individual XML-based application (jh) Chris Wallace

  5. The Rationale for XML database • Case study – the CEMS FOLD • A faculty web site providing staff and students with information about • Modules • Programmes • Staff • Organisational structure Word documents Spread sheets SQL DB JPEGs LDAP Chris Wallace

  6. Why not an RDBMS? • Documents • Unit of editing, ownership, communication • Complex composite structures • Ordering and other complex relationships • Linked by shared values • Spreadsheets • Familiar data organisation tool • Process descriptions • eBXML Chris Wallace

  7. structured text composition Complex expressions associations ordering subtypes Chris Wallace

  8. eXist Native XML Database • Open source Java • European team of developers led by Wolfgang Meier(Darmstadt) • Documents (files) are organised in collections (folders) in a file store • XML Documents stored in an efficient, B+ tree structure with indexes • Non-XML resources (XQuery, CSS, JPEG ..), etc can be stored as binary • Deployable in different ways • Embedded in a Java application • With embedded Jetty HTTPserver • Multiple Interfaces • REST – to Java servlet • SOAP • XML:RPC • Support for XQuery • Function library extensions • Language extensions (free-text matching and update) • Schema validation supported • Database is not schema-aware – no type information available Chris Wallace

  9. NDX/RDBMS similarities and differences • Similarities • Associations implemented via common values • Differences • NDX can store documents without a prior schema – ‘agile modelling’ • Composition implemented via containment • Sequence directly supported • XQuery fulfils the role of SQL + (PL/SQL,PHP,JSP) Chris Wallace

  10. SQL and XQuery SELECT * FROM emp WHERE deptno = 10; //Emp[deptno = 10] SELECT empno, location FROM dept, emp WHERE dept.DEPTNO = emp.DEPTNO; for $e in //Emp let $d := //Dept[deptno = $e/deptno] return ($e/empno,$d/loc) SELECT e.ename,m.ename FROM emp AS e, emp AS m WHERE e.mgr = m.empno AND e.deptno = 20 for $e in //Emp[deptno = 20] let $m := //Emp[empno = $e/mgr] return <emp>{$e/ename ,$m/ename}</emp> Chris Wallace

  11. Simple Table Example • Data on Excel spreadsheet • Convert to XML (Excel add-in) • Save as XML data • Load into eXist database • Run trip.xql to find and generate XQuery to generate .kml file • View with GoogleEarth Chris Wallace

  12. Stored Query <html> <head> <title>BSA trip reports</title> </head> <body> <h1>BSA trip reports</h1> <table border="1"> <tr><th>Start Date</th><th>Trip</th></tr> { for $trip in collection("/db/chriswallace/voyage")//trip return <tr> <td>{string($trip/startDate)}</td> <td>{string($trip/title)}</td> <td><a href="trip2kml.xql?id={$trip/id}">Google Earth</a></td> <td><a href="showtrip.xql?id={$trip/id}">Show trip</a></td> </tr> } </table> </body> </html> Chris Wallace

  13. Conceptual Data Models • QSEE allows conceptual data models to be created, and then SQL DDL generated with: • Foreign key generation • Composite primary keys • Many-many resolution • Creates the necessary separation between the conceptual model and its realisation in a given logical data model • The student to develop a sense of the utility of ER models across a wide range of structures Chris Wallace

  14. Conceptual Language Model • Web development calls for multiple languages – Java, JavaScript, Perl, PHP, XQuery, XSLT, SQL • This provides the opportunity and need to try to dig down to the common conceptual models e.g. • Formal/informal language mixture • Structured programming • Modularity Chris Wallace

  15. Issues • Controlled exposure to language • Complexity of XQuery versus SQL • Schemas – hindrance or lifeline? • Tools for conceptual modelling • Weaker students Chris Wallace

  16. Takeaways • XQuery and the eXist Native XML database are the most fun I’ve had since Smalltalk • actually more because it delivers useful systems • ‘Take the code to the data, not the data to the code’ • PHP/ Java • loading and unloading XML <> internal structures (SAX, DOM) • XQuery/XSLT • Direct operations on the persistent XML data • ‘Content is king’ • A successful Information system depends on: • Data quality – model fidelity more than model integrity • Handling multiple, sometimes inconsistent, views of the world Chris Wallace

More Related