diff --git a/src/scripts/collect-chebi-labels.sql b/src/scripts/collect-chebi-labels.sql new file mode 100644 index 0000000..6480a43 --- /dev/null +++ b/src/scripts/collect-chebi-labels.sql @@ -0,0 +1,20 @@ +-- Collect labels from ChEBI terms that are not deprecated. +DROP TABLE IF EXISTS label; +CREATE TABLE label ( + curie TEXT PRIMARY KEY, + label TEXT UNIQUE +); + +INSERT OR IGNORE INTO label +SELECT + subject AS curie, + object AS label +FROM chebi +WHERE predicate = 'rdfs:label' + AND subject NOT IN ( + SELECT subject + FROM chebi + WHERE predicate = 'owl:deprecated' + ); +CREATE INDEX idx_label_label ON label(label); +ANALYZE label;