native xml database for information systems
Download
Skip this Video
Download Presentation
Native XML Database for Information Systems

Loading in 2 Seconds...

play fullscreen
1 / 24

Native XML Database for Information Systems - PowerPoint PPT Presentation


  • 149 Views
  • Uploaded on

Native XML Database for Information Systems. Chris Wallace ISD3 March 2006. Exploring the design space. Native XML database (NXD) Storing, querying and updating XML documents without mapping into relations Schema-free Trees are to NXD what tables are to RDBMS Tables are trees

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Native XML Database for Information Systems' - renata


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
exploring the design space
Exploring the design space
  • Native XML database (NXD)
    • Storing, querying and updating XML documents without mapping into relations
    • Schema-free
    • Trees are to NXD what tables are to RDBMS
    • Tables are trees
  • Information Systems
    • Focus on semi-structured data (mixture of simple data items, text and complex nested structures)
    • Searching, derived data, visualisation
    • Process support
    • Large problem space variously supported by spreadsheets, word documents, ad-hoc databases, increasingly web-integrated data.
  • “design as a conversation with the materials in the situation” (Schon)

Chris Wallace, ISD3

exist native xml database
eXist Native XML Database
  • Open source Java
  • European team of developers led by Wolfgang Meier
  • 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
    • Part of a Cocoon pipeline
    • As web application in Apache/Tomcat
    • With embedded Jetty HTTPserver (as on stocks)
  • Multiple Interfaces
    • REST – to Java servlet
    • SOAP
    • XML:RPC

Chris Wallace, ISD3

nxd case studies
NXD case studies
  • FOLD
    • modules, programmes, scheme operations, staff, organisational structures, events
  • Family photos and history
    • Integration of meta-data on family photos with family history (births, deaths and marriages)
  • ISD3 Assignment
    • a web-based calculator
    • e.g. a currency converter
  • State-machine simulator
    • Coke machine

Chris Wallace, ISD3

isd3 coursework 1
ISD3 Coursework 1
  • Develop a simple web-based calculator
  • Not just a programming exercise
    • User interface design
      • Users language, units, not raw data
      • User interaction design
    • Data design
      • choice of representation of domain facts
    • Veracity
      • Relationship between data in database and domain being modelled
      • How is veracity monitored and maintained
    • Process
      • Examine some of the XP processes
        • Test-driven development

Chris Wallace, ISD3

application design
Application Design
  • Data model is one simple table:
    • Currency code, name and symbol
    • Latest conversion rates from GBP to currency X
  • Currency Coding
    • Use ISO4217 e.g. XE.COM list
  • Core algorithm:
    • Conversion from N X to ? Y is
      • N * rate(X to GBP) * rate(GBP to Y) i.e.
      • N * (1/rate (GBP to X) * rate(GBP to Y)
  • Currency rates to be updated by an administrator
    • (not via a web-service)
  • Interface is to be a sticky form:
    • Input form and output result on one page
    • Input form default values from last input
  • Veracity management
    • Rates must be dated and sourced –

Chris Wallace, ISD3

technical decisions
Technical Decisions
  • Choice of platform:
    • PL/SQL and Oracle
    • ASP.NET and SQL Server
    • JSP (Java Servlet Page) and JDBC to Postgres(say)
    • PHP and MySQL
    • XML and Native XML Database (eXist)
  • Calculation location:
    • client-side in ECMAScript (aka JavaScript)
    • server-side
      • with/without Ajax

Chris Wallace, ISD3

two approaches
Two approaches
  • PHP-MySQL
    • Define and create MySQL table
    • Write PHP script to provide interface and access the database using SQL
    • Write editor for the Currency table
  • XML
    • Create MS Excel spreadsheet of currencies
    • Convert to XML in Excel and save
    • Write XQuery script to provide interface

Chris Wallace, ISD3

development process for currency converter
Development Processfor currency converter
  • XP Practices:
    • ‘Spike’ Simple end to end implementation
    • Incremental development
  • Setup eXist database
    • Using the Admin interface:
      • Create a directory for application
      • Create a subdirectory for currency data
  • Create XML dataset(s) in Excel
  • Upload to eXist
  • Write the XQuery script cur.xql
  • Upload to eXist
  • Execute in browser

Chris Wallace, ISD3

currency data in xml
Currency Data in XML
  • Start MS Excel 2003
  • Create the spreadsheet with column headings
  • Convert to List (needs XML add-in)
  • Save as XML data

Chris Wallace, ISD3

xquery
XQuery
  • W3C candidate recommendation
    • http://www.w3.org/TR/xquery/
  • Designed by, amongst others, Don Chamberlin
    • http://www.research.ibm.com/journal/sj/414/chamberlin.pdf
  • A functional programming Language
    • Based on XPath (tree-access language)
    • Integrate, select, update, compute and construct XML documents
    • cf PL/SQL
  • http://www.w3.org/XML/Query/

Chris Wallace, ISD3

write the xquery script
Write the XQuery script
  • Use the admin interface to test simple queries
  • Use a syntax aware editor if possible
    • JEdit
    • Dreamweaver
    • Java Client interface to eXist
    • PFE32

Chris Wallace, ISD3

executing an xquery
Executing an XQuery

cur.xql?fromAmount=100&fromCode=USD&toCode=EUR

Client Browser

eXist: Server

User clicks

link

Get cur.xql +

parameters

servlet

fetch cur.xql

parameters

cur.xql

eXist DB

html

XQuery Engine

render

XSLT

Chris Wallace, ISD3

xquery script 1
XQuery Script (1)

declare namespace request="http://exist-db.org/xquery/request";

let $fromAmount := request:request-parameter("fromAmount",“100"),

$fromCode := request:request-parameter("fromCode","GBP"),

$toCode := request:request-parameter("toCode","EUR"),

$currencies := collection('/db/calculator/currencies')//Currency,

$fromCurrency := $currencies[Code=$fromCode],

$toCurrency := $currencies[Code=$toCode],

$toAmount := round(xs:decimal($fromAmount)

* xs:decimal($toCurrency/Rate)

div xs:decimal($fromCurrency/Rate)

)

return

Chris Wallace, ISD3

xquery script 115
XQuery Script (1)

Default

declare namespace request="http://exist-db.org/xquery/request";

let $fromAmount := request:request-parameter("fromAmount",“100"),

$fromCode := request:request-parameter("fromCode","GBP"),

$toCode := request:request-parameter("toCode","EUR"),

$currencies := collection('/db/calculator/currencies')//Currency,

$fromCurrency := $currencies[Code=$fromCode],

$toCurrency := $currencies[Code=$toCode],

$toAmount := round(xs:decimal($fromAmount)

* xs:decimal($toCurrency/Rate)

div xs:decimal($fromCurrency/Rate)

)

return

Return node sequence of all Currency elements in this doc

Filter

Condition

Cast

Chris Wallace, ISD3

xquery script 2
XQuery Script (2)

XML

return

Currency Calculator

Currency Calculator

Embedded XQuery

Chris Wallace, ISD3

xquery 3
XQuery (3)

FLWOR expression

conditional

Chris Wallace, ISD3

round two enhancements
Round two - enhancements
  • Add another currency
    • ZAR Rand 10.4767
  • Add new columns
    • Source and date/time
      • Update spreadsheet
        • Add columns and data
      • Update XQuery script – cur2.xql
        • Add source – Sources and oldest date

Chris Wallace, ISD3

round 3 currency table
Round 3 – Currency Table
  • Same document used for different purpose:
    • currency.xsl
    • curtable.xql
    • Run it curtable.xql

Chris Wallace, ISD3

slide20
The FOLD

Chris Wallace, ISD3

fold design
FOLD Design
  • Some table data for maintenance in spreadsheet form. Forces some compromises in the data structure
    • Multi-valued fields (not nested)
    • Specific roles (not generic)
  • Module specifications, Programme Structures, Organisational Groups
    • deeply structured documents
    • complex relationships

Chris Wallace, ISD3

research areas
Research Areas
  • Design practice for NDX
    • ‘Pattern language’ to help map from conceptual model to multiple XML schemes
    • Identifier design
    • Structuring documents by responsibility and versions
  • NDX in organisational use
    • Social effects of distributed responsibility
    • Visualisation of complex relationships
    • Handling integrity problems – accept inconsistency as a way of life
    • Management of veracity

Chris Wallace, ISD3

process support
Process support
  • Short term – Process support
    • Form generation
    • Linkage to process documentation
  • Medium term – Process monitoring
    • Online capture of significant dates
      • Coursework hand-in date
      • Date exam sent to moderator
      • Date coursework returned to students
    • Derived information
      • Workload prediction based on coursework schedule and student numbers
      • Display of latest coursework returned and SMS message to students
    • State-based process modelling
      • Exam moderation
  • Long term- Process management
    • Workflow
    • Process enactment software

Chris Wallace, ISD3

next 6 weeks
Next 6 weeks
  • Web Services – Application integration
  • Process modelling
    • Use cases and scenarios
    • State machines
  • Business Process Modelling

Chris Wallace, ISD3

ad
Amount to Convert

name="fromAmount“

value="{$fromAmount}"/>

From Currency