Changeset 1584 for MDService2
- Timestamp:
- 10/20/11 22:32:36 (13 years ago)
- Location:
- MDService2/branches/MDService_simple3
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_model.js
r1574 r1584 206 206 @class Represents a Query. 207 207 */ 208 function Query(collection, columns, query , squery) {208 function Query(collection, columns, query) { 209 209 this.id = 0; 210 210 this.collection = collection; // [] 211 211 this.columns = columns; // string 212 212 this.query = query; //sctext 213 this.squery = squery;213 //this.squery = squery; 214 214 this.listid = ""; 215 215 this.container = {}; … … 314 314 } 315 315 316 /* 316 317 if (json["squerystring"] == "[NULL]"){ 317 318 this.squery = null; … … 319 320 this.squery = json["squerystring"]; 320 321 } 321 322 */ 322 323 this.columns = columns_text; 323 324 … … 446 447 params = params + "query=" + escape(this.query) + "&"; 447 448 } 449 /* 448 450 if (this.squery != null) { 449 451 escaped_sq =escape(this.squery).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ; … … 452 454 params = params + "query=" + escaped_sq + "&"; 453 455 } 456 */ 454 457 params = params + "collection=" + this.getcollectiontext("index") + "&columns=" + this.getcolumnstext() + "&startRecord=" + this.startItem + "&maximumRecords=" + this.maximumItems + "&repository=" + this.repository; 455 458 if (this.options != null) { … … 487 490 var str = ""; 488 491 var coll = (this.getcollectiontext("name") != "" ) ? " in " + this.getcollectiontext("name") : ""; 489 str = Query.queryliststring(this.squery,this.query) + coll + " @" + this.repository.toString(); 492 //str = Query.queryliststring(this.squery,this.query) + coll + " @" + this.repository.toString(); 493 str = Query.queryliststring(this.query) + coll + " @" + this.repository.toString(); 490 494 return str; 491 495 }; … … 552 556 json_cols[i] = cols; 553 557 } 554 /* 555 var q = ""; 556 if (this.squery != undefined){ 557 q = q + squery; 558 } 559 if (this.query != undefined){ 560 q = q + query; 561 } 562 */ 558 563 559 var jsonq = {"id":this.id, 564 560 "name":"", 565 "squerystring":this.squery,566 "querystring": query,561 //"squerystring":this.squery, 562 "querystring":this.query, 567 563 "searchclauses":"null" , 568 564 "collections" : json_coll, … … 655 651 Query.fullformatstring = function (json) { 656 652 var qs = json.querystring; 657 var sqs = json.squerystring;653 //var sqs = json.squerystring; 658 654 659 655 if (qs == "[NULL]") { … … 661 657 } 662 658 663 if (sqs == "[NULL]") {659 /*if (sqs == "[NULL]") { 664 660 sqs = null; 665 661 } 666 662 */ 667 663 var collection_text = Query.collectiontext(json); 668 664 669 665 var full_str = ""; 670 666 var len = formatquerystring_len; 671 667 /* 672 668 if (sqs != null) { 673 669 if (sqs.length > len){ … … 678 674 } 679 675 } 680 676 */ 681 677 if (qs != null) { 682 678 qs = Query.simplequerystring(qs); … … 697 693 }; 698 694 699 Query.queryliststring = function( squery,query) {695 Query.queryliststring = function(query) { 700 696 var s_squery = ""; 701 697 var s_query = ""; 702 698 var str = ""; 703 699 704 if (squery != null){700 /*if (squery != null){ 705 701 s_squery = squery; 706 702 } 703 707 704 if (query != null){ 708 705 s_query = query; … … 715 712 str = Query.simplequerystring(query); 716 713 } 714 */ 715 716 str = Query.simplequerystring(query); 717 717 return str; 718 718 }; … … 907 907 908 908 addDetailFunctionality(q_header, query); 909 $(q_header).find('.result-header').height($(q_header).height()); 909 910 910 911 createTooltip($(this)); -
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js
r1569 r1584 569 569 }, 570 570 571 // from searchclauses to simple querystring only * any <string> is converted572 simplequerytext: function(){573 this.buildsctext();574 if (sctext.substring(0,6) == '* any '){575 return sctext.replace('* any ','');576 }577 return "";578 },579 580 571 buildsctext: function(){ 581 572 var uncompletequery = false; … … 604 595 605 596 } 597 if ((i == 1 && j == 1) && (this.sctext.substring(0,6) == '* any ')) { 598 this.sctext = sctext.replace('* any ',''); 599 } 606 600 if (uncompletequery){ 607 601 this.sctext = ""; 608 602 } 609 603 notifyUser(this.sctext); 604 return this.sctext; 605 610 606 }, 611 607 -
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui.js
r1574 r1584 93 93 searchclauseset.buildfromquerystring(); 94 94 } else { 95 $('#input-simplequery').attr("value",searchclauseset. simplequerytext());95 $('#input-simplequery').attr("value",searchclauseset.buildsctext()); 96 96 } 97 97 }); … … 247 247 event.preventDefault(); 248 248 //hideWelcomeMessage(); 249 var query , squery;249 var query; 250 250 if (getInputMode() == 'complex'){ 251 searchclauseset.buildsctext(); 252 query = searchclauseset.sctext; 251 query = searchclauseset.buildsctext(); 253 252 } else { 254 squery = $('#input-simplequery').attr("value");253 query = $('#input-simplequery').attr("value"); 255 254 } 256 255 //searchclauseset.buildsctext(); … … 269 268 query = null; 270 269 } 271 var q = new Query(collections, columns, query , squery); //actions.collections.current, query );270 var q = new Query(collections, columns, query); //actions.collections.current, query ); 272 271 q.repository = getSelectedRepository(); 273 272 //if (ws) { … … 390 389 qstring = qstring.substring(18,qstring.length); 391 390 392 var q = new Query([],"",qstring ,"");391 var q = new Query([],"",qstring); 393 392 q.bookmark = 1; 394 393 q.save(); … … 695 694 var columns = columns_widget.getListText();//$('#columns_list').attr("value"); 696 695 //var collections = collections_widget.getListText(); 697 var query = new Query(collections,columns,"" ,"");696 var query = new Query(collections,columns,""); 698 697 query.repository = getSelectedRepository(); 699 698 … … 816 815 $("#detail-float").tabs(); 817 816 }; 817 818 //TODO squery remove 818 819 function submit_query (columns, query, squery, ws) { 819 820 notifyUser("processing query"); … … 822 823 query = null; 823 824 } 824 if (jQuery.trim(squery).length == 0){825 /*if (jQuery.trim(squery).length == 0){ 825 826 squery = null; 826 827 } 827 828 var q = new Query(collections, columns, query , squery); //actions.collections.current, query );828 */ 829 var q = new Query(collections, columns, query); //actions.collections.current, query ); 829 830 q.repository = getSelectedRepository(); 830 831 if (ws) { … … 996 997 collections_widget.load(query.collection); 997 998 columns_widget.load(query.columns.split(',')); 998 $('#input-simplequery').attr("value",query. squery);999 $('#input-simplequery').attr("value",query.query); 999 1000 $('#input-withsummary').attr("checked",(query.options != null)); 1000 1001 updateCollectionTree(); -
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui_load.js
r1558 r1584 55 55 56 56 57 58 // USER WORKSPACEPROFILE 59 jQuery.getJSON("/MDService2/workspaceprofile/json/user",function(data){ 60 notifyUser(data['WorkspaceProfile'],'debug'); 61 workspace.user_json = preprocessJSON(data); 57 // server profile first - options needed 58 jQuery.getJSON("/MDService2/workspaceprofile/json/server",function(sdata){ 59 //notifyUser(sdata['WorkspaceProfile'],'debug'); 60 var json = preprocessJSON(sdata); 61 workspace.server_json = json; 62 $("#serverqs").attr("data",JSON.stringify(json)); 63 loadQuerysets("server"); 64 loadRepositories(workspace.server_json["WorkspaceProfile"]["Repositories"]); 65 loadCollections(true); 66 loadTerms(); 67 loadTermsAutocomplete(); 68 loadQueryFromUriParams(); 69 createTooltip(null); 62 70 63 jQuery.getJSON("/MDService2/workspaceprofile/json/server",function(data){ 64 notifyUser(data['WorkspaceProfile'],'debug'); 65 var json = preprocessJSON(data); 66 workspace.server_json = json; 67 $("#serverqs").attr("data",JSON.stringify(json)); 68 //loadQuerysets(json["WorkspaceProfile"]["Querysets"],"server"); 69 loadQuerysets("server"); 70 loadRepositories(json["WorkspaceProfile"]["Repositories"]); 71 loadCollections(true); 72 loadTerms(); 73 loadTermsAutocomplete(); 74 loadQueryFromUriParams(); 75 createTooltip(null); 76 77 78 }); 79 80 //loadQuerysets(workspace.user_json["WorkspaceProfile"]["Querysets"],"user"); 81 loadQuerysets("user"); 82 loadBookmarksets(); 83 //loadTermsets(jsonw["WorkspaceProfile"]["CustomTermsets"]); 84 createTooltip(this); 85 }); 71 // USER WORKSPACEPROFILE 72 jQuery.getJSON("/MDService2/workspaceprofile/json/user",function(data){ 73 notifyUser(data['WorkspaceProfile'],'debug'); 74 workspace.user_json = preprocessJSON(data); 75 loadQuerysets("user"); 76 loadBookmarksets(); 77 createTooltip(this); 78 }); 79 80 }); 81 86 82 87 83 … … 279 275 timestr = json.time; 280 276 } 281 var squery = json.squerystring;282 if (squery = "[NULL]"){283 squery = "";284 }285 277 var qq = json.querystring; 286 if (qq = "[NULL]"){278 if (qq == "[NULL]"){ 287 279 qq = ""; 288 280 } … … 292 284 '<span class="cmd cmd_publish"></span><div class="detail" >' + 293 285 name + 294 '<div class="cmds-elem-prop"><span class="label">squery:</span><span class="value">' + squery + '</span></div>' +295 286 '<div class="cmds-elem-prop"><span class="label">query:</span><span class="value">' + Query.simplequerystring(qq) + '</span></div>' + 296 287 '<div class="cmds-elem-prop"><span class="label">collections:</span><span class="value">' + Query.collectiontext(json) + '</span></div>' + … … 307 298 $(qs).append(x); 308 299 309 var query = new Query([],"","" ,"");300 var query = new Query([],"",""); 310 301 query.load(json); 311 302 $(qs).find("[href='"+ id + "_" + i + "']").closest('.cmds-elem-plus').data('query',query); … … 450 441 $(bs).append(x); 451 442 452 var query = new Query([],"","" ,"");443 var query = new Query([],"",""); 453 444 query.load(json); 454 445 $(bs).find("[href='"+ id + "_" + i + "']").closest('.cmds-elem-plus').data('query',query); -
MDService2/branches/MDService_simple3/WebContent/static/queries.xml
r1575 r1584 6 6 <dd><p>just one word like:</p> 7 7 <ul> 8 <li><a class="query" href=" /MDService2/?query=system">system</a></li>9 <li><a class="query" href=" /MDService2/?query=-year-olds">-year-olds</a> - a bug there (don't use '-'!)</li>10 <li><a class="query" href=" /MDService2/?query=acquisition">acquisition</a></li>8 <li><a class="query" href="?query=system">system</a></li> 9 <li><a class="query" href="?query=-year-olds">-year-olds</a> - a bug there (don't use '-'!)</li> 10 <li><a class="query" href="?query=acquisition">acquisition</a></li> 11 11 </ul> 12 12 </dd> … … 14 14 <dd> 15 15 <ul> 16 <!-- <li><a class="query" href="/MDService2/?squery=/?squery=child%20%7C%20acquisition">child | acquisition</a></li>17 -->16 <li><a class="query" href="?squery=/?squery=child%20%7C%20acquisition">child | acquisition</a></li> 17 18 18 </ul> 19 19 </dd> … … 21 21 <dd> 22 22 <ul> 23 <li><a class="query" href=" /MDService2/?query=child%20acquisition">child acquisition</a></li>24 <li><a class="query" href=" /MDService2/?query=longitudinal%20study">longitudinal study</a></li>23 <li><a class="query" href="?query=child%20acquisition">child acquisition</a></li> 24 <li><a class="query" href="?query=longitudinal%20study">longitudinal study</a></li> 25 25 </ul> 26 26 </dd> … … 28 28 <dd>a sequence of terms 29 29 <ul> 30 <li><a class="query" href=" /MDService2/?query=%22longitudinal%20study%22">"longitudinal study"</a></li>30 <li><a class="query" href="?query=%22longitudinal%20study%22">"longitudinal study"</a></li> 31 31 </ul> 32 32 </dd> -
MDService2/branches/MDService_simple3/WorkspaceProfile.xml
r1540 r1584 78 78 </item> 79 79 <item> 80 <type> </type>80 <type>model</type> 81 81 <id>compreg</id> 82 82 <name>compreg</name> … … 139 139 <maximumItems>10</maximumItems> 140 140 <name>lrt:2787?repository=clarin.at-mirror</name> 141 <options null="true"/>141 <options>null</options> 142 142 <querystring>clarin%252Eeu%3Alrt%3A2787?repository=clarin.at-mirror</querystring> 143 143 <searchclauses>null</searchclauses> 144 <squerystring null="true"/>145 144 <startItem>1</startItem> 146 145 <time>2011-06-05 23:22:33</time> … … 162 161 <maximumItems>10</maximumItems> 163 162 <name>C4:220?repository=clarin.at-mirror</name> 164 <options null="true"/>163 <options>null</options> 165 164 <querystring>clarin-at%3Aaac-test-corpus%3AC4%3A220?repository=clarin.at-mirror</querystring> 166 165 <searchclauses>null</searchclauses> 167 <squerystring null="true"/>168 166 <startItem>1</startItem> 169 167 <time>2011-06-05 23:18:28</time> … … 195 193 <maximumItems>10</maximumItems> 196 194 <name>schule | </name> 197 <options null="true"/> 198 <querystring null="true"/> 199 <searchclauses>null</searchclauses> 200 <squerystring>schule</squerystring> 195 <options>null</options> 196 <searchclauses>null</searchclauses> 197 <querystring>schule</querystring> 201 198 <startItem>1</startItem> 202 199 <time>2011-06-05 22:49:20</time> … … 210 207 <maximumItems>10</maximumItems> 211 208 <name>machine | </name> 212 <options null="true"/> 213 <querystring null="true"/> 214 <searchclauses>null</searchclauses> 215 <squerystring>machine</squerystring> 209 <options>null</options> 210 <searchclauses>null</searchclauses> 211 <querystring>machine</querystring> 216 212 <startItem>1</startItem> 217 213 <time>2011-06-05 23:023:58</time> … … 232 228 <maximumItems>10</maximumItems> 233 229 <name>mar | </name> 234 <options null="true"/> 235 <querystring null="true"/> 236 <searchclauses>null</searchclauses> 237 <squerystring>mar</squerystring> 230 <options>null</options> 231 <searchclauses>null</searchclauses> 232 <querystring>mar</querystring> 238 233 <startItem>1</startItem> 239 234 <time>2011-06-05 23:023:31</time> … … 247 242 <maximumItems>10</maximumItems> 248 243 <name>januar | </name> 249 <options null="true"/> 250 <querystring null="true"/> 251 <searchclauses>null</searchclauses> 252 <squerystring>januar</squerystring> 244 <options>null</options> 245 <searchclauses>null</searchclauses> 246 <querystring>januar</querystring> 253 247 <startItem>1</startItem> 254 248 <time>2011-06-05 23:15:59</time> … … 269 263 <maximumItems>10</maximumItems> 270 264 <name>januar | </name> 271 <options null="true"/> 272 <querystring null="true"/> 273 <searchclauses>null</searchclauses> 274 <squerystring>januar</squerystring> 265 <options>null</options> 266 <searchclauses>null</searchclauses> 267 <querystring>januar</querystring> 275 268 <startItem>1</startItem> 276 269 <time>2011-06-05 23:16:33</time> -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/internal/Cache.java
r1540 r1584 237 237 if (str.trim().length() == 0) return ""; 238 238 239 // provisional hack, setting simple string to "" 240 query = new Query("", str,"recordset",""); 239 query = new Query(str,"recordset",""); 241 240 if (query.isStatus(Query.PARSEERROR)) { 242 241 log.debug("Cache.transformQuery.PARSEERROR:" + query.getMsg()); -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/model/Query.java
r1540 r1584 56 56 private URL targetRequest; 57 57 private String syntax = "cql"; /* cql, cmdIndex, xpath */ 58 private String squery_string;59 58 private String query_string; 60 private String full_query_string;59 //private String full_query_string; 61 60 private CQLNode query_cql; 62 61 private String msg; … … 80 79 81 80 82 public Query(String squeryString, StringqueryString) {83 this( squeryString,queryString, MODEL);81 public Query(String queryString) { 82 this(queryString, MODEL); 84 83 } 85 84 … … 91 90 */ 92 91 93 public Query(String squeryString,StringqueryString, String type, String collection, String columns) {92 public Query(String queryString, String type, String collection, String columns) { 94 93 this.type =type; 95 if (squeryString == null)squeryString ="";96 94 if (queryString == null)queryString =""; 97 setFullQueryString( squeryString,queryString);95 setFullQueryString(queryString); 98 96 setCollection(collection); 99 97 setColumns(columns); … … 107 105 */ 108 106 109 public Query(String squeryString, String queryString, String type, String collection) { 110 //this.type =type; 111 //setFullQueryString(squeryString, queryString); 112 //setCollection(collection); 113 this(squeryString, queryString, type, collection, "Id,name"); 107 public Query(String queryString, String type, String collection) { 108 this( queryString, type, collection, "Id,name"); 114 109 } 115 110 … … 121 116 */ 122 117 123 public Query(String squeryString, String queryString, String type) { 124 //this.type =type; 125 //if (squeryString == null)squeryString =""; 126 //setFullQueryString(squeryString, queryString); 127 this(squeryString, queryString, type, ""); 118 public Query(String queryString, String type) { 119 this(queryString, type, ""); 128 120 } 129 121 … … 133 125 134 126 public String getStatus() { 135 if (type.equals(Query.RECORDSET) && query_cql== null && ( full_query_string != "")) {127 if (type.equals(Query.RECORDSET) && query_cql== null && (query_string != "")) { 136 128 return Query.PARSEERROR; 137 129 } else { … … 153 145 } 154 146 155 public void setFullQueryString(String squeryString, StringqueryString) {147 public void setFullQueryString(String queryString) { 156 148 157 149 query_string=queryString; 158 150 159 if (squeryString.trim().length() == 0){160 squeryString = null;161 }162 151 if (queryString.trim().length() == 0){ 163 152 queryString = null; 164 153 } 165 154 /* 166 155 String squery = createsqueryString(squeryString); 167 156 if (squery != null && queryString != null){ … … 174 163 full_query_string = ""; 175 164 } 176 log.debug("QUERY.FULLQUERYSTRING:" + full_query_string); 177 if (type.equals(RECORDSET) && (full_query_string.length() > 0)) { 165 */ 166 log.debug("QUERY.FULLQUERYSTRING:" + query_string); 167 if (type.equals(RECORDSET) && (query_string.length() > 0)) { 178 168 parse(); 179 169 //preprocess(); … … 181 171 182 172 } 183 173 /* 184 174 public String getFullQueryString() { 185 175 return full_query_string; 186 176 } 187 177 */ 188 178 189 179 public void setCollection(String collection) { … … 428 418 CQLParser parser = new CQLParser(); 429 419 // cannot accept '-' at the CQL beginning 430 String local_full_query_string = full_query_string;420 String local_full_query_string = query_string; 431 421 local_full_query_string = local_full_query_string.replace("-", "%2D"); 432 422 -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/proxy/MDRepoProxy.java
r1569 r1584 65 65 //TODO squery removed 66 66 //Query query = new Query(getParam("squery"), getParam("query"),getSourceAction().getActionkey()); 67 Query query = new Query( "",getParam("query"),getSourceAction().getActionkey());67 Query query = new Query(getParam("query"),getSourceAction().getActionkey()); 68 68 69 69 //log.debug("MDRPx.getQ:" + getSquery() + " and (" + getQ() + ")");
Note: See TracChangeset
for help on using the changeset viewer.