Project

General

Profile

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

    
28
<%@ include file="../../common/common-settings.jsp"%>
29
<%@ include file="../../common/configure-check.jsp"%>
30

    
31
<html>
32
<head>
33
<title>Semantic search</title>
34
<link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/semtools/semtools.css">
35
<script type="text/javascript"
36
	src="<%=STYLE_SKINS_URL%>/semtools/search.js"></script>
37

    
38
<script type="text/javascript">
39
                    	    // Set defaults for this installation
40
                    	    //var BP_SEARCH_SERVER = "http://oor-01.cim3.net";
41
                    	    //var BP_SITE = "Sandbox";
42
                    	    //var BP_ORG = "OOR";
43
                    	  </script>
44
<!--  
45
<script language="Javascript" type="text/JavaScript" src="<%=STYLE_SKINS_URL%>/semtools/bioportal/form_complete.js"></script>
46
-->
47
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/jsTree/_lib/jquery.js"></script>
48
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/jsTree/_lib/jquery.cookie.js"></script>
49
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/jsTree/jquery.jstree.js"></script>
50
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/semtools.js"></script>
51
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/branding.js"></script>
52

    
53
<script language="Javascript" type="text/JavaScript"><!--
54
function populateActiveDomain(divId, class) {
55
	// collect the filtering values we have so far
56
	// these are hidden input fields in the form for holding the selected values
57
	var entity = $("#activeEntitiesValue").val() ? $("#activeEntitiesValue").val() : "";
58
	var characteristic = $("#activeCharacteristicsValue").val() ? $("#activeCharacteristicsValue").val() : "";
59
	var protocol = $("#activeProtocolsValue").val() ? $("#activeProtocolsValue").val() : "";
60
	var measurement = $("#activeMeasurementsValue").val() ? $("#activeMeasurementsValue").val() : "";
61
	
62
	// TODO: remember the selected value for this when filtering by active domain
63
	var selectedNode = $("#" + divId).jstree("get_selected", $("#" + divId));
64
	var selectedNodeId = $(selectedNode).attr("id");
65
	//alert(divId + " selected node: " + selectedNodeId);
66
	
67
	// load the tree for the given div, passing in the other filtered values
68
	$("#" + divId).load(
69
		"<%=SERVLET_URL%>", 
70
		{
71
			'action': "getactivedomain",
72
			'class': class,
73
			'entity': entity,
74
			'characteristic': characteristic,
75
			'protocol': protocol,
76
			'measurement': measurement
77
		},
78
		// call back function when loading finishes
79
		function(response, status, xhr) {
80
			//alert("callback for: " + divId + " selected node: " + selectedNodeId);
81
			// error
82
			if (status == "error") {
83
				var msg = "Sorry but there was an error: ";
84
				$("#error").html(msg + xhr.status + " " + xhr.statusText);
85
			}
86
 
87
			// make it a js tree
88
			$(function () {
89
				$("#" + divId)
90
					.jstree({
91
						"ui" : {
92
							"select_limit" : 1,
93
							"select_multiple_modifier" : "alt",
94
							"selected_parent_close" : "select_parent"//,
95
							//"initially_select" : [ selectedNodeId ]
96
						},				
97
						//"core" : { "initially_open" : [ selectedNodeId ] },
98
						"search" : { "case_insensitive" : true },
99
						"plugins" : [ "themes", "html_data", "ui", "cookies", "search" ]
100
					});
101
			});
102

    
103
			// enable searching on it
104
			$("#" + divId + "Search").keyup(
105
				function () {
106
					if ($("#" + divId + "Search").val().length >= 3) {
107
						$("#" + divId).jstree("search", $("#" + divId + "Search").val());
108
					}
109
				});
110

    
111
			// TODO: try to select the original node after refresh with active domain
112
			//$("#" + divId).jstree("open_node", $(selectedNode));
113
			//$("#" + divId).jstree("select_node", $(selectedNode));
114
		});
115
}
116
function initialize(source) {
117
	// we don't want to reload the source of the filtering request
118
	// but we do want to reload the other trees for active domains
119
	// we reload all of them if no source is given - first time the page loads
120
	if (source) {
121
		source = $(source).attr("id");
122
	}
123
	if (!source) {
124
		source = "";
125
	}
126
	if (source != 'activeEntities') {
127
		populateActiveDomain('activeEntities', 'org.ecoinformatics.sms.annotation.Entity');
128
	}
129
	if (source != 'activeCharacteristics') {
130
		populateActiveDomain('activeCharacteristics', 'org.ecoinformatics.sms.annotation.Characteristic');
131
	}
132
	if (source != 'activeProtocols') {
133
		populateActiveDomain('activeProtocols', 'org.ecoinformatics.sms.annotation.Protocol');
134
	}
135
	if (source != 'activeMeasurements') {
136
		populateActiveDomain('activeMeasurements', 'org.ecoinformatics.sms.annotation.Measurement');
137
	}
138
}
139
function select(item) {
140

    
141
	// get the selected value, stored in the title attribute of the item <a> tag
142
	var value = $(item).attr("title");
143
	//alert("value: " + value);
144
	
145
	// get the parent div so we know what kind of class it is meant to filter
146
	// this is "the first parent of the class 'select'"
147
	var parent = $(item).parents("div.select:first");
148
	//alert("parent: " + parent);
149
	
150
	// set the value for the hidden input value
151
	// the input field of class "value" will hold it, this way we don't need to know the id
152
	var input = $(parent).children("input.value");
153
	$(input).val(value);
154
	//alert("input: " + input);
155

    
156
	// refresh the other trees for active domain after this filtering action
157
	// TODO actually do the active domain filtering when selection is made
158
	//initialize($(parent).children("div"));
159
}
160
function donothing() {}
161
--></script>
162

    
163
</head>
164
<body onload="initialize()">
165
<script language="javascript">
166
	insertTemplateOpening("<%=CONTEXT_URL%>");
