Document Loading

Back | Home | Next

Metacat provides functionality for inserting, updating, and deleting XML documents in the database. Inserted or updated documents are read, checked for validity, decomposed into nodes and inserted into the db. Document validity is checked if a valid DTD is provided.

architecture diagram  of write action

Operations

Insertions, updates and deletes are passed to Metacat as servlet parameters. The following is an example of a web form that can perform these tasks.

    <html>
    <head>
    <title>MetaCat</title>
    <link rel="stylesheet" type="text/css" href="metacat/style/rowcol.css">
    </head>
    <body class="emlbody">
    <b>MetaCat XML Loader</b>
    <p>
    Upload, Change, or Delete an XML document using this form.
    </p>
    <form action="http://dev.nceas.ucsb.edu/metacat/servlet/metacat" method="POST">
      <strong>1. Choose an action: </strong>
      <input type="radio" name="action" value="insert" checked> Insert
      <input type="radio" name="action" value="update"> Update
      <input type="radio" name="action" value="delete"> Delete
      <input type="submit" value="Process Action">
      <br />
      <strong>2. Provide a Document ID </strong>
      <input type="text" name="docid"> (optional for Insert)
         <input type="checkbox" name="public" value="yes" checked><strong>Public Document</strong>
      <br />
      <strong>3. Provide XML text </strong> (not needed for Delete)
      <textarea name="doctext" cols="65" rows="15"></textarea>
      <strong>4. Provide DTD text for upload </strong> (optional; not needed for Delete)
      <textarea name="dtdtext" cols="65" rows="15"></textarea>
    </form>
    </body>
    </html>
  

Once inserted into the database, the document looks like the following:

SQL> select * from xml_nodes where docid='NCEAS:1' 
NODEID NODEINDEX NODETYPE NODENAME NODEDATA PARENTNODEID ROOTNODEID DOCID ------ --------- ---------- --------------- ---------------------- ------------ ---------- ------- 1 DOCUMENT eml-dataset 1 NCEAS:1 2 1 ELEMENT eml-dataset 1 1 NCEAS:1 3 1 TEXT 2 1 NCEAS:1 4 2 ELEMENT meta_file_id 2 1 NCEAS:1 5 1 TEXT NCEAS:1 4 1 NCEAS:1 6 3 TEXT 2 1 NCEAS:1 7 4 ELEMENT dataset_id 2 1 NCEAS:1 8 1 TEXT Dist.ssd01 7 1 NCEAS:1 9 5 TEXT 2 1 NCEAS:1 10 6 ELEMENT title 2 1 NCEAS:1 11 1 TEXT Insights on community 10 1 NCEAS:1 dynamics 12 7 TEXT 2 1 NCEAS:1 13 8 ELEMENT originator 2 1 NCEAS:1 14 1 ATTRIBUTE description Names and addresses of 13 1 NCEAS:1 principal investigator

If you follow the parentnodeid pointers you can recontruct this document. The Metacat Database section provides more details on the storage of XML documents.


Back | Home | Next