150 likes | 272 Views
From model to service: relational databases and SCONE. Presentation to CDLR staff on Wed 5 Feb 2003 By Gordon Dunsire. Overview. From theory to practice A bit about collection level description A bit about relational database design A bit about entity-relationship models
E N D
From model to service: relational databases and SCONE Presentation to CDLR staff on Wed 5 Feb 2003 By Gordon Dunsire
Overview • From theory to practice • A bit about collection level description • A bit about relational database design • A bit about entity-relationship models • Not necessarily in that order! • But using SCONE as a case-study
Implementation stages • Entity-relationship model • Attribute sets • Entities & relationships map to relational database tables • Attributes map to fields (columns) in table • Tables related using standard rdbms structures • Service data retrieved using SQL
Entity-Relationship model • Defines entities (things) and relationships between them • Entity-Relationship-Entity syntax • Defines attributes (pieces of information) common to each entity and relationship • SCONE is based on a model developed by Michael Heaney for UKOLN
Attribute sets • Entity: Location (physical repository) • Place; Identifier • Entity: Agent:Collector (person) • Name; Date; Biography • Relationship: Collects • Legal status; Accrual policy • Relationship: Administers • Access conditions
Implementation in RDBMS • Map entities and relationships to tables • Entity Location (physical repository) maps to table LocationPhys • Relationship Collects maps to table Collects • Map attribute sets to fields in each table • Decomposition to finer detail data elements where appropriate • E.g. Location – place decomposes to building name, address, town, region, postcode, etc.
Example: LocationPhys • Table fields from attributes • Address1 • Address2 • Address3 • Postcode • Plus fields from “experience tells me” attributes • Notes
Example: LocationPhys • Plus fields for administrative metadata • LastDate • Plus fields for RDBMS structure • LocationPhysID (primary key) • TownID (secondary, foreign key) • Maps attribute Town to a lookup table (Town treated as an entity) matched by keys
Relational databases LocationPhys Address1 Address2 Address3 TownID Postcode LocationPhysID LastDate Etc. Town Name TownID LastDate
Relationships (model) Agent [AgentPers] Forename Surname Dates … AgentID … Administers AccessOpenHours … AdministersID … AgentID LocationID Location [LocationPhys] Address1 Address2 Address3 TownID … LocationID …
Terminological inexactitudes • Relationships (model) are NOT the same as relationships (RDBMS) • But can often appear so! • Relationship (m) requires its own table (mostly); relationship (r) is the link between tables • Can sometimes simplify so relationship (m) is implicitly defined by relationship (r), but NOT if relationship (m) has its own attributes
Assembling the record • Use Structured Query Language (SQL) to request fields from related tables matching specified criteria • E.g. to get location town and postcode: • SELECT Town.Name, LocationPhys.Postcode FROM LocationPhys INNER JOIN Town on Town.TownID=LocationPhys.TownID WHERE LocationPhys.LocationPhysID=23
SCONE Service • Web page design and content by DreamWeaver • RDBMS data added to page content dynamically by ColdFusion • Fully integrated environment with DW • SQL scripts • Data processing (program flow) scripts • Data stored in SQL Server
Views • SCONE data retrieved in different ways for different purposes using SQL • Data is stored once, used many times • Data updates are immediately visible • Data updated once, visible in many places • Single RDBMS supports multiple, overlapping services: • SCONE, SCAMP, SLIR (SWOP, ESH), RCO, CAIRNS, Cultural portal