1 |
878
|
berkley
|
<!--
|
2 |
|
|
* metacatload.html
|
3 |
|
|
*
|
4 |
|
|
* Authors: Jivka Bojilova
|
5 |
|
|
* Copyright: 2000 Regents of the University of California and the
|
6 |
|
|
* National Center for Ecological Analysis and Synthesis
|
7 |
|
|
* For Details: http://www.nceas.ucsb.edu/
|
8 |
|
|
* Created: 2000 April 5
|
9 |
|
|
* Version: 0.01
|
10 |
|
|
* File Info: '$Id$'
|
11 |
|
|
*
|
12 |
|
|
* October Meeting SDSC, 2000
|
13 |
|
|
-->
|
14 |
|
|
<HTML>
|
15 |
|
|
<HEAD>
|
16 |
|
|
<TITLE>Metacat</TITLE>
|
17 |
3780
|
daigle
|
<link rel="stylesheet" type="text/css" href="./default.css">
|
18 |
878
|
berkley
|
</HEAD>
|
19 |
|
|
<BODY>
|
20 |
|
|
<table width="100%">
|
21 |
|
|
<tr>
|
22 |
|
|
<td class="tablehead" colspan="2"><p class="label">Document Loading</p></td>
|
23 |
|
|
<td class="tablehead" colspan="2" align="right">
|
24 |
2310
|
jones
|
<a href="./clientapi.html">Back</a> | <a href="./metacattour.html">Home</a> |
|
25 |
878
|
berkley
|
<a href="./metacatquery.html">Next</a>
|
26 |
|
|
</td>
|
27 |
|
|
</tr>
|
28 |
|
|
</table>
|
29 |
881
|
berkley
|
<P>Metacat provides functionality for inserting, updating, and deleting
|
30 |
878
|
berkley
|
XML documents in the database. Inserted or updated documents are read, checked
|
31 |
|
|
for validity, decomposed into nodes and inserted into the db. Document validity
|
32 |
|
|
is checked if a valid DTD is provided.
|
33 |
|
|
<P> <img alt="architecture diagram of write action" src="metadatawrite.gif">
|
34 |
|
|
<P> <b>Operations</b>
|
35 |
|
|
<ul>
|
36 |
|
|
<li>INSERT - A new XML document is inserted into the DB with given unique
|
37 |
|
|
docid. The client must specify the docid.</li>
|
38 |
|
|
<li>UPDATE - A document is provided to update a document that already
|
39 |
|
|
has a valid docid. The original document is archived, then overwritten.</li>
|
40 |
|
|
<li>DELETE - Document is archived, and pointer in xml_documents is moved
|
41 |
|
|
to xml_revisions, efectively deleting the document from public view but
|
42 |
|
|
preserving the revision for the revision history.</li>
|
43 |
|
|
</ul>
|
44 |
|
|
|
45 |
|
|
<p>Insertions, updates and deletes are passed to Metacat as servlet parameters.
|
46 |
|
|
The following is an example of a web form that can perform these tasks.</p>
|
47 |
|
|
|
48 |
|
|
<pre>
|
49 |
|
|
<html>
|
50 |
|
|
<head>
|
51 |
|
|
<title>MetaCat</title>
|
52 |
|
|
<link rel="stylesheet" type="text/css" href="metacat/style/rowcol.css">
|
53 |
|
|
</head>
|
54 |
|
|
<body class="emlbody">
|
55 |
|
|
<b>MetaCat XML Loader</b>
|
56 |
|
|
<p>
|
57 |
|
|
Upload, Change, or Delete an XML document using this form.
|
58 |
|
|
</p>
|
59 |
|
|
<form action="http://dev.nceas.ucsb.edu/metacat/servlet/metacat" method="POST">
|
60 |
|
|
<strong>1. Choose an action: </strong>
|
61 |
|
|
<input type="radio" name="action" value="insert" checked> Insert
|
62 |
|
|
<input type="radio" name="action" value="update"> Update
|
63 |
|
|
<input type="radio" name="action" value="delete"> Delete
|
64 |
|
|
<input type="submit" value="Process Action">
|
65 |
|
|
<br />
|
66 |
|
|
<strong>2. Provide a Document ID </strong>
|
67 |
|
|
<input type="text" name="docid"> (optional for Insert)
|
68 |
|
|
<input type="checkbox" name="public" value="yes" checked><strong>Public Document</strong>
|
69 |
|
|
<br />
|
70 |
|
|
<strong>3. Provide XML text </strong> (not needed for Delete)
|
71 |
|
|
<textarea name="doctext" cols="65" rows="15"></textarea>
|
72 |
|
|
<strong>4. Provide DTD text for upload </strong> (optional; not needed for Delete)
|
73 |
|
|
<textarea name="dtdtext" cols="65" rows="15"></textarea>
|
74 |
|
|
</form>
|
75 |
|
|
</body>
|
76 |
|
|
</html>
|
77 |
|
|
</pre>
|
78 |
|
|
|
79 |
|
|
<p>Once inserted into the database, the document looks like the following:</p>
|
80 |
|
|
|
81 |
|
|
<PRE><b>SQL> select * from xml_nodes where docid='NCEAS:1'</b> <br>
|
82 |
|
|
NODEID NODEINDEX NODETYPE NODENAME NODEDATA PARENTNODEID ROOTNODEID DOCID
|
83 |
|
|
------ --------- ---------- --------------- ---------------------- ------------ ---------- -------
|
84 |
|
|
1 DOCUMENT eml-dataset 1 NCEAS:1
|
85 |
|
|
2 1 ELEMENT eml-dataset 1 1 NCEAS:1
|
86 |
|
|
3 1 TEXT 2 1 NCEAS:1
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
4 2 ELEMENT meta_file_id 2 1 NCEAS:1
|
90 |
|
|
5 1 TEXT NCEAS:1 4 1 NCEAS:1
|
91 |
|
|
6 3 TEXT 2 1 NCEAS:1
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
7 4 ELEMENT dataset_id 2 1 NCEAS:1
|
95 |
|
|
8 1 TEXT Dist.ssd01 7 1 NCEAS:1
|
96 |
|
|
9 5 TEXT 2 1 NCEAS:1
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
10 6 ELEMENT title 2 1 NCEAS:1
|
100 |
|
|
11 1 TEXT Insights on community 10 1 NCEAS:1
|
101 |
|
|
dynamics
|
102 |
|
|
|
103 |
|
|
12 7 TEXT 2 1 NCEAS:1
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
13 8 ELEMENT originator 2 1 NCEAS:1
|
107 |
|
|
14 1 ATTRIBUTE description Names and addresses of 13 1 NCEAS:1
|
108 |
|
|
principal investigator
|
109 |
|
|
</PRE>
|
110 |
|
|
|
111 |
|
|
<p>If you follow the parentnodeid pointers you can recontruct this document.
|
112 |
|
|
The <a href="./metacatdb.html">Metacat Database</a> section provides more details
|
113 |
|
|
on the storage of XML documents.</p>
|
114 |
|
|
|
115 |
|
|
<br>
|
116 |
2310
|
jones
|
<a href="./clientapi.html">Back</a> | <a href="./metacattour.html">Home</a> |
|
117 |
878
|
berkley
|
<a href="./metacatquery.html">Next</a>
|
118 |
|
|
|
119 |
|
|
</BODY>
|
120 |
|
|
</HTML>
|