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-22 16:25:09 -0800 (Mon, 22 Nov 2010) $'
10
 * '$Revision: 5660 $'
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
						"plugins" : [ "themes", "html_data", "ui", "cookies", "search" ]
106
					});
107
			});
108

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

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

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

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

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

    
175
<div id="content_wrapper">
176

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

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

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

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

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

    
360
</div>
361

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

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