You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
candlecao
changed the title
I need to master how to create a schema and insert data for a relational database on Open Link Virtuoso.
I need to master how to create a schema and insert data for a relational database using SQL on Open Link Virtuoso.
Nov 8, 2024
-- Create the Source table
CREATE TABLE "cantus"."sample"."Source" (
Source_ID INT PRIMARY KEY,
title VARCHAR(255) NOT NULL
);
-- Create the Chant table with a foreign key constraint on source_link
CREATE TABLE "cantus"."sample"."Chant" (
Chant_ID INT PRIMARY KEY,
incipit VARCHAR(255),
genre VARCHAR(255),
source_link INT,
FOREIGN KEY (source_link) REFERENCES "cantus"."sample"."Source"(Source_ID)
);
-- Insert data into the Source table
INSERT INTO "cantus"."sample"."Source" VALUES (123716, 'Wolfenb_');
INSERT INTO "cantus"."sample"."Source" VALUES (123730, 'Prague_');
INSERT INTO "cantus"."sample"."Source" VALUES (123756, 'Wroclaw_');
INSERT INTO "cantus"."sample"."Source" VALUES (669163, 'Sydney_');
INSERT INTO "cantus"."sample"."Source" VALUES (702611, 'Gent_');
-- Insert data into the Chant table
INSERT INTO "cantus"."sample"."Chant" VALUES (562633, 'Ecce nunc palam loqueris et', 'http://www.wikidata.org/entity/Q582093', 123756);
INSERT INTO "cantus"."sample"."Chant" VALUES (671551, 'Dominus tamquam ovis ad victimam', 'http://www.wikidata.org/entity/Q582093', 669163);
INSERT INTO "cantus"."sample"."Chant" VALUES (562160, 'Seniores populi consilium fecerunt ut', 'http://www.wikidata.org/entity/Q604748', 123756);
INSERT INTO "cantus"."sample"."Chant" VALUES (467250, 'Ad te domine levavi animam', 'http://www.wikidata.org/entity/Q582093', 123730);
INSERT INTO "cantus"."sample"."Chant" VALUES (560736, 'Stephanus servus dei quem lapidabant', 'http://www.wikidata.org/entity/Q604748', 123756);
INSERT INTO "cantus"."sample"."Chant" VALUES (557534, 'Si diligis me Simon Petre', 'http://www.wikidata.org/entity/Q604748', 123716);
INSERT INTO "cantus"."sample"."Chant" VALUES (561787, 'Pater Abraham miserere mei et', 'http://www.wikidata.org/entity/Q582093', 123756);
INSERT INTO "cantus"."sample"."Chant" VALUES (670564, 'Sit nomen domini benedictum in', 'http://www.wikidata.org/entity/Q582093', 669163);
INSERT INTO "cantus"."sample"."Chant" VALUES (561208, 'Naturae genitor conserva morte redemptos', 'http://www.wikidata.org/entity/Q582093', 123756);
INSERT INTO "cantus"."sample"."Chant" VALUES (670715, 'Dives ille guttam aquae petiit', 'http://www.wikidata.org/entity/Q582093', 669163);
INSERT INTO "cantus"."sample"."Chant" VALUES (669638, 'Hic est beatissimus evangelista et', 'http://www.wikidata.org/entity/Q604748', 669163);
INSERT INTO "cantus"."sample"."Chant" VALUES (561604, 'Veni hodie ad fontem aquae', 'http://www.wikidata.org/entity/Q604748', 123756);
INSERT INTO "cantus"."sample"."Chant" VALUES (704158, 'Ponens Petrus genua sua oravit', 'http://www.wikidata.org/entity/Q582093', 702611);
Only when I master this can I load a relational database into Virtuoso.
This should precede #104.
In terms of using SQL to create a schema, it's typical to create a foreign key restraint relation between tables.
The text was updated successfully, but these errors were encountered: