Project

General

Profile

1
<%@ page language="java"%>
2
<%@page import="java.util.List"%>
3
<%@page import="java.util.ArrayList"%>
4
<%@page import="org.ecoinformatics.sms.SMS"%>
5
<%@page import="org.ecoinformatics.sms.ontology.OntologyClass"%>
6

    
7
<%
8
/**
9
 * 
10
 * '$RCSfile$'
11
 * Copyright: 2008 Regents of the University of California and the
12
 *             National Center for Ecological Analysis and Synthesis
13
 *    '$Author: leinfelder $'
14
 *      '$Date: 2010-11-08 17:25:11 -0800 (Mon, 08 Nov 2010) $'
15
 * '$Revision: 5632 $'
16
 * 
17
 * This program is free software; you can redistribute it and/or modify
18
 * it under the terms of the GNU General Public License as published by
19
 * the Free Software Foundation; either version 2 of the License, or
20
 * (at your option) any later version.
21
 * 
22
 * This program is distributed in the hope that it will be useful,
23
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 * GNU General Public License for more details.
26
     
27
 * You should have received a copy of the GNU General Public License
28
 * along with this program; if not, write to the Free Software
29
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30
 */  
31
%>
32
<%
33

    
34
	//harvest parameters
35
	String[] entityParam = request.getParameterValues("entity");
36
	String[] characteristicParam = request.getParameterValues("characteristic");
37
	String[] standardParam = request.getParameterValues("standard");
38
	String[] protocolParam = request.getParameterValues("protocol");
39
	String[] measurementParam = request.getParameterValues("measurement");
40
	
41
	List<OntologyClass> activeEntities = new ArrayList<OntologyClass>();
42
	List<OntologyClass> activeCharacteristics = new ArrayList<OntologyClass>();
43
	List<OntologyClass> activeStandards = new ArrayList<OntologyClass>();
44
	List<OntologyClass> activeProtocols = new ArrayList<OntologyClass>();
45
	List<OntologyClass> activeMeasurements = new ArrayList<OntologyClass>();
46
	
47
	// Entity
48
	if (entityParam != null) {
49
		for (String entityString: entityParam) {
50
			OntologyClass e = new OntologyClass(entityString);
51
			activeEntities.add(e);
52
		}
53
	}
54
	// Characteristic
55
	if (characteristicParam != null) {
56
		for (String classString: characteristicParam) {
57
			OntologyClass c = new OntologyClass(classString);
58
			activeCharacteristics.add(c);
59
		}
60
	}
61
	// Standard
62
	if (standardParam != null) {
63
		for (String classString: standardParam) {
64
			OntologyClass c = new OntologyClass(classString);
65
			activeStandards.add(c);
66
		}
67
	}
68
	// Protocol
69
	if (protocolParam != null) {
70
		for (String classString: protocolParam) {
71
			OntologyClass c = new OntologyClass(classString);
72
			activeProtocols.add(c);
73
		}
74
	}
75
	// Measurement
76
	// TODO: implement measurement expansion
77
	
78
	// construct the selection fields for existing annotations
79
	// Entity
80
	StringBuffer entityOptions = new StringBuffer();
81
	List<OntologyClass> entities = SMS.getInstance().getAnnotationManager().getActiveEntities(activeCharacteristics, activeStandards);
82
	for (OntologyClass oc: entities) {
83
		entityOptions.append("<option ");
84
		entityOptions.append("title='");
85
		entityOptions.append(oc.getURI());
86
		entityOptions.append("' ");
87
		entityOptions.append("value='");
88
		entityOptions.append(oc.getURI());
89
		entityOptions.append("'");
90
		entityOptions.append(">");
91
		entityOptions.append(oc.getName());
92
		entityOptions.append("</option>");
93
	}
94
	// Characteristic
95
	StringBuffer characteristicOptions = new StringBuffer();
96
	List<OntologyClass> characteristics = SMS.getInstance().getAnnotationManager().getActiveCharacteristics(activeEntities, activeStandards);
97
	for (OntologyClass oc: characteristics) {
98
		characteristicOptions.append("<option ");
99
		characteristicOptions.append("title='");
100
		characteristicOptions.append(oc.getURI());
101
		characteristicOptions.append("' ");
102
		characteristicOptions.append("value='");
103
		characteristicOptions.append(oc.getURI());
104
		characteristicOptions.append("'");
105
		characteristicOptions.append(">");
106
		characteristicOptions.append(oc.getName());
107
		characteristicOptions.append("</option>");
108
	}
109
	// Standard
110
	StringBuffer standardOptions = new StringBuffer();
111
	List<OntologyClass> standards = SMS.getInstance().getAnnotationManager().getActiveStandards(activeEntities, activeCharacteristics);
112
	for (OntologyClass oc: standards) {
113
		standardOptions.append("<option ");
114
		standardOptions.append("title='");
115
		standardOptions.append(oc.getURI());
116
		standardOptions.append("' ");
117
		standardOptions.append("value='");
118
		standardOptions.append(oc.getURI());
119
		standardOptions.append("'");
120
		standardOptions.append(">");
121
		standardOptions.append(oc.getName());
122
		standardOptions.append("</option>");
123
	}
124
	// Protocol TODO: filtering
125
	StringBuffer protocolOptions = new StringBuffer();
126
	List<OntologyClass> protocols = SMS.getInstance().getAnnotationManager().getActiveProtocols();
127
	for (OntologyClass oc: protocols) {
128
		protocolOptions.append("<option ");
129
		protocolOptions.append("title='");
130
		protocolOptions.append(oc.getURI());
131
		protocolOptions.append("' ");
132
		protocolOptions.append("value='");
133
		protocolOptions.append(oc.getURI());
134
		protocolOptions.append("'");
135
		protocolOptions.append(">");
136
		protocolOptions.append(oc.getName());
137
		protocolOptions.append("</option>");
138
	}
139
	// Measurement TODO: filtering
140
	StringBuffer measurementOptions = new StringBuffer();
141
	List<OntologyClass> measurements = SMS.getInstance().getAnnotationManager().getActiveMeasurements();
142
	for (OntologyClass oc: measurements) {
143
		measurementOptions.append("<option ");
144
		measurementOptions.append("title='");
145
		measurementOptions.append(oc.getURI());
146
		measurementOptions.append("' ");
147
		measurementOptions.append("value='");
148
		measurementOptions.append(oc.getURI());
149
		measurementOptions.append("'");
150
		measurementOptions.append(">");
151
		measurementOptions.append(oc.getName());
152
		measurementOptions.append("</option>");
153
	}
154
%>
155

    
156
<%@ include file="../../common/common-settings.jsp"%>
157
<%@ include file="../../common/configure-check.jsp"%>
158

    
159
<html>
160
<head>
161
<title>Semantic search</title>
162
<link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/semtools/semtools.css">
163
<script type="text/javascript"
164
	src="<%=STYLE_SKINS_URL%>/semtools/search.js"></script>
165

    
166
<script type="text/javascript">
167
                    	    // Set defaults for this installation
168
                    	    //var BP_SEARCH_SERVER = "http://oor-01.cim3.net";
169
                    	    //var BP_SITE = "Sandbox";
170
                    	    //var BP_ORG = "OOR";
171
                    	  </script>
172
<script language="Javascript" type="text/JavaScript"
173
	src="<%=STYLE_SKINS_URL%>/semtools/bioportal/form_complete.js">
174
</script>
175

    
176
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/semtools.js"></script>
177
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/branding.js"></script>
178

    
179
</head>
180
<body>
181
<script language="javascript">
182
	insertTemplateOpening("<%=CONTEXT_URL%>");
183
</script>
184

    
185
<div id="content_wrapper">
186

    
187
<h2>Annotation-based search</h2>
188

    
189
<form method="POST" action="<%=SERVLET_URL%>" target="_top" id="searchForm" name="searchForm" onSubmit="return checkSearch(this)">
190
	<input name="query" type="hidden" />
191
	<input name="qformat" value="semtools" type="hidden" />
192
	<input name="action" value="semquery" type="hidden" />
193

    
194
	<table class="group group_border">
195
		<tr>
196
			<th colspan="3">
197
				<p>
198
					Locate <b>data packages</b> that have been semantically annotated within the observation model by
199
					selecting concepts from
200
					<br/>
201
					(a) existing semantic annotations
202
					<br/>
203
					(b) registered OBOE extension ontologies
204
				</p>
205
			</th>
206
		</tr>
207
		<!--  measurement -->
208
		<tr>
209
			<td colspan="3">
210
				<table class="subGroup subGroup_border onehundred_percent">
211
					<tr>
212
						<th colspan="2">
213
							Measurement
214
						</th>
215
					</tr>
216
					<tr>
217
						<td>a template that defines Entity, Characteristic, Standard, and/or Protocol</td>
218
					</tr>
219
					<tr>
220
						<td>
221
							<select name="dynamicValue" id="dynamicValue" multiple="multiple" size="5" style="width: 100%">
