Project

General

Profile

« Previous | Next » 

Revision 114

moved sql files to src directory

View differences:

sqlcatlist.sql
1
set pagesize 100
2
column entity_name format a10
3
column entity_type format a5
4
column source_doctype format a15
5
column target_doctype format a15
6
column public_id format a20
7
column system_id format a20
8
select entity_type,source_doctype,target_doctype,public_id,system_id
9
from xml_catalog;
10 0

  
loadstylesheets.sql
1
INSERT INTO xml_catalog (entity_type, source_doctype, target_doctype,
2
     public_id, system_id)
3
     VALUES ('XSL', '-//NCEAS//eml-dataset//EN', '-//W3C//HTML//EN',
4
     '-//NCEAS//eml-dataset-display.xsl',
5
     'file:///home/httpd/html/xmltodb/xsqltest/eml-dataset-display.xsl');
6
INSERT INTO xml_catalog (entity_type, source_doctype, target_doctype,
7
     public_id, system_id)
8
     VALUES ('XSL', '-//NCEAS//eml-variable//EN', '-//W3C//HTML//EN',
9
     '-//NCEAS//eml-variable-display.xsl',
10
     'file:///home/httpd/html/xmltodb/xsqltest/eml-variable-display.xsl');
11
INSERT INTO xml_catalog (entity_type, source_doctype, target_doctype,
12
     public_id, system_id)
13
     VALUES ('XSL', '-//NCEAS//eml-file//EN', '-//W3C//HTML//EN',
14
     '-//NCEAS//eml-file-display.xsl',
15
     'file:///home/httpd/html/xmltodb/xsqltest/eml-file-display.xsl');
16 0

  
sqldoclist.sql
1
set pagesize 100
2
column docid format 999
3
column docname format a15
4
column doctype format a25
5
column doctitle format a20
6
select docid,docname,doctype,rootnodeid,doctitle from xml_documents;
7 0

  
sqlnodeslist.sql
1
column nodedata format a60
2
select nodeid,nodedata from xml_nodes where nodedata like '&qstr';
3 0

  
xmltables.sql
1
/*
2
 * xmltables.sql -- Create or replace tables for storing XML in the db
3
 *
4
 *      Purpose: creates tables needed for XML database
5
 * 
6
 *      Created: 12 September 1999
7
 *       Author: Matt Jones
8
 * Organization: National Center for Ecological Analysis and Synthesis
9
 *      Version: '$Id$'
10
 *
11
 */
12

  
13
/*
14
 * Drop all of the objects in proper order
15
 */
16
set echo off
17

  
18
DROP SEQUENCE xml_nodes_id_seq;
19
DROP SEQUENCE xml_entity_id_seq;
20
DROP SEQUENCE xml_documents_id_seq;
21

  
22
DROP TRIGGER xml_nodes_before_insert;
23
DROP TRIGGER xml_documents_before_insert;
24
DROP TRIGGER xml_catalog_before_insert;
25

  
26
DROP TABLE xml_catalog;
27
DROP TABLE xml_documents;
28
DROP TABLE xml_nodes;
29

  
30
/* 
31
 * Nodes -- table to store XML Nodes (both elements and attributes)
32
 */
33
CREATE TABLE xml_nodes (
34
	nodeid		NUMBER(20),
35
	parentnodeid	NUMBER(20),
36
	nodeindex	NUMBER(10),
37
	nodetype	VARCHAR2(20),
38
	nodename	VARCHAR2(100),
39
	nodedata	VARCHAR2(4000),
40
	date_created	DATE,
41
	date_updated	DATE,
42
   CONSTRAINT xml_nodes_pk PRIMARY KEY (nodeid),
43
   CONSTRAINT xml_nodes_parent_fk 
44
		FOREIGN KEY (parentnodeid) REFERENCES xml_nodes
45
);
46

  
47
CREATE SEQUENCE xml_nodes_id_seq;
48

  
49
CREATE TRIGGER xml_nodes_before_insert
50
BEFORE INSERT ON xml_nodes FOR EACH ROW
51
BEGIN
52
  SELECT xml_nodes_id_seq.nextval
53
    INTO :new.nodeid
54
    FROM dual;
55
END;
56
/
57

  
58
/* 
59
 * Documents -- table to store XML documents
60
 */
61
CREATE TABLE xml_documents (
62
	docid		NUMBER(20),
63
	rootnodeid	NUMBER(20),
64
	docname		VARCHAR2(100),
65
	doctype		VARCHAR2(100),
66
	doctitle	VARCHAR2(1000),
67
	date_created	DATE,
68
	date_updated	DATE,
69
   CONSTRAINT xml_documents_pk PRIMARY KEY (docid),
70
   CONSTRAINT xml_documents_root_fk 
71
		FOREIGN KEY (rootnodeid) REFERENCES xml_nodes
72
);
73

  
74
CREATE SEQUENCE xml_documents_id_seq;
75

  
76
CREATE TRIGGER xml_documents_before_insert
77
BEFORE INSERT ON xml_documents FOR EACH ROW
78
BEGIN
79
  SELECT xml_documents_id_seq.nextval
80
    INTO :new.docid
81
    FROM dual;
82
END;
83
/
84

  
85
/* 
86
 * XML Catalog -- table to store all external sources for XML documents
87
 */
88
CREATE TABLE xml_catalog (
89
	entity_id	NUMBER(20),
90
	entity_name	VARCHAR2(100),
91
	entity_type	VARCHAR2(20),
92
	source_doctype	VARCHAR2(100),
93
	target_doctype	VARCHAR2(100),
94
	public_id	VARCHAR2(100),
95
	system_id	VARCHAR2(1000),
96
	date_created	DATE,
97
	date_updated	DATE,
98
   CONSTRAINT xml_catalog_pk PRIMARY KEY (entity_id),
99
   CONSTRAINT xml_catalog_uk UNIQUE (entity_type, source_doctype, target_doctype, public_id)
100
);
101

  
102
CREATE SEQUENCE xml_entity_id_seq;
103

  
104
CREATE TRIGGER xml_catalog_before_insert
105
BEFORE INSERT ON xml_catalog FOR EACH ROW
106
BEGIN
107
  SELECT xml_entity_id_seq.nextval
108
    INTO :new.entity_id
109
    FROM dual;
110
END;
111
/
112 0

  

Also available in: Unified diff