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-12-01 10:06:51 -0800 (Wed, 01 Dec 2010) $'
|
10
|
* '$Revision: 5676 $'
|
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
|
<link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/semtools/jqueryui/css/smoothness/jquery-ui-1.8.6.custom.css">
|
36
|
<script type="text/javascript"
|
37
|
src="<%=STYLE_SKINS_URL%>/semtools/search.js"></script>
|
38
|
|
39
|
<script type="text/javascript">
|
40
|
// Set defaults for this installation
|
41
|
//var BP_SEARCH_SERVER = "http://oor-01.cim3.net";
|
42
|
//var BP_SITE = "Sandbox";
|
43
|
//var BP_ORG = "OOR";
|
44
|
</script>
|
45
|
<!--
|
46
|
<script language="Javascript" type="text/JavaScript" src="<%=STYLE_SKINS_URL%>/semtools/bioportal/form_complete.js"></script>
|
47
|
-->
|
48
|
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/jsTree/_lib/jquery.js"></script>
|
49
|
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/jsTree/_lib/jquery.cookie.js"></script>
|
50
|
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/jsTree/jquery.jstree.js"></script>
|
51
|
<!-- jquery ui -->
|
52
|
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/jqueryui/js/jquery-ui-1.8.6.custom.min.js"></script>
|
53
|
|
54
|
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/semtools.js"></script>
|
55
|
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/branding.js"></script>
|
56
|
|
57
|
<script language="Javascript" type="text/JavaScript"><!--
|
58
|
function populateActiveDomain(divId, class) {
|
59
|
// collect the filtering values we have so far
|
60
|
// these are hidden input fields in the form for holding the selected values
|
61
|
var entity = $("#activeEntitiesValue").val() ? $("#activeEntitiesValue").val() : "";
|
62
|
var characteristic = $("#activeCharacteristicsValue").val() ? $("#activeCharacteristicsValue").val() : "";
|
63
|
var protocol = $("#activeProtocolsValue").val() ? $("#activeProtocolsValue").val() : "";
|
64
|
var measurement = $("#activeMeasurementsValue").val() ? $("#activeMeasurementsValue").val() : "";
|
65
|
|
66
|
// TODO: remember the selected value for this when filtering by active domain
|
67
|
var selectedNode = $("#" + divId).jstree("get_selected", $("#" + divId));
|
68
|
var selectedNodeId = $(selectedNode).attr("id");
|
69
|
//alert(divId + " selected node: " + selectedNodeId);
|
70
|
|
71
|
// load the tree for the given div, passing in the other filtered values
|
72
|
$("#" + divId).load(
|
73
|
"<%=SERVLET_URL%>",
|
74
|
{
|
75
|
'action': "getactivedomain",
|
76
|
'class': class,
|
77
|
'entity': entity,
|
78
|
'characteristic': characteristic,
|
79
|
'protocol': protocol,
|
80
|
'measurement': measurement
|
81
|
},
|
82
|
// call back function when loading finishes
|
83
|
function(response, status, xhr) {
|
84
|
//alert("callback for: " + divId + " selected node: " + selectedNodeId);
|
85
|
// error
|
86
|
if (status == "error") {
|
87
|
var msg = "Sorry but there was an error: ";
|
88
|
$("#error").html(msg + xhr.status + " " + xhr.statusText);
|
89
|
}
|
90
|
|
91
|
// make it a js tree
|
92
|
$(function () {
|
93
|
$("#" + divId)
|
94
|
//bind calls here
|
95
|
.jstree({
|
96
|
"ui" : {
|
97
|
"select_limit" : 1,
|
98
|
"select_multiple_modifier" : "alt",
|
99
|
"selected_parent_close" : "select_parent"//,
|
100
|
//"initially_select" : [ selectedNodeId ]
|
101
|
},
|
102
|
"themes" : {
|
103
|
"theme" : "default",
|
104
|
"dots" : true,
|
105
|
"icons" : false
|
106
|
},
|
107
|
//"core" : { "initially_open" : [ selectedNodeId ] },
|
108
|
"search" : { "case_insensitive" : true },
|
109
|
//"cookies" : {
|
110
|
// "save_opened" : "jstree_open_" + divId,
|
111
|
// "save_selected" : "jstree_select_" + divId,
|
112
|
//},
|
113
|
"plugins" : [
|
114
|
"themes",
|
115
|
"html_data",
|
116
|
"ui",
|
117
|
//"cookies",
|
118
|
"search" ]
|
119
|
});
|
120
|
});
|
121
|
|
122
|
// enable searching on it
|
123
|
$("#" + divId + "Search").keyup(
|
124
|
function () {
|
125
|
if ($("#" + divId + "Search").val().length >= 3) {
|
126
|
$("#" + divId).jstree("search", $("#" + divId + "Search").val());
|
127
|
// now prune
|
128
|
prune(divId, "jstree-search");
|
129
|
}
|
130
|
});
|
131
|
|
132
|
// toggle the active domain prune
|
133
|
$("#" + divId + "Only").click(function() {
|
134
|
doActiveDomain(divId);
|
135
|
});
|
136
|
|
137
|
// actually prune if we should
|
138
|
doActiveDomain(divId);
|
139
|
|
140
|
// open to the node to last selected
|
141
|
var nodePath = $("#" + divId).jstree("get_path", $(selectedNode));
|
142
|
if (nodePath) {
|
143
|
for (var index = 0; index < nodePath.length; index++) {
|
144
|
$("#" + divId).jstree("open_node", $("#" + nodePath[index]));
|
145
|
}
|
146
|
// select the original node
|
147
|
$("#" + divId).jstree("select_node", $(selectedNode), false);
|
148
|
$("#" + divId).jstree("refresh", $(selectedNode));
|
149
|
// TODO: scroll to selected node.
|
150
|
// This is supposed to be part of jsTree 1.0-rc2 but appears to be broken
|
151
|
}
|
152
|
|
153
|
});
|
154
|
}
|
155
|
/**
|
156
|
* Prunes the given tree to inlcude the given matched class
|
157
|
**/
|
158
|
function prune(divId, matchClass) {
|
159
|
|
160
|
// show all nodes (reset)
|
161
|
$("#" + divId).find("li").show();
|
162
|
|
163
|
// done if we don't have any thing to prune
|
164
|
if (!matchClass) {
|
165
|
return;
|
166
|
}
|
167
|
|
168
|
// get all non-matched anchor tags
|
169
|
var nonmatches = $("#" + divId).find("a").not("." + matchClass);
|
170
|
|
171
|
// get their parent nodes
|
172
|
nonmatches = $(nonmatches).parents("li");
|
173
|
|
174
|
// are there any matches under each parent node?
|
175
|
$(nonmatches).each(
|
176
|
function(index) {
|
177
|
// do any chidren match?
|
178
|
var childMatches = $(this).find("a." + matchClass);
|
179
|
if (childMatches && childMatches.length > 0) {
|
180
|
return true;
|
181
|
}
|
182
|
// parent matches?
|
183
|
var parentMatches = $(this).parents("li").children("a." + matchClass);
|
184
|
if (parentMatches && parentMatches.length > 0) {
|
185
|
return true;
|
186
|
}
|
187
|
// hide this node if no matches under it
|
188
|
$(this).hide();
|
189
|
});
|
190
|
}
|
191
|
function doActiveDomain(divId) {
|
192
|
if ($("#" + divId + "Only").is(":checked")) {
|
193
|
// prune to active
|
194
|
prune(divId, "bold");
|
195
|
} else {
|
196
|
// reset
|
197
|
prune(divId, null);
|
198
|
}
|
199
|
}
|
200
|
function initialize(source) {
|
201
|
// we don't want to reload the source of the filtering request
|
202
|
// but we do want to reload the other trees for active domains
|
203
|
// we reload all of them if no source is given - first time the page loads
|
204
|
if (source) {
|
205
|
source = $(source).attr("id");
|
206
|
}
|
207
|
if (!source) {
|
208
|
source = "";
|
209
|
}
|
210
|
if (source != 'activeEntities') {
|
211
|
populateActiveDomain('activeEntities', 'org.ecoinformatics.sms.annotation.Entity');
|
212
|
}
|
213
|
if (source != 'activeCharacteristics') {
|
214
|
populateActiveDomain('activeCharacteristics', 'org.ecoinformatics.sms.annotation.Characteristic');
|
215
|
}
|
216
|
if (source != 'activeProtocols') {
|
217
|
populateActiveDomain('activeProtocols', 'org.ecoinformatics.sms.annotation.Protocol');
|
218
|
}
|
219
|
if (source != 'activeMeasurements') {
|
220
|
populateActiveDomain('activeMeasurements', 'org.ecoinformatics.sms.annotation.Measurement');
|
221
|
}
|
222
|
}
|
223
|
function select(item) {
|
224
|
|
225
|
// get the selected value, stored in the title attribute of the item <a> tag
|
226
|
var value = $(item).attr("title");
|
227
|
//alert("value: " + value);
|
228
|
|
229
|
// get the parent div so we know what kind of class it is meant to filter
|
230
|
// this is "the first parent of the class 'select'"
|
231
|
var parent = $(item).parents("div.select:first");
|
232
|
//alert("parent: " + parent);
|
233
|
|
234
|
// set the value for the hidden input value
|
235
|
// the input field of class "value" will hold it, this way we don't need to know the id
|
236
|
var input = $(parent).children("input.value");
|
237
|
$(input).val(value);
|
238
|
//alert("input: " + input);
|
239
|
|
240
|
// set it in the search field
|
241
|
var treeInstance = $(item).parents("div.jstree:first");
|
242
|
var shortName = $(item).parent().attr("id");
|
243
|
$("#" + $(treeInstance).attr("id") + "Search").val(shortName)
|
244
|
|
245
|
// refresh the search results
|
246
|
doSearch($("#searchForm").get(0));
|
247
|
|
248
|
// refresh the other trees for active domain after this filtering action
|
249
|
initialize($(parent).children("div"));
|
250
|
}
|
251
|
function doSearch(formObj) {
|
252
|
// set the hidden parameters based on the current state of the form
|
253
|
checkSearch(formObj);
|
254
|
|
255
|
//load the results
|
256
|
$("#searchResults").load(
|
257
|
"<%=SERVLET_URL%>" + " #content_wrapper",
|
258
|
$(formObj).serialize(),
|
259
|
// call back function when loading finishes
|
260
|
function(response, status, xhr) {
|
261
|
if (status == "error") {
|
262
|
var msg = "Sorry but there was an error performing the search: ";
|
263
|
$("#error").html(msg + xhr.status + " " + xhr.statusText);
|
264
|
}
|
265
|
// collapsible search results?
|
266
|
$(function() {
|
267
|
$('.accordian').click(function() {
|
268
|
$(this).next().slideToggle("slow");
|
269
|
return false;
|
270
|
}).next().hide();
|
271
|
});
|
272
|
|
273
|
});
|
274
|
|
275
|
return false;
|
276
|
|
277
|
}
|
278
|
function clearForm() {
|
279
|
// clear the form values
|
280
|
$('#searchForm').get(0).reset();
|
281
|
// clear each of the tree selections
|
282
|
$(".jstree").each(function(index) {
|
283
|
$(this).jstree("deselect_all");
|
284
|
});
|
285
|
$("input.value").each(function(index) {
|
286
|
$(this).val("");
|
287
|
});
|
288
|
// reload the trees
|
289
|
initialize();
|
290
|
// reload the search results
|
291
|
//alert($('#searchForm').get(0));
|
292
|
doSearch($('#searchForm').get(0));
|
293
|
}
|
294
|
function donothing() {}
|
295
|
--></script>
|
296
|
|
297
|
</head>
|
298
|
<body onload="initialize()">
|
299
|
<script language="javascript">
|
300
|
insertTemplateOpening("<%=CONTEXT_URL%>");
|
301
|
</script>
|
302
|
|
303
|
<div id="content_wrapper">
|
304
|
|
305
|
<h2>Annotation-based search</h2>
|
306
|
|
307
|
<div id="error">
|
308
|
<!-- error messages here -->
|
309
|
</div>
|
310
|
|
311
|
<!-- set up the tabs -->
|
312
|
<script>
|
313
|
$(function() {
|
314
|
$("#searchTabs").tabs();
|
315
|
$("#searchTabs").tabs("add", "#ecpTab", "Entity, Characteristic, Protocol");
|
316
|
$("#searchTabs").tabs("add", "#measurementTab", "Measurement");
|
317
|
$("#searchTabs").tabs("add", "#optionsTab", "Options");
|
318
|
});
|
319
|
</script>
|
320
|
|
321
|
<form method="POST"
|
322
|
action="<%=SERVLET_URL%>"
|
323
|
target="_top"
|
324
|
id="searchForm"
|
325
|
name="searchForm"
|
326
|
onSubmit="return doSearch(this)">
|
327
|
<input name="query" type="hidden" />
|
328
|
<input name="qformat" value="semtools" type="hidden" />
|
329
|
<input name="includeHeader" value="false" type="hidden" />
|
330
|
<input name="action" value="semquery" type="hidden" />
|
331
|
|
332
|
<!-- tabs for the search interface -->
|
333
|
<div id="searchTabs">
|
334
|
<!-- place holder for ui tabs -->
|
335
|
<ul></ul>
|
336
|
|
337
|
<!-- other criteria tabs -->
|
338
|
<div id="ecpTab">
|
339
|
<table>
|
340
|
<tr>
|
341
|
<td>
|
342
|
<table class="subGroup subGroup_border">
|
343
|
|
344
|
<tr>
|
345
|
<th><p>Find observations of</p></th>
|
346
|
</tr>
|
347
|
<tr>
|
348
|
<td>
|
349
|
<input type="text" id="activeEntitiesSearch" />
|
350
|
<input type="checkbox" id="activeEntitiesOnly" title="Show only active concepts" />
|
351
|
<div class="select">
|
352
|
<div id="activeEntities" class="activeTree">
|
353
|
<p>loading...</p>
|
354
|
</div>
|
355
|
<input type="hidden" class="value" name="activeEntitiesValue" id="activeEntitiesValue"/>
|
356
|
<input type="hidden" name="activeEntitiesClass" id="activeEntitiesClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity"/>
|
357
|
</div>
|
358
|
</td>
|
359
|
</tr>
|
360
|
</table>
|
361
|
</td>
|
362
|
<td>
|
363
|
<table class="subGroup subGroup_border">
|
364
|
<tr>
|
365
|
<th><p>with measurements of</p></th>
|
366
|
</tr>
|
367
|
<tr>
|
368
|
<td>
|
369
|
<input type="text" id="activeCharacteristicsSearch" />
|
370
|
<input type="checkbox" id="activeCharacteristicsOnly" title="Show only active concepts" />
|
371
|
<div class="select">
|
372
|
<div id="activeCharacteristics" class="activeTree">
|
373
|
<p>loading...</p>
|
374
|
</div>
|
375
|
<input type="hidden" class="value" name="activeCharacteristicsValue" id="activeCharacteristicsValue"/>
|
376
|
<input type="hidden" name="activeCharacteristicsClass" id="activeCharacteristicsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic"/>
|
377
|
</div>
|
378
|
</td>
|
379
|
</tr>
|
380
|
</table>
|
381
|
</td>
|
382
|
<td>
|
383
|
<table class="subGroup subGroup_border">
|
384
|
<tr>
|
385
|
<th><p>using procedures outlined by</p></th>
|
386
|
</tr>
|
387
|
<tr>
|
388
|
<td>
|
389
|
<input type="text" id="activeProtocolsSearch" />
|
390
|
<input type="checkbox" id="activeProtocolsOnly" title="Show only active concepts" />
|
391
|
<div class="select">
|
392
|
<div id="activeProtocols" class="activeTree">
|
393
|
<p>loading...</p>
|
394
|
</div>
|
395
|
<input type="hidden" class="value" name="activeProtocolsValue" id="activeProtocolsValue" />
|
396
|
<input type="hidden" name="activeProtocolsClass" id="activeProtocolsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol"/>
|
397
|
</div>
|
398
|
</td>
|
399
|
</tr>
|
400
|
</table>
|
401
|
</td>
|
402
|
</tr>
|
403
|
</table>
|
404
|
</div>
|
405
|
|
406
|
<!-- measurement -->
|
407
|
<div id="measurementTab">
|
408
|
<table class="subGroup subGroup_border onehundred_percent">
|
409
|
|
410
|
<tr>
|
411
|
<th><p>a template that defines Entity, Characteristic, Standard, and/or Protocol</p></th>
|
412
|
</tr>
|
413
|
|
414
|
<tr>
|
415
|
<td>
|
416
|
<input type="text" id="activeMeasurementsSearch" />
|
417
|
Only active? <input type="checkbox" id="activeMeasurementsOnly" title="Show only active concepts"/>
|
418
|
<div class="select">
|
419
|
<div id="activeMeasurements" class="activeTree" style="width: 100%">
|
420
|
<p>loading...</p>
|
421
|
</div>
|
422
|
<input type="hidden" class="value" name="activeMeasurementsValue" id="activeMeasurementsValue"/>
|
423
|
<input type="hidden" name="activeMeasurementsClass" id="activeMeasurementsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement"/>
|
424
|
</div>
|
425
|
</td>
|
426
|
</tr>
|
427
|
</table>
|
428
|
</div>
|
429
|
|
430
|
<!-- query options -->
|
431
|
<div id="optionsTab">
|
432
|
<table class="group group_border">
|
433
|
<tr>
|
434
|
<th colspan="2">
|
435
|
<p>
|
436
|
Locate <b>data packages</b> that have been semantically annotated within the observation model by
|
437
|
selecting concepts from OBOE extension ontologies
|
438
|
</p>
|
439
|
</th>
|
440
|
</tr>
|
441
|
|
442
|
<tr>
|
443
|
|
444
|
<td colspan="1">Match All? <input type="checkbox" name="matchAll" checked="checked"/></td>
|
445
|
|
446
|
<td colspan="1">From same Observation? <input type="checkbox" name="strict"/></td>
|
447
|
</tr>
|
448
|
|
449
|
</table>
|
450
|
</div>
|
451
|
|
452
|
</div>
|
453
|
|
454
|
<br/>
|
455
|
|
456
|
<!-- search results here -->
|
457
|
<table class="subGroup subGroup_border onehundred_percent">
|
458
|
<tr>
|
459
|
<th>
|
460
|
Search Results
|
461
|
<input type="reset" value="Clear" onclick="clearForm()"/>
|
462
|
</th>
|
463
|
</tr>
|
464
|
<tr>
|
465
|
<td>
|
466
|
<div id="searchResults">
|
467
|
No query has been specified
|
468
|
</div>
|
469
|
</td>
|
470
|
</tr>
|
471
|
</table>
|
472
|
|
473
|
</form>
|
474
|
|
475
|
|
476
|
|
477
|
<!-- Included default search/login -->
|
478
|
<% if ( PropertyService.getProperty("spatial.runSpatialOption").equals("true") ) { %>
|
479
|
<script language="javascript">
|
480
|
insertMap("<%=CONTEXT_URL%>");
|
481
|
</script>
|
482
|
<br/>
|
483
|
<% } %>
|
484
|
|
485
|
<script language="javascript">
|
486
|
insertSearchBox("<%=CONTEXT_URL%>");
|
487
|
insertLoginBox("<%=CONTEXT_URL%>");
|
488
|
</script>
|
489
|
|
490
|
</div>
|
491
|
|
492
|
<script language="javascript">
|
493
|
insertTemplateClosing("<%=CONTEXT_URL%>");
|
494
|
</script>
|
495
|
|
496
|
</body>
|
497
|
</html>
|