222
								<%=measurementOptions %>
223
							</select>
224
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement"/>
225
						</td>
226
					</tr>
227
					<tr>
228
						<td colspan="1">
229
							<input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="60" />
230
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement"/>
231
						</td>
232
					</tr>
233
				</table>
234
			</td>
235
		</tr>
236
		<tr>
237
			<td>
238
				<table class="subGroup subGroup_border">
239
					<tr>
240
						<th colspan="1">
241
							Entity
242
						</th>
243
					</tr>
244
					<tr>
245
						<td>Find observations of</td>
246
					</tr>
247
					<tr>
248
						<td>
249
							(a)
250
							<select name="dynamicValue" id="dynamicValue" multiple="multiple" size="5" style="width: 216px">
251
								<%=entityOptions %>
252
							</select>
253
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity"/>
254
						</td>
255
					</tr>
256
					<tr>
257
						<td colspan="1">
258
							(b)
259
							<input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="30" />
260
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity"/>
261
						</td>
262
					</tr>
263
				</table>
264
			</td>
265
			<td>
266
				<table class="subGroup subGroup_border">
267
					<tr>
268
						<th colspan="1">
269
							Characteristic
270
						</th>
271
					</tr>
272
					<tr>
273
						<td>with measurements of</td>
274
					</tr>
275
					<tr>
276
						<td>
277
							<select name="dynamicValue" id="dynamicValue" multiple="multiple" size="5" style="width: 216px">
278
								<%=characteristicOptions %>
279
							</select>
280
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic"/>
281
						</td>
282
					</tr>
283
					<tr>
284
						<td colspan="1">
285
							<input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="30" />
286
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic"/>
287
						</td>
288
					</tr>
289
				</table>
290
			</td>
291
			<!-- removing Standard
292
			<td>
293
				<table class="subGroup subGroup_border">
294
					<tr>
295
						<th colspan="1">
296
							Standard
297
						</th>
298
					</tr>
299
					<tr>
300
						<td>were recorded in units of</td>
301
					</tr>
302
					<tr>
303
						<td>
304
							<select name="dynamicValue" id="dynamicValue" multiple="multiple" size="5" style="width: 216px">
305
								<%=standardOptions %>
306
							</select>
307
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Standard"/>
308
						</td>
309
					</tr>
310
					<tr>
311
						<td colspan="1">
312
							<input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="30" />
313
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Standard"/>
314
						</td>
315
					</tr>
316
				</table>
317
			</td>
318
			-->
319
			<td>
320
				<table class="subGroup subGroup_border">
321
					<tr>
322
						<th colspan="1">
323
							Protocol
324
						</th>
325
					</tr>
326
					<tr>
327
						<td>using procedures outlined by</td>
328
					</tr>
329
					<tr>
330
						<td>
331
							<select name="dynamicValue" id="dynamicValue" multiple="multiple" size="5" style="width: 216px">
332
								<%=protocolOptions %>
333
							</select>
334
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol"/>
335
						</td>
336
					</tr>
337
					<tr>
338
						<td colspan="1">
339
							<input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="30" />
340
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol"/>
341
						</td>
342
					</tr>
343
				</table>
344
			</td>
345
		</tr>
346
		<tr>
347
			<td colspan="3">Match All? <input type="checkbox" name="matchAll" checked="checked"/></td>
348
		</tr>
349
		<tr>
350
			<td colspan="3">From same Observation? <input type="checkbox" name="strict"/></td>
351
		</tr>
352
		<tr>
353
			<td colspan="3"><input type="submit" value="Search"/></td>
354
		</tr>
355
	</table>
356
		<!-- 
357
		<tr>
358
			<td>Entity: (SBC only)</td>
359
			<td><input type="text" name="entity" class="bp_form_complete-1523-uri" size="100" /></td>
360
		</tr>
361
		 -->		
362
</form>
363

    
364
<!-- Included default search/login -->
365
<% if ( PropertyService.getProperty("spatial.runSpatialOption").equals("true") ) { %>
366
<script language="javascript">
367
	insertMap("<%=CONTEXT_URL%>");
368
</script>
369
<br/>
370
<% } %>
371
  
372
<script language="javascript">
373
	insertSearchBox("<%=CONTEXT_URL%>");
374
	insertLoginBox("<%=CONTEXT_URL%>");	
375
</script>
376

    
377
</div>
378

    
379
<script language="javascript">
380
	insertTemplateClosing("<%=CONTEXT_URL%>");
381
</script>
382

    
383
</body>
384
</html>
(5-5/14)