Project

General

Profile

1 878 berkley
<!--
2
  * metacatquery.html
3
  *
4
  *      Authors: Jivka Bojilova
5
  *    Copyright: 2000 Regents of the University of California and the
6
  *               National Center for Ecological Analysis and Synthesis
7
  *  For Details: http://www.nceas.ucsb.edu/
8
  *      Created: 2000 April 5
9
  *      Version: 0.01
10
  *    File Info: '$Id$'
11
  *
12
  * October Meeting SDSC, 2000
13
-->
14
<HTML>
15
<HEAD>
16
<TITLE>Metacat</TITLE>
17
<link rel="stylesheet" type="text/css" href="@docrooturl@default.css">
18
</HEAD>
19
<BODY>
20
  <table width="100%">
21
    <tr>
22
      <td class="tablehead" colspan="2"><p class="label">Queries and Results</p></td>
23
      <td class="tablehead" colspan="2" align="right">
24
        <a href="./metacatload.html">Back</a> | <a href="./metacattour.html">Home</a> |
25
        <a href="./metacatread.html">Next</a>
26
      </td>
27
    </tr>
28
  </table>
29
  <P>The Metacat Server provides
30
  an interface for searching of metadata stored in the Metacat database.
31
  <P> <img alt="architecture diagram of a Metacat query" src="metadataquery.gif">
32 881 berkley
  <br><br><b>Steps to perform a query in Metacat</b>
33 878 berkley
  <ol>
34 881 berkley
    <li>A pathquery document is created from the search criteria provided through
35 878 berkley
    the servlet parameters.</li>
36
    <li>This pathquery document is sent to DBQuery where it
37
    is processed and translated into SQL statements.</li>
38
    <li>The SQL statements are executed against the database and the resultsets
39
    are translated into an xml document of doctype "resultset".</li>
40
    <li>The resultset document is either returned directly to the client as XML
41
    or is transformed through XSLT and returned as HTML.</li>
42
  </ol>
43
44
  <b>The Pathquery Document</b>
45
  <pre>
46
   &lt;pathquery version="1.0"&gt;
47
      &lt;meta_file_id&gt;unspecified&lt;/meta_file_id&gt;
48
      &lt;querytitle&gt;unspecified&lt;/querytitle&gt;
49
      &lt;returnfield&gt;resource/dataset/originator/individualName/surName&lt;/returnfield>
50
      &lt;returnfield&gt;resource/dataset/originator/individualName/givenName&lt;/returnfield>
51
      &lt;returnfield&gt;resource/dataset/keywordInfo/keyword&lt;/returnfield>
52
      &lt;returndoctype&gt;&lt;/returndoctype>
53
      &lt;querygroup operator="UNION"&gt;
54
        &lt;queryterm casesensitive="false" searchmode="contains"&gt;
55
          &lt;value>%&lt;/value&gt;
56
        &lt;/queryterm&gt;
57
        &lt;queryterm casesensitive="false" searchmode="contains"&gt;
58
          &lt;value&gt;-//NCEAS//resource//EN&lt;/value&gt;
59
          &lt;pathexpr&gt;returndoc&lt;/pathexpr&gt;
60
        &lt;/queryterm&gt;
61
        &lt;queryterm casesensitive="false" searchmode="contains"&gt;
62
          &lt;value&gt;-//NCEAS//eml-dataset//EN&lt;/value&gt;
63
          &lt;pathexpr&gt;returndoc&lt;/pathexpr&gt;
64
        &lt;/queryterm&gt;
65
      &lt;/querygroup&gt;
66
    &lt;/pathquery&gt;
67
  </pre>
68
69
  <p>The pathquery document was designed to be flexible enough to query specific
70
  fields of any XML document.  It also allows the client to specify which fields
71
  from a returned document are returned in the initial resultset.  Each
72
  &lt;returnfield&gt; parameter specifies a field which the DB will return
73
  for any query hit.  The returndoctype fields allows the client to limit the
74
  type of documents to be returned.  If left blank, all document types are returned.
75
  A &lt;querygroup&gt; creates an AND or an OR statement of the &lt;queryterm&gt;s
76 2476 costa
  in the group.  The operator can be UNION or INTERSECT.  A &lt;queryterm&gt;
77 878 berkley
  defines the actual field against which the query is being performed.  The value
