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:42:46 -0800 (Fri, 19 Nov 2010) $'
10
 * '$Revision: 5659 $'
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
						"themes" : {
98
							"theme" : "default",
99
							"dots" : true,
100
							"icons" : false
101
						},
102
						//"core" : { "initially_open" : [ selectedNodeId ] },
103
						"search" : { "case_insensitive" : true },
104
						"plugins" : [ "themes", "html_data", "ui", "cookies", "search" ]
105
					});
106
			});
107

    
108
			// enable searching on it
109
			$("#" + divId + "Search").keyup(
110
				function () {
111
					if ($("#" + divId + "Search").val().length >= 3) {
112
						$("#" + divId).jstree("search", $("#" + divId + "Search").val());
113
					}
114
				});
115

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

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

    
161
	// refresh the other trees for active domain after this filtering action
162
	// TODO actually do the active domain filtering when selection is made
163
	//initialize($(parent).children("div"));
164
}
165
function donothing() {}
166
--></script>
167

    
168
</head>
169
<body onload="initialize()">
170
<script language="javascript">
171
	insertTemplateOpening("<%=CONTEXT_URL%>");
172
</script>
173

    
174
<div id="content_wrapper">
175

    
176
<h2>Annotation-based search</h2>
177

    
178
<div id="error">
179
	<!-- error messages here -->
180
</div>
181

    
182
<form method="POST" action="<%=SERVLET_URL%>" target="_top" id="searchForm" name="searchForm" onSubmit="return checkSearch(this)">
183
	<input name="query" type="hidden" />
184
	<input name="qformat" value="semtools" type="hidden" />
185
	<input name="action" value="semquery" type="hidden" />
186

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

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

    
359
</div>
360

    
361
<script language="javascript">
362
	insertTemplateClosing("<%=CONTEXT_URL%>");
363
</script>
364

    
365
</body>
366
</html>
(5-5/14)