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