167
</script>
168

    
169
<div id="content_wrapper">
170

    
171
<h2>Annotation-based search</h2>
172

    
173
<div id="error">
174
	<!-- error messages here -->
175
</div>
176

    
177
<form method="POST" action="<%=SERVLET_URL%>" target="_top" id="searchForm" name="searchForm" onSubmit="return checkSearch(this)">
178
	<input name="query" type="hidden" />
179
	<input name="qformat" value="semtools" type="hidden" />
180
	<input name="action" value="semquery" type="hidden" />
181

    
182
	<table class="group group_border">
183
		<tr>
184
			<th colspan="3">
185
				<p>
186
					Locate <b>data packages</b> that have been semantically annotated within the observation model by
187
					selecting concepts from
188
					<br/>
189
					(a) existing semantic annotations
190
					<br/>
191
					(b) registered OBOE extension ontologies
192
				</p>
193
			</th>
194
		</tr>
195
		<!--  measurement -->
196
		<tr>
197
			<td colspan="3">
198
				<table class="subGroup subGroup_border onehundred_percent">
199
					<tr>
200
						<th colspan="2">
201
							Measurement
202
						</th>
203
					</tr>
204
					<tr>
205
						<td>a template that defines Entity, Characteristic, Standard, and/or Protocol</td>
206
					</tr>
207
					<tr>
208
						<td>
209
							<input type="text" id="activeMeasurementsSearch" />
210
							<div class="select">
211
								<div name="activeMeasurements" id="activeMeasurements" multiple="multiple" size="5" style="width: 100%" onchange="initialize(this)">
212
									<p>loading...</p>
213
								</div>
214
								<input type="hidden" class="value" name="activeMeasurementsValue" id="activeMeasurementsValue"/>
215
								<input type="hidden" name="activeMeasurementsClass" id="activeMeasurementsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement"/>
216
							</div>
217
						</td>
218
					</tr>
219
					<tr>
220
						<td colspan="1">
221
							<input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="60" />
222
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement"/>
223
						</td>
224
					</tr>
225
				</table>
226
			</td>
227
		</tr>
228
		<tr>
229
			<td>
230
				<table class="subGroup subGroup_border">
231
					<tr>
232
						<th colspan="1">
233
							Entity
234
						</th>
235
					</tr>
236
					<tr>
237
						<td>Find observations of</td>
238
					</tr>
239
					<tr>
240
						<td>
241
							<input type="text" id="activeEntitiesSearch" />
242
							<div class="select">
