diff m-toolbox/html_help/help/ug/repo_retrieve_content.html @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/html_help/help/ug/repo_retrieve_content.html	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,77 @@
+<p>
+  Objects can be retrieved from the repository either by specifying an object ID or a collection ID. The LTPDA 
+  Toolbox provides class construtors to retrieve objects. In additon, to retrieve a collection of objects, the <tt>collection</tt> class
+  can be used.
+</p>
+<br>
+<h2>The retrieval process</h2>
+<p>
+  When an object is retrieved, the following steps are taken:
+  <ol>
+    <li>The object type for the requested ID is retrieved from the <tt>objmeta</tt> table</li>
+    <li>A call is made to the appropriate class constructor</li>
+    <li>The class constructor retrieves the XML string from the objs table</li>
+    <li>The XML string is then converted into an XML Xdoc object</li>
+    <li>The Xdoc object is then parsed to recreate the desired object</li>
+  </ol>
+</p>
+
+<br>
+<h2>Retrieving objects</h2>
+
+<p>
+  To retrieve an object, you must know its object ID, or the ID of the collection that contains that object. If you don't know the 
+  class of the object, you can use the <tt>collection</tt> class as a container, as follows:
+  <div class="fragment"><pre>
+      >> a = collection(plist('hostname', 'localhost', 'database', 'ltpda_test', 'id', 1))
+      
+      ** Connection status:
+      LWB: Disconnected from localhost/ltpda_test as hewitson
+      ---- collection 1 ----
+      name: none
+      num objs: 1
+      01: ao | New Block/tsdataNdata=[10x1], fs=1, nsecs=10, t0=1970-01-01 00:00:00.000
+      description: 
+      UUID: 9ec7a613-9442-4451-9b40-af18f4afea00
+      ----------------------
+  </pre></div>
+</p>
+<p>
+  If you already know the class of the object (for example, <tt>ao</tt>), you can directly call the class constructor method:
+  <div class="fragment"><pre>
+      <span class="comment">% Define the hostname and database</span>
+      hostname = <span class="string">'localhost'</span>;
+      database = <span class="string">'ltpda_test'</span>;
+      
+      <span class="comment">% Retrieve the object</span>
+      q = ao(plist(<span class="string">'hostname'</span>, hostname, <span class="string">'database'</span>, dbname, <span class="string">'ID'</span>, 12));	
+  </pre></div>
+</p>
+
+<br>
+<p>
+  Multiple objects can be retrieved simultaneously by giving a list of object IDs. For example
+  <div class="fragment"><pre>
+      >> a = ao(plist('hostname', 'localhost', 'database', 'ltpda_test', 'id', [1 2 3]))
+  </pre></div>
+</p>
+<br>
+<h2>Retrieving object collections</h2>
+<p>
+  Collections of objects can be retrieved by specifying the collection ID. The following script retrieves a collection:
+  <div class="fragment"><pre>
+      >> a = collection(plist('hostname', 'localhost', 'database', 'ltpda_test', 'cid', 1))      
+  </pre></div>
+  The output is a <tt>collection</tt> object containing the objects retrieved.
+</p>
+
+<h2>Retrieving binary objects</h2>
+<p>The retrieval process may be speeded up by taking advantage of the fact that the objects are stored in the databases also in binary form. 
+This can be achieved by using the parameter 'binary', that will build the object from the corresponding binary representation, if 
+stored in the database.
+  <div class="fragment"><pre>
+      <span class="comment">% Retrieve the collection</span>
+      q = ao(plist(<span class="string">'hostname'</span>, hostname, <span class="string">'database'</span>, dbname, <span class="string">'ID'</span>, 12, <span class="string">'binary'</span>, <span class="string">'yes'</span>));      
+  </pre></div>
+  If the binary representation is not in the database, the object will be built from the xml one.
+</p>