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 881 2001-12-18 19:50:12Z berkley $'
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
  <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;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
  in the group.  The operator can be UNION or INTERSECTION.  A &lt;queryterm&gt;
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 &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
          &lt;relation&gt;
127
            &lt;relationtype&gt;hasTransitiveRelationTo&lt;/relationtype&gt;
128
            &lt;relationdoc&gt;Metacat://dev.nceas.ucsb.edu:8090/Metacat?docid=nceas.43&lt;/relationdoc&gt;
129
            &lt;relationdoctype&gt;-//NCEAS//eml-file//EN&lt;/relationdoctype&gt;
130
          &lt;/relation&gt;
131
          &lt;relation&gt;
132
            &lt;relationtype&gt;isresourcemetadatafor&lt;/relationtype&gt;
133
            &lt;relationdoc&gt;http://www.nceas.ucsb.edu/marine/data/ambrose/surgras1.txt&lt;/relationdoc&gt;
134
            &lt;relationdoctype&gt;null&lt;/relationdoctype&gt;
135
          &lt;/relation&gt;
136
        &lt;/document&gt;  
137
        
138
        &lt;document&gt;
139
          &lt;docid&gt;nceas.42.1&lt;/docid&gt;
140
          &lt;docname&gt;resource&lt;/docname&gt;
141
          &lt;doctype&gt;-//NCEAS//resource//EN&lt;/doctype&gt;
142
          &lt;doctitle&gt;SLottia.txt&lt;/doctitle&gt;
143
          &lt;createdate&gt;2001-01-12 16:11:31.0&lt;/createdate&gt;
144
          &lt;updatedate&gt;2001-01-12 16:11:31.0&lt;/updatedate&gt;
145
          &lt;param name="resource/dataset/keywordInfo/keyword"&gt;lottia&lt;/param&gt;
146
          &lt;param name="resource/dataset/keywordInfo/keyword"&gt;intertidal&lt;/param&gt;
147
          &lt;param name="resource/dataset/keywordInfo/keyword"&gt;Orange&lt;/param&gt;
148
          &lt;relation&gt;
149
            &lt;relationtype&gt;hasTransitiveRelationTo&lt;/relationtype&gt;
150
            &lt;relationdoc&gt;Metacat://dev.nceas.ucsb.edu:8090/Metacat?docid=nceas.41&lt;/relationdoc&gt;
151
            &lt;relationdoctype&gt;-//NCEAS//eml-file//EN&lt;/relationdoctype&gt;
152
          &lt;/relation&gt;
153
          &lt;relation&gt;
154
            &lt;relationtype&gt;isresourcemetadatafor&lt;/relationtype&gt;
155
            &lt;relationdoc&gt;http://www.nceas.ucsb.edu/marine/data/murray/SLottia.txt&lt;/relationdoc&gt;
156
            &lt;relationdoctype&gt;null&lt;/relationdoctype&gt;
157
          &lt;/relation&gt;
158
        &lt;/document&gt;
159
      .....  
160
      &lt;/resultset&gt;
161
    
162
  </pre>
163
  <p>The first element in the resultset is &lt;query&gt;.  Its content is just 
164
  the pathquery document.  The resultset always returns 
165
  the pathquery document that created it in the &lt;query&gt; tag.  The next
166
  major tag is &lt;document&gt;.  Each XML document returned by the query
167
  is represented by a &lt;document&gt; tag.  The default document information returned
168
  is docid, docname, doctype, doctitle, createdate and  
169
  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.  &lt;relation&gt;
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>
181

    
(26-26/45)