Mercurial > hg > ltpda
comparison m-toolbox/html_help/help/ug/repo_retrieve.html @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
2 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> | |
3 | |
4 <html lang="en"> | |
5 <head> | |
6 <meta name="generator" content= | |
7 "HTML Tidy for Mac OS X (vers 1st December 2004), see www.w3.org"> | |
8 <meta http-equiv="Content-Type" content= | |
9 "text/html; charset=us-ascii"> | |
10 | |
11 <title>Retrieving LTPDA objects from a repository (LTPDA Toolbox)</title> | |
12 <link rel="stylesheet" href="docstyle.css" type="text/css"> | |
13 <meta name="generator" content="DocBook XSL Stylesheets V1.52.2"> | |
14 <meta name="description" content= | |
15 "Presents an overview of the features, system requirements, and starting the toolbox."> | |
16 </head> | |
17 | |
18 <body> | |
19 <a name="top_of_page" id="top_of_page"></a> | |
20 | |
21 <p style="font-size:1px;"> </p> | |
22 | |
23 <table class="nav" summary="Navigation aid" border="0" width= | |
24 "100%" cellpadding="0" cellspacing="0"> | |
25 <tr> | |
26 <td valign="baseline"><b>LTPDA Toolbox</b></td><td><a href="../helptoc.html">contents</a></td> | |
27 | |
28 <td valign="baseline" align="right"><a href= | |
29 "repo_explore.html"><img src="b_prev.gif" border="0" align= | |
30 "bottom" alt="Exploring an LTPDA Repository"></a> <a href= | |
31 "repo_gui.html"><img src="b_next.gif" border="0" align= | |
32 "bottom" alt="Using the LTPDA Repository GUI"></a></td> | |
33 </tr> | |
34 </table> | |
35 | |
36 <h1 class="title"><a name="f3-12899" id="f3-12899"></a>Retrieving LTPDA objects from a repository</h1> | |
37 <hr> | |
38 | |
39 <p> | |
40 <p> | |
41 Objects can be retrieved from the repository either by specifying an object ID or a collection ID. The LTPDA | |
42 Toolbox provides class construtors to retrieve objects. In additon, to retrieve a collection of objects, the <tt>collection</tt> class | |
43 can be used. | |
44 </p> | |
45 <br> | |
46 <h2>The retrieval process</h2> | |
47 <p> | |
48 When an object is retrieved, the following steps are taken: | |
49 <ol> | |
50 <li>The object type for the requested ID is retrieved from the <tt>objmeta</tt> table</li> | |
51 <li>A call is made to the appropriate class constructor</li> | |
52 <li>The class constructor retrieves the XML string from the objs table</li> | |
53 <li>The XML string is then converted into an XML Xdoc object</li> | |
54 <li>The Xdoc object is then parsed to recreate the desired object</li> | |
55 </ol> | |
56 </p> | |
57 | |
58 <br> | |
59 <h2>Retrieving objects</h2> | |
60 | |
61 <p> | |
62 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 | |
63 class of the object, you can use the <tt>collection</tt> class as a container, as follows: | |
64 <div class="fragment"><pre> | |
65 >> a = collection(plist('hostname', 'localhost', 'database', 'ltpda_test', 'id', 1)) | |
66 | |
67 ** Connection status: | |
68 LWB: Disconnected from localhost/ltpda_test as hewitson | |
69 ---- collection 1 ---- | |
70 name: none | |
71 num objs: 1 | |
72 01: ao | New Block/tsdataNdata=[10x1], fs=1, nsecs=10, t0=1970-01-01 00:00:00.000 | |
73 description: | |
74 UUID: 9ec7a613-9442-4451-9b40-af18f4afea00 | |
75 ---------------------- | |
76 </pre></div> | |
77 </p> | |
78 <p> | |
79 If you already know the class of the object (for example, <tt>ao</tt>), you can directly call the class constructor method: | |
80 <div class="fragment"><pre> | |
81 <span class="comment">% Define the hostname and database</span> | |
82 hostname = <span class="string">'localhost'</span>; | |
83 database = <span class="string">'ltpda_test'</span>; | |
84 | |
85 <span class="comment">% Retrieve the object</span> | |
86 q = ao(plist(<span class="string">'hostname'</span>, hostname, <span class="string">'database'</span>, dbname, <span class="string">'ID'</span>, 12)); | |
87 </pre></div> | |
88 </p> | |
89 | |
90 <br> | |
91 <p> | |
92 Multiple objects can be retrieved simultaneously by giving a list of object IDs. For example | |
93 <div class="fragment"><pre> | |
94 >> a = ao(plist('hostname', 'localhost', 'database', 'ltpda_test', 'id', [1 2 3])) | |
95 </pre></div> | |
96 </p> | |
97 <br> | |
98 <h2>Retrieving object collections</h2> | |
99 <p> | |
100 Collections of objects can be retrieved by specifying the collection ID. The following script retrieves a collection: | |
101 <div class="fragment"><pre> | |
102 >> a = collection(plist('hostname', 'localhost', 'database', 'ltpda_test', 'cid', 1)) | |
103 </pre></div> | |
104 The output is a <tt>collection</tt> object containing the objects retrieved. | |
105 </p> | |
106 | |
107 <h2>Retrieving binary objects</h2> | |
108 <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. | |
109 This can be achieved by using the parameter 'binary', that will build the object from the corresponding binary representation, if | |
110 stored in the database. | |
111 <div class="fragment"><pre> | |
112 <span class="comment">% Retrieve the collection</span> | |
113 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>)); | |
114 </pre></div> | |
115 If the binary representation is not in the database, the object will be built from the xml one. | |
116 </p> | |
117 | |
118 </p> | |
119 | |
120 <br> | |
121 <br> | |
122 <table class="nav" summary="Navigation aid" border="0" width= | |
123 "100%" cellpadding="0" cellspacing="0"> | |
124 <tr valign="top"> | |
125 <td align="left" width="20"><a href="repo_explore.html"><img src= | |
126 "b_prev.gif" border="0" align="bottom" alt= | |
127 "Exploring an LTPDA Repository"></a> </td> | |
128 | |
129 <td align="left">Exploring an LTPDA Repository</td> | |
130 | |
131 <td> </td> | |
132 | |
133 <td align="right">Using the LTPDA Repository GUI</td> | |
134 | |
135 <td align="right" width="20"><a href= | |
136 "repo_gui.html"><img src="b_next.gif" border="0" align= | |
137 "bottom" alt="Using the LTPDA Repository GUI"></a></td> | |
138 </tr> | |
139 </table><br> | |
140 | |
141 <p class="copy">©LTP Team</p> | |
142 </body> | |
143 </html> |