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
PostgresSQL is not only relevant for performance analysis (#26) but also allows to extend the database e.g. with information about libraries.
-- technically PPN is an integer with checksum so more can be improvedCREATEDOMAINppnASTEXTCHECK (VALUE ~*'^[0-9]+[0-9X]$');
CREATETABLEIF NOT EXISTS Vocabulary (
key textNOT NULL,
jskos json NOT NULL DEFAULT '{}'::json,
PRIMARY KEY (key),
CONSTRAINT valid_key CHECK (key ~*'^[a-z]+$')
);
CREATETABLEIF NOT EXISTS Title (
ppn ppn NOT NULL,
PRIMARY KEY (ppn)
);
-- By now this is the only table needed for occurrences-apiCREATETABLEIF NOT EXISTS Subject (
ppn ppn NOT NULL,
voc textNOT NULL,
notation textNOT NULL,
FOREIGN KEY (voc) REFERENCES Vocabulary (key),
FOREIGN KEY (ppn) REFERENCES Title (ppn)
);
CREATETABLEIF NOT EXISTS Library (
iln smallintNOT NULL,
PRIMARY KEY (iln)
);
CREATETABLEIF NOT EXISTS Item (
epn intNOT NULL,
ppn textNOT NULL,
iln smallintNOT NULL,
PRIMARY KEY (epn),
FOREIGN KEY (ppn) REFERENCES Title (ppn),
FOREIGN KEY (iln) REFERENCES Library (iln)
);
-- allows to insert new ppn but keep foreign key on title.ppnCREATE OR REPLACEFUNCTIONcreate_title_if_missing() RETURNS TRIGGER AS'begin if not exists(select ppn from Title where ppn=new.ppn) then insert into Title values (new.ppn); end if; return new;end; ' language plpgsql;
DROPTRIGGER IF EXISTS subject_unknonw_ppn ON SUBJECT;
createtriggersubject_unknonw_ppn
before insert orupdateon Subject
for each row execute procedure create_title_if_missing();
Adding information about libraries would allow to limit query to titles held by a specific library.
The text was updated successfully, but these errors were encountered:
Concept hierarchy and mapping inference could be added as well to support queries for broad topic areas (e.g. everything in physics) by using PosgreSQL feature WITH RECURSIVE and MATERIALIZED VIEW or possibly later with Apache AGE.
PostgresSQL is not only relevant for performance analysis (#26) but also allows to extend the database e.g. with information about libraries.
Adding information about libraries would allow to limit query to titles held by a specific library.
The text was updated successfully, but these errors were encountered: