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