Project

General

Profile

1 6147 jones
Accessing and Submitting Metadata and Data
2
==========================================
3
4 6843 jones
.. contents::
5 6147 jones
6 6843 jones
The Metacat repository can be accessed and updated using a number of tools,
7
including:
8 6147 jones
9 6843 jones
* the Registry, Metacat's optional Web interface
10
* user-created HTML forms
11
* Metacat's EarthGrid API
12
* existing clients, such as KNB's Morpho application, designed to help
13
  scientists create, edit, and manage metadata
14
* user-created desktop clients that take advantage of Metacat's Java API.
15
16
In this section, we will look at how to take advantage of these tools to
17
customize Metacat for your user-base.
18
19
A Brief Note about How Information is Stored
20
--------------------------------------------
21
Metacat stores XML files as a hierarchy of nodes, where each node is stored as
22
records in database tables. Because many XML data schemas are broken up into
23
multiple DTDs requiring multiple XML files that are related but stored
24
separately in the system, the system uses "packages" to link related but
25
separate documents. Packaged documents contain information that shows how they
26
are related to eachother, essentially stating that file A has a relationship
27
to file B, etc. A package file also allows users to link metadata files to the
28
data files they describe. For more information about the structure of data
29
packages and how XML documents and data are stored in Metacat, please see the
30
developer's documentation.
31
32
Using the Registry
33
------------------
34
Metacat's optional Registry provides a simple Web-based interface for creating,
35
editing, and submitting metadata to the Metacat repository (Figure 4.1). The
36
interface includes help documentation, and can be customized using Metacat's
37
configuration settings. The Registry also includes an administrative interface
38
for managing LDAP user accounts, which is useful if you are using LDAP as your
39
Metacat authentication system. Note that you must be running your own LDAP
40
server if you wish to use the LDAP Web interface. If you do not have your own
41
LDAP server, you can create and manage new accounts on the KNB website
42
(http://knb.ecoinformatics.org/). Please note that at this time, the Registry
43
interface has only been tested on Linux systems.
44
45
.. figure:: images/screenshots/image033.jpg
46
   :align: center
47
48
   An example installation of the Register's web interface. Customize the
49
   displayed and required modules with the Skins Configuration settings.
50
51
You can customize which modules (e.g., "Name of Submitter" or "Temporal
52
Coverage of Data") are displayed and which are required using the Skins
53
Configuration settings
54
55
Installing the Registry
56
~~~~~~~~~~~~~~~~~~~~~~~
57
In order to install and run the Registry, you must have Metacat installed and
58
Tomcat must be running behind an Apache Web server (see previous sections for
59
information about installing and configuring Apache to run with Tomcat).
60
61
To install and run the Registry:
62
63
1. Build the Metacat Perl client library:
64
65
  ::
66
67
    cd $METACAT/src/perl/Metacat
68
    perl Makefile.PL
69
    sudo make
70
    sudo make install
71
72
.. sidebar:: Instructions for Red Hat (Alternate Step 2)
73
74
  * Install the libraries
75
76
    ::
77
78
      sudo yum install gcc libxml2-devel libxslt-devel ant –y
79
80
  * Install CPAN, which allows us to install the Perl dependencies for the
81
    registry and account management parts of Metacat. If asked to manually
82
    configure cpan, type 'no' and CPAN will be setup with its default values.
83
84
    ::
85
86
      sudo yum install perl-CPAN
87
      sudo cpan
88
89
  * You should now see a prompt which looks like:
90
91
    ::
92
93
      cpan>
94
95
  * The rest of the commands assume you're inside of CPAN. Let's get the most
96
    recent version of the CPAN software. Just press return after any prompts
97
    you receive during this process.
98
99
    ::
100
101
      install Bundle::CPAN
102
      reload cpan
103
104
  * Install the required modules. Here we're installing an old LibXSLT, as the
105
    current one requires a newer libxslt than is available on Redhat 4 & 5.
106
    Again, just answer 'yes' to any questions.
107
108
    ::
109
110
      install AutoLoader
111
      install CGI
112
      install CGI::SEssion
113
      install LWP::UserAgent
114
      install Net::LDAP
115
      install Template
116
      install URI
117
      install MSERGEANT/XML-LibXSLT-1.58.tar.gz
118
119
2. Install the required system libraries using Ubuntu/Debian (instructions
120
   Red Hat in sidebar)
121
122
  * Install the libraries
123
124
    ::
125
126
      sudo apt-get install ant libappconfig-perl libxml-libxml-perl libxml-libxslt-perl libtemplate-perl libcgi-session-perl libdigest-sha1-perl libnet-ldap-perl libterm-readkey-perl libxml-dom-perl libsoap-lite-perl -y
127
128
  * Install two more package using cpan
129
130
    ::
131
132
      sudo cpan -i Config::Properties
133
      sudo cpan -i Scalar::Util
134
135
136
3. Double-check that Metacat's temporary folder, application.tempDir, is
137
   writable by the apache user, usually www-data or apache.
138
139
4. Make sure that the following scripts (found in ``<tomcat-home>/webapps/knb/cgi-bin``)
140
   are executable: register-dataset.cgi and ldapweb.cgi.
141
142
  ::
143
144
    sudo chmod +x <tomcat-home>/webapps/knb/cgi-bin/*.cgi
145
146
5. Restart Apache.
147
148
  ::
149
150
    sudo /etc/init.d/apache2 restart
151
152
6. Visit the resulting URL:
153
   http://<your_context_url>/cgi-bin/register-dataset.cgi?cfg=default
154
   Where ``<your_context_url>`` is the URL of the server hosting the Metacat
155
   followed by the name of the WAR file (i.e., the application context) that
156
   you installed. For instance, the context URL for the KNB Metacat is:
157
   http://knb.ecoinformatics.org/knb.
158
159
If everything worked correctly, the registry home page will open (see figure).
160
161
.. figure:: images/screenshots/image035.jpg
162
   :align: center
163
164
   An example of the Registry home page (with the default skin).
165
166
Customizing the Registry
167
~~~~~~~~~~~~~~~~~~~~~~~~
168
Before using the registry, you may wish to customize the interface using the
169
Skins Configuration settings. If you are using the default skin, you must
170
disable the 'show site list' setting before you can submit the form without
171
errors. You may also wish to remove (or modify) the list of NCEAS-specific
172
projects that appear in the default registry. To remove these form fields,
173
open Metacat's administrative interface (http://<your.context.url>/knb/admin)
174
and select the Skins Specific Properties Configuration option. On the skins
175
configuration page, uncheck the boxes beside any form elements that you do not
176
wish to appear in the registry.
177
178
Once you have saved your changes, you must restart Tomcat for them to come
179
into effect. To restart Tomcat, log in as the user that runs your Tomcat
180
server (often "tomcat") and type: /etc/init.d/tomcat5.5 restart or an
181
equivalent command appropriate to your operating system.
182
183
.. figure:: images/screenshots/image037.jpg
184
   :align: center
185
186
   Uncheck the box beside any setting to remove it from the Registry form. In
187
   the example, the "Show Site List" and "Show Work Group" form fields,
188
   corresponding to the "Station Name" and "NCEAS Project" drop-down lists in
189
   the registry form, have been removed.
190
191
Using HTML Forms (the HTTP Interface)
192
-------------------------------------
193
Metacat's HTTP interface supports Get and Post requests and a variety of actions (Table 4.1) that facilitate information retrieval and storage. HTTP requests can be sent from any client application that communicates using the Web's HTTP protocol.
194
195
* Supported Actions (API)
196
* Logging in
197
* Inserting, Updating, and Deleting XML and Data Documents
198
* Searching Metacat
199
* Paged Query Return
200
* Reading Data and Metadata
201
202
Supported Actions
203
~~~~~~~~~~~~~~~~~
204
Metacat supports get and post requests as well as actions for writing, querying,
205
and reading stored XML. In addition, the HTTP interface includes functions for
206
validating and transforming XML documents (see table).
207
208
Note that if Replication is enabled, Metacat recognizes several additional
209
actions, included in Table 4.2. For more information about replication,
210
please see :doc:`replication`.
211
212
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
213
| Action                   | Description and Parameters                                                                                                                                                                                                                                         |
214
+==========================+====================================================================================================================================================================================================================================================================+
215
| delete                   | Delete the specified document from the database. For an                                                                                                                                                                                                            |
216
|                          | example, please see Inserting, Updating, and                                                                                                                                                                                                                       |
217
|                          | Deleting XML and Data Documents.                                                                                                                                                                                                                                   |
218
|                          |                                                                                                                                                                                                                                                                    |
219
|                          | ``docid`` - the docid of the document to delete                                                                                                                                                                                                                    |
220
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
221
| export                   | Export a data package in a zip file.                                                                                                                                                                                                                               |
222
|                          |                                                                                                                                                                                                                                                                    |
223
|                          | ``docid`` - the docid of the document to delete                                                                                                                                                                                                                    |
224
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
225
| getaccesscontrol         | Get the access control list (ACL) for the                                                                                                                                                                                                                          |
226
|                          | specified document.                                                                                                                                                                                                                                                |
227
|                          |                                                                                                                                                                                                                                                                    |
228
|                          | ``docid`` - the docid of the document to delete                                                                                                                                                                                                                    |
229
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
230
| getalldocids             | Retrieve a list of all docids registered with the system.                                                                                                                                                                                                          |
231
|                          |                                                                                                                                                                                                                                                                    |
232
|                          | ``scope`` - a string used to match a range of docids in a SQL LIKE statement                                                                                                                                                                                       |
233
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
234
| getdataguide             | Read a data guide for the specified document type                                                                                                                                                                                                                  |
235
| DEPRECATED               |                                                                                                                                                                                                                                                                    |
236
| Use getdtdschema instead | ``doctype`` - the doctype for which to get the data guide                                                                                                                                                                                                          |
237
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
238
| getdoctypes              | Get all doctypes currently available in the Metacat Catalog System. No parameters.                                                                                                                                                                                 |
239
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
240
| getdtdschema             | Read the DTD or XMLSchema file for the specified doctype.                                                                                                                                                                                                          |
241
|                          |                                                                                                                                                                                                                                                                    |
242
|                          | ``doctype`` - the doctype for which DTD or XMLSchema files to read                                                                                                                                                                                                 |
243
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
244
| getlastdocid             | Get the latest docid with revision number used by user.                                                                                                                                                                                                            |
245
|                          |                                                                                                                                                                                                                                                                    |
246
|                          | ``username`` - the user's log-in name                                                                                                                                                                                                                              |
247
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
248
| getlog                   | Get the latest docid with revision number used by user.                                                                                                                                                                                                            |
249
|                          |                                                                                                                                                                                                                                                                    |
250
|                          | ``ipaddress`` - the internet protocol address for the event                                                                                                                                                                                                        |
251
|                          | ``principal`` - the principal for the event (a username, etc)                                                                                                                                                                                                      |
252
|                          | ``docid`` - the identifier of the document to which the event applies                                                                                                                                                                                              |
253
|                          | ``event`` - the string code for the event                                                                                                                                                                                                                          |
254
|                          | ``start`` - beginning of date-range for query                                                                                                                                                                                                                      |
255
|                          | ``end`` - end of date-range for query                                                                                                                                                                                                                              |
256
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
257
| getloggedinuserinfo      | Get user info for the currently logged in user. No parameters.                                                                                                                                                                                                     |
258
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
259
| getpricipals             | Get all users and groups in the current authentication schema. No parameters.                                                                                                                                                                                      |
260
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
261
| getrevisionanddoctype    | Return the revision and doctype of a document.                                                                                                                                                                                                                     |
262
|                          | The output is String that looks like "rev;doctype"                                                                                                                                                                                                                 |
263
|                          |                                                                                                                                                                                                                                                                    |
264
|                          | ``docid`` - the docid of the document                                                                                                                                                                                                                              |
265
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
266
| getversion               | Get Metacat version.   Return the current version of Metacat as XML. No parameters.                                                                                                                                                                                |
267
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
268
| insert                   | Insert an XML document into the database. For an example, please see                                                                                                                                                                                               |
269
|                          | Inserting, Updating, and Deleting XML and Data Documents                                                                                                                                                                                                           |
270
|                          |                                                                                                                                                                                                                                                                    |
271
|                          | ``docid`` - the user-defined docid to assign to the new XML document                                                                                                                                                                                               |
272
|                          | ``doctext`` - the text of the XML document to insert                                                                                                                                                                                                               |
273
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
274
| insertmultipart          | Insert an XML document using multipart encoding into the database.                                                                                                                                                                                                 |
275
|                          |                                                                                                                                                                                                                                                                    |
276
|                          | ``docid`` - the user-defined docid to assign to the new XML document                                                                                                                                                                                               |
277
|                          | ``doctext`` - the text of the XML document to insert                                                                                                                                                                                                               |
278
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
279
| isregistered             | Check if an individual document exists in either the xml_documents or xml_revisions tables.                                                                                                                                                                        |
280
|                          | For more information about Metacat's database schema, please see the developer documentation.                                                                                                                                                                      |
281
|                          |                                                                                                                                                                                                                                                                    |
282
|                          | ``docid`` - the docid of the document                                                                                                                                                                                                                              |
283
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
284
| login                    | Log the user in. You must log in using this action before you can perform                                                                                                                                                                                          |
285
|                          | many of the actions. For an example of the login action, see Logging In.                                                                                                                                                                                           |
286
|                          |                                                                                                                                                                                                                                                                    |
287
|                          | ``username`` - the user's login name                                                                                                                                                                                                                               |
288
|                          | ``password`` - the user's password                                                                                                                                                                                                                                 |
289
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
290
| logout                   | Log the current user out and destroy the associated session. No parameters.                                                                                                                                                                                        |
291
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
292
| query                    | Perform a free text query. For an example, please see Searching Metacat.                                                                                                                                                                                           |
293
|                          |                                                                                                                                                                                                                                                                    |
294
|                          | ``returndoctype`` - the doctype to use for your Package View. For more information about packages, see http://knb.ecoinformatics.org/software/metacat/packages.html                                                                                                |
295
|                          | ``qformat`` - the format of the returned result set. Possible values are html or xml or the name of your servlet's Metacat skin.                                                                                                                                   |
296
|                          | ``querytitle`` - OPTIONAL - the title of the query                                                                                                                                                                                                                 |
297
|                          | ``doctype`` - OPTIONAL - if doctype is specified, the search is limited only to the specified doctype(s). (e.g., eml://ecoinformatics.org/eml-2.0.1 and/or eml://ecoinformatics.org/eml-2.0.0) If no doctype element is specified, all document types are returned |
298
|                          | ``returnfield`` - a custom field to be returned by any hit document.                                                                                                                                                                                               |
299
|                          | ``operator`` - the Boolean operator to apply to the query. Possible values are: union or intersect                                                                                                                                                                 |
300
|                          | ``searchmode`` - the type of search to be performed. Possible values are: contains, starts-with, ends-with, equals, isnot-equal, greater-than, less-than, greater-than-equals, less-than-equals.                                                                   |
301
|                          | ``anyfield`` - a free-text search variable. The value placed in this parameter will be searched for in any document in any node.                                                                                                                                   |
302
|                          | ``pagesize`` – the number of search results to display on each search results page (e.g., 10). Used with pagestart. See section 4.3.4 for an example.                                                                                                              |
303
|                          | ``pagestart`` – the displayed search results page (e.g, 1). Used with pagesize. See section 4.3.4 for an example.                                                                                                                                                  |
304
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
305
| read                     | Get a document from the database and return it in the specified format. See Searching Metacat for an example.                                                                                                                                                      |
306
|                          |                                                                                                                                                                                                                                                                    |
307
|                          | ``docid`` - the docid of the document to return                                                                                                                                                                                                                    |
308
|                          | ``qformat`` - the format to return the document in. Possible values are: ``html``, ``xml``,or, if your Metacat uses a skin, the name of the skin.                                                                                                                  |
309
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
310
| readinlinedata           | Read inline data only.                                                                                                                                                                                                                                             |
311
|                          |                                                                                                                                                                                                                                                                    |
312
|                          | ``inlinedataid`` - the id of the inline data to read                                                                                                                                                                                                               |
313
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
314
| setaccess                | Change access permissions for a user on a specified document.                                                                                                                                                                                                      |
315
|                          |                                                                                                                                                                                                                                                                    |
316
|                          | ``docid`` - the docid of the document to be modified.                                                                                                                                                                                                              |
317
|                          | ``principal`` - the user or group whose permissions will be modified                                                                                                                                                                                               |
318
|                          | ``permission`` - the permission  to set (read, write, all)                                                                                                                                                                                                         |
319
|                          | ``permType`` - the type of permission to set (allow, deny)                                                                                                                                                                                                         |
320
|                          | ``permOrder`` - the order in which to apply the permission (allowFirst, denyFirst)                                                                                                                                                                                 |
321
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
322
| spatial_query            | Perform a spatial query. These queries may include any of the queries supported by the                                                                                                                                                                             |
323
|                          | WFS / WMS standards. For more information, see Spatial Queries.                                                                                                                                                                                                    |
324
|                          |                                                                                                                                                                                                                                                                    |
325
|                          | ``xmax`` - max x spatial coordinate                                                                                                                                                                                                                                |
326
|                          | ``ymax`` - max y spatial coordinate                                                                                                                                                                                                                                |
327
|                          | ``xmin`` - min x spatial coordinate                                                                                                                                                                                                                                |
328
|                          | ``ymin`` - min y spatial coordinate                                                                                                                                                                                                                                |
329
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
330
| squery                   | Perform a structured query. For an example, please see Searching Metacat.                                                                                                                                                                                          |
331
|                          |                                                                                                                                                                                                                                                                    |
332
|                          | ``query`` - the text of the pathquery document sent to the server                                                                                                                                                                                                  |
333
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
334
| update                   | Overwrite an XML document with a new one and give the new one the same docid but with                                                                                                                                                                              |
335
|                          | the next revision number. For an example, please see Inserting, Updating, and                                                                                                                                                                                      |
336
|                          | Deleting XML and Data Documents.                                                                                                                                                                                                                                   |
337
|                          |                                                                                                                                                                                                                                                                    |
338
|                          | ``docid`` - the docid of the document to update                                                                                                                                                                                                                    |
339
|                          | ``doctext`` - the text with which to update the XML document                                                                                                                                                                                                       |
340
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
341
| upload                   | Upload (insert or update) a data file into Metacat. Data files are stored on Metacat and may be in any                                                                                                                                                             |
342
|                          | format (binary or text), but they are all treated as if they were binary.                                                                                                                                                                                          |
343
|                          |                                                                                                                                                                                                                                                                    |
344
|                          | ``docid`` - the docid of the data file to upload                                                                                                                                                                                                                   |
345
|                          | ``datafile`` - the data file to upload                                                                                                                                                                                                                             |
346
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
347
| validate                 | Validate a specified document against its DTD.                                                                                                                                                                                                                     |
348
|                          |                                                                                                                                                                                                                                                                    |
349
|                          | ``docid`` - the docid of the document to validate                                                                                                                                                                                                                  |
350
|                          | ``valtext`` - the DTD by which to validate this document                                                                                                                                                                                                           |
351
+--------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
352
353
354
Metacat Replication Parameters
355
356
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
357
| Action         | Description and Parameters                                                                                                                                      |
358
+================+=================================================================================================================================================================+
359
| forcereplicate | Force the local server to get the specified document from the remote host.                                                                                      |
360
|                |                                                                                                                                                                 |
361
|                | ``server`` - The server to which this document is being sent                                                                                                    |
362
|                | ``docid`` - The docid of the document to send                                                                                                                   |
363
|                | ``dbaction`` - The action to perform on the document: insert or update (the default)                                                                            |
364
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
365
| getall         | Force the local server to check all known servers for updated documents. No parameters.                                                                         |
366
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
367
| getcatalog     | Send the contents of the xml_catalog table encoded in XML. No parameters.                                                                                       |
368
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
369
| getlock        | Request a lock on the specified document.                                                                                                                       |
370
|                |                                                                                                                                                                 |
371
|                | ``docid`` - the docid of the document                                                                                                                           |
372
|                | ``updaterev`` - the revision number of docid                                                                                                                    |
373
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
374
| gettime        | Return the local time on this server. No parameters.                                                                                                            |
375
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
376
| servercontrol  | Perform the specified replication control on the Replication daemon.                                                                                            |
377
|                |                                                                                                                                                                 |
378
|                | ``add`` - add a new server to the replication list                                                                                                              |
379
|                | ``delete`` - remove a server from the replication list                                                                                                          |
380
|                | ``list`` - list all of the servers currently in the server list                                                                                                 |
381
|                | ``replicate`` - a Boolean flag (1 or 0) which determines if this server should copy files from the newly added server.                                          |
382
|                | ``server`` - the server to add/delete                                                                                                                           |
383
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
384
| read           | Sends docid to the remote host.                                                                                                                                 |
385
|                |                                                                                                                                                                 |
386
|                | ``docid`` - the docid of the document to read                                                                                                                   |
387
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
388
| start          | Start the Replication daemon with a time interval of deltaT.                                                                                                    |
389
|                |                                                                                                                                                                 |
390
|                | ``rate`` - The rate (in seconds) at which you want the replication daemon to check for updated documents. The value cannot be less than 30. The default is 1000 |
391
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
392
| stop           | Stop the Replication daemon. No parameters.                                                                                                                     |
393
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
394
| update         | Send a list of all documents on the local server along with their revision numbers. No parameters.                                                              |
395
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
396
397
Logging In
398
~~~~~~~~~~
399
To log in to Metacat, use the ``login`` action.
400
401
The following is an example of a Web form (see figure) that logs a user into
402
Metact. Example HTML code is included below the screenshot.
403
404
.. figure:: images/screenshots/image039.jpg
405
   :align: center
406
407
   Logging into Metacat using an HTML form.
408
409
::
410
411
  <html>
412
  <body>
413
  <form name="loginform" method="post"action="http://yourserver.com/yourcontext/servlet/metacat"
414
  target="_top" onsubmit="return submitform(this);" id="loginform">
415
    <input type="hidden" name="action" value="login"> <input type=
416
    "hidden" name="username" value=""> <input type="hidden" name=
417
    "qformat" value="xml"> <input type="hidden" name=
418
    "enableediting" value="false">
419
420
    <table>
421
      <tr valign="middle">
422
        <td align="left" valign="middle" class="text_plain">
423
        username:</td>
424
425
        <td width="173" align="left" class="text_plain" style=
426
        "padding-top: 2px; padding-bottom: 2px;"><input name="uid"
427
        type="text" style="width: 140px;" value=""></td>
428
      </tr>
429
430
      <tr valign="middle">
431
        <td height="28" align="left" valign="middle" class=
432
        "text_plain">organization:</td>
433
434
        <td align="left" class="text_plain" style=
435
        "padding-top: 2px; padding-bottom: 2px;"><select name=
436
        "organization" style="width:140px;">
437
          <option value=""    selected>&#8212; choose one &#8212;</option>
438
          <option value="NCEAS">NCEAS</option>
439
          <option value="LTER">LTER</option>
440
          <option value="UCNRS">UCNRS</option>
441
          <option value="PISCO">PISCO</option>
442
          <option value="OBFS">OBFS</option>
443
          <option value="OSUBS">OSUBS</option>
444
          <option value="SAEON">SAEON</option>
445
          <option value="SANParks">SANParks</option>
446
          <option value="SDSC">SDSC</option>
447
          <option value="KU">KU</option>
448
          <option value="unaffiliated">unaffiliated</option>
449
        </select></td>
450
      </tr>
451
452
      <tr valign="middle">
453
        <td width="85" align="left" valign="middle" class=
454
        "text_plain">password:</td>
455
456
        <td colspan="2" align="left" class="text_plain" style=
457
        "padding-top: 2px; padding-bottom: 2px;">
458
          <table width="100%" border="0" cellpadding="0"
459
          cellspacing="0">
460
            <tr>
461
              <td width="150" align="left"><input name="password"
462
              type="password" maxlength="50" style="width:140px;"
463
              value=""></td>
464
465
              <td align="center" class="buttonBG_login">
466
              <input type="submit" name="loginAction" value="Login"
467
              class="button_login"></td>
468
469
              <td align="left">&nbsp;</td>
470
            </tr>
471
          </table>
472
        </td>
473
      </tr>
474
    </table>
475
  </form>
476
  </body>
477
  </html>
478
479
Inserting, Updating, and Deleting XML and Data Documents
480
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
481
Adding, editing, and deleting XML documents in Metacat can be accomplished
482
using the insert, update, and delete actions, respectively. Before you can
483
insert, delete, or update documents, you must log in to Metacat using the
484
login action. See Logging in for an example.
485
486
``insert``
487
   Insert a new XML or data document into Metacat. You must specify a document ID.
488
489
``update``
490
   Update an existing Metacat document. The original document is archived,
491
   then overwritten.
492
493
``delete``
494
   Archive a document and move the pointer in xml_documents to xml_revisions,
495
   effectively "deleting" the document from public view, but preserving the
496
   revision for the revision history.
497
498
The following is an example of a Web form (see figure) that can perform all
499
three tasks. Example HTML code is included in the sidebar.
500
501
.. figure:: images/screenshots/image041.jpg
502
   :align: center
503
504
   An example of a Web form used to insert, delete, or update XML documents in Metacat.
505
506
::
507
508
  <html>
509
    <head>
510
    <title>MetaCat</title>
511
    </head>
512
    <body class="emlbody">
513
    <b>MetaCat XML Loader</b>
514
    <p>
515
    Upload, Change, or Delete an XML document using this form.
516
    </p>
517
    <form action="http://yourserver.com/yourcontext/servlet/metacat" method="POST">
518
      <strong>1. Choose an action: </strong>
519
      <input type="radio" name="action" value="insert" checked> Insert
520
      <input type="radio" name="action" value="update"> Update
521
      <input type="radio" name="action" value="delete"> Delete
522
      <input type="submit" value="Process Action">
523
      <br />
524
      <strong>2. Provide a Document ID </strong>
525
      <input type="text" name="docid"> (optional for Insert)
526
         <input type="checkbox" name="public" value="yes" checked><strong>Public Document</strong>
527
      <br />
528
      <strong>3. Provide XML text </strong> (not needed for Delete)<br/>
529
      <textarea name="doctext" cols="65" rows="15"></textarea><br/>
530
      <strong>4. Provide DTD text for upload </strong> (optional; not needed for Delete)
531
      <textarea name="dtdtext" cols="65" rows="15"></textarea>
532
    </form>
533
    </body>
534
  </html>
535
536
Searching Metacat
537
~~~~~~~~~~~~~~~~~
538
To search Metacat use the ``query`` or ``squery`` actions.
539
540
``query``:
541
   Perform a free text query. Specify the returndoctype, qformat, returnfield,
542
   operator, searchmode, anyfield, and (optionally) a querytitle and doctype.
543
544
``squery``:
545
   Perform a structured query by submitting an XML pathquery document to the
546
   Metacat server.
547
548
549
When Metacat receives a query via HTTP (Figure 4.8), the server creates a
550
"pathquery" document, which is an XML document populated with the specified
551
search criteria (Figure 4.10). The pathquery document is then translated into
552
SQL statements that are executed against the data base. Results are translated
553
into an XML "resultset" document, which can be returned as XML or transformed
554
into HTML and returned (specify which you would prefer with the returnfield
555
parameter). You can also opt to submit a pathquery document directly,
556
using an squery action.
557
558
.. figure:: images/screenshots/image043.jpg
559
   :align: center
560
561
   Example of a basic search form using a query action.
562
563
::
564
565
  <html>
566
  <head>
567
  <title>Search</title>
568
  </head>
569
  <body>
570
  <form method="POST" action="http://panucci.nceas.ucsb.edu/knb/servlet/metacat">
571
572
  Search for:
573
574
  <input name="action" value="query" type="hidden">
575
  <input name="operator" value="INTERSECT" type="hidden">
576
  <input name="anyfield" type="text" value=" " size="40">
577
  <input name="qformat" value="html" type="hidden">
578
579
  <input name="returnfield" value="creator/individualName/surName" type="hidden">
580
  <input name="returnfield" value="creator/individualName/givenName" type="hidden">
581
  <input name="returnfield" value="creator/organizationName" type="hidden">
582
  <input name="returnfield" value="dataset/title" type="hidden">
583
  <input name="returnfield" value="keyword" type="hidden">
584
585
  <input name="returndoctype" value="eml://ecoinformatics.org/eml-2.0.1" type="hidden">
586
587
  <input value="Start Search" type="submit">
588
589
  </form>
590
  </body>
591
  </html>
592
593
Metacat's pathquery document can query specific fields of any XML document.
594
The pathquery can also be used to specify which fields from each hit are
595
returned and displayed in the search result set.
596
597
::
598
599
  <pathquery version="1.0">
600
      <meta_file_id>unspecified</meta_file_id>
601
      <querytitle>unspecified</querytitle>
602
      <returnfield>dataset/title</returnfield>
603
      <returnfield>keyword</returnfield>
604
      <returnfield>originator/individualName/surName</returnfield>
605
      <returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>
606
      <returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>
607
      <querygroup operator="UNION">
608
        <queryterm casesensitive="false" searchmode="contains">
609
          <value>Plant</value>
610
          <pathexpr>dataset/title</pathexpr>
611
        </queryterm>
612
        <queryterm casesensitive="false" searchmode="contains">
613
          <value>plant</value>
614
          <pathexpr>keyword</pathexpr>
615
        </queryterm>
616
      </querygroup>
617
  </pathquery>
618
619
Each ``<returnfield>`` parameter specifies a field that the data base will
620
return (in addition to the fields Metacat returns by default) for each search
621
result.
622
623
The ``<returndoctype>`` field limits the type of returned documents
624
(eg, eml://ecoinformatics.org/eml-2.0.1 and/or eml://ecoinformatics.org/eml-2.0.0).
625
If no returndoctype element is specified, all document types are returned.
626
627
A ``<querygroup>`` creates an AND or an OR statement that applies to the
628
nested ``<queryterm>`` tags. The querygroup operator can be UNION or INTERSECT.
629
A ``<queryterm>`` defines the actual field (contained in ``<pathexpr>`` tags)
630
against which the query (contained in the ``<value>`` tags) is being performed.
631
632
The ``<pathexpr>`` can also contain a document type keyword contained in
633
``<returndoc>`` tags. The specified document type applies only to documents
634
that are packaged together (e.g., a data set and its corresponding metadata file).
635
If Metacat identifies the search term in a packaged document, the servlet will
636
check to see if that document's type matches the specified one. If not,
637
Metacat will check if one of the other documents in the package matches. If so,
638
Metacat will return the matching document. For more information about packages,
639
please see the developer documentation.
640
641
After Metacat has processed a Pathquery document, it returns a resultset document.
642
643
::
644
645
  <resultset>
646
        <query>
647
          <pathquery version="1.0">
648
            <meta_file_id>unspecified</meta_file_id>
649
            <querytitle>unspecified</querytitle>
650
            <returnfield>dataset/title</returnfield>
651
            <returnfield>keyword</returnfield>
652
            <returnfield>originator/individualName/surName</returnfield>
653
            <returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>
654
            <returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>
655
            <querygroup operator="UNION">
656
                  <queryterm casesensitive="false" searchmode="contains">
657
                      <value>Datos</value>
658
                      <pathexpr>dataset/title</pathexpr>
659
                  </queryterm>
660
                  <queryterm casesensitive="false" searchmode="contains">
661
                     <value>plant</value>
662
                     <pathexpr>keyword</pathexpr>
663
                  </queryterm>
664
           </querygroup>
665
         </pathquery>
666
        </query>
667
668
        <document>
669
          <docid>nceas.44.1</docid>
670
          <docname>resource</docname>
671
          <doctype>eml://ecoinformatics.org/eml-2.0.1</doctype>
672
          <createdate>2001-01-12 16:12:06.0</createdate>
673
          <updatedate>2001-01-12 16:12:06.0</updatedate>
674
          <param name="dataset/title">Datos Meteorologicos</param>
675
          <param name="keyword">intertidal</param>
676
          <param name="originator/individualName/surName">Smith</param>
677
        </document>
678
679
        <document>
680
          <docid>nceas.42.1</docid>
681
          <docname>resource</docname>
682
          <doctype>eml://ecoinformatics.org/eml-2.0.1</doctype>
683
          <createdate>2001-01-12 16:11:31.0</createdate>
684
          <updatedate>2001-01-12 16:11:31.0</updatedate>
685
          <param name="dataset/title">Ocean Surface Temperature</param>
686
          <param name="keyword">Plant</param>
687
          <param name="originator/individualName/surName">Henry</param>
688
       </document>
689
      .....
690
  </resultset>
691
692
When Metacat returns a resultset document, the servlet always includes the
693
pathquery used to create it. The pathquery XML is contained in the <query> tag,
694
the first element in the resultset.
695
696
Each XML document returned by the query is represented by a ``<document>`` tag. By
697
default, Metacat will return the docid, docname, doctype, doctitle, createdate
698
and updatedate for each search result. If the user specified additional return
699
fields in the pathquery using ``<returnfield>`` tags (e.g., dataset/title to return
700
the document title), the additional fields are returned in ``<param>`` tags.
701
702
Metacat can return the XML resultset to your client as either XML or HTML.
703
704
Paged Query Returns
705
~~~~~~~~~~~~~~~~~~~
706
Dividing large search result sets over a number of pages speeds load-time and
707
makes the result sets more readable to users (Figure 4.12). To break your search
708
results into pages, use the query action's optional pagestart and pagesize
709
parameters. The pagesize parameter indicates how many results should be
710
returned for a given page. The pagestart parameter indicates which page you
711
are currently viewing.
712
713
.. figure:: images/screenshots/image045.jpg
714
   :align: center
715
716
   An example of paged search results.
717
718
When a paged query is performed, the query's resultset contains four extra
719
fields: pagestart, pagesize, nextpage, and previouspage (Figure 4.13).  The
720
nextpage and previouspage fields help Metacat generate navigational links in
721
the rendered resultset using XSLT to transform the XML to HTML.
722
723
::
724
725
  <!-- An example of an XML resultset that include support for page breaks.
726
       The pagestart parameter will always indicate the page you are currently viewing.
727
  -->
728
  <resultset>
729
      <pagestart>1</pagestart>
730
      <pagesize>10</pagesize>
731
      <nextpage>2</nextpage>
732
      <previouspage>0</previouspage>
733
      <query> ...</query>
734
      <document>...</document>
735
      <document>...</document>
736
    </resultset>
737
738
The HTML search results displayed in the figure were rendered using Kepler's XSLT,
739
which can be found in lib/style/skins/kepler. Kepler's XSLT uses the four extra
740
resultset fields to render the "Next" and "Previous" links.
741
742
::
743
744
  <a href="metacat?action=query&operator=INTERSECT&enableediting=false&anyfield=actor&qformat=kepler&pagestart=0&pagesize=10">Previous Page</a>
745
  <a href="metacat?action=query&operator=INTERSECT&enableediting=false&anyfield=actor&qformat=kepler&pagestart=2&pagesize=10">Next Page</a>
746
747
In the example above, the current page is 1, and the previous page (page 0) and next page (page 2) pages are indicated by the values of the pagestart parameters.
748
749
Reading Data and Metadata
750
~~~~~~~~~~~~~~~~~~~~~~~~~
751
To read data or metadata from Metacat, use the ``read`` action. The ``read`` action
752
takes two parameters: ``docid``, which specifies the document ID of the document
753
to return, and ``qformat``, which specifies the return format for the document
754
(``html`` or ``xml`` or the name of a configured style-set, e.g., ``default``). If ``qformat``
755
is set to ``xml``, Metacat will return the XML document untransformed. If the
756
return format is set to ``html``, Metacat will transform the XML document into
757
HTML using the default XSLT style sheet (specified in the Metacat
758
configuration). If the name of a style-set is specified, Metacat will use the
759
XSLT styles specified in the set to transform the XML.
760
761
.. figure:: images/screenshots/image047.jpg
762
   :align: center
763
764
   The same document displayed using different qformat parameters (from left
765
   to right: the default style-set, XML, and HTML).
766
767
Note that the ``read`` action can be used to read both data files and metadata files.
768
To read a data file, you could use the following request::
769
770
  http://yourserver.com/yourcontext/metacat?action=read&docid=nceas.55&qformat=default
771
772
Where ``nceas.55`` is the docid of the data file stored in the Metacat and
773
``default`` is the name of the style (you could also use "html" or "xml" or the
774
name of a customized skin).
775
776
::
777
778
  <html>
779
  <head>
780
    <title>Read Document</title>
781
  </head>
782
  <body>
783
    <form method="POST" action="http://your.server/your.context/servlet/metacat">
784
      <input name="action" value="read" type="hidden">
785
      <input name="docid" type="text" value="" size="40">
786
      <input name="qformat" value="default" type="hidden">
787
      <input value="Read" type="submit">
788
    </form>
789
  </body>
790
  </html>
791
792
Using the EarthGrid API (aka EcoGrid)
793
-------------------------------------
794
795 6844 jones
.. Note::
796
797
  The EarthGrid/EcoGrid web service API is *deprecated* and will be removed from
798
  a future version of Metacat.  Its functionality is being replaced by the
799
  standardized DataONE REST service interface.
800
801
The EarthGrid (aka EcoGrid) provides access to disparate data on different
802
networks (e.g., KNB, GBIF, GEON) and storage systems (e.g., Metacat and SRB),
803
allowing scientists access to a wide variety of data and analytic resources
804
(e.g., data, metadata, analytic workflows and processors) networked at different
805
sites and at different organizations via the internet.
806
807
Because Metacat supports the EarthGrid API (see table), it can query the
808
distributed EarthGrid, retrieve metadata and data results, and write new and
809
updated metadata and data back to the grid nodes.
810
811
For more information about each EarthGrid service and its WSDL file, navigate
812
to the "services" page on your Metacat server
813
(e.g., http://knb.ecoinformatics.org/knb/services).
814
Note that the AdminService and Version service that appear on this page are
815
not part of EarthGrid.
816
817
EarthGrid/EcoGrid API Summary
818
819
+----------------------------+-----------------------------------------------------------------------------------------------------+
820
| Service                    | Description                                                                                         |
821 6845 jones
+============================+=====================================================================================================+
822 6844 jones
| AuthenticationQueryService | Search for and retrieve protected metadata and data from the EarthGrid as an authenticated user.    |
823
|                            |                                                                                                     |
824
|                            | Methods: ``query``, ``get``                                                                         |
825
+----------------------------+-----------------------------------------------------------------------------------------------------+
826
| AuthenticationService      | Log in and out of the EarthGrid                                                                     |
827
|                            |                                                                                                     |
828
|                            | Methods: ``login``, ``logout``                                                                      |
829
+----------------------------+-----------------------------------------------------------------------------------------------------+
830
| IdentifierService          | List, lookup, validate, and add Life Science Identifiers (LSIDs) to the EarthGrid                   |
831
|                            |                                                                                                     |
832
|                            | Methods: ``isRegistered``, ``addLSID``, ``getNextRevision``, ``getNextObject``, ``getAllIds``       |
833
+----------------------------+-----------------------------------------------------------------------------------------------------+
834
| PutService                 | Write metadata to the EarthGrid                                                                     |
835
|                            |                                                                                                     |
836
|                            | Methods: ``put``                                                                                    |
837
+----------------------------+-----------------------------------------------------------------------------------------------------+
838
| QueryService               | Search for and retrieve metadata from the EarthGrid                                                 |
839
|                            |                                                                                                     |
840
|                            | Methods: ``query``, ``get``                                                                         |
841
+----------------------------+-----------------------------------------------------------------------------------------------------+
842
| RegistryService            | Add, update, remove, and search for registered EarthGrid services.                                  |
843
|                            | Note: The WSDL for this  service is found under http://ecogrid.ecoinformatics.org/registry/services |
844
|                            |                                                                                                     |
845
|                            | Methods: ``add``, ``update``, ``remove``, ``list``, ``query``                                       |
846
+----------------------------+-----------------------------------------------------------------------------------------------------+
847
848 6843 jones
Using Morpho
849 6147 jones
------------
850 6844 jones
Morpho is a desktop tool created to facilitate the creation, storage, and
851
retrieval of metadata. Morpho interfaces with any Metacat server, allowing
852
users to upload, download, store, query and view relevant metadata and data
853
using the network. Users can authorize the public or only selected colleagues
854
to view their data files.
855 6147 jones
856 6844 jones
Morpho is part of the Knowledge Network for Biocomplexity (KNB), a national
857
network intended to facilitate ecological and environmental research on
858
biocomplexity. To use Morpho with your Metacat, set the Metacat URL in the
859
Morpho Preferences to point to your Metacat server.
860
861
.. figure:: images/screenshots/image049.png
862
   :align: center
863
864
   Set the Metacat URL in the Morpho preferences to point to your Metacat.
865
866
For more information about Morpho, please see: http://knb.ecoinformatics.org/morphoportal.jsp
867
868 6843 jones
Creating Your Own Client
869
------------------------
870 6844 jones
Metacat's client API is available in Java and Perl (the Java interface is
871
described in this section and further detailed in the appendix). Some of the
872
API is also available in Python and Ruby. The API allows client applications
873
to easily authenticate users and perform basic Metacat operations such as
874
reading metadata and data files; inserting, updating, and deleting files; and
875
searching for packages based on metadata matches.
876 6843 jones
877 6844 jones
The Client API is defined by the interface edu.ucsb.nceas.metacat.client.Metacat,
878
and all operations are fully defined in the javadoc_ documentation. To use the
879
client API, include the ``metacat-client.jar``, ``utilities.jar``, and
880
``httpclient.jar`` in your classpath. After including these classes, you can
881
begin using the API methods (see the next table).
882
883
.. _javadoc: http://knb.ecoinformatics.org/software/metacat/dev/api/index.html
884
885
The following code block displays a typical session for reading a document
886
from Metacat using the Java client API.
887
888
::
889
890
  String metacatUrl = "http://foo.com/context/metacat";
891
  String username = "uid=jones,o=NCEAS,dc=ecoinformatics,dc=org";
892
  String password = "neverHarcodeAPasswordInCode";
893
  try {
894
      Metacat m = MetacatFactory.createMetacatConnection(metacatUrl);
895
      m.login(username, password);
896
      Reader r = m.read("testdocument.1.1");
897
      // Do whatever you want with Reader r
898
  } catch (MetacatAuthException mae) {
899
      handleError("Authorization failed:\n" + mae.getMessage());
900
  } catch (MetacatInaccessibleException mie) {
901
      handleError("Metacat Inaccessible:\n" + mie.getMessage());
902
  } catch (Exception e) {
903
      handleError("General exception:\n" + e.getMessage());
904
  }
905
906
  Operations provided by Client API  (Metacat.java class)
907
908
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
909
| Method               | Parameters and Throws                                                                                                                                                                                       | Description                                                                                                                               |
910 6845 jones
+======================+=============================================================================================================================================================================================================+===========================================================================================================================================+
911 6844 jones
| delete               | ``public String delete(String docid) throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException;``                                                                                   | Delete an XML document in the repository.                                                                                                 |
912
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
913
| getAllDocids         | ``public Vector getAllDocids(String scope) throws MetacatException;``                                                                                                                                       | Return a list of all docids that match a given scope. If scope is null, return all docids registered in the system.                       |
914
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
915
| getLastDocid         | ``public String getLastDocid(String scope) throws MetacatException;``                                                                                                                                       | Return the highest document ID for a given scope.  Used by clients to determine the next free identifier in a sequence for a given scope. |
916
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
917
| getloggedinuserinfo  | ``public String getloggedinuserinfo() throws MetacatInaccessibleException;``                                                                                                                                | Return the logged in user for this session.                                                                                               |
918
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
919
| getNewestDocRevision | ``public int getNewestDocRevision(String docId) throws MetacatException;``                                                                                                                                  | Return the latest revision of specified the document from Metacat                                                                         |
920
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
921
| getSessonId          | ``public String getSessionId();``                                                                                                                                                                           | Return the session identifier for this session.                                                                                           |
922
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
923
| insert               | ``public String insert(String docid, Reader xmlDocument, Reader schema) throws InsufficientKarmaException, MetacatException, IOException, MetacatInaccessibleException;``                                   | Insert an XML document into the repository.                                                                                               |
924
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
925
| isRegistered         | ``public boolean isRegistered(String docid) throws MetacatException;``                                                                                                                                      | Return true if given docid is registered; false if not.                                                                                   |
926
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
927
| login                | ``public String login(String username, String password) throws MetacatAuthException, MetacatInaccessibleException;``                                                                                        | Log in to a Metacat server.                                                                                                               |
928
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
929
| logout               | ``public String logout() throws MetacatInaccessibleException, MetacatException;``                                                                                                                           | Log out of a Metacat server.                                                                                                              |
930
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
931
| query                | ``public Reader query(Reader xmlQuery) throws MetacatInaccessibleException, IOException;``                                                                                                                  | Query the Metacat repository and return the result set as a Reader.                                                                       |
932
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
933
| query                | ``public Reader query(Reader xmlQuery, String qformat) throws MetacatInaccessibleException, IOException;``                                                                                                  | Query the Metacat repository with the given metacat-compatible query format and return the result set as a Reader.                        |
934
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
935
| read                 | ``public Reader read(String docid) throws InsufficientKarmaException, MetacatInaccessibleException, DocumentNotFoundException, MetacatException;``                                                          | Read an XML document from the Metacat server.                                                                                             |
936
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
937
| readInlineData       | ``public Reader readInlineData(String inlinedataid) throws InsufficientKarmaException, MetacatInaccessibleException, MetacatException;``                                                                    | Read inline data from the Metacat server session.                                                                                         |
938
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
939
| setAccess            | ``public String setAccess(String _docid, String _principal, String _permission, String _permType, String _permOrder ); throws InsufficientKarmaException, MetacatException, MetacatInaccessibleException;`` | Set permissions for an XML document in the Metacat repository.                                                                            |
940
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
941
| setMetacatUrl        | ``public void setMetacatUrl(String metacatUrl);``                                                                                                                                                           | Set the MetacatUrl to which connections should be made.                                                                                   |
942
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
943
| setSessionId         | ``public void setSessionId(String sessionId);``                                                                                                                                                             | Set the session identifier for this session.                                                                                              |
944
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
945
| update               | ``public String update(String docid, Reader xmlDocument, Reader schema) throws InsufficientKarmaException, MetacatException, IOException, MetacatInaccessibleException;``                                   | Update an XML document in the repository by providing a new version of the XML document.                                                  |
946
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
947
| upload               | ``public String upload(String docid, File file) throws InsufficientKarmaException, MetacatException, IOException, MetacatInaccessibleException;``                                                           | Upload a data document into the repository.                                                                                               |
948
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
949
| upload               | ``public String publicupload(String docid, String fileName, InputStream fileData, int size) throws InsufficientKarmaException, MetacatException, IOException, MetacatInaccessibleException;``               | Upload a data document into the repository.                                                                                               |
950
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+