78
  of the queryterm that we are quering for is encased in &lt;value&gt; tags.
79
  The &lt;pathexpr&gt; tag specifies an exact path to which you want to restrict
80
  the search.  A &lt;pathexpr&gt; tag which contains the keyword returndoc is
81
  a special case which is discussed in <a href="./packages.html">Packages and
82
  Relations</a>.</p><br>
83
84
  <b>The Resultset Document</b><br>
85
86
  <p>When the pathquery document is submitted and processed, Metacat returns
87
  another XML document called a resultset document.<p>
88
89
  <pre>
90
        &lt;resultset&gt;
91
        &lt;query&gt;
92
          &lt;pathquery version="1.0"&gt;
93
            &lt;meta_file_id&gt;unspecified&lt;/meta_file_id&gt;
94
            &lt;querytitle&gt;unspecified&lt;/querytitle&gt;
95
            &lt;returnfield&gt;resource/dataset/originator/individualName/surName&lt;/returnfield&gt;
96
            &lt;returnfield&gt;resource/dataset/originator/individualName/givenName&lt;/returnfield&gt;
97
            &lt;returnfield&gt;resource/dataset/keywordInfo/keyword&lt;/returnfield&gt;
98
            &lt;returndoctype&gt;&lt;/returndoctype&gt;
99
            &lt;querygroup operator="UNION"&gt;
100
              &lt;queryterm casesensitive="false" searchmode="contains"&gt;
101
                &lt;value&gt;%&lt;/value&gt;
102
              &lt;/queryterm&gt;
103
              &lt;queryterm casesensitive="false" searchmode="contains"&gt;
104
                &lt;value&gt;-//NCEAS//resource//EN&lt;/value&gt;
105
                &lt;pathexpr&gt;returndoc&lt;/pathexpr&gt;
106
              &lt;/queryterm&gt;
107
              &lt;queryterm casesensitive="false" searchmode="contains"&gt;
108
                &lt;value&gt;-//NCEAS//eml-dataset//EN&lt;/value&gt;
109
                &lt;pathexpr&gt;returndoc&lt;/pathexpr&gt;
110
              &lt;/queryterm&gt;
111
            &lt;/querygroup&gt;
112
          &lt;/pathquery&gt;
113
        &lt;/query&gt;
114
115
        &lt;document&gt;
116
          &lt;docid&gt;nceas.44.1&lt;/docid&gt;
117
          &lt;docname&gt;resource&lt;/docname&gt;
118
          &lt;doctype&gt;-//NCEAS//resource//EN&lt;/doctype&gt;
119
          &lt;doctitle&gt;Surgras1.txt&lt;/doctitle&gt;
120
          &lt;createdate&gt;2001-01-12 16:12:06.0&lt;/createdate&gt;
121
          &lt;updatedate&gt;2001-01-12 16:12:06.0&lt;/updatedate&gt;
122
          &lt;param name="resource/dataset/keywordInfo/keyword"&gt;surfgrass&lt;/param&gt;
123
          &lt;param name="resource/dataset/keywordInfo/keyword"&gt;intertidal&lt;/param&gt;
124
          &lt;param name="resource/dataset/keywordInfo/keyword"&gt;Ventura&lt;/param&gt;
125
          &lt;param name="resource/dataset/keywordInfo/keyword"&gt;Los Angeles&lt;/param&gt;
126 1987 tao
          &lt;triple&gt;
127
           &lt;subject&gt;nceas.46&lt;/subject&gt;
128
           &lt;relationship&gt;provides table-entity information for package&lt;/relationship&gt;
129
           &lt;object&gt;nceas.44&lt;/object&gt;
130
          &lt;/triple&gt;
131
          &lt;triple&gt;
132
            &lt;subject&gt;nceas.45&lt;/subject&gt;
133
            &lt;relationship&gt;provides eml-physical information for Table&lt;/relationship&gt;
134
            &lt;object&gt;nceas.46&lt;/object&gt;
135
          &lt;/triple&gt;
136
          &lt;triple&gt;
137
            &lt;subject&gt;nceas.47&lt;/subject&gt;
138
            &lt;relationship&gt;provides access control rules for&lt;/relationship&gt;
139
            &lt;object&gt;nceas.44&lt;/object&gt;
140
          &lt;/triple&gt;