243
								<div name="activeEntities" id="activeEntities" multiple="multiple" size="5" style="width: 216px" onchange="initialize(this)">
244
									<p>loading...</p>
245
								</div>
246
								<input type="hidden" class="value" name="activeEntitiesValue" id="activeEntitiesValue"/>
247
								<input type="hidden" name="activeEntitiesClass" id="activeEntitiesClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity"/>
248
							</div>
249
						</td>
250
					</tr>
251
					<tr>
252
						<td colspan="1">
253
							<input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="30" />
254
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity"/>
255
						</td>
256
					</tr>
257
				</table>
258
			</td>
259
			<td>
260
				<table class="subGroup subGroup_border">
261
					<tr>
262
						<th colspan="1">
263
							Characteristic
264
						</th>
265
					</tr>
266
					<tr>
267
						<td>with measurements of</td>
268
					</tr>
269
					<tr>
270
						<td>
271
							<input type="text" id="activeCharacteristicsSearch" />
272
							<div class="select">
273
								<div name="activeCharacteristics" id="activeCharacteristics" multiple="multiple" size="5" style="width: 216px" onchange="initialize(this)">
274
									<p>loading...</p>
275
								</div>
276
								<input type="hidden" class="value" name="activeCharacteristicsValue" id="activeCharacteristicsValue"/>
277
								<input type="hidden" name="activeCharacteristicsClass" id="activeCharacteristicsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic"/>
278
							</div>
279
						</td>
280
					</tr>
281
					<tr>
282
						<td colspan="1">
283
							<input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="30" />
284
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic"/>
285
						</td>
286
					</tr>
287
				</table>
288
			</td>
289
			<td>
290
				<table class="subGroup subGroup_border">
291
					<tr>
292
						<th colspan="1">
293
							Protocol
294
						</th>
295
					</tr>
296
					<tr>
297
						<td>using procedures outlined by</td>
298
					</tr>
299
					<tr>
300
						<td>
301
							<input type="text" id="activeProtocolsSearch" />
302
							<div class="select">
303
								<div name="activeProtocols" id="activeProtocols" multiple="multiple" size="5" style="width: 216px" onchange="initialize(this)">
304
									<p>loading...</p>
305
								</div>
306
								<input type="hidden" class="value" name="activeProtocolsValue" id="activeProtocolsValue" />
307
								<input type="hidden" name="activeProtocolsClass" id="activeProtocolsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol"/>
308
							</div>
309
						</td>
310
					</tr>
311
					<tr>
312
						<td colspan="1">
313
							<input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="30" />
314
							<input type="hidden" name="dynamicClass" id="dynamicClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol"/>
315
						</td>
316
					</tr>
317
				</table>
318
			</td>
319
		</tr>
320
		<tr>
321
			<td colspan="3">Match All? <input type="checkbox" name="matchAll" checked="checked"/></td>
322
		</tr>
323
		<tr>
324
			<td colspan="3">From same Observation? <input type="checkbox" name="strict"/></td>
325
		</tr>
326
		<tr>
327
			<td colspan="3">
328
				<input type="submit" value="Search"/>
329
				<input type="reset" value="Clear" onclick="$('#searchForm').get(0).reset(); initialize()"/>
330
			</td>
331
		</tr>
332
	</table>
333
		<!-- 
334
		<tr>
335
			<td>Entity: (SBC only)</td>
336
			<td><input type="text" name="entity" class="bp_form_complete-1523-uri" size="100" /></td>
337
		</tr>
338
		 -->		
339
</form>
340

    
341
<!-- Included default search/login -->
342
<% if ( PropertyService.getProperty("spatial.runSpatialOption").equals("true") ) { %>
343
<script language="javascript">
344
	insertMap("<%=CONTEXT_URL%>");
345
</script>
346
<br/>
347
<% } %>
348
  
349
<script language="javascript">
350
	insertSearchBox("<%=CONTEXT_URL%>");
351
	insertLoginBox("<%=CONTEXT_URL%>");	
352
</script>
353

    
354
</div>
355

    
356
<script language="javascript">
357
	insertTemplateClosing("<%=CONTEXT_URL%>");
358
</script>
359

    
360
</body>
361
</html>
(5-5/14)