Project

General

Profile

1 5509 leinfelder
<%@ 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$'
9
 *      '$Date$'
10
 * '$Revision$'
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 5385 leinfelder
%>
27 5632 leinfelder
28 5509 leinfelder
<%@ include file="../../common/common-settings.jsp"%>
29
<%@ include file="../../common/configure-check.jsp"%>
30 5604 leinfelder
31 5385 leinfelder
<html>
32
<head>
33 5509 leinfelder
<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 5656 leinfelder
<!--
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 5509 leinfelder
<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 5656 leinfelder
<script language="Javascript" type="text/JavaScript"><!--
54 5633 leinfelder
function populateActiveDomain(divId, class) {
55 5656 leinfelder
	// 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 5633 leinfelder
62 5656 leinfelder
	// 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 5633 leinfelder
	$("#" + divId).load(
69 5656 leinfelder
		"<%=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 5660 leinfelder
					//bind calls here
91 5656 leinfelder
					.jstree({
92
						"ui" : {
93
							"select_limit" : 1,
94
							"select_multiple_modifier" : "alt",
95
							"selected_parent_close" : "select_parent"//,
96
							//"initially_select" : [ selectedNodeId ]
97 5659 leinfelder
						},
98
						"themes" : {
99
							"theme" : "default",
100
							"dots" : true,
101
							"icons" : false
102
						},
103 5656 leinfelder
						//"core" : { "initially_open" : [ selectedNodeId ] },
104 5658 leinfelder
						"search" : { "case_insensitive" : true },
105
						"plugins" : [ "themes", "html_data", "ui", "cookies", "search" ]
106 5656 leinfelder
					});
107
			});
