Project

General

Profile

metacat / docs / user / metacatload.html @ 3067

1
<!--
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: metacatload.html 2310 2004-09-21 09:01:22Z jones $'
11
  * 
12
  * October Meeting SDSC, 2000
13
-->
14
<HTML>
15
<HEAD>
16
<TITLE>Metacat</TITLE>
17
<link rel="stylesheet" type="text/css" href="@docrooturl@default.css">
18
</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
        <a href="./clientapi.html">Back</a> | <a href="./metacattour.html">Home</a> | 
25
        <a href="./metacatquery.html">Next</a>
26
      </td>
27
    </tr>
28
  </table>
29
  <P>Metacat provides functionality for inserting, updating, and deleting
30
  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
    &lt;html&gt;
50
    &lt;head&gt;
51
    &lt;title&gt;MetaCat&lt;/title&gt;
52
    &lt;link rel="stylesheet" type="text/css" href="metacat/style/rowcol.css"&gt;
53
    &lt;/head&gt;
54
    &lt;body class="emlbody"&gt;
55
    &lt;b&gt;MetaCat XML Loader&lt;/b&gt;
56
    &lt;p&gt;
57
    Upload, Change, or Delete an XML document using this form.
58
    &lt;/p&gt;
59
    &lt;form action="http://dev.nceas.ucsb.edu/metacat/servlet/metacat" method="POST"&gt;
60
      &lt;strong&gt;1. Choose an action: &lt;/strong&gt;
61
      &lt;input type="radio" name="action" value="insert" checked&gt; Insert
62
      &lt;input type="radio" name="action" value="update"&gt; Update
63
      &lt;input type="radio" name="action" value="delete"&gt; Delete
64
      &lt;input type="submit" value="Process Action"&gt;
65
      &lt;br /&gt;
66
      &lt;strong&gt;2. Provide a Document ID &lt;/strong&gt;
67
      &lt;input type="text" name="docid"&gt; (optional for Insert)
68
      &nbsp;&nbsp;&nbsp;&lt;input type="checkbox" name="public" value="yes" checked&gt;&lt;strong&gt;Public Document&lt;/strong&gt;
69
      &lt;br /&gt;
70
      &lt;strong&gt;3. Provide XML text &lt;/strong&gt; (not needed for Delete)
71
      &lt;textarea name="doctext" cols="65" rows="15"&gt;&lt;/textarea&gt;
72
      &lt;strong&gt;4. Provide DTD text for upload &lt;/strong&gt; (optional; not needed for Delete)
73
      &lt;textarea name="dtdtext" cols="65" rows="15"&gt;&lt;/textarea&gt;
74
    &lt;/form&gt;
75
    &lt;/body&gt;
76
    &lt;/html&gt;
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
  <a href="./clientapi.html">Back</a> | <a href="./metacattour.html">Home</a> | 
117
  <a href="./metacatquery.html">Next</a>
118
  
119
</BODY>
120
</HTML>
121