Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I need to master how to create a schema and insert data for a relational database using SQL on Open Link Virtuoso. #217

Closed
candlecao opened this issue Nov 8, 2024 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation Priority: high high priority

Comments

@candlecao
Copy link
Contributor

candlecao commented Nov 8, 2024

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.

@candlecao candlecao added the Priority: high high priority label Nov 8, 2024
@candlecao candlecao self-assigned this Nov 8, 2024
@candlecao 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
@candlecao
Copy link
Contributor Author

E.g.:

-- 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);

@candlecao candlecao added the documentation Improvements or additions to documentation label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation Priority: high high priority
Projects
None yet
Development

No branches or pull requests

1 participant