Data Schemas

Sportwire does not really care much about the specific object-relational mapping used to store the XML feed. The current implementation uses XML-DBMS, an O:R mapping system developed by the Working Group on Databases and Information Systems at the University of Paderborn[2]. Sportwire can be adapted to another XML database by creating a new class based on the DocHandler interface.

To map the XML input to relational tables, schemas can be partially generated using the included GenerateMap utility; this provides a skeletal SQL and Map schema that must be hand-edited to align the schema to the server requirements. The following script generates an initial Map and the CREATE TABLE statements:


#!/bin/sh
########################################################################
# Filename: genmap.sh
#
# Generate an initial map and SQL create stmts from a DDML or DTD file
# when run from this directory, it takes a single command line
# parameter of the DTD file and will create the output files in
# the same directory as that DTD.
#
# Author:  Gary Lawrence Murphy <garym@teledyn.com>
# Copyright:  2001 Canadian Broadcasting Corporation (cbc.ca)
# Version: $Id: architecture.xml,v 1.7 2002/04/20 19:43:52 garym Exp $
########################################################################
GENDIR=.
MYPATH=$GENDIR/classes:$GENDIR/jars/xmldbms.jar
#MYPATH=$MYPATH:$GENDIR/jars/nanoxml-2.1.1.jar:$GENDIR/jars/nanoxml-sax-2.1.1.jar
MYPATH=$MYPATH:$GENDIR/jars/xerces.jar
MYPATH=$MYPATH:$GENDIR/jars/jdbc7.0-1.2.jar
java -classpath $MYPATH GenerateMap $*

The above script run on FILENAME.dtd generates FILENAME.sql and FILENAME.map; these files are then hand-edited to remove unnecessary fields and set columns to reasonable datatypes. Map can even be adjusted to conform to legacy database schemas.



[2] XML-DBMS intends to implement the evolving W3C schemas, and currently supports the draft specification released on December 17th, 1999.