Digital Media Technology Week 10
foreign key primary key TREASURE_IDTITLECREATORLIBRARYSUBJECTYEAR 1Sidereus Nuncius77SCI1610 2Requiem KV 62621MUS1791 3Rabbit Hunt, in the lower left Brueghel ART1560 4De antiquitate Britanicae Ecclesiae84ART1572 5Vedute di Roma con scene di costume66HIS1810 6Corrected page proofs of 'Les Fleurs du mal'12HIS1857 7Vinegar Hill, charge of the 5th Dragoon Guards45HIS1880 8Poster of "Internationale Ausstellung für Buchgewerbe und Graphik"59ART1914 9Fontana dei Fiumi a Piazza Navona96ART1734 CREATOR_IDNAME_LASTNAME_FIRSTYEAR_OF_BIRTHYEAR_OF_DEATHCOUNTRY_BORN 1BaudelaireCharles FR 2MozartWolfgang Amadeus AT 3Bruegel The ElderPieter BE 4SadlerWilliam IE 5TiemannWalter DE 6MacchiavelliGiacomo IT 7GalileiGalileo IT 8ParkerMatthew GB 9WittelCaspar van NL 10MolyneuxDaniel IE
CREATE TABLE TREASURE ( TREASURE_ID INT (4) NOT NULL AUTO_INCREMENT, TITLE VARCHAR (150), CREATOR INT, LIBRARY CHAR(6), SUBJECT CHAR(3), YEAR INT (4), PRIMARY KEY (TREASURE_ID), FOREIGN KEY (CREATOR) REFERENCES CREATOR ON DELETE RESTRICT ON UPDATE CASCADE, FOREIGN KEY (LIBRARY) REFERENCES LIBRARY ON DELETE RESTRICT ON UPDATE CASCADE, FOREIGN KEY (SUBJECT) REFERENCES SUBJECT ON DELETE RESTRICT ON UPDATE CASCADE );
FK = PK
Semantic Web
Entity Relationship Diagrams
PERSON P_ID NAME PHONE DATE_OF_BIRTH Attributes PK is underlined
BOOK PERSON COMPANY
□ Cardinality: how many instances of the entity can be associated with one instance of the related entity? BOOKCOMPANY
STUDENTCOURSE ENROLMENT
PERSON COMPANY many EMPLOYMENT P_IDC_ID P_ID C_ID E_ID many one many one
Making an ERD □ Identify entities □ Consider the cardinality of the relations between these entities □ One-to-one relations must be removed – these entitites can be combined in a single entity □ Change many-to-many relations into one- to-many relations by making use of linking tables □ Add attributes
codename ukGreat Britain frFrance neThe Netherlands beBelgium A look-up table (based on ISO )
NameCountry_born Shelley, Percy ByssheGreat Britain Swinburne, Algernon Charles Britain Cowper, WilliamUnited Kingdom Coleridge, Samuel TaylorU.K.
NameCountry_born Shelley, Percy Byssheuk Swinburne, Algernon Charles uk Cowper, Williamuk Coleridge, Samuel Tayloruk
Referential Integrity □ Each foreign key should correspond to an existing primary key. □ Most DBMSs take measures to prevents users or applications from entering inconsistent data.
CREATE TABLE BOOK ( B_ID INT NOT NULL AUTO_INCREMENT, TITLE VARCHAR (50), AUTHOR INT, LANGUAGE VARCHAR (40), PUBLISHER INT, EXTENT INT, YEAR INT(4), PRIMARY KEY (B_ID), FOREIGN KEY (AUTHOR) REFERENCES PERSON ON DELETE RESTRICT ON UPDATE CASCADE, FOREIGN KEY (PUBLISHER) REFERENCES COMPANY ON DELETE RESTRICT ON UPDATE CASCADE );
Interpretation continuum Data: relatively unstructured Information: very structured Source: Obrst and Liu, Knowledge representation, Ontological Engineering and Topic Maps, in: XML Topic Maps, 2003
□ SQL: Structured Query Language □ Supported by most RDBMSs. □ Makes use of regular English words
SELECT TITLE, YEAR FROM TREASURE ; TITLEYEAR Sidereus Nuncius1610 Requiem KV Rabbit Hunt, in the lower left Brueghel De antiquitate Britanicae Ecclesiae1572 Vedute di Roma con scene di costume 1810 Corrected page proofs of 'Les Fleurs du mal' 1857 Vinegar Hill, charge of the 5th Dragoon Guards 1880 Poster of "Internationale Ausstellung für Buchgewerbe und Graphik" 1914 Fontana dei Fiumi a Piazza Navona1734
SELECT * FROM TREASURE ; treasure_idtitleyearcreatorlibrarysubject 1Sidereus Nuncius161077SCI 2Requiem KV MUS 3Rabbit Hunt, in the lower left Brueghel ART 4De antiquitate Britanicae Ecclesiae ART 5Vedute di Roma con scene di costume HIS 6Corrected page proofs of 'Les Fleurs du mal' HIS 7Vinegar Hill, charge of the 5th Dragoon Guards HIS 8Poster of "Internationale Ausstellung für Buchgewerbe und Graphik" ART 9Fontana dei Fiumi a Piazza Navona ART
SELECT TITLE, YEAR FROM TREASURE ORDER BY YEAR ; TITLEYEAR Rabbit Hunt, in the lower left Brueghel De antiquitate Britanicae Ecclesiae1572 Sidereus Nuncius1610 Fontana dei Fiumi a Piazza Navona1734 Requiem KV Vedute di Roma con scene di costume 1810 Corrected page proofs of 'Les Fleurs du mal' 1857 Vinegar Hill, charge of the 5th Dragoon Guards 1880 Poster of "Internationale Ausstellung für Buchgewerbe und Graphik" 1914
SELECT NAME_LAST, NAME_FIRST, (YEAR_OF_DEATH - YEAR_OF_BIRTH) AS AGE FROM CREATOR ; NAME_LASTNAME_FIRSTAGE BaudelaireCharles46 MozartWolfgang Amadeus 35 Bruegel The ElderPieter44 SadlerWilliam57 TiemannWalter75 MacchiavelliGiacomo55 GalileiGalileo78 ParkerMatthew71 WittelCaspar van81 MolyneuxDaniel64
SELECT TITLE, YEAR FROM TREASURE WHERE YEAR > 1800 ; TITLEYEAR Vedute di Roma con scene di costume 1810 Corrected page proofs of 'Les Fleurs du mal' 1857 Vinegar Hill, charge of the 5th Dragoon Guards 1880 Poster of "Internationale Ausstellung für Buchgewerbe und Graphik" 1914
SELECT DISTINCT SUBJECT FROM TREASURE ; SUBJECT ART HIS MUS SCI