Shadowhelix:Datenbank/Umsetzung SQL: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Loki (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Loki (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
Zeile 98: | Zeile 98: | ||
,web_link TEXT | ,web_link TEXT | ||
,direct_link TEXT | ,direct_link TEXT | ||
); | |||
CREATE TABLE index_illustration_person( | |||
id_person INTEGER(0) NOT NULL | |||
,id_illustration INTEGER(0) NOT NULL | |||
); | ); | ||
Zeile 149: | Zeile 154: | ||
,description TEXT NOT NULL | ,description TEXT NOT NULL | ||
,sex TEXT | ,sex TEXT | ||
); | ); | ||
Zeile 196: | Zeile 196: | ||
.import ShxDB_illustration_type.txt illustration_type | .import ShxDB_illustration_type.txt illustration_type | ||
.import ShxDB_illustration_weblink.txt illustration_weblink | .import ShxDB_illustration_weblink.txt illustration_weblink | ||
.import ShxDB_index_illustration_person.txt index_illustration_person | |||
.import ShxDB_corporation_name.txt corporation_name | .import ShxDB_corporation_name.txt corporation_name | ||
.import ShxDB_corporation_ownership.txt corporation_ownership | .import ShxDB_corporation_ownership.txt corporation_ownership | ||
.import ShxDB_person.txt person | .import ShxDB_person.txt person | ||
.import ShxDB_product_name.txt product_name | .import ShxDB_product_name.txt product_name | ||
.import ShxDB_product_source.txt product_source | .import ShxDB_product_source.txt product_source |
Version vom 10. April 2016, 12:18 Uhr
Datenbankstruktur
Skript für Tabellenerstellung:
CREATE TABLE source( id_source INTEGER(0) NOT NULL ,description TEXT NOT NULL ,language_code TEXT NOT NULL ,type TEXT ); CREATE TABLE source_catalog( id_source INTEGER(0) NOT NULL ,catalog TEXT ,key TEXT ); CREATE TABLE source_translated( id_source INTEGER(0) NOT NULL ,id_source_original INTEGER(0) NOT NULL ,partial_translation TEXT ); CREATE TABLE contributor( id_contributor INTEGER(0) NOT NULL ,surname TEXT NOT NULL ,surname_suffix TEXT ,forename_first TEXT ,forename_second TEXT ,forename_third TEXT ,year_birth TEXT ,year_death TEXT ,sex CHAR(1) ); CREATE TABLE contributor_catalog( id_contributor INTEGER(0) NOT NULL ,catalog TEXT ,key TEXT ,archive_copy_timestamp INTEGER(0) ); CREATE TABLE contributor_referenced_name( id_contributor INTEGER(0) NOT NULL ,referenced_name TEXT NOT NULL ); CREATE TABLE contributor_weblink( id_contributor INTEGER(0) NOT NULL ,url TEXT NOT NULL ,archive_copy_timestamp INTEGER(0) ); CREATE TABLE contributor_weblink_hosting_service( id_contributor INTEGER(0) NOT NULL ,hosting_service TEXT NOT NULL ,account_name TEXT NOT NULL ,archive_copy_timestamp INTEGER(0) ); CREATE TABLE contribution( id_contributor INTEGER(0) NOT NULL ,id_source INTEGER(0) NOT NULL ,standard_descriptor TEXT NOT NULL ,uncredited CHAR(1) ,title_contribution TEXT ); CREATE TABLE contribution_illustration( id_contributor INTEGER(0) NOT NULL ,id_illustration INTEGER(0) ); CREATE TABLE illustration_catalog( id_illustration INTEGER(0) NOT NULL ,catalog TEXT ,key TEXT ); CREATE TABLE illustration_source( id_illustration INTEGER(0) NOT NULL ,id_source INTEGER(0) NOT NULL ,issue TEXT ,page_reference TEXT ,entry_reference TEXT ,position TEXT ,modification TEXT ); CREATE TABLE illustration_type( id_illustration INTEGER(0) NOT NULL ,type TEXT NOT NULL ); CREATE TABLE illustration_weblink( id_illustration INTEGER(0) NOT NULL ,web_link TEXT ,direct_link TEXT ); CREATE TABLE index_illustration_person( id_person INTEGER(0) NOT NULL ,id_illustration INTEGER(0) NOT NULL ); CREATE TABLE corporation_name( id_corporation INTEGER(0) NOT NULL ,language_code TEXT ,short_name TEXT ,full_name TEXT ,abbreviation TEXT ); CREATE TABLE corporation_ownership( id_corporation INTEGER(0) NOT NULL ,id_corporation_owner INTEGER(0) ,id_organisation_owner INTEGER(0) ,id_person_owner INTEGER(0) ,fraction TEXT ,from_year TEXT ,from_month TEXT ,to_year TEXT ,to_month TEXT ); CREATE TABLE product_name( id_product INTEGER(0) NOT NULL ,language_code TEXT ,name TEXT ); CREATE TABLE product_source( id_product INTEGER(0) NOT NULL ,id_source INTEGER(0) ,issue TEXT ,page_reference TEXT ,entry_reference TEXT ); CREATE TABLE product_type( id_product INTEGER(0) NOT NULL ,id_type INTEGER(0) ); CREATE TABLE type( id_type INTEGER(0) NOT NULL ,language_code TEXT ,name TEXT ); CREATE TABLE person( id_person INTEGER(0) NOT NULL ,description TEXT NOT NULL ,sex TEXT ); CREATE TABLE shadow_matrix_user( id_user INTEGER(0) NOT NULL ,id_person INTEGER(0) ,name TEXT ); CREATE TABLE shadow_matrix_shadowtalk_source( id_user INTEGER(0) NOT NULL ,id_source INTEGER(0) NOT NULL ,issue TEXT ,page_reference TEXT ,entry_reference TEXT );
Beispielimplementierung - SQLite
Anleitung - Erstellung der Datenbank
- Voraussetzung: SQLite ist installiert.
- Datenbank-Dateien herunterladen.
- Obenstehendes Skript in die Datei create_tables.sql kopieren.
- Import-Skript in die Datei import.sql schreiben. Inhalt (kürzen, falls nicht alle Daten eingefügt werden müssen):
.separator "\t" .import ShxDB_contributor.txt contributor .import ShxDB_contributor_contributors_catalog.txt contributor_catalog .import ShxDB_contributor_referenced_name contributor_referenced_name .import ShxDB_contributor_weblink.txt contributor_weblink .import ShxDB_contributor_weblink_hosting_service.txt contributor_weblink_hosting_service .import ShxDB_source.txt source .import ShxDB_source_catalog.txt source_catalog .import ShxDB_source_translated.txt source_translated .import ShxDB_contribution.txt contribution .import ShxDB_contribution_illustration.txt contribution_illustration .import ShxDB_illustration_catalog.txt illustration_catalog .import ShxDB_illustration_source.txt illustration_source .import ShxDB_illustration_type.txt illustration_type .import ShxDB_illustration_weblink.txt illustration_weblink .import ShxDB_index_illustration_person.txt index_illustration_person .import ShxDB_corporation_name.txt corporation_name .import ShxDB_corporation_ownership.txt corporation_ownership .import ShxDB_person.txt person .import ShxDB_product_name.txt product_name .import ShxDB_product_source.txt product_source .import ShxDB_product_type.txt product_type .import ShxDB_type.txt type .import ShxDB_shadow_matrix_user.txt shadow_matrix_user .import ShxDB_shadow_matrix_shadowtalk_source.txt shadow_matrix_shadowtalk_source
- Alle Dateien in ein Verzeichnis zusammenführen.
- Neue Datenbank anlegen ggf. systemabhängig aber normalerweise durch Aufruf des SQLite-Kommandos mit Datenbankname, z.B.
- > sqlite shx.db
- In SQlite die Tabellen durch Ausführen von create_tables.sql erstellen.
- sqlite> .read create_tables.sql
- In SQlite den Inhalt der Datenbankdateien durch Ausführen von import.sql in die Tabellen importieren.
- sqlite> .read import.sql