view m-toolbox/html_help/help/ug/repo_submit_content.html @ 39:11e3ed9d2115 database-connection-manager

Implement databases listing in database connection dialog
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

<p>
  Any of the <it>user</it> objects can be submitted to an LTPDA repository
</p>

<p>
  There are three different methods which submit/update object(s) to the repository:
  <ul>
    <li><h3>submit</h3>
      Submits the given collection of objects to an LTPDA Repository. If multiple objects 
      are submitted together, a corresponding collection entry will be made. The objects 
      are stored as a XML representation <b>and</b> if possible a binary representation 
    (see bsubmit).</li>
    <li><h3>bsubmit</h3>
      Submits the given collection of objects to an LTPDA Repository. If multiple objects 
      are submitted together, a corresponding collection entry will be made. The objects 
      are stored <b>only</b> as a binary representation.<br />
      In order to retrieve this object by calling a constructor it is necessary to 
      set the key <tt>'BINARY'</tt> to 'yes' because the XML representation doesn't exist. 
      For example the AO constructor 
      <a href="matlab:web(ao.getInfo('ao', 'from repository').tohtml, '-helpbrowser')">'From Repository'</a>
    </li>    
    <li><h3>update</h3>
      Updates the specified object with a new object.
    </li>    
  </ul>
</p>

<h2>The submission process</h2>

<p>
  When an object is submitted, the following steps are taken:<br />
  <ol>
    <li>The <tt>userid</tt> of the user connecting is retrieved from the <it>Users</it> table of the repository</li>
    <li>For each object to be submitted:
      <ol>
        <li>The object to be submitted is checked to be one of the types listed above</li>
        <li>The <tt>name</tt>, <tt>created</tt>, and <tt>version</tt> fields are read from the object</li>
        <li>The object is converted to an XML text string</li>
        <li>An MD5 hash sum is computed for the XML string</li>
        <li>The XML string and the hash code are inserted in to the <tt>objs</tt> table</li>
        <li>The automatically assigned ID of the object is retrieved from the <tt>objs</tt> table</li>
        <li>An attempt is made to create a binary representation of the object (.MAT). If this is possible, the binary data is inserted in the <tt>bobjs</tt> table.</li>
        <li>Various pieces of meta-data (object name, object type, created time, client IP address, <i>etc.</i>) are submitted to the <tt>objmeta</tt> table</li>
        <li>Additional meta-data is entered into the table matching the object class (<tt>ao</tt>, <tt>tsdata</tt>, <i>etc.</i>)</li>
        <li>An 'in' entry is made in the <tt>transaction</tt> table recording the user ID and the object ID</li>
      </ol>
    </li>
    <li>A entry is then made in the <tt>collections</tt> table, even if this is a single object submission</li>
    <li>The object IDs and the collection ID are returned to the user</li>
  </ol>
</p>

<br />
<h2>Submitting objects</h2>

<p>
  Objects can be submitted using the command <tt>submit</tt>. This command takes at least two inputs:
  <table border="1" cellpadding="2" width="30%" bgcolor="#DDDDDD">
    <tr valign="top">
      <td><tt>object</tt></td><td>The object(s) to submit</td>
    </tr>
    <tr valign="top">
      <td><tt>pl</tt></td><td>A plist containing various pieces of information (see below)</td>
    </tr>
  </table>
</p>
<p>
  The <tt>plist</tt> details can be found at: <a href="matlab:web(ltpda_uo.getInfo('submit').tohtml, '-helpbrowser')">Parameter Sets</a>
</p>
<p>
  The following example script connects to a repository and submits an AO:
  <div class="fragment"><pre>
      
      <span class="comment">% Connect to a repository</span>
      conn = utils.jmysql.connect(<span class="string">'localhost'</span>, <span class="string">'ltpda_test'</span>);
      
      <span class="comment">% Load the AO</span>
      a = ao(<span class="string">'result.xml'</span>);
      
      <span class="comment">% Build an information plist</span>
      pl = plist;
      pl.append(<span class="string">'conn'</span>, conn);
      pl.append(<span class="string">'experiment title'</span>, <span class="string">'Interferometer noise'</span>);
      pl.append(<span class="string">'experiment description'</span>, <span class="string">'Spectral estimation of interferometer output signal'</span>);
      pl.append(<span class="string">'analysis description'</span>, <span class="string">'Spectrum of the recorded signal'</span>);
      pl.append(<span class="string">'quantity'</span>, <span class="string">'photodiode output'</span>);
      pl.append(<span class="string">'keywords'</span>, <span class="string">'interferometer, noise, spectrum'</span>);
      pl.append(<span class="string">'reference ids'</span>, <span class="string">''</span>);
      pl.append(<span class="string">'additional comments'</span>, <span class="string">'none'</span>);
      pl.append(<span class="string">'additional authors'</span>, <span class="string">'no one'</span>);
      
      <span class="comment">% Submit the AO</span>
      [ids, cid] = submit(a, pl);
      
      <span class="comment">% Close the connection</span>
      conn.closeConnection
  </pre></div>
  The ID assigned to the submitted object is contained in the first output of the <tt>submit</tt> function:
  <div class="fragment"><pre>
      <span class="comment">% Inspect the object ID</span>
      disp(ids)
      212
  </pre></div>
  If the <tt>plist</tt> contains sufficient information, it is possible to overide the appearance of the
  'submission' dialog by giving the key/value pair: 'no dialog', <tt>true</tt>.
</p>

<h2>Submitting collections</h2>
<p>
  Collections of LTPDA objects can also be submitted. Here a collection is defined as a group of objects
  submitted at the same time. In this way, a single information structure describing the collection is
  assigned to all the objects. The collection is just a virtual object; it is defined by a list of object IDs in the database.
</p>