Project

General

Profile

1
<!--
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: metacatquery.html 3784 2008-04-03 21:35:51Z tao $'
11
  * 
12
  * October Meeting SDSC, 2000
13
-->
14
<HTML>
15
<HEAD>
16
<TITLE>Metacat</TITLE>
17
<link rel="stylesheet" type="text/css" href="./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
  <br><br><b>Steps to perform a query in Metacat</b>
33
  <ol>
34
    <li>A pathquery document is created from the search criteria provided through
35
    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;dataset/title&lt;/returnfield&gt;
50
      &lt;returnfield&gt;keyword&lt;/returnfield&gt;
51
      &lt;returnfield&gt;originator/individualName/surName&lt;/returnfield&gt;
52
      &lt;returndoctype&gt;eml://ecoinformatics.org/eml-2.0.1&lt;/returndoctype&gt;
53
      &lt;returndoctype&gt;eml://ecoinformatics.org/eml-2.0.0&lt;/returndoctype&gt;
54
      &lt;querygroup operator="UNION"&gt;
55
        &lt;queryterm casesensitive="false" searchmode="contains"&gt;
56
          &lt;value&gt;Plant&lt;/value&gt;
57
          &lt;pathexpr&gt;dataset/title&lt;/pathexpr&gt;
58
        &lt;/queryterm&gt;
59
        &lt;queryterm casesensitive="false" searchmode="contains"&gt;
60
          &lt;value&gt;plant&lt;/value&gt;
61
          &lt;pathexpr&gt;keyword&lt;/pathexpr&gt;
62
        &lt;/queryterm&gt;
63
      &lt;/querygroup&gt;
64
  &lt;/pathquery&gt;
65
  </pre>
66
  
67
  <p>The pathquery document was designed to be flexible enough to query specific
68
  fields of any XML document.  It also allows the client to specify which fields
69
  from a returned document are returned in the initial resultset.  Each
70
  &lt;returnfield&gt; parameter specifies a field which the DB will return
71
  for any query hit.  The returndoctype fields allows the client to limit the 
72
  type of documents to be returned.  If no returndoctype element , all document types are returned.
73
  A &lt;querygroup&gt; creates an AND or an OR statement of the &lt;queryterm&gt;s
74
  in the group.  The operator can be UNION or INTERSECT.  A &lt;queryterm&gt;
75
  defines the actual field against which the query is being performed.  The value
76
  of the queryterm that we are quering for is encased in &lt;value&gt; tags.
77
  The &lt;pathexpr&gt; tag specifies an exact path to which you want to restrict
78
  the search.  A &lt;pathexpr&gt; tag which contains the keyword returndoc is 
79
  a special case which is discussed in <a href="./packages.html">Packages and 
80
  Relations</a>.</p><br>
81
  
82
  <b>The Resultset Document</b><br>
83
  
84
  <p>When the pathquery document is submitted and processed, Metacat returns
85
  another XML document called a resultset document.<p>
86
  
87
  <pre>
88
      &lt;resultset&gt;
89
        &lt;query&gt;
90
          &lt;pathquery version="1.0"&gt;
91
            &lt;meta_file_id&gt;unspecified&lt;/meta_file_id&gt;
92
            &lt;querytitle&gt;unspecified&lt;/querytitle&gt;
93
            &lt;returnfield&gt;dataset/title&lt;/returnfield&gt;
94
            &lt;returnfield&gt;keyword&lt;/returnfield&gt;
95
            &lt;returnfield&gt;originator/individualName/surName&lt;/returnfield&gt;
96
            &lt;returndoctype&gt;eml://ecoinformatics.org/eml-2.0.1&lt;/returndoctype&gt;
97
            &lt;returndoctype&gt;eml://ecoinformatics.org/eml-2.0.0&lt;/returndoctype&gt;
98
            &lt;querygroup operator="UNION"&gt;
99
                  &lt;queryterm casesensitive="false" searchmode="contains"&gt;
100
                      &lt;value&gt;Datos&lt;/value&gt;
101
                      &lt;pathexpr&gt;dataset/title&lt;/pathexpr&gt;
102
                  &lt;/queryterm&gt;
103
                  &lt;queryterm casesensitive="false" searchmode="contains"&gt;
104
                     &lt;value&gt;plant&lt;/value&gt;
105
                     &lt;pathexpr&gt;keyword&lt;/pathexpr&gt;
106
                  &lt;/queryterm&gt;
107
           &lt;/querygroup&gt;
108
         &lt;/pathquery&gt;
109
        &lt;/query&gt;  
110
      
111
        &lt;document&gt;
112
          &lt;docid&gt;nceas.44.1&lt;/docid&gt;
113
          &lt;docname&gt;resource&lt;/docname&gt;
114
          &lt;doctype&gt;eml://ecoinformatics.org/eml-2.0.1&lt;/doctype&gt;
115
          &lt;createdate&gt;2001-01-12 16:12:06.0&lt;/createdate&gt;
116
          &lt;updatedate&gt;2001-01-12 16:12:06.0&lt;/updatedate&gt;
117
          &lt;param name="dataset/title"&gt;Datos Meteorologicos&lt;/param&gt;
118
          &lt;param name="keyword"&gt;intertidal&lt;/param&gt;
119
          &lt;param name="originator/individualName/surName"&gt;Smith&lt;/param&gt;
120
        &lt;/document&gt;  
121
        
122
        &lt;document&gt;
123
          &lt;docid&gt;nceas.42.1&lt;/docid&gt;
124
          &lt;docname&gt;resource&lt;/docname&gt;
125
          &lt;doctype&gt;eml://ecoinformatics.org/eml-2.0.1&lt;/doctype&gt;
126
          &lt;createdate&gt;2001-01-12 16:11:31.0&lt;/createdate&gt;
127
          &lt;updatedate&gt;2001-01-12 16:11:31.0&lt;/updatedate&gt;
128
          &lt;param name="dataset/title"&gt;Ocean Surface Temperature&lt;/param&gt;
129
          &lt;param name="keyword"&gt;Plant&lt;/param&gt;
130
          &lt;param name="originator/individualName/surName"&gt;Henry&lt;/param&gt;   
131
       &lt;/document&gt;
132
      .....  
133
      &lt;/resultset&gt;
134
    
135
  </pre>
136
  <p>The first element in the resultset is &lt;query&gt;.  Its content is just 
137
  the pathquery document.  The resultset always returns 
138
  the pathquery document that created it in the &lt;query&gt; tag.  The next
139
  major tag is &lt;document&gt;.  Each XML document returned by the query
140
  is represented by a &lt;document&gt; tag.  The default document information returned
141
  is docid, docname, doctype, doctitle, createdate and  
142
  updatedate.  The param tags are present if the document found contained
143
  the returnfield chosen in the pathquery document.  The name attribute of the
144
  param tag is the full path to the node specified by the returnfield. <p>
145
  
146
  <br>
147
  <a href="./metacatload.html">Back</a> | <a href="./metacattour.html">Home</a> | 
148
  <a href="./metacatread.html">Next</a>
149

    
150
</BODY>
151
</HTML>
152

    
(35-35/57)