Revision 5533
Added by ben leinfelder over 14 years ago
lib/style/skins/semtools/search.js | ||
---|---|---|
3 | 3 |
} |
4 | 4 |
|
5 | 5 |
function checkSearch(submitFormObj) { |
6 |
//var searchString = trim(submitFormObj.entity.value); |
|
7 |
var searchString = submitFormObj.entity.value; |
|
8 | 6 |
|
9 |
if (searchString=="") { |
|
10 |
if (confirm("Show *all* data in the KNB?")) { |
|
11 |
searchString = "%"; |
|
12 |
} else { |
|
13 |
return false; |
|
14 |
} |
|
15 |
} |
|
16 |
|
|
17 |
if (true) { |
|
18 |
submitFormObj.query.value = "<pathquery version=\"1.2\">" |
|
19 |
+"<querytitle>Web-Search</querytitle>" |
|
20 |
+"<returndoctype>eml://ecoinformatics.org/eml-2.1.0</returndoctype>" |
|
21 |
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>" |
|
22 |
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>" |
|
23 |
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>" |
|
24 |
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>" |
|
25 |
+"<returndoctype>-//NCEAS//resource//EN</returndoctype>" |
|
26 |
+"<returndoctype>-//NCEAS//eml-dataset//EN</returndoctype>" |
|
27 |
+"<returndoctype>metadata</returndoctype>" |
|
28 |
+"<returnfield>originator/individualName/surName</returnfield>" |
|
29 |
+"<returnfield>originator/individualName/givenName</returnfield>" |
|
30 |
+"<returnfield>creator/individualName/surName</returnfield>" |
|
31 |
+"<returnfield>creator/individualName/givenName</returnfield>" |
|
32 |
+"<returnfield>originator/organizationName</returnfield>" |
|
33 |
+"<returnfield>creator/organizationName</returnfield>" |
|
34 |
+"<returnfield>dataset/title</returnfield>" |
|
35 |
+"<returnfield>keyword</returnfield>" |
|
36 |
//fgdc fields |
|
37 |
+"<returnfield>idinfo/citation/citeinfo/title</returnfield>" |
|
38 |
+"<returnfield>idinfo/citation/citeinfo/origin</returnfield>" |
|
39 |
+"<returnfield>idinfo/keywords/theme/themekey</returnfield>" |
|
40 |
+"<querygroup operator=\"INTERSECT\">" |
|
41 |
+"<querygroup operator=\"UNION\">" |
|
42 |
// EML fields |
|
43 |
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">" |
|
44 |
+"<value>" + searchString + "</value>" |
|
45 |
+"<pathexpr>keyword</pathexpr>" |
|
46 |
+"</queryterm>" |
|
47 |
|
|
48 |
//FGDC fields |
|
49 |
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">" |
|
50 |
+"<value>" + searchString + "</value>" |
|
51 |
+"<pathexpr>idinfo/keywords/theme/themekey</pathexpr>" |
|
52 |
+"</queryterm>" |
|
53 |
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">" |
|
54 |
+"<value>" + searchString + "</value>" |
|
55 |
+"<pathexpr>placekey</pathexpr>" |
|
56 |
+"</queryterm>" |
|
57 |
+"</querygroup>" |
|
58 |
+"</querygroup>" |
|
59 |
+"</pathquery>"; |
|
60 |
} |
|
7 |
var operator = "OR"; |
|
8 |
if (submitFormObj.matchAll.checked) { |
|
9 |
operator = "AND"; |
|
10 |
} |
|
11 |
var strict = "false"; |
|
12 |
if (submitFormObj.strict.checked) { |
|
13 |
strict = "true"; |
|
14 |
} |
|
15 |
submitFormObj.query.value = |
|
16 |
"<sq:query queryId='query.1' system='semtools' " + |
|
17 |
"xmlns:sq='http://ecoinformatics.org/semQuery-1.0.0' " + |
|
18 |
"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " + |
|
19 |
"xsi:schemaLocation='http://ecoinformatics.org/semQuery-1.0.0 semQuery.xsd '>" + |
|
20 |
"<namespace prefix='sms'>http://ecoinformatics.org/sms/annotation.0.9</namespace>" + |
|
21 |
"<returnField>/@id</returnField>" + |
|
22 |
"<returnField>/@emlPackage</returnField>" + |
|
23 |
"<returnField>/@dataTable</returnField>" + |
|
24 |
"<title>Semantic Search Example</title>" + |
|
25 |
"<!-- Match all criteria, must be on same observation -->" + |
|
26 |
"<" + operator + " strict='" + strict + "'>"; |
|
27 |
for (var i=0; i < submitFormObj.dynamicClass.length; i++) { |
|
28 |
var searchClass = submitFormObj.dynamicClass[i].value; |
|
29 |
var searchValue = submitFormObj.dynamicValue[i].value; |
|
30 |
if (searchValue!="") { |
|
31 |
submitFormObj.query.value += |
|
32 |
"<condition " + |
|
33 |
"concept='" + searchClass + "' " + |
|
34 |
"operator='EQUALS'>" + |
|
35 |
searchValue + |
|
36 |
"</condition>"; |
|
37 |
} |
|
38 |
} |
|
39 |
submitFormObj.query.value += "</" + operator + ">"; |
|
40 |
submitFormObj.query.value += "</sq:query>"; |
|
41 |
|
|
61 | 42 |
alert("query: " + submitFormObj.query.value); |
62 | 43 |
|
63 | 44 |
return true; |
lib/style/skins/semtools/resultset.xsl | ||
---|---|---|
68 | 68 |
cellpadding="5" cellspacing="0"> |
69 | 69 |
<tr> |
70 | 70 |
<td align="left"> |
71 |
<br /> |
|
72 | 71 |
<p class="emphasis"> |
73 | 72 |
<xsl:number |
74 | 73 |
value="count(resultset/document)" /> |
... | ... | |
78 | 77 |
</tr> |
79 | 78 |
</table> |
80 | 79 |
|
81 |
<table align="center" border="0" cellpadding="0" cellspacing="5" style="width:98%;">
|
|
80 |
<table align="left" border="0" cellpadding="0" cellspacing="5">
|
|
82 | 81 |
<tr valign="top"> |
83 | 82 |
|
84 | 83 |
<!-- ANNOTATIONS HERE --> |
85 | 84 |
<xsl:if test="count(resultset/document[docname='annotation']) > 0"> |
86 |
<td width="45%">
|
|
85 |
<td> |
|
87 | 86 |
<xsl:call-template name="annotationResults"/> |
88 | 87 |
</td> |
89 | 88 |
</xsl:if> |
90 | 89 |
|
91 |
<td width="10%"></td> |
|
90 |
<xsl:if test="count(resultset/document[docname='annotation']) > 0"> |
|
91 |
<xsl:if test="count(resultset/document[docname='eml']) > 0"> |
|
92 |
<td width="10%"></td> |
|
93 |
</xsl:if> |
|
94 |
</xsl:if> |
|
92 | 95 |
|
93 | 96 |
<!-- EML HERE --> |
94 | 97 |
<xsl:if test="count(resultset/document[docname='eml']) > 0"> |
95 |
<td width="45%">
|
|
98 |
<td> |
|
96 | 99 |
<xsl:call-template name="emlResults"/> |
97 | 100 |
</td> |
98 | 101 |
</xsl:if> |
lib/style/skins/semtools/index.jsp | ||
---|---|---|
53 | 53 |
insertTemplateOpening("<%=CONTEXT_URL%>"); |
54 | 54 |
</script> |
55 | 55 |
|
56 |
<h2>Concept search</h2>
|
|
56 |
<h2>Annotation-based search</h2>
|
|
57 | 57 |
|
58 | 58 |
<form method="POST" action="<%=SERVLET_URL%>" target="_top" id="searchForm" name="searchForm" onSubmit="return checkSearch(this)"> |
59 | 59 |
<input name="query" type="hidden" /> |
60 | 60 |
<input name="qformat" value="semtools" type="hidden" /> |
61 |
<input name="action" value="squery" type="hidden" /> |
|
61 |
<input name="action" value="semquery" type="hidden" />
|
|
62 | 62 |
|
63 | 63 |
<table> |
64 | 64 |
<tr> |
65 |
<td> |
|
66 |
<select name="dynamicClass" id="dynamicClass"> |
|
67 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity" selected="selected">Entity</option> |
|
68 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic">Characteristic</option> |
|
69 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Standard">Standard</option> |
|
70 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol">Protocol</option> |
|
71 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement">Measurement</option> |
|
72 |
</select> |
|
73 |
</td> |
|
74 |
<td><input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="100" /></td> |
|
75 |
</tr> |
|
76 |
<tr> |
|
77 |
<td> |
|
78 |
<select name="dynamicClass" id="dynamicClass"> |
|
79 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity">Entity</option> |
|
80 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic" selected="selected">Characteristic</option> |
|
81 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Standard">Standard</option> |
|
82 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol">Protocol</option> |
|
83 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement">Measurement</option> |
|
84 |
</select> |
|
85 |
</td> |
|
86 |
<td><input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="100" /></td> |
|
87 |
</tr> |
|
88 |
<tr> |
|
89 |
<td> |
|
90 |
<select name="dynamicClass" id="dynamicClass"> |
|
91 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity">Entity</option> |
|
92 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic">Characteristic</option> |
|
93 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Standard" selected="selected">Standard</option> |
|
94 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol">Protocol</option> |
|
95 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement">Measurement</option> |
|
96 |
</select> |
|
97 |
</td> |
|
98 |
<td><input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="100" /></td> |
|
99 |
</tr> |
|
100 |
<tr> |
|
101 |
<td> |
|
102 |
<select name="dynamicClass" id="dynamicClass"> |
|
103 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity">Entity</option> |
|
104 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic">Characteristic</option> |
|
105 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Standard">Standard</option> |
|
106 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol" selected="selected">Protocol</option> |
|
107 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement">Measurement</option> |
|
108 |
</select> |
|
109 |
</td> |
|
110 |
<td><input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="100" /></td> |
|
111 |
</tr> |
|
112 |
<tr> |
|
113 |
<td> |
|
114 |
<select name="dynamicClass" id="dynamicClass"> |
|
115 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity">Entity</option> |
|
116 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic">Characteristic</option> |
|
117 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Standard">Standard</option> |
|
118 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol">Protocol</option> |
|
119 |
<option value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement" selected="selected">Measurement</option> |
|
120 |
</select> |
|
121 |
</td> |
|
122 |
<td><input type="text" name="dynamicValue" id="dynamicValue" class="bp_form_complete-all-uri" size="100" /></td> |
|
123 |
</tr> |
|
124 |
<!-- |
|
125 |
<tr> |
|
65 | 126 |
<td>Entity: (SBC only)</td> |
66 | 127 |
<td><input type="text" name="entity" class="bp_form_complete-1523-uri" size="100" /></td> |
67 | 128 |
</tr> |
129 |
--> |
|
68 | 130 |
<tr> |
69 |
<td>Characteristic: (all)</td> |
|
70 |
<td><input type="text" name="characteristic" class="bp_form_complete-all-uri" size="100" /></td> |
|
131 |
<td colspan="2">Match All? <input type="checkbox" name="matchAll" checked="checked"/></td> |
|
71 | 132 |
</tr> |
72 | 133 |
<tr> |
73 |
<td>Standard: (all)</td> |
|
74 |
<td><input type="text" name="standard" class="bp_form_complete-all-uri" size="100" /></td> |
|
134 |
<td colspan="2">From same Observation? <input type="checkbox" name="strict"/></td> |
|
75 | 135 |
</tr> |
76 | 136 |
<tr> |
77 |
<td>Protocol: (all)</td> |
|
78 |
<td><input type="text" name="protocol" class="bp_form_complete-all-uri" size="100" /></td> |
|
79 |
</tr> |
|
80 |
<tr> |
|
81 | 137 |
<td colspan="2"><input type="submit" value="Search"/></td> |
82 | 138 |
</tr> |
83 | 139 |
</table> |
Also available in: Unified diff
basic query can be issued and includes:
-match any/all
-from same observation
-for Entity, Characteristic, Standard, Protocol, Measurement