# Presentation: 796320

## From DB to METS

- Eric StedfeldNew York University

- METS Opening Day – October 27-28, 2003

## Goals

- Simple database structure for the most  common METS needs
- Simple interface to take user input, generate METS and return results
- XML processing to convert and display selected material in a web environment
- Future extensions for more complicated media types and metadata

- METS Opening Day – October 27-28, 2003

## Tools

- MySQL database to store structural, descriptive and image technical metadata
- Perl to take user input, query database, build METS file and return Web “success” page
- XT to transform METS XML to HTML using XSLT
- Tomcat to call XT servlet and display HTML to user

- METS Opening Day – October 27-28, 2003

## Web Interface – Generate METS

- METS Opening Day – October 27-28, 2003

## Web Interface – Success

- METS Opening Day – October 27-28, 2003

## Web Interface – Return Results

- METS Opening Day – October 27-28, 2003

## Web Interface – Select Page

- METS Opening Day – October 27-28, 2003

## Web Interface – View Closeup

- METS Opening Day – October 27-28, 2003

## Database Schema – ZeroDB

- METS Opening Day – October 27-28, 2003

## Database Schema – Center

- METS Opening Day – October 27-28, 2003

## Database Schema – Center

- METS Opening Day – October 27-28, 2003

## Database Schema – Object Tree

- METS Opening Day – October 27-28, 2003

## Database Schema – Subject

- METS Opening Day – October 27-28, 2003

## Database Schema – Name

- METS Opening Day – October 27-28, 2003

## Database Schema – Phys. Object

- METS Opening Day – October 27-28, 2003

## Database Schema – Media

- METS Opening Day – October 27-28, 2003

## App Code – Main Routine

- # Set query, path and database variables
- &print_head; # Start "Success" HTML page
**$dbh = DBI->connect("DBI:mysql:$database", ****	****$dbuser, $dbpass);****&do_one;****$dbh->disconnect;**
- &return_to_browser;&print_footer; # Finish "Success" HTML page

- METS Opening Day – October 27-28, 2003

## App Code – Do One

- $objectTreeID = $fetchme;
- # Set up file and path variables using $objectTreeID
**&get_children; # create array of objectIDs**
**open (OUTFILE, ">$path");****&print_xml;****close (OUTFILE);**
- }

- METS Opening Day – October 27-28, 2003

## App Code – Get Children

**$SQLstmt** = "SELECT o.objectTreeID, o.parentIDFROM objectTree AS o WHERE o.parentID = $objectTreeIDORDER BY o.objectTreeID";
**$sth = $dbh->prepare($SQLstmt);****$sth->execute;**
- while (@row = $**sth**->fetchrow_array){	$childID = $row[0];	@children = $childID;}
**$sth->finish;**}

- METS Opening Day – October 27-28, 2003

## App Code – Print XML

- # SQL to fetch METS header info&print_METSHeader;
**&print_dmdSecDM;****&print_amdSec;****&print_fileSec;****&print_structMap;**
- print OUTFILE<<EOF;# METS close file stuff hereEOF}

- METS Opening Day – October 27-28, 2003

## XML – Descriptive Metadata

- METS Opening Day – October 27-28, 2003

## XML – Technical Metadata

- METS Opening Day – October 27-28, 2003

## XML – File Section

- METS Opening Day – October 27-28, 2003

## XML – Structural Map

- METS Opening Day – October 27-28, 2003

## Web Interface – Select Page

- METS Opening Day – October 27-28, 2003

## Issues

- Database capability vs. METS flexibility
- Normalized vs. efficient database schema
- General vs. specialized approach for many METS types
- Hard areas such as rights metadata
- Data synchronization
- Consistency across institution(s)

- METS Opening Day – October 27-28, 2003

## Future

- “Meta-programming” – programs to create programs, database schemata and stylesheets
- Consistent utilization and implementation of Profiles
- Down-streaming more of the work – less specialized skill sets required, less “boutique-y”

- METS Opening Day – October 27-28, 2003

## From DB to METS

- Eric StedfeldNew York University

- METS Opening Day – October 27-28, 2003