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 |
|
|
<pathquery version="1.0">
|
47 |
|
|
<meta_file_id>unspecified</meta_file_id>
|
48 |
|
|
<querytitle>unspecified</querytitle>
|
49 |
|
|
<returnfield>resource/dataset/originator/individualName/surName</returnfield>
|
50 |
|
|
<returnfield>resource/dataset/originator/individualName/givenName</returnfield>
|
51 |
|
|
<returnfield>resource/dataset/keywordInfo/keyword</returnfield>
|
52 |
|
|
<returndoctype></returndoctype>
|
53 |
|
|
<querygroup operator="UNION">
|
54 |
|
|
<queryterm casesensitive="false" searchmode="contains">
|
55 |
|
|
<value>%</value>
|
56 |
|
|
</queryterm>
|
57 |
|
|
<queryterm casesensitive="false" searchmode="contains">
|
58 |
|
|
<value>-//NCEAS//resource//EN</value>
|
59 |
|
|
<pathexpr>returndoc</pathexpr>
|
60 |
|
|
</queryterm>
|
61 |
|
|
<queryterm casesensitive="false" searchmode="contains">
|
62 |
|
|
<value>-//NCEAS//eml-dataset//EN</value>
|
63 |
|
|
<pathexpr>returndoc</pathexpr>
|
64 |
|
|
</queryterm>
|
65 |
|
|
</querygroup>
|
66 |
|
|
</pathquery>
|
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 |
|
|
<returnfield> 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 <querygroup> creates an AND or an OR statement of the <queryterm>s
|
76 |
|
|
in the group. The operator can be UNION or INTERSECTION. A <queryterm>
|
77 |
|
|
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 <value> tags.
|
79 |
|
|
The <pathexpr> tag specifies an exact path to which you want to restrict
|
80 |
|
|
the search. A <pathexpr> 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 |
|
|
<resultset>
|
91 |
|
|
<query>
|
92 |
|
|
<pathquery version="1.0">
|
93 |
|
|
<meta_file_id>unspecified</meta_file_id>
|
94 |
|
|
<querytitle>unspecified</querytitle>
|
95 |
|
|
<returnfield>resource/dataset/originator/individualName/surName</returnfield>
|
96 |
|
|
<returnfield>resource/dataset/originator/individualName/givenName</returnfield>
|
97 |
|
|
<returnfield>resource/dataset/keywordInfo/keyword</returnfield>
|
98 |
|
|
<returndoctype></returndoctype>
|
99 |
|
|
<querygroup operator="UNION">
|
100 |
|
|
<queryterm casesensitive="false" searchmode="contains">
|
101 |
|
|
<value>%</value>
|
102 |
|
|
</queryterm>
|
103 |
|
|
<queryterm casesensitive="false" searchmode="contains">
|
104 |
|
|
<value>-//NCEAS//resource//EN</value>
|
105 |
|
|
<pathexpr>returndoc</pathexpr>
|
106 |
|
|
</queryterm>
|
107 |
|
|
<queryterm casesensitive="false" searchmode="contains">
|
108 |
|
|
<value>-//NCEAS//eml-dataset//EN</value>
|
109 |
|
|
<pathexpr>returndoc</pathexpr>
|
110 |
|
|
</queryterm>
|
111 |
|
|
</querygroup>
|
112 |
|
|
</pathquery>
|
113 |
|
|
</query>
|
114 |
|
|
|
115 |
|
|
<document>
|
116 |
|
|
<docid>nceas.44.1</docid>
|
117 |
|
|
<docname>resource</docname>
|
118 |
|
|
<doctype>-//NCEAS//resource//EN</doctype>
|
119 |
|
|
<doctitle>Surgras1.txt</doctitle>
|
120 |
|
|
<createdate>2001-01-12 16:12:06.0</createdate>
|
121 |
|
|
<updatedate>2001-01-12 16:12:06.0</updatedate>
|
122 |
|
|
<param name="resource/dataset/keywordInfo/keyword">surfgrass</param>
|
123 |
|
|
<param name="resource/dataset/keywordInfo/keyword">intertidal</param>
|
124 |
|
|
<param name="resource/dataset/keywordInfo/keyword">Ventura</param>
|
125 |
|
|
<param name="resource/dataset/keywordInfo/keyword">Los Angeles</param>
|
126 |
|
|
<relation>
|
127 |
|
|
<relationtype>hasTransitiveRelationTo</relationtype>
|
128 |
|
|
<relationdoc>Metacat://dev.nceas.ucsb.edu:8090/Metacat?docid=nceas.43</relationdoc>
|
129 |
|
|
<relationdoctype>-//NCEAS//eml-file//EN</relationdoctype>
|
130 |
|
|
</relation>
|
131 |
|
|
<relation>
|
132 |
|
|
<relationtype>isresourcemetadatafor</relationtype>
|
133 |
|
|
<relationdoc>http://www.nceas.ucsb.edu/marine/data/ambrose/surgras1.txt</relationdoc>
|
134 |
|
|
<relationdoctype>null</relationdoctype>
|
135 |
|
|
</relation>
|
136 |
|
|
</document>
|
137 |
|
|
|
138 |
|
|
<document>
|
139 |
|
|
<docid>nceas.42.1</docid>
|
140 |
|
|
<docname>resource</docname>
|
141 |
|
|
<doctype>-//NCEAS//resource//EN</doctype>
|
142 |
|
|
<doctitle>SLottia.txt</doctitle>
|
143 |
|
|
<createdate>2001-01-12 16:11:31.0</createdate>
|
144 |
|
|
<updatedate>2001-01-12 16:11:31.0</updatedate>
|
145 |
|
|
<param name="resource/dataset/keywordInfo/keyword">lottia</param>
|
146 |
|
|
<param name="resource/dataset/keywordInfo/keyword">intertidal</param>
|
147 |
|
|
<param name="resource/dataset/keywordInfo/keyword">Orange</param>
|
148 |
|
|
<relation>
|
149 |
|
|
<relationtype>hasTransitiveRelationTo</relationtype>
|
150 |
|
|
<relationdoc>Metacat://dev.nceas.ucsb.edu:8090/Metacat?docid=nceas.41</relationdoc>
|
151 |
|
|
<relationdoctype>-//NCEAS//eml-file//EN</relationdoctype>
|
152 |
|
|
</relation>
|
153 |
|
|
<relation>
|
154 |
|
|
<relationtype>isresourcemetadatafor</relationtype>
|
155 |
|
|
<relationdoc>http://www.nceas.ucsb.edu/marine/data/murray/SLottia.txt</relationdoc>
|
156 |
|
|
<relationdoctype>null</relationdoctype>
|
157 |
|
|
</relation>
|
158 |
|
|
</document>
|
159 |
|
|
.....
|
160 |
|
|
</resultset>
|
161 |
|
|
|
162 |
|
|
</pre>
|
163 |
881
|
berkley
|
<p>The first element in the resultset is <query>. Its content is just
|
164 |
|
|
the pathquery document. The resultset always returns
|
165 |
878
|
berkley
|
the pathquery document that created it in the <query> tag. The next
|
166 |
|
|
major tag is <document>. Each XML document returned by the query
|
167 |
881
|
berkley
|
is represented by a <document> tag. The default document information returned
|
168 |
|
|
is docid, docname, doctype, doctitle, createdate and
|
169 |
878
|
berkley
|
updatedate. The param tags are present if the document found contained
|
170 |
|
|
the returnfield chosen in the pathquery document. The name attribute of the
|
171 |
|
|
param tag is the full path to the node specified by the returnfield. <relation>
|
172 |
|
|
tags specify any documents to which the returned document is related. Relations
|
173 |
|
|
and packages are talked about <a href="./packages.html">later</a>.<p>
|
174 |
|
|
|
175 |
|
|
<br>
|
176 |
|
|
<a href="./metacatload.html">Back</a> | <a href="./metacattour.html">Home</a> |
|
177 |
|
|
<a href="./metacatread.html">Next</a>
|
178 |
|
|
|
179 |
|
|
</BODY>
|
180 |
|
|
</HTML>
|