Revision 2516
Added by sgarg over 19 years ago
src/xmltables.sql | ||
---|---|---|
57 | 57 |
DROP TABLE xml_relation; |
58 | 58 |
DROP TABLE xml_documents; |
59 | 59 |
DROP TABLE xml_nodes; |
60 |
DROP TABLE xml_nodes_revision; |
|
60 | 61 |
DROP TABLE xml_replication; |
61 | 62 |
DROP TABLE xml_catalog; |
62 | 63 |
DROP TABLE accession_number; |
... | ... | |
129 | 130 |
END; |
130 | 131 |
/ |
131 | 132 |
|
133 |
|
|
132 | 134 |
/* |
133 | 135 |
* Indexes of rootnodeid, parentnodeid, and nodename in xml_nodes |
134 | 136 |
*/ |
... | ... | |
136 | 138 |
CREATE INDEX xml_nodes_idx2 ON xml_nodes (parentnodeid); |
137 | 139 |
CREATE INDEX xml_nodes_idx3 ON xml_nodes (nodename); |
138 | 140 |
|
141 |
|
|
139 | 142 |
/* |
143 |
* xml_nodes_revision -- table to store nodes from xml_nodes which are of old revisions and deleted document |
|
144 |
*/ |
|
145 |
|
|
146 |
CREATE TABLE xml_nodes_revision ( |
|
147 |
nodeid NUMBER(20), -- the unique node id (pk) |
|
148 |
nodeindex NUMBER(10), -- order of nodes within parent |
|
149 |
nodetype VARCHAR2(20), -- type (DOCUMENT, COMMENT, PI, |
|
150 |
-- ELEMENT, ATTRIBUTE, TEXT) |
|
151 |
nodename VARCHAR2(250), -- the name of an element or attribute |
|
152 |
nodeprefix VARCHAR2(50), -- the namespace prefix of an element |
|
153 |
-- or attribute |
|
154 |
nodedata VARCHAR2(4000), -- the data for this node (e.g., |
|
155 |
-- for TEXT it is the content) |
|
156 |
parentnodeid NUMBER(20), -- index of the parent of this node |
|
157 |
rootnodeid NUMBER(20), -- index of the root node of this tree |
|
158 |
docid VARCHAR2(250), -- index to the document id |
|
159 |
date_created DATE, |
|
160 |
date_updated DATE, |
|
161 |
nodedatanumerical NUMBER, -- the data for this node if |
|
162 |
-- it is a number |
|
163 |
CONSTRAINT xml_nodes_revision_pk PRIMARY KEY (nodeid), |
|
164 |
CONSTRAINT xml_nodes_revision_root_fk |
|
165 |
FOREIGN KEY (rootnodeid) REFERENCES xml_nodes_revision, |
|
166 |
CONSTRAINT xml_nodes_revision_parent_fk |
|
167 |
FOREIGN KEY (parentnodeid) REFERENCES xml_nodes_revision |
|
168 |
); |
|
169 |
|
|
170 |
|
|
171 |
/* |
|
172 |
* Indexes of rootnodeid, parentnodeid, and nodename in xml_nodes_revision |
|
173 |
*/ |
|
174 |
CREATE INDEX xml_nodes_revision_idx1 ON xml_nodes_revision (rootnodeid); |
|
175 |
CREATE INDEX xml_nodes_revision_idx2 ON xml_nodes_revision (parentnodeid); |
|
176 |
CREATE INDEX xml_nodes_revisions_idx3 ON xml_nodes_revision (nodename); |
|
177 |
|
|
178 |
/* |
|
140 | 179 |
* XML Catalog -- table to store all external sources for XML documents |
141 | 180 |
*/ |
142 | 181 |
CREATE TABLE xml_catalog ( |
... | ... | |
216 | 255 |
CONSTRAINT xml_revisions_rep_fk |
217 | 256 |
FOREIGN KEY (server_location) REFERENCES xml_replication, |
218 | 257 |
CONSTRAINT xml_revisions_root_fk |
219 |
FOREIGN KEY (rootnodeid) REFERENCES xml_nodes, |
|
258 |
FOREIGN KEY (rootnodeid) REFERENCES xml_nodes_revisions,
|
|
220 | 259 |
CONSTRAINT xml_revisions_catalog_fk |
221 | 260 |
FOREIGN KEY (catalog_id) REFERENCES xml_catalog |
222 | 261 |
); |
... | ... | |
275 | 314 |
*/ |
276 | 315 |
CREATE INDEX xml_index_idx1 ON xml_index (path); |
277 | 316 |
|
317 |
|
|
318 |
/* |
|
319 |
* Index of Paths -- table to store nodes with paths specified by userst in metacat.properties |
|
320 |
*/ |
|
321 |
CREATE TABLE xml_path_index ( |
|
322 |
nodeid NUMBER(20), -- the unique node id |
|
323 |
docid VARCHAR2(250), -- index to the document id |
|
324 |
path VARCHAR2(1000), -- precomputed path through tree |
|
325 |
nodedata VARCHAR2(4000), -- the data for this node (e.g., |
|
326 |
-- for TEXT it is the content) |
|
327 |
nodedatanumerical NUMBER, -- the data for this node if |
|
328 |
-- it is a number |
|
329 |
parentnodeid NUMBER(20), -- index of the parent of this node |
|
330 |
|
|
331 |
CONSTRAINT xml_path_index_pk PRIMARY KEY (nodeid), |
|
332 |
CONSTRAINT xml_path_index_docid_fk |
|
333 |
FOREIGN KEY (docid) REFERENCES xml_documents |
|
334 |
); |
|
335 |
|
|
336 |
CREATE SEQUENCE xml_path_index_id_seq; |
|
337 |
|
|
338 |
CREATE TRIGGER xml_path_index_before_insert |
|
339 |
BEFORE INSERT ON xml_path_indexn FOR EACH ROW |
|
340 |
BEGIN |
|
341 |
SELECT xml_path_index_id_seq.nextval |
|
342 |
INTO :new.relationid |
|
343 |
FROM dual; |
|
344 |
END; |
|
345 |
/ |
|
346 |
|
|
347 |
|
|
348 |
/* |
|
349 |
* Index of the path, nodedata, nodedatanumerical in xml_path_index |
|
350 |
*/ |
|
351 |
CREATE INDEX xml_path_index_idx1 ON xml_path_index (path); |
|
352 |
CREATE INDEX xml_path_index_idx2 ON xml_path_index (nodedata); |
|
353 |
CREATE INDEX xml_path_index_idx3 ON xml_path_index (nodedatanumerical); |
|
354 |
|
|
355 |
|
|
278 | 356 |
CREATE TABLE xml_relation ( |
279 | 357 |
relationid NUMBER(20) PRIMARY KEY, -- unique id |
280 | 358 |
docid VARCHAR2(250), -- the docid of the package file |
... | ... | |
385 | 463 |
END; |
386 | 464 |
/ |
387 | 465 |
|
466 |
|
|
467 |
|
|
468 |
|
|
388 | 469 |
/* |
389 | 470 |
* Logging -- table to store metadata and data access log |
390 | 471 |
*/ |
Also available in: Unified diff
Modified xmltables script so that:
1. Foreign key for rootnodeid in xml_revision points to xml_node_revision table instead of xml_nodes
2. Added a new table xml_path_index which is used to index the paths specified by user in metacat.properties
3. Addes a new table xml_nodes_revision which stores the nodes of old revisions and deleted documents