141
          &lt;triple&gt;
142
            &lt;subject&gt;nceas.47&lt;/subject&gt;
143
            &lt;relationship&gt;provides access control rules for&lt;/relationship&gt;
144
            &lt;object&gt;nceas.45&lt;/object&gt;
145
          &lt;/triple&gt;
146
          &lt;triple&gt;
147
            &lt;subject&gt;nceas.47&lt;/subject&gt;
148
            &lt;relationship&gt;provides access control rules for&lt;/relationship&gt;
149
            &lt;object&gt;nceas.46&lt;/object&gt;
150
          &lt;/triple&gt;
151
         &lt;/document&gt;
152 878 berkley
153
        &lt;document&gt;
154
          &lt;docid&gt;nceas.42.1&lt;/docid&gt;
155
          &lt;docname&gt;resource&lt;/docname&gt;
156
          &lt;doctype&gt;-//NCEAS//resource//EN&lt;/doctype&gt;
157
          &lt;doctitle&gt;SLottia.txt&lt;/doctitle&gt;
158
          &lt;createdate&gt;2001-01-12 16:11:31.0&lt;/createdate&gt;
159
          &lt;updatedate&gt;2001-01-12 16:11:31.0&lt;/updatedate&gt;
160
          &lt;param name="resource/dataset/keywordInfo/keyword"&gt;lottia&lt;/param&gt;
161
          &lt;param name="resource/dataset/keywordInfo/keyword"&gt;intertidal&lt;/param&gt;
162
          &lt;param name="resource/dataset/keywordInfo/keyword"&gt;Orange&lt;/param&gt;
163 1987 tao
          &lt;triple&gt;
164
            &lt;subject&gt;nceas.41&lt;/subject&gt;
165
            &lt;relationship&gt;provides table-entity information for package&lt;/relationship&gt;
166
            &lt;object&gt;nceas.42&lt;/object&gt;
167
          &lt;/triple&gt;
168
          &lt;triple&gt;
169
            &lt;subject&gt;nceas.40&lt;/subject&gt;
170
            &lt;relationship&gt;provides eml-physical information for Table&lt;/relationship&gt;
171
            &lt;object&gt;nceas.41&lt;/object&gt;
172
          &lt;/triple&gt;
173
          &lt;triple&gt;
174
            &lt;subject&gt;nceas.39&lt;/subject&gt;
175
            &lt;relationship&gt;provides access control rules for&lt;/relationship&gt;
176
            &lt;object&gt;nceas.40&lt;/object&gt;
177
          &lt;/triple&gt;
178
          &lt;triple&gt;
179
            &lt;subject&gt;nceas.39&lt;/subject&gt;
180
            &lt;relationship&gt;provides access control rules for&lt;/relationship&gt;
181
            &lt;object&gt;nceas.41&lt;/object&gt;
182
          &lt;/triple&gt;
183
          &lt;triple&gt;
184
            &lt;subject&gt;nceas.39&lt;/subject&gt;
185
            &lt;relationship&gt;provides access control rules for&lt;/relationship&gt;
186
            &lt;object&gt;nceas.42&lt;/object&gt;
187
          &lt;/triple&gt;
188
       &lt;/document&gt;
189 878 berkley
      .....
190
      &lt;/resultset&gt;
191
192
  </pre>
193 881 berkley
  <p>The first element in the resultset is &lt;query&gt;.  Its content is just
194
  the pathquery document.  The resultset always returns
195 878 berkley
  the pathquery document that created it in the &lt;query&gt; tag.  The next
196
  major tag is &lt;document&gt;.  Each XML document returned by the query
197 881 berkley
  is represented by a &lt;document&gt; tag.  The default document information returned
198
  is docid, docname, doctype, doctitle, createdate and
199 878 berkley
  updatedate.  The param tags are present if the document found contained
200
  the returnfield chosen in the pathquery document.  The name attribute of the
201
  param tag is the full path to the node specified by the returnfield.  &lt;relation&gt;
202
  tags specify any documents to which the returned document is related.  Relations
203
  and packages are talked about <a href="./packages.html">later</a>.<p>
204
205
  <br>
206
  <a href="./metacatload.html">Back</a> | <a href="./metacattour.html">Home</a> |
207
  <a href="./metacatread.html">Next</a>
208
209
</BODY>
210
</HTML>