108
109 5658 leinfelder
			// 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 5656 leinfelder
			// 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 5633 leinfelder
}
122
function initialize(source) {
123 5656 leinfelder
	// 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 5633 leinfelder
	if (source) {
127 5656 leinfelder
		source = $(source).attr("id");
128 5633 leinfelder
	}
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 5656 leinfelder
function select(item) {
146 5633 leinfelder
147 5656 leinfelder
	// 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 5662 leinfelder
162
	// set it in the search field
163
	var treeInstance = $(item).parents("div.jstree:first");
164
	var shortName = $(item).parent().attr("id");
165
	$("#" + $(treeInstance).attr("id") + "Search").val(shortName)
166 5656 leinfelder
167
	// refresh the other trees for active domain after this filtering action
168
	// TODO actually do the active domain filtering when selection is made
169
	//initialize($(parent).children("div"));
170
}
171
function donothing() {}
172
--></script>
173
174 5385 leinfelder
</head>
175 5633 leinfelder
<body onload="initialize()">
176 5509 leinfelder
<script language="javascript">
177
	insertTemplateOpening("<%=CONTEXT_URL%>");
178
</script>
179 5385 leinfelder
180 5574 leinfelder
<div id="content_wrapper">
181
182 5533 leinfelder
<h2>Annotation-based search</h2>
183 5385 leinfelder
184 5633 leinfelder
<div id="error">
185
	<!-- error messages here -->
186
</div>
187
188 5509 leinfelder
<form method="POST" action="<%=SERVLET_URL%>" target="_top" id="searchForm" name="searchForm" onSubmit="return checkSearch(this)">
189
	<input name="query" type="hidden" />
190
	<input name="qformat" value="semtools" type="hidden" />
191 5533 leinfelder
	<input name="action" value="semquery" type="hidden" />
192 5509 leinfelder
193 5602 leinfelder
	<table class="group group_border">
194 5509 leinfelder
		<tr>
195 5632 leinfelder
			<th colspan="3">
196 5602 leinfelder
				<p>
197
					Locate <b>data packages</b> that have been semantically annotated within the observation model by
198
					selecting concepts from
199
					<br/>
200
					(a) existing semantic annotations
201
					<br/>
202
					(b) registered OBOE extension ontologies
203
				</p>
204
			</th>
205 5533 leinfelder
		</tr>
206 5632 leinfelder
		<!--  measurement -->
207 5533 leinfelder
		<tr>
208 5632 leinfelder
			<td colspan="3">
209
				<table class="subGroup subGroup_border onehundred_percent">
210
					<tr>
211
						<th colspan="2">
212
							Measurement
213
						</th>
214
					</tr>
215
					<tr>
216
						<td>a template that defines Entity, Characteristic, Standard, and/or Protocol</td>
217
					</tr>
218
					<tr>
219
						<td>
220 5658 leinfelder
							<input type="text" id="activeMeasurementsSearch" />
221 5656 leinfelder
							<div class="select">
222 5660 leinfelder
								<div id="activeMeasurements" style="width: 100%; height: 100px; overflow: auto">
223 5656 leinfelder
									<p>loading...</p>
224
								</div>
225
								<input type="hidden" class="value" name="activeMeasurementsValue" id="activeMeasurementsValue"/>
226
								<input type="hidden" name="activeMeasurementsClass" id="activeMeasurementsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement"/>
227
							</div>
228 5632 leinfelder
						</td>
229
					</tr>
230
				</table>
231
			</td>
232
		</tr>
233
		<tr>
234 5533 leinfelder
			<td>
235 5602 leinfelder
				<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 5658 leinfelder
							<input type="text" id="activeEntitiesSearch" />
247 5656 leinfelder
							<div class="select">
248 5660 leinfelder
								<div id="activeEntities" style="width: 216px; height: 100px; overflow: auto">
249 5656 leinfelder
									<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 5602 leinfelder
						</td>
255
					</tr>
256
				</table>
257 5533 leinfelder
			</td>
258
			<td>
259 5602 leinfelder
				<table class="subGroup subGroup_border">
260
					<tr>
261
						<th colspan="1">
262
							Characteristic
263
						</th>
264
					</tr>
265
					<tr>
266 5632 leinfelder
						<td>with measurements of</td>
267 5602 leinfelder
					</tr>
268
					<tr>
269
						<td>
270 5658 leinfelder
							<input type="text" id="activeCharacteristicsSearch" />
271 5656 leinfelder
							<div class="select">
272 5660 leinfelder
								<div id="activeCharacteristics" style="width: 216px; height: 100px; overflow: auto">
273 5656 leinfelder
									<p>loading...</p>
274
								</div>
275
								<input type="hidden" class="value" name="activeCharacteristicsValue" id="activeCharacteristicsValue"/>
276
								<input type="hidden" name="activeCharacteristicsClass" id="activeCharacteristicsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic"/>
277
							</div>
278 5602 leinfelder
						</td>
279
					</tr>
280
				</table>
281 5533 leinfelder
			</td>
282
			<td>
283 5602 leinfelder
				<table class="subGroup subGroup_border">
284
					<tr>
285
						<th colspan="1">
286
							Protocol
287
						</th>
288
					</tr>
289
					<tr>
290 5632 leinfelder
						<td>using procedures outlined by</td>
291 5602 leinfelder
					</tr>
292
					<tr>
293
						<td>
294 5658 leinfelder
							<input type="text" id="activeProtocolsSearch" />
295 5656 leinfelder
							<div class="select">
296 5660 leinfelder
								<div id="activeProtocols" style="width: 216px; height: 100px; overflow: auto">
297 5656 leinfelder
									<p>loading...</p>
298
								</div>
299
								<input type="hidden" class="value" name="activeProtocolsValue" id="activeProtocolsValue" />
300
								<input type="hidden" name="activeProtocolsClass" id="activeProtocolsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol"/>
301
							</div>
302 5602 leinfelder
						</td>
303
					</tr>
304
				</table>
305 5533 leinfelder
			</td>
306
		</tr>
307
		<tr>
308 5632 leinfelder
			<td colspan="3">Match All? <input type="checkbox" name="matchAll" checked="checked"/></td>
309 5509 leinfelder
		</tr>
310
		<tr>
311 5632 leinfelder
			<td colspan="3">From same Observation? <input type="checkbox" name="strict"/></td>
312 5509 leinfelder
		</tr>
313
		<tr>
314 5633 leinfelder
			<td colspan="3">
315
				<input type="submit" value="Search"/>
316
				<input type="reset" value="Clear" onclick="$('#searchForm').get(0).reset(); initialize()"/>
317
			</td>
318 5509 leinfelder
		</tr>
319 5602 leinfelder
	</table>
320
		<!--
321 5509 leinfelder
		<tr>
322 5602 leinfelder
			<td>Entity: (SBC only)</td>
323
			<td><input type="text" name="entity" class="bp_form_complete-1523-uri" size="100" /></td>
324 5509 leinfelder
		</tr>
325 5602 leinfelder
		 -->
326 5509 leinfelder
</form>
327
328
<!-- Included default search/login -->
329
<% if ( PropertyService.getProperty("spatial.runSpatialOption").equals("true") ) { %>
330
<script language="javascript">
331
	insertMap("<%=CONTEXT_URL%>");
332
</script>
333
<br/>
334
<% } %>
335
336
<script language="javascript">
337
	insertSearchBox("<%=CONTEXT_URL%>");
338
	insertLoginBox("<%=CONTEXT_URL%>");
339
</script>
340
341 5574 leinfelder
</div>
342
343 5509 leinfelder
<script language="javascript">
344
	insertTemplateClosing("<%=CONTEXT_URL%>");
345
</script>
346
347 5385 leinfelder
</body>
348
</html>