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 15:06:25 -0800 (Fri, 19 Nov 2010) $'
10
 * '$Revision: 5656 $'
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
						//"core" : { "initially_open" : [ selectedNodeId ] },
98
						"plugins" : [ "themes", "html_data", "ui", "cookies" ]
99
					});
100
			});
101

    
102
			// TODO: try to select the original node after refresh with active domain
103
			//$("#" + divId).jstree("open_node", $(selectedNode));
104
			//$("#" + divId).jstree("select_node", $(selectedNode));
105
		});
106
}
107
function initialize(source) {
108
	// we don't want to reload the source of the filtering request
109
	// but we do want to reload the other trees for active domains
110
	// we reload all of them if no source is given - first time the page loads
111
	if (source) {
112
		source = $(source).attr("id");
113
	}
114
	if (!source) {
115
		source = "";
116
	}
117
	if (source != 'activeEntities') {
118
		populateActiveDomain('activeEntities', 'org.ecoinformatics.sms.annotation.Entity');
119
	}
120
	if (source != 'activeCharacteristics') {
121
		populateActiveDomain('activeCharacteristics', 'org.ecoinformatics.sms.annotation.Characteristic');
122
	}
123
	if (source != 'activeProtocols') {
124
		populateActiveDomain('activeProtocols', 'org.ecoinformatics.sms.annotation.Protocol');
125
	}
126
	if (source != 'activeMeasurements') {
127
		populateActiveDomain('activeMeasurements', 'org.ecoinformatics.sms.annotation.Measurement');
128
	}
129
}
130
function select(item) {
131

    
132
	// get the selected value, stored in the title attribute of the item <a> tag
133
	var value = $(item).attr("title");
134
	//alert("value: " + value);
135
	
136
	// get the parent div so we know what kind of class it is meant to filter
137
	// this is "the first parent of the class 'select'"
138
	var parent = $(item).parents("div.select:first");
139
	//alert("parent: " + parent);
140
	
141
	// set the value for the hidden input value
142
	// the input field of class "value" will hold it, this way we don't need to know the id
143
	var input = $(parent).children("input.value");
144
	$(input).val(value);
145
	//alert("input: " + input);
146

    
147
	// refresh the other trees for active domain after this filtering action
148
	// TODO actually do the active domain filtering when selection is made
149
	//initialize($(parent).children("div"));
150
}
151
function donothing() {}
152
--></script>
153

    
154
</head>
155
<body onload="initialize()">
156
<script language="javascript">
157
	insertTemplateOpening("<%=CONTEXT_URL%>");
158
</script>
159

    
160
<div id="content_wrapper">
161

    
162
<h2>Annotation-based search</h2>
163

    
164
<div id="error">
165
	<!-- error messages here -->
166
</div>
167

    
168
<form method="POST" action="<%=SERVLET_URL%>" target="_top" id="searchForm" name="searchForm" onSubmit="return checkSearch(this)">
169
	<input name="query" type="hidden" />
170
	<input name="qformat" value="semtools" type="hidden" />
171
	<input name="action" value="semquery" type="hidden" />
172

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

    
343
<script language="javascript">
344
	insertTemplateClosing("<%=CONTEXT_URL%>");
345
</script>
346

    
347
</body>
348
</html>
(5-5/14)