[21927] | 1 | package org.greenstone.mat.servlet;
|
---|
[18107] | 2 |
|
---|
| 3 | import java.io.*;
|
---|
| 4 | import java.text.SimpleDateFormat;
|
---|
| 5 | import java.util.ArrayList;
|
---|
| 6 | import java.util.Calendar;
|
---|
| 7 | import java.util.Collection;
|
---|
| 8 | import java.util.HashMap;
|
---|
| 9 | import java.util.Iterator;
|
---|
| 10 | import java.util.Map;
|
---|
| 11 | import java.util.Set;
|
---|
| 12 |
|
---|
| 13 | import javax.xml.parsers.DocumentBuilder;
|
---|
| 14 | import javax.xml.parsers.DocumentBuilderFactory;
|
---|
| 15 |
|
---|
| 16 | import org.w3c.dom.Document;
|
---|
| 17 | import org.w3c.dom.Element;
|
---|
| 18 | import org.w3c.dom.Node;
|
---|
| 19 | import org.w3c.dom.NodeList;
|
---|
| 20 | import org.greenstone.gsdl3.*;
|
---|
| 21 | import org.greenstone.gsdl3.util.GlobalProperties;
|
---|
| 22 |
|
---|
| 23 | public class PrintHTML {
|
---|
| 24 |
|
---|
| 25 | private final String NORMAL = "normal";
|
---|
| 26 | private final String WORST = "worst";
|
---|
| 27 | private final String BEST = "best";
|
---|
| 28 | private final String title1 ="Hide Empty Metadata ,";
|
---|
| 29 | private final String title2 ="Hide Completed Metadata ,";
|
---|
| 30 | private final String title3 ="Hide Documents with Empty Metadata ,";
|
---|
| 31 | private final String title4 ="Hide Documents with Completed Metadata ,";
|
---|
| 32 | private final String title5 ="No Available Graph";
|
---|
| 33 | private final String metadataSet1 = "Dublin Core";
|
---|
| 34 | private final String metadataSet2 = "Extracted";
|
---|
| 35 | private final String spaceLeft = "<I>«";
|
---|
| 36 | private final String spaceRight = "»</I>";
|
---|
| 37 | private final String htmlSpace = " ";
|
---|
| 38 | private final String oddChar ="odd Character";
|
---|
| 39 | private final String destination;
|
---|
| 40 | private final String space ="space";
|
---|
| 41 | private String hostName;
|
---|
| 42 | private String cssString;
|
---|
| 43 | private int port_number;
|
---|
| 44 | private GlobalProperties globalProperty = null;
|
---|
| 45 | private String fileSeparator = File.separator;
|
---|
| 46 |
|
---|
| 47 | String linkIdentifier = "";
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 | private HashMap url;
|
---|
| 52 |
|
---|
| 53 | MetadataStats mds;
|
---|
| 54 | DataMaker dm;
|
---|
| 55 | Calendar cl;
|
---|
| 56 | SimpleDateFormat sdf;
|
---|
| 57 | PrintWriter printWriter;
|
---|
| 58 |
|
---|
| 59 | public PrintHTML(MetadataStats ms, PrintWriter arg, int port){
|
---|
| 60 |
|
---|
| 61 | port_number = port;
|
---|
| 62 | mds = ms;
|
---|
| 63 | printWriter = arg;
|
---|
| 64 | dm = new DataMaker(mds);
|
---|
| 65 | cl=Calendar.getInstance();
|
---|
| 66 | linkIdentifier = "dc.Identifier";
|
---|
| 67 | destination = mds.HTMLDirectory;
|
---|
| 68 | sdf = new SimpleDateFormat(" dd MMM yyyy 'at' HH:mm:ss z 'GMT'Z");
|
---|
| 69 | setupMetadataLink("metadataElementURL");
|
---|
| 70 |
|
---|
| 71 |
|
---|
| 72 | try {
|
---|
| 73 | java.net.InetAddress localMachine = java.net.InetAddress.getLocalHost();
|
---|
| 74 | hostName = localMachine.getHostName();
|
---|
| 75 | }catch (java.net.UnknownHostException uhe) {
|
---|
| 76 | uhe.printStackTrace();
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | cssString = "<link rel=\"stylesheet\" href=\"http://"+hostName+":"+port_number+"/greenstone3/mat/script/mat.css\" type=\"text/css\" >";
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | private ArrayList getHideEmptyMetadataDetail(ArrayList dataset, String[] id, String[] metadataName){
|
---|
| 83 |
|
---|
| 84 | printWriter.write("<!-- generating all possible page -->");
|
---|
| 85 | printWriter.flush();
|
---|
| 86 |
|
---|
| 87 | if(id.length==0 || metadataName.length==0){
|
---|
| 88 | return new ArrayList();
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | ArrayList detailList = new ArrayList();
|
---|
| 92 | ArrayList alist = new ArrayList();
|
---|
| 93 | ArrayList nameList = new ArrayList();
|
---|
| 94 |
|
---|
| 95 | for(int i = 0; i< metadataName.length; i++){
|
---|
| 96 | if(!dm.IsElementEmpty(metadataName[i])){
|
---|
| 97 | alist.add(dm.getMetadataRows(metadataName[i]));
|
---|
| 98 | nameList.add(metadataName[i]);
|
---|
| 99 | }
|
---|
| 100 | }
|
---|
| 101 |
|
---|
| 102 | String[] metaDataElementName = new String[nameList.size()];
|
---|
| 103 |
|
---|
| 104 | for(int i = 0; i< nameList.size(); i++){
|
---|
| 105 | metaDataElementName[i] = nameList.get(i).toString();
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | if(id.length==0 || metaDataElementName.length==0){
|
---|
| 109 | return new ArrayList();
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | detailList.add(alist);
|
---|
| 113 | detailList.add(id);
|
---|
| 114 | detailList.add(metaDataElementName);
|
---|
| 115 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 116 | printWriter.flush();
|
---|
| 117 |
|
---|
| 118 | return detailList;
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | private ArrayList getHideFullMetadataDetail(ArrayList dataset, String[] id, String[] metadataName){
|
---|
| 122 |
|
---|
| 123 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 124 | printWriter.flush();
|
---|
| 125 |
|
---|
| 126 | if(id.length==0 || metadataName.length==0){
|
---|
| 127 | return new ArrayList();
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | ArrayList detailList = new ArrayList();
|
---|
| 131 | ArrayList alist = new ArrayList();
|
---|
| 132 | ArrayList nameList = new ArrayList();
|
---|
| 133 |
|
---|
| 134 | for(int i = 0; i< metadataName.length; i++){
|
---|
| 135 | if(!dm.IsElementFull(metadataName[i])){
|
---|
| 136 | alist.add(dm.getMetadataRows(metadataName[i]));
|
---|
| 137 | nameList.add(metadataName[i]);
|
---|
| 138 | }
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 | String[] metaDataElementName = new String[nameList.size()];
|
---|
| 142 |
|
---|
| 143 | for(int i = 0; i< nameList.size(); i++){
|
---|
| 144 | metaDataElementName[i] = nameList.get(i).toString();
|
---|
| 145 | }
|
---|
| 146 |
|
---|
| 147 | if(id.length==0 || metaDataElementName.length==0){
|
---|
| 148 | return new ArrayList();
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | detailList.add(alist);
|
---|
| 152 | detailList.add(id);
|
---|
| 153 | detailList.add(metaDataElementName);
|
---|
| 154 |
|
---|
| 155 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 156 | printWriter.flush();
|
---|
| 157 |
|
---|
| 158 | return detailList;
|
---|
| 159 | }
|
---|
| 160 |
|
---|
| 161 | private ArrayList getHideEmptyDocumentDetail(ArrayList dataset, String[] id, String[] metadataName){
|
---|
| 162 |
|
---|
| 163 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 164 | printWriter.flush();
|
---|
| 165 |
|
---|
| 166 | if(id.length==0 || metadataName.length==0){
|
---|
| 167 | return new ArrayList();
|
---|
| 168 | }
|
---|
| 169 |
|
---|
| 170 | ArrayList detailList = new ArrayList();
|
---|
| 171 | ArrayList alist = dm.removeDocument(dataset, id, 0);
|
---|
| 172 | ArrayList idList = dm.getRemovedID();
|
---|
| 173 | ArrayList newIDList = new ArrayList();
|
---|
| 174 |
|
---|
| 175 | for(int i = 0; i< id.length; i++){
|
---|
| 176 | if(!idList.contains(id[i])){
|
---|
| 177 | newIDList.add(id[i]);
|
---|
| 178 | }
|
---|
| 179 | }
|
---|
| 180 |
|
---|
| 181 | id = new String[newIDList.size()];
|
---|
| 182 | for(int i = 0; i<newIDList.size(); i++){
|
---|
| 183 | id[i] = newIDList.get(i).toString();
|
---|
| 184 | }
|
---|
| 185 |
|
---|
| 186 | if(id.length==0 || metadataName.length==0){
|
---|
| 187 | return new ArrayList();
|
---|
| 188 | }
|
---|
| 189 |
|
---|
| 190 | detailList.add(alist);
|
---|
| 191 | detailList.add(id);
|
---|
| 192 | detailList.add(metadataName);
|
---|
| 193 |
|
---|
| 194 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 195 | printWriter.flush();
|
---|
| 196 |
|
---|
| 197 | return detailList;
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 | private ArrayList getHideFullDocumentDetail(ArrayList dataset, String[] id, String[] metadataName){
|
---|
| 201 |
|
---|
| 202 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 203 | printWriter.flush();
|
---|
| 204 |
|
---|
| 205 | if(id.length==0 || metadataName.length==0){
|
---|
| 206 | return new ArrayList();
|
---|
| 207 | }
|
---|
| 208 |
|
---|
| 209 | ArrayList detailList = new ArrayList();
|
---|
| 210 | ArrayList alist = dm.removeDocument(dataset, id ,1);
|
---|
| 211 | ArrayList idList = dm.getRemovedID();
|
---|
| 212 | ArrayList newIDList = new ArrayList();
|
---|
| 213 |
|
---|
| 214 | for(int i = 0; i< id.length; i++){
|
---|
| 215 | if(!idList.contains(id[i])){
|
---|
| 216 | newIDList.add(id[i]);
|
---|
| 217 | }
|
---|
| 218 | }
|
---|
| 219 |
|
---|
| 220 | id = new String[newIDList.size()];
|
---|
| 221 | for(int i = 0; i<newIDList.size(); i++){
|
---|
| 222 | id[i] = newIDList.get(i).toString();
|
---|
| 223 | }
|
---|
| 224 |
|
---|
| 225 | if(id.length==0 || metadataName.length==0){
|
---|
| 226 | return new ArrayList();
|
---|
| 227 | }
|
---|
| 228 |
|
---|
| 229 | detailList.add(alist);
|
---|
| 230 | detailList.add(id);
|
---|
| 231 | detailList.add(metadataName);
|
---|
| 232 |
|
---|
| 233 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 234 | printWriter.flush();
|
---|
| 235 |
|
---|
| 236 | return detailList;
|
---|
| 237 | }
|
---|
| 238 |
|
---|
| 239 | public void generateAllPossibleGraph(ArrayList Namelist,String[]ids,String[] names,String condition){
|
---|
| 240 |
|
---|
| 241 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 242 | printWriter.flush();
|
---|
| 243 |
|
---|
| 244 | ArrayList dataList= Namelist;
|
---|
| 245 | String[] id = ids;
|
---|
| 246 | String[] metadataName = names;
|
---|
| 247 |
|
---|
| 248 | ArrayList alist = new ArrayList();
|
---|
| 249 | ArrayList detailList = new ArrayList();
|
---|
| 250 | ArrayList new_dataList = new ArrayList();
|
---|
| 251 | String[] idList;
|
---|
| 252 | String[] metadataNameList;
|
---|
| 253 |
|
---|
| 254 | //---------------------------------------------------------------------------------------------------------SS
|
---|
| 255 | //-----------------------------------------------------------------------SSSS
|
---|
| 256 | if(id.length==0 || metadataName.length==0){
|
---|
| 257 | generateEmptyGraph("SSSS",WORST,condition);
|
---|
| 258 | generateEmptyGraph("SSSS",BEST,condition);
|
---|
| 259 | }
|
---|
| 260 |
|
---|
| 261 | else{
|
---|
| 262 | new_dataList = transformDataList(dataList,id);
|
---|
| 263 | WriteHTML("SSSS",new_dataList,id,metadataName,WORST,"Show completed graph",condition);
|
---|
| 264 | WriteHTML("SSSS",new_dataList,id,metadataName,BEST,"Show completed graph",condition);
|
---|
| 265 | }
|
---|
| 266 | //-----------------------------------------------------------------------SSSH
|
---|
| 267 | detailList = getHideFullDocumentDetail(dataList,id,metadataName);
|
---|
| 268 | if(detailList.size()==0){
|
---|
| 269 | generateEmptyGraph("SSSH",WORST,condition);
|
---|
| 270 | generateEmptyGraph("SSSH",BEST,condition);
|
---|
| 271 | }
|
---|
| 272 | else{
|
---|
| 273 | alist = (ArrayList)detailList.get(0);
|
---|
| 274 | idList = (String[])detailList.get(1);
|
---|
| 275 | metadataNameList = (String[])detailList.get(2);
|
---|
| 276 | new_dataList = transformDataList(alist,idList);
|
---|
| 277 | WriteHTML("SSSH",new_dataList,idList,metadataNameList,WORST,title4,condition);
|
---|
| 278 | WriteHTML("SSSH",new_dataList,idList,metadataNameList,BEST,title4,condition);
|
---|
| 279 | }
|
---|
| 280 | //-----------------------------------------------------------------------SSHS
|
---|
| 281 | detailList = getHideEmptyDocumentDetail(dataList,id,metadataName);
|
---|
| 282 | if(detailList.size()==0){
|
---|
| 283 | generateEmptyGraph("SSHS",WORST,condition);
|
---|
| 284 | generateEmptyGraph("SSHS",BEST,condition);
|
---|
| 285 | generateEmptyGraph("SSHH",WORST,condition);
|
---|
| 286 | generateEmptyGraph("SSHH",BEST,condition);
|
---|
| 287 | }
|
---|
| 288 | else{
|
---|
| 289 | alist = (ArrayList)detailList.get(0);
|
---|
| 290 | idList = (String[])detailList.get(1);
|
---|
| 291 | metadataNameList = (String[])detailList.get(2);
|
---|
| 292 | new_dataList = transformDataList(alist,idList);
|
---|
| 293 | WriteHTML("SSHS",new_dataList,idList,metadataNameList,WORST,title3,condition);
|
---|
| 294 | WriteHTML("SSHS",new_dataList,idList,metadataNameList,BEST,title3,condition);
|
---|
| 295 | //-----------------------------------------------------------------------SSHH
|
---|
| 296 | detailList = getHideFullDocumentDetail(alist,idList,metadataNameList);
|
---|
| 297 | if(detailList.size()==0){
|
---|
| 298 | generateEmptyGraph("SSHH",WORST,condition);
|
---|
| 299 | generateEmptyGraph("SSHH",BEST,condition);
|
---|
| 300 | }
|
---|
| 301 | else{
|
---|
| 302 | alist = (ArrayList)detailList.get(0);
|
---|
| 303 | idList = (String[])detailList.get(1);
|
---|
| 304 | metadataNameList = (String[])detailList.get(2);
|
---|
| 305 | new_dataList = transformDataList(alist,idList);
|
---|
| 306 | WriteHTML("SSHH",new_dataList,idList,metadataNameList,WORST,title3+title4,condition);
|
---|
| 307 | WriteHTML("SSHH",new_dataList,idList,metadataNameList,BEST,title3+title4,condition);
|
---|
| 308 | }
|
---|
| 309 | }
|
---|
| 310 |
|
---|
| 311 | //---------------------------------------------------------------------------------------------------------SH
|
---|
| 312 | ArrayList xList = new ArrayList();
|
---|
| 313 | String[] idListCopy;
|
---|
| 314 | String[] metadataNameListCopy;
|
---|
| 315 |
|
---|
| 316 | //-----------------------------------------------------------------------SHSS
|
---|
| 317 | detailList = getHideFullMetadataDetail(dataList,id,metadataName);
|
---|
| 318 |
|
---|
| 319 | if(detailList.size()==0){
|
---|
| 320 | generateEmptyGraph("SHSS",WORST,condition);
|
---|
| 321 | generateEmptyGraph("SHSS",BEST,condition);
|
---|
| 322 |
|
---|
| 323 | generateEmptyGraph("SHSH",WORST,condition);
|
---|
| 324 | generateEmptyGraph("SHSH",BEST,condition);
|
---|
| 325 |
|
---|
| 326 | generateEmptyGraph("SHHS",WORST,condition);
|
---|
| 327 | generateEmptyGraph("SHHS",BEST,condition);
|
---|
| 328 |
|
---|
| 329 | generateEmptyGraph("SHHH",WORST,condition);
|
---|
| 330 | generateEmptyGraph("SHHH",BEST,condition);
|
---|
| 331 | }
|
---|
| 332 | else{
|
---|
| 333 | alist = (ArrayList)detailList.get(0);
|
---|
| 334 | idList = (String[])detailList.get(1);
|
---|
| 335 | metadataNameList = (String[])detailList.get(2);
|
---|
| 336 |
|
---|
| 337 | xList = (ArrayList)alist.clone();
|
---|
| 338 | idListCopy = (String[]) idList.clone();
|
---|
| 339 | metadataNameListCopy = (String[])metadataNameList.clone();
|
---|
| 340 | new_dataList = transformDataList(alist,idList);
|
---|
| 341 | WriteHTML("SHSS",new_dataList,idList,metadataNameList,WORST,title2,condition);
|
---|
| 342 | WriteHTML("SHSS",new_dataList,idList,metadataNameList,BEST,title2,condition);
|
---|
| 343 |
|
---|
| 344 | //-----------------------------------------------------------------------SHHS
|
---|
| 345 | detailList = getHideEmptyDocumentDetail((ArrayList)xList.clone(),(String[])idListCopy.clone(),(String[])metadataNameListCopy.clone());
|
---|
| 346 | if(detailList.size()==0){
|
---|
| 347 | generateEmptyGraph("SHHS",WORST,condition);
|
---|
| 348 | generateEmptyGraph("SHHS",BEST,condition);
|
---|
| 349 | generateEmptyGraph("SHHH",WORST,condition);
|
---|
| 350 | generateEmptyGraph("SHHH",BEST,condition);
|
---|
| 351 | }
|
---|
| 352 | else{
|
---|
| 353 | alist = (ArrayList)detailList.get(0);
|
---|
| 354 | idList = (String[])detailList.get(1);
|
---|
| 355 | metadataNameList = (String[])detailList.get(2);
|
---|
| 356 | new_dataList = transformDataList(alist,idList);
|
---|
| 357 | WriteHTML("SHHS",new_dataList,idList,metadataNameList,WORST,title2+title3,condition);
|
---|
| 358 | WriteHTML("SHHS",new_dataList,idList,metadataNameList,BEST,title2+title3,condition);
|
---|
| 359 |
|
---|
| 360 | //-----------------------------------------------------------------------SHHH
|
---|
| 361 | detailList = getHideFullDocumentDetail(alist,idList,metadataNameList);
|
---|
| 362 | if(detailList.size()==0){
|
---|
| 363 | generateEmptyGraph("SHHH",WORST,condition);
|
---|
| 364 | generateEmptyGraph("SHHH",BEST,condition);
|
---|
| 365 | }
|
---|
| 366 | else{
|
---|
| 367 | alist = (ArrayList)detailList.get(0);
|
---|
| 368 | idList = (String[])detailList.get(1);
|
---|
| 369 | metadataNameList = (String[])detailList.get(2);
|
---|
| 370 | new_dataList = transformDataList(alist,idList);
|
---|
| 371 | WriteHTML("SHHH",new_dataList,idList,metadataNameList,WORST,title2+title3+title4,condition);
|
---|
| 372 | WriteHTML("SHHH",new_dataList,idList,metadataNameList,BEST,title2+title3+title4,condition);
|
---|
| 373 | }
|
---|
| 374 | }
|
---|
| 375 |
|
---|
| 376 | //-----------------------------------------------------------------------SHSH
|
---|
| 377 | detailList = getHideFullDocumentDetail((ArrayList)xList.clone(),(String[])idListCopy.clone(),(String[])metadataNameListCopy.clone());
|
---|
| 378 | if(detailList.size()==0){
|
---|
| 379 | generateEmptyGraph("SHSH",WORST,condition);
|
---|
| 380 | generateEmptyGraph("SHSH",BEST,condition);
|
---|
| 381 | }
|
---|
| 382 | else{
|
---|
| 383 | alist = (ArrayList)detailList.get(0);
|
---|
| 384 | idList = (String[])detailList.get(1);
|
---|
| 385 | metadataNameList = (String[])detailList.get(2);
|
---|
| 386 | new_dataList = transformDataList(alist,idList);
|
---|
| 387 | WriteHTML("SHSH",new_dataList,idList,metadataNameList,WORST,title2+title4,condition);
|
---|
| 388 | WriteHTML("SHSH",new_dataList,idList,metadataNameList,BEST,title2+title4,condition);
|
---|
| 389 | }
|
---|
| 390 | }
|
---|
| 391 |
|
---|
| 392 | //---------------------------------------------------------------------------------------------------------HS
|
---|
| 393 | ArrayList xList1 = new ArrayList();
|
---|
| 394 | String[] idListCopy1;
|
---|
| 395 | String[] metadataNameListCopy1;
|
---|
| 396 |
|
---|
| 397 | //-----------------------------------------------------------------------HSSS
|
---|
| 398 | detailList = getHideEmptyMetadataDetail(dataList,id,metadataName);
|
---|
| 399 |
|
---|
| 400 | if(detailList.size()==0){
|
---|
| 401 | generateEmptyGraph("HSSS",WORST,condition);
|
---|
| 402 | generateEmptyGraph("HSSS",BEST,condition);
|
---|
| 403 |
|
---|
| 404 | generateEmptyGraph("HSHS",WORST,condition);
|
---|
| 405 | generateEmptyGraph("HSHS",BEST,condition);
|
---|
| 406 |
|
---|
| 407 | generateEmptyGraph("HSHH",WORST,condition);
|
---|
| 408 | generateEmptyGraph("HSHH",BEST,condition);
|
---|
| 409 |
|
---|
| 410 | generateEmptyGraph("HSSH",WORST,condition);
|
---|
| 411 | generateEmptyGraph("HSSH",BEST,condition);
|
---|
| 412 | }
|
---|
| 413 | else{
|
---|
| 414 | alist = (ArrayList)detailList.get(0);
|
---|
| 415 | idList = (String[])detailList.get(1);
|
---|
| 416 | metadataNameList = (String[])detailList.get(2);
|
---|
| 417 |
|
---|
| 418 | xList1 = (ArrayList)alist.clone();
|
---|
| 419 | idListCopy1 = (String[]) idList.clone();
|
---|
| 420 | metadataNameListCopy1 = (String[])metadataNameList.clone();
|
---|
| 421 |
|
---|
| 422 | new_dataList = transformDataList(alist,idList);
|
---|
| 423 | WriteHTML("HSSS",new_dataList,idList,metadataNameList,WORST,title1,condition);
|
---|
| 424 | WriteHTML("HSSS",new_dataList,idList,metadataNameList,BEST,title1,condition);
|
---|
| 425 |
|
---|
| 426 | //-----------------------------------------------------------------------HSHS
|
---|
| 427 | detailList = getHideEmptyDocumentDetail((ArrayList)xList1.clone(),(String[])idListCopy1.clone(),(String[])metadataNameListCopy1.clone());
|
---|
| 428 | if(detailList.size()==0){
|
---|
| 429 | generateEmptyGraph("HSHS",WORST,condition);
|
---|
| 430 | generateEmptyGraph("HSHS",BEST,condition);
|
---|
| 431 |
|
---|
| 432 | generateEmptyGraph("HSHH",WORST,condition);
|
---|
| 433 | generateEmptyGraph("HSHH",BEST,condition);
|
---|
| 434 | }
|
---|
| 435 | else{
|
---|
| 436 | alist = (ArrayList)detailList.get(0);
|
---|
| 437 | idList = (String[])detailList.get(1);
|
---|
| 438 | metadataNameList = (String[])detailList.get(2);
|
---|
| 439 |
|
---|
| 440 | new_dataList = transformDataList(alist,idList);
|
---|
| 441 | WriteHTML("HSHS",new_dataList,idList,metadataNameList,WORST,title1+title3,condition);
|
---|
| 442 | WriteHTML("HSHS",new_dataList,idList,metadataNameList,BEST,title1+title3,condition);
|
---|
| 443 |
|
---|
| 444 | //-----------------------------------------------------------------------HSHH
|
---|
| 445 | detailList = getHideFullDocumentDetail(alist,idList,metadataNameList);
|
---|
| 446 | if(detailList.size()==0){
|
---|
| 447 | generateEmptyGraph("HSHH",WORST,condition);
|
---|
| 448 | generateEmptyGraph("HSHH",BEST,condition);
|
---|
| 449 | }
|
---|
| 450 | else{
|
---|
| 451 | alist = (ArrayList)detailList.get(0);
|
---|
| 452 | idList = (String[])detailList.get(1);
|
---|
| 453 | metadataNameList = (String[])detailList.get(2);
|
---|
| 454 |
|
---|
| 455 | new_dataList = transformDataList(alist,idList);
|
---|
| 456 | WriteHTML("HSHH",new_dataList,idList,metadataNameList,WORST,title1+title3+title4,condition);
|
---|
| 457 | WriteHTML("HSHH",new_dataList,idList,metadataNameList,BEST,title1+title3+title4,condition);
|
---|
| 458 | }
|
---|
| 459 | }
|
---|
| 460 |
|
---|
| 461 | //-----------------------------------------------------------------------HSSH
|
---|
| 462 | detailList = getHideFullDocumentDetail((ArrayList)xList1.clone(),(String[])idListCopy1.clone(),(String[])metadataNameListCopy1.clone());
|
---|
| 463 | if(detailList.size()==0){
|
---|
| 464 | generateEmptyGraph("HSSH",WORST,condition);
|
---|
| 465 | generateEmptyGraph("HSSH",BEST,condition);
|
---|
| 466 | }
|
---|
| 467 | else{
|
---|
| 468 | alist = (ArrayList)detailList.get(0);
|
---|
| 469 | idList = (String[])detailList.get(1);
|
---|
| 470 | metadataNameList = (String[])detailList.get(2);
|
---|
| 471 |
|
---|
| 472 | new_dataList = transformDataList(alist,idList);
|
---|
| 473 | WriteHTML("HSSH",new_dataList,idList,metadataNameList,WORST,title1+title4,condition);
|
---|
| 474 | WriteHTML("HSSH",new_dataList,idList,metadataNameList,BEST,title1+title4,condition);
|
---|
| 475 | }
|
---|
| 476 | }
|
---|
| 477 |
|
---|
| 478 | //---------------------------------------------------------------------------------------------------------HH
|
---|
| 479 | ArrayList xList2 = new ArrayList();
|
---|
| 480 | String[] idListCopy2;
|
---|
| 481 | String[] metadataNameListCopy2;
|
---|
| 482 |
|
---|
| 483 | //-----------------------------------------------------------------------HHSS
|
---|
| 484 | detailList = getHideEmptyMetadataDetail(dataList,id,metadataName);
|
---|
| 485 | if(detailList.size()==0){
|
---|
| 486 | generateEmptyGraph("HHSS",WORST,condition);
|
---|
| 487 | generateEmptyGraph("HHSS",BEST,condition);
|
---|
| 488 |
|
---|
| 489 | generateEmptyGraph("HHHS",WORST,condition);
|
---|
| 490 | generateEmptyGraph("HHHS",BEST,condition);
|
---|
| 491 |
|
---|
| 492 | generateEmptyGraph("HHHH",WORST,condition);
|
---|
| 493 | generateEmptyGraph("HHHH",BEST,condition);
|
---|
| 494 |
|
---|
| 495 | generateEmptyGraph("HHSH",WORST,condition);
|
---|
| 496 | generateEmptyGraph("HHSH",BEST,condition);
|
---|
| 497 | }
|
---|
| 498 | else{
|
---|
| 499 | alist = (ArrayList)detailList.get(0);
|
---|
| 500 | idList = (String[])detailList.get(1);
|
---|
| 501 | metadataNameList = (String[])detailList.get(2);
|
---|
| 502 |
|
---|
| 503 | detailList = getHideFullMetadataDetail(alist,idList,metadataNameList);
|
---|
| 504 |
|
---|
| 505 | if(detailList.size()==0){
|
---|
| 506 | generateEmptyGraph("HHSS",WORST,condition);
|
---|
| 507 | generateEmptyGraph("HHSS",BEST,condition);
|
---|
| 508 |
|
---|
| 509 | generateEmptyGraph("HHHS",WORST,condition);
|
---|
| 510 | generateEmptyGraph("HHHS",BEST,condition);
|
---|
| 511 |
|
---|
| 512 | generateEmptyGraph("HHHH",WORST,condition);
|
---|
| 513 | generateEmptyGraph("HHHH",BEST,condition);
|
---|
| 514 |
|
---|
| 515 | generateEmptyGraph("HHSH",WORST,condition);
|
---|
| 516 | generateEmptyGraph("HHSH",BEST,condition);
|
---|
| 517 | }
|
---|
| 518 | else{
|
---|
| 519 | alist = (ArrayList)detailList.get(0);
|
---|
| 520 | idList = (String[])detailList.get(1);
|
---|
| 521 | metadataNameList = (String[])detailList.get(2);
|
---|
| 522 |
|
---|
| 523 | xList2 = (ArrayList)alist.clone();
|
---|
| 524 | idListCopy2 = (String[]) idList.clone();
|
---|
| 525 | metadataNameListCopy2 = (String[])metadataNameList.clone();
|
---|
| 526 |
|
---|
| 527 | new_dataList = transformDataList(alist,idList);
|
---|
| 528 | WriteHTML("HHSS",new_dataList,idList,metadataNameList,WORST,title1+title2,condition);
|
---|
| 529 | WriteHTML("HHSS",new_dataList,idList,metadataNameList,BEST,title1+title2,condition);
|
---|
| 530 |
|
---|
| 531 | //---------------------------------------------------------------------- HHSH
|
---|
| 532 | detailList = getHideFullDocumentDetail((ArrayList)xList2.clone(),(String[])idListCopy2.clone(),(String[])metadataNameListCopy2.clone());
|
---|
| 533 | if(detailList.size()==0){
|
---|
| 534 | generateEmptyGraph("HHSH",WORST,condition);
|
---|
| 535 | generateEmptyGraph("HHSH",BEST,condition);
|
---|
| 536 | }
|
---|
| 537 | else{
|
---|
| 538 | alist = (ArrayList)detailList.get(0);
|
---|
| 539 | idList = (String[])detailList.get(1);
|
---|
| 540 | metadataNameList = (String[])detailList.get(2);
|
---|
| 541 |
|
---|
| 542 | new_dataList = transformDataList(alist,idList);
|
---|
| 543 |
|
---|
| 544 | WriteHTML("HHSH",new_dataList,idList,metadataNameList,WORST,title1+title2+title4,condition);
|
---|
| 545 | WriteHTML("HHSH",new_dataList,idList,metadataNameList,BEST,title1+title2+title4,condition);
|
---|
| 546 | }
|
---|
| 547 | //----------------------------------------------------------------------HHHS
|
---|
| 548 | detailList = getHideEmptyDocumentDetail((ArrayList)xList2.clone(),(String[])idListCopy2.clone(),(String[])metadataNameListCopy2.clone());
|
---|
| 549 | if(detailList.size()==0){
|
---|
| 550 | generateEmptyGraph("HHHS",WORST,condition);
|
---|
| 551 | generateEmptyGraph("HHHS",BEST,condition);
|
---|
| 552 |
|
---|
| 553 | generateEmptyGraph("HHHH",WORST,condition);
|
---|
| 554 | generateEmptyGraph("HHHH",BEST,condition);
|
---|
| 555 | }
|
---|
| 556 | else{
|
---|
| 557 | alist = (ArrayList)detailList.get(0);
|
---|
| 558 | idList = (String[])detailList.get(1);
|
---|
| 559 | metadataNameList = (String[])detailList.get(2);
|
---|
| 560 |
|
---|
| 561 | new_dataList = transformDataList(alist,idList);
|
---|
| 562 |
|
---|
| 563 | WriteHTML("HHHS",new_dataList,idList,metadataNameList,WORST,title1+title2+title3,condition);
|
---|
| 564 | WriteHTML("HHHS",new_dataList,idList,metadataNameList,BEST,title1+title2+title3,condition);
|
---|
| 565 |
|
---|
| 566 | //----------------------------------------------------------------------HHHH
|
---|
| 567 | detailList = getHideFullDocumentDetail((ArrayList)alist.clone(),(String[])idList.clone(),(String[])metadataNameList.clone());
|
---|
| 568 | if(detailList.size()==0){
|
---|
| 569 | generateEmptyGraph("HHHH",WORST,condition);
|
---|
| 570 | generateEmptyGraph("HHHH",BEST,condition);
|
---|
| 571 | }
|
---|
| 572 | else{
|
---|
| 573 | alist = (ArrayList)detailList.get(0);
|
---|
| 574 | idList = (String[])detailList.get(1);
|
---|
| 575 | metadataNameList = (String[])detailList.get(2);
|
---|
| 576 |
|
---|
| 577 | new_dataList = transformDataList(alist,idList);
|
---|
| 578 |
|
---|
| 579 | WriteHTML("HHHH",new_dataList,idList,metadataNameList,WORST,title1+title2+title3+title4,condition);
|
---|
| 580 | WriteHTML("HHHH",new_dataList,idList,metadataNameList,BEST,title1+title2+title3+title4,condition);
|
---|
| 581 | }
|
---|
| 582 | }
|
---|
| 583 | }
|
---|
| 584 | }
|
---|
| 585 | }
|
---|
| 586 |
|
---|
| 587 | private ArrayList transformDataList(ArrayList list, String[] ids){
|
---|
| 588 |
|
---|
| 589 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 590 | printWriter.flush();
|
---|
| 591 |
|
---|
| 592 | ArrayList wholeList = new ArrayList();
|
---|
| 593 |
|
---|
| 594 | for(int i = 0; i< ids.length; i++){
|
---|
| 595 | ArrayList idList = new ArrayList();
|
---|
| 596 | for(int j = 0; j<list.size();j++){
|
---|
| 597 | int[] datarows = (int[]) list.get(j);
|
---|
| 598 | idList.add(new Integer (datarows[i]));
|
---|
| 599 | }
|
---|
| 600 | wholeList.add(idList);
|
---|
| 601 | }
|
---|
| 602 |
|
---|
| 603 | for(int i = 0; i< wholeList.size(); i++){
|
---|
| 604 | ArrayList alist = (ArrayList)wholeList.get(i);
|
---|
| 605 | int[] rows = new int[alist.size()];
|
---|
| 606 | for(int j = 0; j< alist.size(); j++){
|
---|
| 607 | rows[j] = ((Integer)alist.get(j)).intValue();
|
---|
| 608 | }
|
---|
| 609 | wholeList.remove(i);
|
---|
| 610 | wholeList.add(i,rows);
|
---|
| 611 | }
|
---|
| 612 |
|
---|
| 613 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 614 | printWriter.flush();
|
---|
| 615 |
|
---|
| 616 | return wholeList;
|
---|
| 617 |
|
---|
| 618 | }
|
---|
| 619 |
|
---|
| 620 | private void generateEmptyGraph(String fileName,String condition,String suffix){
|
---|
| 621 |
|
---|
| 622 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 623 | printWriter.flush();
|
---|
| 624 |
|
---|
| 625 | String suf = suffix;
|
---|
| 626 | if(!suffix.equalsIgnoreCase("dublin")){
|
---|
| 627 | suf = "other";
|
---|
| 628 | }
|
---|
| 629 |
|
---|
| 630 | String cases = condition;
|
---|
| 631 | String collectionFolder = mds.getCollectionName();
|
---|
| 632 |
|
---|
| 633 | try{
|
---|
| 634 | FileWriter fstream = new FileWriter(destination+suf+"_"+fileName+"_"+cases+".html");
|
---|
| 635 | BufferedWriter out = new BufferedWriter(fstream);
|
---|
| 636 | out.write("<!-- This comment keeps IE6/7 in the reliable quirks mode -->\r\n");
|
---|
| 637 | out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
|
---|
| 638 | out.write("<html>\r\n");
|
---|
| 639 | out.write("<head>\r\n<title> No Available Chart</title>\r\n");
|
---|
| 640 | out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n");
|
---|
| 641 | out.write("<link rel=\"stylesheet\" href=\"../script/doby2.css\" type=\"text/css\"/>\r\n");
|
---|
| 642 | out.write("</head>\r\n");
|
---|
| 643 | out.write("<p><a href=\" Overall.html \">Summary</a></p>");
|
---|
| 644 | out.write("<body>\r\n");
|
---|
| 645 | out.write("<p>No data available to render chart.</p>\r\n");
|
---|
| 646 | out.write("<p>Reason: Document number is zero or Metadata element number is zero </p>\r\n");
|
---|
| 647 | out.write("</body></html>\r\n");
|
---|
| 648 | out.close();
|
---|
| 649 | fstream.close();
|
---|
| 650 |
|
---|
| 651 | }catch(Exception e){}
|
---|
| 652 |
|
---|
| 653 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 654 | printWriter.flush();
|
---|
| 655 | }
|
---|
| 656 |
|
---|
| 657 | private void WriteHTML(String fileName, ArrayList dataset, String[] ids, String[] metadataName, String condition, String title, String suffix){
|
---|
| 658 |
|
---|
| 659 | int blueDot = 0;
|
---|
| 660 | String cases = condition;
|
---|
| 661 | String suf = suffix;
|
---|
| 662 | if(!suffix.equalsIgnoreCase("dublin")){
|
---|
| 663 | suf = "other";
|
---|
| 664 | }
|
---|
| 665 | try{
|
---|
| 666 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 667 | printWriter.flush();
|
---|
| 668 |
|
---|
| 669 | ArrayList tempList = mds.getMetadataNameList();
|
---|
| 670 | ArrayList urlIDList;
|
---|
| 671 | if(tempList.contains("dc.Identifier") && linkIdentifier.equals("dc.Identifier")){
|
---|
| 672 | urlIDList = dm.getURLMap("dc.Identifier");
|
---|
| 673 | }
|
---|
| 674 | else if(tempList.contains("nzir_internal.Link") && linkIdentifier.equals("nzir_internal.Link")){
|
---|
| 675 | urlIDList = dm.getURLMap("nzir_internal.Link");
|
---|
| 676 | }
|
---|
| 677 | else{
|
---|
| 678 | urlIDList = new ArrayList();
|
---|
| 679 | }
|
---|
| 680 |
|
---|
| 681 | FileWriter fstream = new FileWriter(destination+suf+"_"+fileName+"_"+cases+".html");
|
---|
| 682 | BufferedWriter out = new BufferedWriter(fstream);
|
---|
| 683 |
|
---|
| 684 | out.write("<!-- This comment keeps IE6/7 in the reliable quirks mode -->\r\n");
|
---|
| 685 | out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
|
---|
| 686 | out.write("<html>\r\n");
|
---|
| 687 | out.write("<head>\r\n<title>"+title+"</title>\r\n");
|
---|
| 688 | out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n");
|
---|
| 689 | out.write("<link rel=\"stylesheet\" href=\"../script/doby2.css\" type=\"text/css\"/>\r\n");
|
---|
| 690 | out.write("<script type=\"text/javascript\" src=\"../script/getInfomation.js\"></script>\r\n");
|
---|
| 691 | out.write("<script type=\"text/javascript\" src=\"http://yui.yahooapis.com/2.4.1/build/yahoo/yahoo-min.js\"></script>\r\n");
|
---|
| 692 | out.write("<script type=\"text/javascript\" src=\"http://yui.yahooapis.com/2.4.1/build/event/event-min.js\"></script>\r\n");
|
---|
| 693 | out.write("<script type=\"text/javascript\" src=\"http://yui.yahooapis.com/2.4.1/build/connection/connection-min.js\"></script>\r\n");
|
---|
| 694 | out.write("</head>\r\n");
|
---|
| 695 | out.write ("<p><a href=\" Overall.html \">Summary</a></p>");
|
---|
| 696 | out.write("<body id=\""+mds.getCollectionName()+"\" onLoad=\"reconfig()\">\r\n");
|
---|
| 697 | out.write("<div id=\"container\">\r\n");
|
---|
| 698 | out.write("<div class=\"tableContainer\">\r\n");
|
---|
| 699 | out.write ("<table cellspacing=\"0\">\r\n");
|
---|
| 700 | out.write ("<thead>\r\n");
|
---|
| 701 | out.write ("<tr>\r\n");
|
---|
| 702 | out.write("<td class=\"qh\">Info\r\n");
|
---|
| 703 | out.write("<td class=\"qh\">URL\r\n");
|
---|
| 704 |
|
---|
| 705 | for(int a = 0; a< metadataName.length; a++){
|
---|
| 706 | out.write("<td>"+ metadataName[a]+"\r\n");
|
---|
| 707 | }
|
---|
| 708 |
|
---|
| 709 | out.write ("</thead>\r\n<tfoot>\r\n<tr>\r\n");
|
---|
| 710 | out.write("<td class=\"qh\"> \r\n");
|
---|
| 711 | out.write("<td class=\"qh\"> \r\n");
|
---|
| 712 |
|
---|
| 713 | for(int a = 0; a< metadataName.length; a++){
|
---|
| 714 | out.write("<td>"+ dm.Mean(metadataName[a])+"%\r\n");
|
---|
| 715 | }
|
---|
| 716 |
|
---|
| 717 | out.write ("</tfoot>\r\n<tbody>\r\n");
|
---|
| 718 |
|
---|
| 719 | if(cases.equals("normal")){
|
---|
| 720 | for(int i = ids.length; i>0; i--){
|
---|
| 721 | out.write ("<tr>");
|
---|
| 722 | int[] datarows = (int[])dataset.get(i-1);
|
---|
| 723 |
|
---|
| 724 | for(int j = 0; j<datarows.length; j++){
|
---|
| 725 |
|
---|
| 726 | if(datarows[j]==1){
|
---|
| 727 | out.write ("<td class=\"b\">");
|
---|
| 728 | blueDot++;
|
---|
| 729 | }
|
---|
| 730 | else {
|
---|
| 731 | out.write ("<td> ");
|
---|
| 732 | }
|
---|
| 733 | }
|
---|
| 734 | }
|
---|
| 735 | }
|
---|
| 736 | else{
|
---|
| 737 | ArrayList idList = new ArrayList();
|
---|
| 738 | for(int i = 0; i<ids.length;i++){
|
---|
| 739 | idList.add(ids[i]);
|
---|
| 740 | }
|
---|
| 741 |
|
---|
| 742 |
|
---|
| 743 | HashMap hp = new HashMap();
|
---|
| 744 |
|
---|
| 745 | for(int i = ids.length; i>0; i--){
|
---|
| 746 | String idValue = ids[i-1];
|
---|
| 747 | int dots = 0;
|
---|
| 748 | int[] datarows = (int[])dataset.get(i-1);
|
---|
| 749 | for(int j = 0; j<datarows.length; j++){
|
---|
| 750 | if(datarows[j]==1){
|
---|
| 751 | dots++;
|
---|
| 752 | }
|
---|
| 753 | }
|
---|
| 754 | hp.put(idValue,new Integer(dots));
|
---|
| 755 |
|
---|
| 756 | }
|
---|
| 757 | ArrayList alist = dm.sortMap(hp);
|
---|
| 758 | String[] idIntValue = new String[alist.size()];
|
---|
| 759 | for(int i = 0; i< alist.size(); i++){
|
---|
| 760 | Map.Entry entry = (Map.Entry) alist.get(i);
|
---|
| 761 | String idElement = ((String) entry.getKey());
|
---|
| 762 | idIntValue[i] = idElement;
|
---|
| 763 | }
|
---|
| 764 |
|
---|
| 765 | if(cases.equals("worst")){
|
---|
| 766 |
|
---|
| 767 | for(int i = 0; i<idIntValue.length; i++){
|
---|
| 768 |
|
---|
| 769 | printWriter.write("<!-- generating all possible page -->");
|
---|
| 770 | printWriter.flush();
|
---|
| 771 |
|
---|
| 772 | int value = idList.indexOf(idIntValue[i]);
|
---|
| 773 | int[] datarows = (int[])dataset.get(value);
|
---|
| 774 |
|
---|
| 775 | out.write ("<tr id=\""+idIntValue[i].substring(4)+"\">\r\n");
|
---|
| 776 | out.write("<td class=\"E\" onclick=\"GD(this)\"> \r\n");
|
---|
| 777 |
|
---|
| 778 | if(urlIDList.contains(idIntValue[i])){
|
---|
| 779 | out.write("<td class=\"qh\" onclick=\"GX(this)\"><span title=\"open URL in new window\">open</span>\r\n");
|
---|
| 780 | }
|
---|
| 781 | else{
|
---|
| 782 | out.write("<td>\r\n");
|
---|
| 783 | }
|
---|
| 784 |
|
---|
| 785 | for(int j = 0; j<datarows.length; j++){
|
---|
| 786 |
|
---|
| 787 | if(datarows[j]==1){
|
---|
| 788 | out.write ("<td class=\"b\">\r\n");
|
---|
| 789 | blueDot++;
|
---|
| 790 | }
|
---|
| 791 | else {
|
---|
| 792 | out.write ("<td class=\"w\">\r\n");
|
---|
| 793 | }
|
---|
| 794 | }
|
---|
| 795 | }
|
---|
| 796 | }
|
---|
| 797 |
|
---|
| 798 | if(cases.equals("best")){
|
---|
| 799 |
|
---|
| 800 | for(int i = idIntValue.length; i>0; i--){
|
---|
| 801 | printWriter.write("<!-- generating all possible page -->");
|
---|
| 802 | printWriter.flush();
|
---|
| 803 |
|
---|
| 804 | int value = idList.indexOf(idIntValue[i-1]);
|
---|
| 805 | int[] datarows = (int[])dataset.get(value);
|
---|
| 806 |
|
---|
| 807 | out.write ("<tr id=\""+idIntValue[i-1].substring(4)+"\">\r\n");
|
---|
| 808 | out.write("<td class=\"E\" onclick=\"GD(this)\"> \r\n");
|
---|
| 809 |
|
---|
| 810 | if(urlIDList.contains(idIntValue[i-1])){
|
---|
| 811 | out.write("<td class=\"qh\" onclick=\"GX(this)\"><span title=\"open URL in new window\">open</span>\r\n");
|
---|
| 812 | }
|
---|
| 813 | else{
|
---|
| 814 | out.write("<td>\r\n");
|
---|
| 815 | }
|
---|
| 816 |
|
---|
| 817 | for(int j = 0; j<datarows.length; j++){
|
---|
| 818 |
|
---|
| 819 | if(datarows[j]==1){
|
---|
| 820 | out.write ("<td class=\"b\">\r\n");
|
---|
| 821 | blueDot++;
|
---|
| 822 | }
|
---|
| 823 | else {
|
---|
| 824 | out.write ("<td class=\"w\">\r\n");
|
---|
| 825 | }
|
---|
| 826 | }
|
---|
| 827 | }
|
---|
| 828 | }
|
---|
| 829 | }
|
---|
| 830 |
|
---|
| 831 | out.write ("</tbody>\r\n");
|
---|
| 832 | out.write ("</table>\r\n</div></div>\r\n");
|
---|
| 833 |
|
---|
| 834 | int t1 = ids.length;
|
---|
| 835 | int t3 = metadataName.length;
|
---|
| 836 | int t4 = t1*t3;
|
---|
| 837 |
|
---|
| 838 | out.write("<table>\r\n<tbody class=\"table1\">");
|
---|
| 839 | out.write("<tr>\r\n");
|
---|
| 840 |
|
---|
| 841 | HashMap tempMap = mds.getMetadataSetMap();
|
---|
| 842 | MetadataSet ms = (MetadataSet)tempMap.get(suffix);
|
---|
| 843 |
|
---|
| 844 | out.write("<td class=\"bfont\">This subset shows "+t1+" out of "+mds.getDocNum()+" documents");
|
---|
| 845 | out.write("<td class=\"bfont\">"+blueDot+" out of "+(mds.getDocNum()*t3)+" metadata items are defined");
|
---|
| 846 | out.write("<tr>\r\n");
|
---|
| 847 | out.write("<td class=\"bfont\">This subset shows "+t3+" out of "+(ms.getIndexsList().size())+" metadata elements");
|
---|
| 848 | out.write("<td class=\"bfont\">Subset completeness: "+dm.round((double)(blueDot*100/t4),5)+"%");
|
---|
| 849 | out.write("</table>\r\n");
|
---|
| 850 | out.write ("<p> <a href=\"Overall.html \">Summary</a></p>");
|
---|
| 851 | out.write ("</body></html>");
|
---|
| 852 | //Close the output stream
|
---|
| 853 |
|
---|
| 854 | out.close();
|
---|
| 855 | fstream.close();
|
---|
| 856 | }catch (Exception e){
|
---|
| 857 | e.printStackTrace(printWriter);
|
---|
| 858 | }
|
---|
| 859 |
|
---|
| 860 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 861 | printWriter.flush();
|
---|
| 862 | }
|
---|
| 863 |
|
---|
| 864 |
|
---|
| 865 | public void generateOverallStatisticsPage(HashMap MetadataSetMap){
|
---|
| 866 |
|
---|
| 867 | String fileName = "Overall";
|
---|
| 868 | ArrayList wholeList = new ArrayList();
|
---|
| 869 | HashMap hp = mds.getMetadataSetMap();
|
---|
| 870 | Collection c = hp.values();
|
---|
| 871 | Iterator i = c.iterator();
|
---|
| 872 | int counter = 0;
|
---|
| 873 | String[][] MetadataData = new String[c.size()][2];
|
---|
| 874 |
|
---|
| 875 | while(i.hasNext()){
|
---|
| 876 | MetadataSet mds = (MetadataSet)i.next();
|
---|
| 877 | wholeList.add(mds);
|
---|
| 878 | ArrayList newMDS = new ArrayList();
|
---|
| 879 | newMDS.add(mds);
|
---|
| 880 |
|
---|
| 881 | MetadataData[counter][0] = mds.getName();
|
---|
| 882 | MetadataData[counter][1] = dm.getSingleMetadataSetCompleteness(newMDS)+"%";
|
---|
| 883 |
|
---|
| 884 | counter++;
|
---|
| 885 | }
|
---|
| 886 |
|
---|
| 887 | try{
|
---|
| 888 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 889 | printWriter.flush();
|
---|
| 890 |
|
---|
| 891 | String str = sdf.format(cl.getTime());
|
---|
| 892 | String collectionFolder = mds.getCollectionName();
|
---|
| 893 |
|
---|
| 894 | FileWriter fstream = new FileWriter(destination+fileName+".html");
|
---|
| 895 | BufferedWriter out = new BufferedWriter(fstream);
|
---|
| 896 |
|
---|
| 897 | out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
|
---|
| 898 | out.write("<html>\r\n");
|
---|
| 899 | out.write("<head><title>Summary</title>\r\n");
|
---|
| 900 | out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n");
|
---|
| 901 | out.write("<style type=\"text/css\">\r\n");
|
---|
| 902 | out.write(".tam{height:20; text-align:right}\r\n");
|
---|
| 903 | out.write("th{height:20; text-align:left}\r\n");
|
---|
| 904 | out.write("body{font-family: Arial;}\r\n");
|
---|
| 905 | out.write("</style>\r\n");
|
---|
| 906 | out.write("<script type=\"text/javascript\" src=\"../script/status3.js\"></script>\r\n");
|
---|
| 907 | out.write("</head>\r\n");
|
---|
| 908 | out.write("<body>\r\n");
|
---|
| 909 | out.write ("<td> <div style=\"float:left;\"> <a href=\"http://"+hostName+":"+port_number+"/greenstone3/mat\">Mat Home</a></div>");
|
---|
| 910 | out.write("<div style=\"float:right;\"><a href=\"http://chnm.gmu.edu/tools/surveys/4386/\">Please send feedback about the Mat tool</a></div></td><br>");
|
---|
| 911 | out.write("<h3 align=\"center\">Summary</h3>\r\n");
|
---|
| 912 | out.write("<table border=1 align=\"center\">\r\n");
|
---|
| 913 | out.write("<colgroup width=\"300\" span=\"2\">\r\n");
|
---|
| 914 | out.write("<tr>\r\n");
|
---|
| 915 | out.write("<th>OAI URL: </th>\r\n");
|
---|
| 916 |
|
---|
| 917 | if(mds.getOAIURL().length()>50){
|
---|
| 918 | out.write("<td class=\"tam\"><font size=\"2px\"><a href=\""+mds.getOAIURL()+"\">"+mds.getOAIURL().substring(0,47)+"....</a></font>\r\n");
|
---|
| 919 | }
|
---|
| 920 | else{
|
---|
| 921 | out.write("<td class=\"tam\"><font size=\"2px\"><a href=\""+mds.getOAIURL()+"\">"+mds.getOAIURL()+"</a></font>\r\n");
|
---|
| 922 | }
|
---|
| 923 |
|
---|
| 924 | out.write("</tr>\r\n");
|
---|
| 925 | out.write("<tr>\r\n");
|
---|
| 926 | out.write("<th>Number of Records:\r\n");
|
---|
| 927 | out.write("<td class=\"tam\">"+mds.getDocNum()+"\r\n");
|
---|
| 928 | out.write("</tr>\r\n");
|
---|
| 929 | out.write("<table border=1 align=\"center\">\r\n");
|
---|
| 930 | out.write("<colgroup width=\"300\" span=\"2\">\r\n");
|
---|
| 931 | out.write("<tr>\r\n");
|
---|
| 932 | out.write("<th>Metadata:\r\n");
|
---|
| 933 | out.write("<td class=\"tam\"><b>Completeness</b>\r\n");
|
---|
| 934 | out.write("</tr><br>\r\n");
|
---|
| 935 |
|
---|
| 936 | for(int a = 0; a<MetadataData.length; a++){
|
---|
| 937 | out.write ("<tr>\r\n");
|
---|
| 938 | if(MetadataData[a][0].equalsIgnoreCase("dublin")){
|
---|
| 939 | out.write ("<th><a href =\""+MetadataData[a][0]+".html\">"+metadataSet1+"</a>");
|
---|
| 940 | }
|
---|
| 941 | else if (MetadataData[a][0].equalsIgnoreCase("extracted")){
|
---|
| 942 | out.write ("<th><a href =\""+MetadataData[a][0]+".html\">"+metadataSet2+"</a>");
|
---|
| 943 | }
|
---|
| 944 | else{
|
---|
| 945 | out.write ("<th><a href =\""+MetadataData[a][0]+".html\">"+MetadataData[a][0]+"</a>");
|
---|
| 946 | }
|
---|
| 947 | out.write ("<td class=\"tam\"> "+MetadataData[a][1]);
|
---|
| 948 | out.write ("</tr>\r\n");
|
---|
| 949 | }
|
---|
| 950 |
|
---|
| 951 | out.write ("</table>");
|
---|
| 952 | out.write("<br>\r\n");
|
---|
| 953 | out.write("<FORM name=\"test\" onsubmit=\"checkStatus()\" action=\"\">");
|
---|
| 954 | out.write("<table border=1 align=\"center\">\r\n");
|
---|
| 955 | out.write ("<colgroup width=\"606\" span=\"1\">\r\n");
|
---|
| 956 | out.write("<tr>\r\n<th>Customize Visualization");
|
---|
| 957 | out.write("<tr>\r\n<td><LABEL FOR=\"H1\"><INPUT align=\"left\" TYPE=\"checkbox\" ID=\"H1\">Hide Empty Metadata Elements</LABEL>");
|
---|
| 958 | out.write("<tr>\r\n<td><LABEL FOR=\"H2\"><INPUT align=\"left\" TYPE=\"checkbox\" ID=\"H2\">Hide Completed Metadata Elements</LABEL>");
|
---|
| 959 | out.write("<tr>\r\n<td><LABEL FOR=\"H3\"><INPUT align=\"left\" TYPE=\"checkbox\" ID=\"H3\">Hide Documents with Empty Metadata Elements</LABEL>");
|
---|
| 960 | out.write("<tr>\r\n<td><LABEL FOR=\"H4\"><INPUT align=\"left\" TYPE=\"checkbox\" ID=\"H4\">Hide Documents with Completed Metadata Elements</LABEL>");
|
---|
| 961 | out.write("<tr>\r\n<th>Metadata: ");
|
---|
| 962 |
|
---|
| 963 | if(MetadataData.length==1){
|
---|
| 964 | if(MetadataData[0][0].equalsIgnoreCase("dublin")){
|
---|
| 965 | out.write("<tr>\r\n<td><LABEL FOR=\"C1\"><INPUT align=\"left\" TYPE=\"radio\" name = \"col\" ID=\"C1\" checked> Dublin Core </LABEL>");
|
---|
| 966 | }
|
---|
| 967 | else {
|
---|
| 968 | out.write("<tr>\r\n<td><LABEL FOR=\"C4\"><INPUT align=\"left\" TYPE=\"radio\" name = \"col\" ID=\"C4\" checked>"+MetadataData[0][0]+"</LABEL>");
|
---|
| 969 | }
|
---|
| 970 | }
|
---|
| 971 | else{
|
---|
| 972 | for(int a = 0; a<MetadataData.length; a++){
|
---|
| 973 | if(a==0){
|
---|
| 974 | if(MetadataData[a][0].equalsIgnoreCase("dublin")){
|
---|
| 975 | out.write("<tr>\r\n<td><LABEL FOR=\"C1\"><INPUT align=\"left\" TYPE=\"radio\" name = \"col\" ID=\"C1\" checked>Dublin Core</LABEL>");
|
---|
| 976 | }
|
---|
| 977 | else {
|
---|
| 978 | out.write("<tr>\r\n<td><LABEL FOR=\"C4\"><INPUT align=\"left\" TYPE=\"radio\" name = \"col\" ID=\"C4\" checked>"+MetadataData[a][0]+"</LABEL>");
|
---|
| 979 | }
|
---|
| 980 | }
|
---|
| 981 | else{
|
---|
| 982 | if(MetadataData[a][0].equalsIgnoreCase("dublin")){
|
---|
| 983 | out.write("<tr>\r\n<td><LABEL FOR=\"C1\"><INPUT align=\"left\" TYPE=\"radio\" name = \"col\" ID=\"C1\">"+MetadataData[a][0]+"</LABEL>");
|
---|
| 984 | }
|
---|
| 985 | else{
|
---|
| 986 | out.write("<tr>\r\n<td><LABEL FOR=\"C4\"><INPUT align=\"left\" TYPE=\"radio\" name = \"col\" ID=\"C4\">"+MetadataData[a][0]+"</LABEL>");
|
---|
| 987 | }
|
---|
| 988 | }
|
---|
| 989 | }
|
---|
| 990 | }
|
---|
| 991 |
|
---|
| 992 | out.write("<tr>\r\n<th>Order By Completeness : ");
|
---|
| 993 | out.write("<tr>\r\n<td><LABEL FOR=\"R1\"><INPUT align=\"left\" TYPE=\"radio\" name = \"order\" ID=\"R1\">Best Case to Worst Case</LABEL>");
|
---|
| 994 | out.write("<tr>\r\n<td><LABEL FOR=\"R2\"><INPUT align=\"left\" TYPE=\"radio\" name = \"order\" ID=\"R2\" checked >Worst Case to Best Case</LABEL>");
|
---|
| 995 | out.write("</table><p align=\"center\"><INPUT TYPE=\"button\" VALUE=\"Show Visualization\" onClick=\"checkStatus()\"> </FORM>");
|
---|
| 996 | out.write("<p align=\"center\">"+str+"</p>");
|
---|
| 997 | out.write("</body></html>");
|
---|
| 998 |
|
---|
| 999 | out.close();
|
---|
| 1000 | fstream.close();
|
---|
| 1001 | }catch (Exception e){
|
---|
| 1002 | System.err.println("Error: " + e.getMessage());
|
---|
| 1003 | }
|
---|
| 1004 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 1005 | printWriter.flush();
|
---|
| 1006 | }
|
---|
| 1007 |
|
---|
| 1008 | public void WriteMetadataSetDetailHTML(MetadataSet mdset){
|
---|
| 1009 |
|
---|
| 1010 | String fileName = mdset.getName();
|
---|
| 1011 |
|
---|
| 1012 | try{
|
---|
| 1013 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 1014 | printWriter.flush();
|
---|
| 1015 |
|
---|
| 1016 | String str = sdf.format(cl.getTime());
|
---|
| 1017 | String collectionFolder = mds.getCollectionName();
|
---|
| 1018 |
|
---|
| 1019 | FileWriter fstream = new FileWriter(destination+fileName+".html");
|
---|
| 1020 | BufferedWriter out = new BufferedWriter(fstream);
|
---|
| 1021 |
|
---|
| 1022 | out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
|
---|
| 1023 | out.write("<html>\r\n");
|
---|
| 1024 | out.write("<head>\r\n<title>Metadata Detail</title>\r\n");
|
---|
| 1025 | out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n");
|
---|
| 1026 | out.write("<style type=\"text/css\">\r\n");
|
---|
| 1027 | out.write("td{height:20;text-align:right;}\r\n");
|
---|
| 1028 | out.write("th{height:20;text-align:left;}\r\n");
|
---|
| 1029 | out.write("body{font-family: Arial;}\r\n");
|
---|
| 1030 | out.write("</style>\r\n");
|
---|
| 1031 | out.write( "</head>\r\n");
|
---|
| 1032 | out.write ("<body>\r\n");
|
---|
| 1033 | out.write ("<td> <div style=\"float:left;\"> <a href=\" Overall.html \">Summary</a></div>");
|
---|
| 1034 | out.write("<div style=\"float:right;\"><a href=\"http://chnm.gmu.edu/tools/surveys/4386/\">Please send feedback about the Mat tool</a></div></td><br>");
|
---|
| 1035 | if(fileName.equalsIgnoreCase("dublin")){
|
---|
| 1036 | out.write ("<h3 align=\"center\">Metadata Detail: "+metadataSet1+"</h3>\r\n");
|
---|
| 1037 | }
|
---|
| 1038 | else if (fileName.equalsIgnoreCase("extracted")){
|
---|
| 1039 | out.write ("<h3 align=\"center\">Metadata Detail: "+metadataSet2+"</h3>\r\n");
|
---|
| 1040 | }
|
---|
| 1041 | else{
|
---|
| 1042 | out.write ("<h3 align=\"center\">Metadata Detail: "+fileName+"</h3>\r\n");
|
---|
| 1043 | }
|
---|
| 1044 |
|
---|
| 1045 | out.write ("<table border=\"1\" align=\"center\">\r\n");
|
---|
| 1046 | out.write ("<colgroup width=\"200\" span=\"2\">\r\n");
|
---|
| 1047 | out.write ("<tr>\r\n");
|
---|
| 1048 | out.write ("<th>Elements:\r\n");
|
---|
| 1049 | out.write ("<td><b>Completeness</b>\r\n");
|
---|
| 1050 | out.write ("</tr>\r\n");
|
---|
| 1051 |
|
---|
| 1052 | ArrayList elementList = mdset.getIndexsList();
|
---|
| 1053 | HashMap hp = new HashMap();
|
---|
| 1054 | int num = elementList.size();
|
---|
| 1055 |
|
---|
| 1056 | for(int i = 0; i<num; i++){
|
---|
| 1057 | String elementName = (String)elementList.get(i);
|
---|
| 1058 | Double elementValue = new Double(dm.Mean(elementName));
|
---|
| 1059 | hp.put(elementName, elementValue);
|
---|
| 1060 | }
|
---|
| 1061 |
|
---|
| 1062 | elementList = new ArrayList();
|
---|
| 1063 | elementList = dm.sortMap(hp);
|
---|
| 1064 | num = elementList.size();
|
---|
| 1065 |
|
---|
| 1066 | for(int i = 0; i<num; i++){
|
---|
| 1067 | Map.Entry entry = (Map.Entry) elementList.get(i);
|
---|
| 1068 | String elementName = (String) entry.getKey();
|
---|
| 1069 | out.write ("<tr>\r\n");
|
---|
| 1070 | out.write ("<th><a href=\""+ elementName +".html\">"+elementName+"</a>\r\n");
|
---|
| 1071 | out.write ("<td>"+ dm.Mean(elementName)+"%\r\n");
|
---|
| 1072 | out.write ("</tr>\r\n");
|
---|
| 1073 | }
|
---|
| 1074 |
|
---|
| 1075 | out.write("</table>\r\n");
|
---|
| 1076 | out.write ("<p align=\"center\"> <a href=\" Overall.html \">Summary</a></p>");
|
---|
| 1077 | out.write("<p align=\"center\">"+str+"</p>");
|
---|
| 1078 | out.write ("</body></html>\r\n");
|
---|
| 1079 |
|
---|
| 1080 | out.close();
|
---|
| 1081 | fstream.close();
|
---|
| 1082 | }catch (Exception e){
|
---|
| 1083 | e.printStackTrace(printWriter);
|
---|
| 1084 | }
|
---|
| 1085 |
|
---|
| 1086 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 1087 | printWriter.flush();
|
---|
| 1088 |
|
---|
| 1089 | }
|
---|
| 1090 |
|
---|
| 1091 | public void generateMetadataElementDetailPage(MetadataSet mds,PrintWriter out){
|
---|
| 1092 |
|
---|
| 1093 | ArrayList nameList = mds.getIndexsList();
|
---|
| 1094 |
|
---|
| 1095 | for(int i = 0; i<nameList.size();i++){
|
---|
| 1096 | WriteMetadataElementDetailHTML((String)nameList.get(i),mds.getName(),out);
|
---|
| 1097 | }
|
---|
| 1098 | }
|
---|
| 1099 |
|
---|
| 1100 | public void WriteMetadataElementDetailHTML(String name, String linkName,PrintWriter outx){
|
---|
| 1101 |
|
---|
| 1102 | String fileName = name;
|
---|
| 1103 |
|
---|
| 1104 | try{
|
---|
| 1105 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 1106 | printWriter.flush();
|
---|
| 1107 |
|
---|
| 1108 | String collectionFolder = mds.getCollectionName();
|
---|
| 1109 |
|
---|
| 1110 | FileWriter fstream = new FileWriter(destination+fileName+".html");
|
---|
| 1111 | BufferedWriter out = new BufferedWriter(fstream);
|
---|
| 1112 |
|
---|
| 1113 | out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
|
---|
| 1114 | out.write ("<html>\r\n");
|
---|
| 1115 | out.write("<head>\r\n<title> "+ name +" </title>\r\n");
|
---|
| 1116 | out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n");
|
---|
| 1117 | out.write("<style type=\"text/css\">\r\n");
|
---|
| 1118 | out.write("td{height:20; text-align:left;}\r\n");
|
---|
| 1119 | out.write(".tam{height:20; text-align:center}\r\n");
|
---|
| 1120 | out.write("th{height:20; text-align:left;}\r\n");
|
---|
| 1121 | out.write("body{font-family: Arial;}\r\n");
|
---|
| 1122 | out.write("</style>\r\n");
|
---|
| 1123 | out.write("<script type=\"text/javascript\" src=\"http://"+hostName+":"+port_number+"/greenstone3/mat/script/status3.js\"></script>");
|
---|
| 1124 | out.write("</head>\r\n");
|
---|
| 1125 | out.write("<body>\r\n");
|
---|
| 1126 | out.write ("<td> <div style=\"float:left;\"> <a href=\" Overall.html \">Summary</a></div>");
|
---|
| 1127 | out.write("<div style=\"float:right;\"><a href=\"http://chnm.gmu.edu/tools/surveys/4386/\">Please send feedback about the Mat tool</a></div></td>");
|
---|
| 1128 | out.write("»");
|
---|
| 1129 |
|
---|
| 1130 | if(linkName.equalsIgnoreCase("dublin")){
|
---|
| 1131 | out.write ("<a href=\""+linkName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 1132 | }
|
---|
| 1133 | else if (linkName.equalsIgnoreCase("extracted")){
|
---|
| 1134 | out.write ("<a href=\""+linkName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 1135 | }
|
---|
| 1136 | else{
|
---|
| 1137 | out.write ("<a href=\""+linkName+".html\">Metadata Detail ("+linkName+")</a>");
|
---|
| 1138 | }
|
---|
| 1139 |
|
---|
| 1140 | if(name.startsWith("dc.")){
|
---|
| 1141 | int dot = name.lastIndexOf('.');
|
---|
| 1142 | dot++;
|
---|
| 1143 | String nameReplace = name.substring(dot);
|
---|
| 1144 |
|
---|
| 1145 | if(url.containsKey(nameReplace)){
|
---|
| 1146 | out.write ("<h3 align=\"center\">Metadata Element Detail:<a href=\""+ url.get(nameReplace) +"\">"+ name +"</a></h3>\r\n");
|
---|
| 1147 | }
|
---|
| 1148 | else{
|
---|
| 1149 | out.write ("<h3 align=\"center\">Metadata Element Detail: "+ name +"</a></h3>\r\n");
|
---|
| 1150 | }
|
---|
| 1151 | }
|
---|
| 1152 | else{
|
---|
| 1153 | out.write ("<h3 align=\"center\">Metadata Element Detail: "+ name +"</h3>\r\n");
|
---|
| 1154 | }
|
---|
| 1155 |
|
---|
| 1156 | out.write ("<table border=\"1\" align=\"center\" width=1000>\r\n");
|
---|
| 1157 | out.write ("<colgroup width=\"500\" span=\"2\">\r\n");
|
---|
| 1158 | out.write ("<tr>\r\n");
|
---|
| 1159 | out.write ("<td><b>Total Number of Records</b>\r\n");
|
---|
| 1160 | out.write ("<td class=\"tam\">"+mds.getDocNum()+"\r\n");
|
---|
| 1161 | out.write ("</tr>\r\n");
|
---|
| 1162 | out.write ("<tr>\r\n");
|
---|
| 1163 | out.write ("<td><b>Unique Values</b>\r\n");
|
---|
| 1164 | out.write ("<td class=\"tam\">"+dm.getDistinctNumber(name)+"\r\n");
|
---|
| 1165 | out.write ("</tr>\r\n");
|
---|
| 1166 | out.write ("<tr>\r\n");
|
---|
| 1167 | out.write ("<td><b>Total times element used</b>\r\n");
|
---|
| 1168 | out.write ("<td class=\"tam\">"+dm.getFrequency(name) +"\r\n");
|
---|
| 1169 | out.write ("</tr>\r\n");
|
---|
| 1170 | out.write ("<tr>\r\n");
|
---|
| 1171 | out.write ("<td><b>No. of records containing element</b>\r\n");
|
---|
| 1172 | out.write ("<td class=\"tam\"> "+dm.getDocumentUsedElement(name)+"\r\n");
|
---|
| 1173 | out.write ("</tr>\r\n");
|
---|
| 1174 | out.write ("<tr>\r\n");
|
---|
| 1175 |
|
---|
| 1176 | double percentage = dm.Mean(name);
|
---|
| 1177 |
|
---|
| 1178 | out.write ("<th title = \"The completeness means the arithmetic average \"> <div style=\"float:left;\"> Completeness</div>");
|
---|
| 1179 | out.write ("<td class=\"tam\"> "+dm.Mean(name) +"%\r\n");
|
---|
| 1180 | out.write ("</tr>\r\n");
|
---|
| 1181 | out.write ("<tr>\r\n");
|
---|
| 1182 | out.write ("<td><b><div style=\"float:left;\">Minimum "+name +" usage in any record</div></b><div style=\"float:right;\"> <a href=\"#\" onClick=\"helpWindow('Minimum','"+name+"')\" style=\"font-size:small;\">What's this?</a></div>\r\n");
|
---|
| 1183 | out.write ("<td class=\"tam\"> "+dm.getMinRange(name) +"\r\n");
|
---|
| 1184 | out.write ("</tr>\r\n");
|
---|
| 1185 |
|
---|
| 1186 | out.write ("<tr>\r\n");
|
---|
| 1187 | out.write ("<td><b><div style=\"float:left;\">Maximum "+name +" usage in any record</div></b><div style=\"float:right;\"> <a href=\"#\" onClick=\"helpWindow('Maximum','"+name+"')\" style=\"font-size:small;\">What's this?</a></div>\r\n");
|
---|
| 1188 | out.write ("<td class=\"tam\"> "+dm.getMaxRange(name) +"\r\n");
|
---|
| 1189 | out.write ("</tr>\r\n");
|
---|
| 1190 |
|
---|
| 1191 | out.write ("<tr>\r\n");
|
---|
| 1192 | out.write ("<td><b><div style=\"float:left;\">Average "+name +" usage/record</div></b><div style=\"float:right;\"> <a href=\"#\" onClick=\"helpWindow('Average','"+name+"')\" style=\"font-size:small;\">What's this?</a></div>\r\n");
|
---|
| 1193 | out.write ("<td class=\"tam\"> "+dm.Average(name) +"\r\n");
|
---|
| 1194 | out.write ("</tr>\r\n");
|
---|
| 1195 |
|
---|
| 1196 | out.write ("<tr>\r\n");
|
---|
| 1197 | out.write ("<td><b><div style=\"float:left;\">Mode of "+name +" usage/record</div></b><div style=\"float:right;\"><a href=\"#\" onClick=\"helpWindow('Mode','"+name+"')\" style=\"font-size:small;\">What's this?</a></div>\r\n");
|
---|
| 1198 | out.write ("<td class=\"tam\"> "+dm.getMode(name) +"\r\n");
|
---|
| 1199 | out.write ("</tr>\r\n");
|
---|
| 1200 |
|
---|
| 1201 | out.write ("<tr>\r\n");
|
---|
| 1202 | out.write ("<td><b><div style=\"float:left;\">Coverage of the mode of "+name +" usage/record</div></b><div style=\"float:right;\"><a href=\"#\" onClick=\"helpWindow('Mode Frequency','"+name+"')\" style=\"font-size:small;\">What's this?</a></div>\r\n");
|
---|
| 1203 | out.write ("<td class=\"tam\">"+dm.ModeFrequency(name) +"%\r\n");
|
---|
| 1204 | out.write ("</tr>\r\n");
|
---|
| 1205 |
|
---|
| 1206 | if(mds.getOaiPrefix().equalsIgnoreCase("oai_dc")){
|
---|
| 1207 |
|
---|
| 1208 | HashMap suggestionMap = generateMetadataElementSortList(fileName,"ASCII",linkName,outx);
|
---|
| 1209 |
|
---|
| 1210 | if(suggestionMap.size()>0){
|
---|
| 1211 | boolean status = compareElement(fileName,collectionFolder,suggestionMap,linkName);
|
---|
| 1212 | if(status){
|
---|
| 1213 | out.write("<tr><td class=\"tam\"><a href =\""+fileName+"_Suggestion.html\">View Potential Duplicate List</a>");
|
---|
| 1214 | if(percentage<100){
|
---|
| 1215 | out.write ("<td class=\"tam\"><a href =\""+fileName+"_IncompletedList.html\">Records missing "+fileName+"</a></td>");
|
---|
| 1216 | createIncompletedList(fileName,linkName,collectionFolder,outx);
|
---|
| 1217 | }
|
---|
| 1218 | else{
|
---|
| 1219 | out.write("<td class=\"tam\">No Records Missing "+ fileName);
|
---|
| 1220 | }
|
---|
| 1221 | }
|
---|
| 1222 | else{
|
---|
| 1223 | out.write("<tr><td class=\"tam\">No Potential Duplicates");
|
---|
| 1224 | if(percentage<100){
|
---|
| 1225 | out.write ("<td class=\"tam\"><a href =\""+fileName+"_IncompletedList.html\">Records missing "+fileName+"</a></td>");
|
---|
| 1226 | createIncompletedList(fileName,linkName,collectionFolder,outx);
|
---|
| 1227 | }
|
---|
| 1228 | else{
|
---|
| 1229 | out.write("<td class=\"tam\">No Records Missing "+ fileName);
|
---|
| 1230 | }
|
---|
| 1231 | }
|
---|
| 1232 | }
|
---|
| 1233 | else{
|
---|
| 1234 | out.write("<tr><td class=\"tam\">No Potential Duplicates");
|
---|
| 1235 | if(percentage<100){
|
---|
| 1236 | out.write ("<td class=\"tam\"><a href =\""+fileName+"_IncompletedList.html\">Records missing "+fileName+"</a></td>");
|
---|
| 1237 | createIncompletedList(fileName,linkName,collectionFolder,outx);
|
---|
| 1238 | }
|
---|
| 1239 | else{
|
---|
| 1240 | out.write("<td class=\"tam\">No Records Missing "+ fileName);
|
---|
| 1241 | }
|
---|
| 1242 | }
|
---|
| 1243 | generateMetadataElementSortList(fileName,"Frequency-based",linkName,outx);
|
---|
| 1244 | }
|
---|
| 1245 | else{
|
---|
| 1246 | HashMap suggestionMap = generateMetadataElementSortListNoIdentifier(fileName,"ASCII",linkName,outx);
|
---|
| 1247 | generateMetadataElementSortListNoIdentifier(fileName,"Frequency-based",linkName,outx);
|
---|
| 1248 | }
|
---|
| 1249 |
|
---|
| 1250 | out.write ("<tr>\r\n");
|
---|
| 1251 | out.write ("<td class=\"tam\"><a href =\""+fileName+"_Frequency-based.html\">"+"View Full Frequency Sorted list</a>" +
|
---|
| 1252 | " <td class=\"tam\"><a href =\""+fileName+"_ASCII.html\">"+"View Full ASCII Sorted list</a></td>");
|
---|
| 1253 | out.write ("</tr>\r\n");
|
---|
| 1254 | out.write ("</table><br>\r\n");
|
---|
| 1255 | out.write ("<table border=\"1\" align=\"center\" width=1000>\r\n");
|
---|
| 1256 | out.write ("<colgroup width=\"500\" span=\"2\">\r\n");
|
---|
| 1257 | out.write ("<tr>\r\n");
|
---|
| 1258 | out.write ("<th>ASCII-Based\r\n");
|
---|
| 1259 | out.write ("<th>First Five\r\n");
|
---|
| 1260 | out.write ("</tr>\r\n");
|
---|
| 1261 |
|
---|
| 1262 | String[] temp = dm.getSortList(name,"ASCII");
|
---|
| 1263 | String[] temp2 = {" "," "," "," "," "};
|
---|
| 1264 | int length = 0;
|
---|
| 1265 | if(temp.length>=5){
|
---|
| 1266 | length=5;
|
---|
| 1267 | }
|
---|
| 1268 | else if(temp.length<5){
|
---|
| 1269 | length = temp.length;
|
---|
| 1270 | }
|
---|
| 1271 |
|
---|
| 1272 | for(int i =0; i<length; i++){
|
---|
| 1273 | temp2[i] = temp[i];
|
---|
| 1274 | }
|
---|
| 1275 |
|
---|
| 1276 | int x = temp2.length;
|
---|
| 1277 | for(int a = 0; a<x; a++){
|
---|
| 1278 | out.write ("<tr>\r\n");
|
---|
| 1279 | if(!temp2[a].equals(" ")){
|
---|
| 1280 | out.write ("<th>"+(a+1)+"\r\n");
|
---|
| 1281 | }
|
---|
| 1282 | else{
|
---|
| 1283 | out.write ("<th> \r\n");
|
---|
| 1284 | }
|
---|
| 1285 | if(temp2[a].startsWith("http://")){
|
---|
| 1286 | if(temp2[a].length()>60){
|
---|
| 1287 | out.write ("<td><a href = \""+temp2[a]+"\">"+temp2[a].substring(0, 60)+"...</a>");
|
---|
| 1288 | }
|
---|
| 1289 | else {
|
---|
| 1290 | out.write ("<td><a href = \""+temp2[a]+"\">"+temp2[a]+"</a>");
|
---|
| 1291 | }
|
---|
| 1292 | }
|
---|
| 1293 | else{
|
---|
| 1294 | char singleChar = temp2[a].charAt(0);
|
---|
| 1295 | if(temp2[a].length()>61 ){
|
---|
| 1296 | if(temp2[a].startsWith(" ") && ((int)singleChar!=65279)){
|
---|
| 1297 | temp2[a] = temp2[a].substring(1);
|
---|
| 1298 | out.write ("<td>"+spaceLeft+space+spaceRight+temp2[a].substring(0, 60)+"<a href=\""+fileName+"_ASCII.html#topFive\"> ... </a>\r\n");
|
---|
| 1299 | }
|
---|
| 1300 | else if (((int)singleChar==65279)){
|
---|
| 1301 | temp2[a] = temp2[a].substring(1);
|
---|
| 1302 | out.write ("<td>"+spaceLeft+oddChar+spaceRight+temp2[a].substring(0, 60)+"<a href=\""+fileName+"_ASCII.html#topFive\"> ... </a>\r\n");
|
---|
| 1303 | }
|
---|
| 1304 | else{
|
---|
| 1305 | out.write ("<td>"+temp2[a].substring(0, 60)+"<a href=\""+fileName+"_ASCII.html#topFive\"> ... </a>\r\n");
|
---|
| 1306 | }
|
---|
| 1307 | }
|
---|
| 1308 | else {
|
---|
| 1309 | if(temp2[a].startsWith(" ")&& ((int)singleChar!=65279)){
|
---|
| 1310 | temp2[a] = temp2[a].substring(1);
|
---|
| 1311 | out.write ("<td>"+spaceLeft+space+spaceRight+temp2[a]+"\r\n");
|
---|
| 1312 | }
|
---|
| 1313 | else if (((int)singleChar==65279)){
|
---|
| 1314 | temp2[a] = temp2[a].substring(1);
|
---|
| 1315 | out.write ("<td>"+spaceLeft+oddChar+spaceRight+temp2[a]+"\r\n");
|
---|
| 1316 | }
|
---|
| 1317 | else{
|
---|
| 1318 | out.write ("<td>"+temp2[a]+"\r\n");
|
---|
| 1319 | }
|
---|
| 1320 | }
|
---|
| 1321 | }
|
---|
| 1322 | out.write ("</tr>\r\n");
|
---|
| 1323 | }
|
---|
| 1324 |
|
---|
| 1325 | String[] temp3 ={" "," "," "," "," "};
|
---|
| 1326 | length = 0;
|
---|
| 1327 | int start = temp.length;
|
---|
| 1328 |
|
---|
| 1329 | if(temp.length>=5){
|
---|
| 1330 | length= 5;
|
---|
| 1331 | }
|
---|
| 1332 | else if(temp.length<5){
|
---|
| 1333 | length = temp.length;
|
---|
| 1334 | }
|
---|
| 1335 |
|
---|
| 1336 | for(int i = length; i>0; i--){
|
---|
| 1337 | temp3[i-1] = temp[start-1];
|
---|
| 1338 | start--;
|
---|
| 1339 | }
|
---|
| 1340 |
|
---|
| 1341 | out.write ("<tr>\r\n");
|
---|
| 1342 | out.write ("<th>......\r\n");
|
---|
| 1343 | out.write ("<th>Last Five\r\n");
|
---|
| 1344 | out.write ("</tr>\r\n");
|
---|
| 1345 |
|
---|
| 1346 | int counter = temp.length;
|
---|
| 1347 | start = temp.length;
|
---|
| 1348 | x = temp3.length;
|
---|
| 1349 |
|
---|
| 1350 | for(int a = 0; a<x; a++){
|
---|
| 1351 | out.write ("<tr>\r\n");
|
---|
| 1352 |
|
---|
| 1353 | if(!temp3[a].equals(" ")){
|
---|
| 1354 | out.write ("<th>"+(start-length+1+a));
|
---|
| 1355 | }
|
---|
| 1356 | else{
|
---|
| 1357 | out.write ("<th> ");
|
---|
| 1358 | }
|
---|
| 1359 | if(temp3[a].startsWith("http://")){
|
---|
| 1360 | if(temp3[a].length()>60){
|
---|
| 1361 | out.write ("<td><a href = \""+temp3[a]+"\">"+temp3[a].substring(0, 60)+"...</a>");
|
---|
| 1362 | }
|
---|
| 1363 | else {
|
---|
| 1364 | out.write ("<td><a href = \""+temp3[a]+"\">"+temp3[a]+"</a>");
|
---|
| 1365 | }
|
---|
| 1366 | }
|
---|
| 1367 | else{
|
---|
| 1368 | char singleChar = temp3[a].charAt(0);
|
---|
| 1369 | if(temp3[a].length()>61){
|
---|
| 1370 | if(temp3[a].startsWith(" ") && (int)singleChar!=65279){
|
---|
| 1371 | temp3[a] = temp3[a].substring(1);
|
---|
| 1372 | out.write ("<td>"+spaceLeft+space+spaceRight+temp3[a].substring(0, 60)+"<a href=\""+fileName+"_ASCII.html#lastFive\"> ... </a>\r\n");
|
---|
| 1373 | }
|
---|
| 1374 | else if((int)singleChar==65279){
|
---|
| 1375 | temp3[a] = temp3[a].substring(1);
|
---|
| 1376 | out.write ("<td>"+spaceLeft+oddChar+spaceRight+temp3[a].substring(0, 60)+"<a href=\""+fileName+"_ASCII.html#lastFive\"> ... </a>\r\n");
|
---|
| 1377 |
|
---|
| 1378 | }
|
---|
| 1379 | else{
|
---|
| 1380 | out.write ("<td>"+temp3[a].substring(0, 60)+"<a href=\""+fileName+"_ASCII.html#lastFive\"> ... </a>\r\n");
|
---|
| 1381 | }
|
---|
| 1382 | }
|
---|
| 1383 | else{
|
---|
| 1384 | if(temp3[a].startsWith(" ")&& (int)singleChar!=65279){
|
---|
| 1385 | temp3[a] = temp3[a].substring(1);
|
---|
| 1386 | out.write ("<td>"+spaceLeft+space+spaceRight+temp3[a]+"\r\n");
|
---|
| 1387 | }
|
---|
| 1388 | else if((int)singleChar==65279){
|
---|
| 1389 | out.write ("<td>"+spaceLeft+oddChar+spaceRight+temp3[a]+"\r\n");
|
---|
| 1390 | }
|
---|
| 1391 | else{
|
---|
| 1392 | out.write ("<td>"+temp3[a]+"\r\n");
|
---|
| 1393 | }
|
---|
| 1394 | }
|
---|
| 1395 | out.write ("</tr>\r\n");
|
---|
| 1396 | }
|
---|
| 1397 | }
|
---|
| 1398 | out.write ("</table><br>\r\n");
|
---|
| 1399 | out.write ("<table border=\"1\" align=\"center\" width=1000>\r\n");
|
---|
| 1400 | out.write ("<colgroup width=\"500\" span=\"2\">\r\n");
|
---|
| 1401 | out.write ("<tr>\r\n");
|
---|
| 1402 | out.write ("<th>Frequency-Based:\r\n");
|
---|
| 1403 | out.write ("<th>First Five\r\n");
|
---|
| 1404 | out.write ("</tr>\r\n");
|
---|
| 1405 |
|
---|
| 1406 | HashMap xMap = dm.getDistinctValueMap(name);
|
---|
| 1407 | temp = dm.getSortList(name,"Frequency-based");
|
---|
| 1408 | temp2 = new String[] {" "," "," "," "," "};
|
---|
| 1409 | length = 0;
|
---|
| 1410 |
|
---|
| 1411 | if(temp.length>=5){
|
---|
| 1412 | length=5;
|
---|
| 1413 | }
|
---|
| 1414 | else if(temp.length<5){length = temp.length;}
|
---|
| 1415 |
|
---|
| 1416 | for(int i =0; i<length; i++){
|
---|
| 1417 | temp2[i] = temp[i];
|
---|
| 1418 | }
|
---|
| 1419 |
|
---|
| 1420 | ArrayList tempList = new ArrayList();
|
---|
| 1421 |
|
---|
| 1422 | for(int i =0; i<length; i++){
|
---|
| 1423 | if(((Integer)xMap.get(temp2[i])).intValue()==1){
|
---|
| 1424 | tempList.add(temp2[i]);
|
---|
| 1425 | }
|
---|
| 1426 | }
|
---|
| 1427 |
|
---|
| 1428 | x = temp2.length;
|
---|
| 1429 | for(int a = 0; a<x; a++){
|
---|
| 1430 | out.write ("<tr>\r\n");
|
---|
| 1431 |
|
---|
| 1432 | if(!temp2[a].equals(" ")){
|
---|
| 1433 | char singleChar = temp2[a].charAt(0);
|
---|
| 1434 | out.write ("<th>"+(a+1)+". (No. of occurrences: "+((Integer)xMap.get(temp2[a])).toString()+")\r\n");
|
---|
| 1435 | if(temp2[a].startsWith("http://") && (int)singleChar != 65279){
|
---|
| 1436 | if(temp2[a].length()>61){
|
---|
| 1437 | out.write ("<td><a href = \""+temp2[a]+"\">"+temp2[a].substring(0, 60)+"...</a>");
|
---|
| 1438 | }
|
---|
| 1439 | else {
|
---|
| 1440 | out.write ("<td><a href = \""+temp2[a]+"\">"+temp2[a]+"</a>");
|
---|
| 1441 | }
|
---|
| 1442 | }
|
---|
| 1443 |
|
---|
| 1444 | else{
|
---|
| 1445 | if(temp2[a].length()>61){
|
---|
| 1446 |
|
---|
| 1447 | if(temp2[a].startsWith(" ")){
|
---|
| 1448 | temp2[a] = temp2[a].substring(1);
|
---|
| 1449 | out.write ("<td>"+spaceLeft+space+spaceRight+temp2[a].substring(0, 60)+"<a href=\""+fileName+"_Frequency-based.html#topFive\"> ... </a>\r\n");
|
---|
| 1450 | }
|
---|
| 1451 |
|
---|
| 1452 | else if((int)singleChar == 65279){
|
---|
| 1453 | temp2[a] = temp2[a].substring(1);
|
---|
| 1454 | out.write ("<td>"+spaceLeft+oddChar+spaceRight+temp2[a].substring(0, 60)+"<a href=\""+fileName+"_Frequency-based.html#topFive\"> ... </a>\r\n");
|
---|
| 1455 | }
|
---|
| 1456 | else{
|
---|
| 1457 | out.write ("<td>"+temp2[a].substring(0, 60)+"<a href=\""+fileName+"_Frequency-based.html#topFive\"> ... </a>\r\n");
|
---|
| 1458 | }
|
---|
| 1459 |
|
---|
| 1460 | }
|
---|
| 1461 | else{
|
---|
| 1462 | if(temp2[a].startsWith(" ")){
|
---|
| 1463 | temp2[a] = temp2[a].substring(1);
|
---|
| 1464 | out.write ("<td>"+spaceLeft+space+spaceRight+temp2[a]+"\r\n");
|
---|
| 1465 | }
|
---|
| 1466 | else if((int)singleChar == 65279){
|
---|
| 1467 | temp2[a] = temp2[a].substring(1);
|
---|
| 1468 | out.write ("<td>"+spaceLeft+oddChar+spaceRight+temp2[a]+"\r\n");
|
---|
| 1469 | }
|
---|
| 1470 | else{
|
---|
| 1471 | out.write ("<td>"+temp2[a]+"\r\n");
|
---|
| 1472 | }
|
---|
| 1473 | }
|
---|
| 1474 | }
|
---|
| 1475 | }
|
---|
| 1476 | else{
|
---|
| 1477 | out.write ("<th> \r\n");
|
---|
| 1478 | out.write ("<td>\r\n");
|
---|
| 1479 | }
|
---|
| 1480 | out.write ("</tr>\r\n");
|
---|
| 1481 | }
|
---|
| 1482 |
|
---|
| 1483 | temp3 = new String[]{" "," "," "," "," "};
|
---|
| 1484 | length = 0;
|
---|
| 1485 | start = temp.length;
|
---|
| 1486 | if(temp.length>=5){length= 5;}
|
---|
| 1487 | else if(temp.length<5){length = temp.length;}
|
---|
| 1488 |
|
---|
| 1489 | for(int i = length; i>0; i--){
|
---|
| 1490 | temp3[i-1] = temp[start-1];
|
---|
| 1491 | start--;
|
---|
| 1492 | }
|
---|
| 1493 |
|
---|
| 1494 | out.write ("<tr>\r\n");
|
---|
| 1495 | out.write ("<th>......\r\n");
|
---|
| 1496 | out.write ("<th>Last Five\r\n");
|
---|
| 1497 | out.write ("</tr>\r\n");
|
---|
| 1498 |
|
---|
| 1499 | x = temp3.length;
|
---|
| 1500 | start = temp.length;
|
---|
| 1501 | for(int a = 0; a<x; a++){
|
---|
| 1502 | out.write ("<tr>\r\n");
|
---|
| 1503 | if(!temp3[a].equals(" ")){
|
---|
| 1504 |
|
---|
| 1505 |
|
---|
| 1506 | out.write ("<th>"+(start-length+1+a)+". (No. of occurrences: "+((Integer)xMap.get(temp3[a])).toString()+")\r\n");
|
---|
| 1507 |
|
---|
| 1508 | char singleChar = temp3[a].charAt(0);
|
---|
| 1509 | if(temp3[a].startsWith("http://")){
|
---|
| 1510 | if(temp3[a].length()>60){
|
---|
| 1511 | out.write ("<td><a href = \""+temp3[a]+"\">"+temp3[a].substring(0, 60)+"...</a>");
|
---|
| 1512 | }
|
---|
| 1513 | else {
|
---|
| 1514 | out.write ("<td><a href = \""+temp3[a]+"\">"+temp3[a]+"</a>");
|
---|
| 1515 | }
|
---|
| 1516 | }
|
---|
| 1517 | else{
|
---|
| 1518 | if(temp3[a].length()>61){
|
---|
| 1519 |
|
---|
| 1520 | if(temp3[a].startsWith(" ")){
|
---|
| 1521 | temp3[a] = temp3[a].substring(1);
|
---|
| 1522 | out.write ("<td>"+spaceLeft+space+spaceRight+temp3[a].substring(0, 60)+"<a href=\""+fileName+"_Frequency-based.html#lastFive\"> ... </a>\r\n");
|
---|
| 1523 | }
|
---|
| 1524 | else if((int)singleChar == 65279){
|
---|
| 1525 | temp3[a] = temp3[a].substring(1);
|
---|
| 1526 | out.write ("<td>"+spaceLeft+oddChar+spaceRight+temp3[a].substring(0, 60)+"<a href=\""+fileName+"_Frequency-based.html#lastFive\"> ... </a>\r\n");
|
---|
| 1527 |
|
---|
| 1528 | }
|
---|
| 1529 | else{
|
---|
| 1530 | out.write ("<td>"+temp3[a].substring(0, 60)+"<a href=\""+fileName+"_Frequency-based.html#lastFive\"> ... </a>\r\n");
|
---|
| 1531 | }
|
---|
| 1532 |
|
---|
| 1533 | }
|
---|
| 1534 | else{
|
---|
| 1535 | if(temp3[a].startsWith(" ")){
|
---|
| 1536 | out.write ("<td>"+spaceLeft+space+spaceRight+temp3[a]+"\r\n");
|
---|
| 1537 | }
|
---|
| 1538 |
|
---|
| 1539 | else if((int)singleChar == 65279){
|
---|
| 1540 | temp3[a] = temp3[a].substring(1);
|
---|
| 1541 | out.write ("<td>"+spaceLeft+oddChar+spaceRight+temp3[a]+"\r\n");
|
---|
| 1542 |
|
---|
| 1543 | }
|
---|
| 1544 |
|
---|
| 1545 | else{
|
---|
| 1546 | out.write ("<td>"+temp3[a]+"\r\n");
|
---|
| 1547 | }
|
---|
| 1548 | }
|
---|
| 1549 | }
|
---|
| 1550 |
|
---|
| 1551 | }
|
---|
| 1552 | else{
|
---|
| 1553 | //out.write ("<th>"+(a+1)+"\r\n");
|
---|
| 1554 | out.write ("<th> \r\n");
|
---|
| 1555 | out.write ("<th>\r\n");
|
---|
| 1556 | }
|
---|
| 1557 | out.write ("</tr>\r\n");
|
---|
| 1558 | }
|
---|
| 1559 |
|
---|
| 1560 |
|
---|
| 1561 | out.write ("</table>\r\n");
|
---|
| 1562 |
|
---|
| 1563 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
---|
| 1564 | out.write ("<p> <a href=\" Overall.html \">Summary</a>");
|
---|
| 1565 | out.write ("»");
|
---|
| 1566 |
|
---|
| 1567 | if(linkName.equalsIgnoreCase("dublin")){
|
---|
| 1568 | out.write ("<a href=\""+linkName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 1569 |
|
---|
| 1570 | }
|
---|
| 1571 | else if (linkName.equalsIgnoreCase("extracted")){
|
---|
| 1572 | out.write ("<a href=\""+linkName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 1573 |
|
---|
| 1574 | }
|
---|
| 1575 | else{
|
---|
| 1576 | out.write ("<a href=\""+linkName+".html\">Metadata Detail ("+linkName+")</a>");
|
---|
| 1577 | }
|
---|
| 1578 | //out.write(str+"</p>");
|
---|
| 1579 | out.write ("</body></html>\r\n");
|
---|
| 1580 |
|
---|
| 1581 | //Close the output stream
|
---|
| 1582 | out.close();
|
---|
| 1583 | fstream.close();
|
---|
| 1584 | }catch (Exception e){
|
---|
| 1585 |
|
---|
| 1586 | e.printStackTrace(printWriter);
|
---|
| 1587 | }
|
---|
| 1588 |
|
---|
| 1589 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 1590 | printWriter.flush();
|
---|
| 1591 | //System.out.println("detail ends");
|
---|
| 1592 |
|
---|
| 1593 | }
|
---|
| 1594 |
|
---|
| 1595 |
|
---|
| 1596 | private HashMap generateMetadataElementSortList(String title, String sort, String metadataSetName,PrintWriter outx){
|
---|
| 1597 |
|
---|
| 1598 | String fileName = title+"_"+sort;
|
---|
| 1599 | String collectionFolder = mds.getCollectionName();
|
---|
| 1600 |
|
---|
| 1601 | String IDENTIFIER = linkIdentifier;
|
---|
| 1602 | SearchLink sl = new SearchLink(mds.StatsDirectory);
|
---|
| 1603 | HashMap suggestionMap = new HashMap();
|
---|
| 1604 |
|
---|
| 1605 | HashMap valueMap = sl.createValueMap(title,collectionFolder);
|
---|
| 1606 |
|
---|
| 1607 | HashMap linkMap = sl.createLinkMap(IDENTIFIER,collectionFolder);
|
---|
| 1608 | HashMap internalIDMap = dm.getInternalIdentifier(title);
|
---|
| 1609 | boolean status = false;
|
---|
| 1610 |
|
---|
| 1611 | try{
|
---|
| 1612 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 1613 | printWriter.flush();
|
---|
| 1614 |
|
---|
| 1615 | FileWriter fstream = new FileWriter(destination+fileName+".html");
|
---|
| 1616 | BufferedWriter out = new BufferedWriter(fstream);
|
---|
| 1617 |
|
---|
| 1618 | out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
|
---|
| 1619 | out.write ("<html>\r\n");
|
---|
| 1620 | out.write("<head>\r\n<title>Metadata Element Sort List</title>\r\n");
|
---|
| 1621 | out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n");
|
---|
| 1622 | out.write("<script type=\"text/javascript\" src=\"../script/getInfomation.js\"></script>\r\n");
|
---|
| 1623 | out.write("<script type=\"text/javascript\" src=\"http://yui.yahooapis.com/2.4.1/build/yahoo/yahoo-min.js\"></script>\r\n");
|
---|
| 1624 | out.write("<script type=\"text/javascript\" src=\"http://yui.yahooapis.com/2.4.1/build/event/event-min.js\"></script>\r\n");
|
---|
| 1625 | out.write("<script type=\"text/javascript\" src=\"http://yui.yahooapis.com/2.4.1/build/connection/connection-min.js\"></script>\r\n");
|
---|
| 1626 |
|
---|
| 1627 | out.write("<style type=\"text/css\">\r\n");
|
---|
| 1628 | out.write("td{height:20; text-align:left;padding-left:5px;}\r\n");
|
---|
| 1629 | out.write(".tam{height:20; text-align:center}\r\n");
|
---|
| 1630 | out.write("th{height:20; text-align:center;}\r\n");
|
---|
| 1631 | out.write("body{font-family: Arial;}\r\n");
|
---|
| 1632 | out.write("</style>\r\n");
|
---|
| 1633 | out.write("</head><body id=\""+collectionFolder+"\">\r\n");
|
---|
| 1634 |
|
---|
| 1635 | out.write("<td><div style=\"float:left;\"><a href=\" Overall.html \">Summary</a>");
|
---|
| 1636 | out.write("»");
|
---|
| 1637 | ////////////////////////////////////////////////////////////////////////////////////
|
---|
| 1638 | if(metadataSetName.equalsIgnoreCase("dublin")){
|
---|
| 1639 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 1640 | }
|
---|
| 1641 | else if (metadataSetName.equalsIgnoreCase("extracted")){
|
---|
| 1642 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 1643 | }
|
---|
| 1644 | else{
|
---|
| 1645 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSetName+")</a>");
|
---|
| 1646 | }
|
---|
| 1647 | out.write("»");
|
---|
| 1648 | out.write("<a href=\""+title+".html\">"+title+"</a></div>");
|
---|
| 1649 | out.write("<div style=\"float:right;\"><a href=\"http://chnm.gmu.edu/tools/surveys/4386/\">Please send feedback about the Mat tool</a></div></td><br>");
|
---|
| 1650 |
|
---|
| 1651 |
|
---|
| 1652 | String[] list = dm.getSortList(title, sort);
|
---|
| 1653 |
|
---|
| 1654 |
|
---|
| 1655 | if(list.length>=1){
|
---|
| 1656 |
|
---|
| 1657 |
|
---|
| 1658 | if(sort.equals("ASCII")){
|
---|
| 1659 |
|
---|
| 1660 | out.write("<table border=\"1\" align=\"center\" width=\"800\">\r\n");
|
---|
| 1661 | out.write ("<h2 align=\"center\">"+ title+"</h2>\r\n");
|
---|
| 1662 | out.write ("<th class=\"tam\">ASCII Sort\r\n");
|
---|
| 1663 | out.write ("<th class=\"tam\">Element Values\r\n");
|
---|
| 1664 | out.write ("<th class=\"tam\">Source Documents\r\n");
|
---|
| 1665 | out.write ("<th class=\"tam\">Internal Link\r\n");
|
---|
| 1666 |
|
---|
| 1667 | out.write ("<a name='topFive'>\r\n");
|
---|
| 1668 |
|
---|
| 1669 | int counter = 0;
|
---|
| 1670 |
|
---|
| 1671 | for(int i = 0; i<list.length; i++){
|
---|
| 1672 | if(list.length<=5 && i==0){
|
---|
| 1673 | out.write ("<a name='lastFive'>\r\n");
|
---|
| 1674 | }
|
---|
| 1675 | else if((list.length>5) && (list.length-5==i)){
|
---|
| 1676 | out.write ("<a name='lastFive'>\r\n");
|
---|
| 1677 | }
|
---|
| 1678 |
|
---|
| 1679 |
|
---|
| 1680 | InternalLink il= (InternalLink)internalIDMap.get(list[i]);
|
---|
| 1681 | ArrayList alist2 = il.retrieveList();
|
---|
| 1682 | String id = (String)alist2.get(0);
|
---|
| 1683 | id = id.substring(4);
|
---|
| 1684 | out.write("<tr id=\""+id+"\" >\r\n");
|
---|
| 1685 |
|
---|
| 1686 |
|
---|
| 1687 | if(list[i].length()>=201){
|
---|
| 1688 | if(list[i].startsWith("http://")){
|
---|
| 1689 |
|
---|
| 1690 | if(title.equals(IDENTIFIER)){
|
---|
| 1691 | if(list[i].length()>=100){
|
---|
| 1692 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"...</a>");
|
---|
| 1693 |
|
---|
| 1694 | }
|
---|
| 1695 | else{
|
---|
| 1696 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 1697 | }
|
---|
| 1698 | out.write("<td><a href=\""+list[i]+"\">Source</a>\r\n");
|
---|
| 1699 | }
|
---|
| 1700 | else{
|
---|
| 1701 | ArrayList alist= sl.CreateIndentifierLinkPage(title, list[i],IDENTIFIER, collectionFolder,valueMap,linkMap);
|
---|
| 1702 |
|
---|
| 1703 | if(list[i].length()>=100){
|
---|
| 1704 | String url = (String)alist.get(0);
|
---|
| 1705 | if(alist.size()==1){
|
---|
| 1706 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"...</a>");
|
---|
| 1707 | if(url.startsWith("http://")){
|
---|
| 1708 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1709 | }else{
|
---|
| 1710 | out.write("<td>Source\r\n");
|
---|
| 1711 | }
|
---|
| 1712 | }
|
---|
| 1713 | else if(alist.size()>1){
|
---|
| 1714 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"...</a>");
|
---|
| 1715 | if(url.startsWith("http://")){
|
---|
| 1716 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 1717 | }else{
|
---|
| 1718 | out.write("<td>Source\r\n");
|
---|
| 1719 | }
|
---|
| 1720 |
|
---|
| 1721 | }
|
---|
| 1722 | else{
|
---|
| 1723 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 1724 | out.write("<td>No Source Available\r\n");
|
---|
| 1725 | }
|
---|
| 1726 | suggestionMap.put(list[i], url);
|
---|
| 1727 | }
|
---|
| 1728 | else{
|
---|
| 1729 |
|
---|
| 1730 | String url = (String)alist.get(0);
|
---|
| 1731 | if(alist.size()==1){
|
---|
| 1732 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 1733 | //out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1734 | if(url.startsWith("http://")){
|
---|
| 1735 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1736 | }else{
|
---|
| 1737 | out.write("<td>Source\r\n");
|
---|
| 1738 | }
|
---|
| 1739 | }
|
---|
| 1740 | else if(alist.size()>1){
|
---|
| 1741 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 1742 | //out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 1743 | if(url.startsWith("http://")){
|
---|
| 1744 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 1745 | }else{
|
---|
| 1746 | out.write("<td>Source\r\n");
|
---|
| 1747 | }
|
---|
| 1748 | }
|
---|
| 1749 | else{
|
---|
| 1750 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 1751 | out.write("<td>No Source Available\r\n");
|
---|
| 1752 | }
|
---|
| 1753 | suggestionMap.put(list[i], url);
|
---|
| 1754 | }
|
---|
| 1755 | }
|
---|
| 1756 |
|
---|
| 1757 |
|
---|
| 1758 |
|
---|
| 1759 | }
|
---|
| 1760 | else{
|
---|
| 1761 |
|
---|
| 1762 | ArrayList alist= sl.CreateIndentifierLinkPage(title, list[i],IDENTIFIER, collectionFolder,valueMap,linkMap);
|
---|
| 1763 |
|
---|
| 1764 | //////////////////////////////////////
|
---|
| 1765 |
|
---|
| 1766 | if(list[i].startsWith(" ")){
|
---|
| 1767 | String elements = list[i];
|
---|
| 1768 | list[i] = list[i].substring(1);
|
---|
| 1769 |
|
---|
| 1770 | if(alist.size()==1){
|
---|
| 1771 | out.write("<td>"+(counter+1)+"<td>"+spaceLeft+space+spaceRight+list[i].substring(0, 200)+"...<td>"+
|
---|
| 1772 | "<a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1773 | suggestionMap.put(elements, (String)alist.get(0));
|
---|
| 1774 | }
|
---|
| 1775 | else if(alist.size()>1){
|
---|
| 1776 | out.write("<td>"+(counter+1)+"<td>"+spaceLeft+space+spaceRight+list[i].substring(0, 200)+"...<td>"+
|
---|
| 1777 | "<a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 1778 | suggestionMap.put(elements, (String)alist.get(0));
|
---|
| 1779 | }
|
---|
| 1780 | else{
|
---|
| 1781 | out.write("<td>"+(counter+1)+"<td>"+spaceLeft+space+spaceRight+list[i].substring(0, 200)+"...<td>No Source Available \r\n");
|
---|
| 1782 | suggestionMap.put(elements, "No Source Available");
|
---|
| 1783 | }
|
---|
| 1784 | }
|
---|
| 1785 | else{
|
---|
| 1786 |
|
---|
| 1787 | if(alist.size()==1){
|
---|
| 1788 | out.write("<td>"+(counter+1)+"<td>"+list[i].substring(0, 200)+"...<td>" +
|
---|
| 1789 | "<a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1790 | suggestionMap.put(list[i], (String)alist.get(0));
|
---|
| 1791 | }
|
---|
| 1792 | else if(alist.size()>1){
|
---|
| 1793 | out.write("<td>"+(counter+1)+"<td>"+list[i].substring(0, 200)+"...<td>" +
|
---|
| 1794 | "<a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 1795 | suggestionMap.put(list[i], (String)alist.get(0));
|
---|
| 1796 | }
|
---|
| 1797 | else{
|
---|
| 1798 | out.write("<td>"+(counter+1)+"<td>"+list[i].substring(0, 200)+"... <td>No Source Available\r\n");
|
---|
| 1799 | suggestionMap.put(list[i],"No Source Available");
|
---|
| 1800 | }
|
---|
| 1801 | }
|
---|
| 1802 | }
|
---|
| 1803 |
|
---|
| 1804 | }
|
---|
| 1805 | else{
|
---|
| 1806 | if(list[i].startsWith("http://")){
|
---|
| 1807 |
|
---|
| 1808 | if(title.equals(IDENTIFIER)){
|
---|
| 1809 | if(list[i].length()>=100){
|
---|
| 1810 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"...</a>");
|
---|
| 1811 |
|
---|
| 1812 | }
|
---|
| 1813 | else{
|
---|
| 1814 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 1815 | }
|
---|
| 1816 | out.write("<td><a href=\""+list[i]+"\">Source</a>\r\n");
|
---|
| 1817 | }
|
---|
| 1818 | else{
|
---|
| 1819 | ArrayList alist= sl.CreateIndentifierLinkPage(title, list[i],IDENTIFIER, collectionFolder,valueMap,linkMap);
|
---|
| 1820 |
|
---|
| 1821 | if(list[i].length()>=100){
|
---|
| 1822 | if(alist.size()==1){
|
---|
| 1823 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"...</a>");
|
---|
| 1824 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1825 | }
|
---|
| 1826 | else if(alist.size()>1){
|
---|
| 1827 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"...</a>");
|
---|
| 1828 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 1829 | }
|
---|
| 1830 | else{
|
---|
| 1831 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 1832 | out.write("<td>No Source Available\r\n");
|
---|
| 1833 | }
|
---|
| 1834 | }
|
---|
| 1835 | else{
|
---|
| 1836 | if(alist.size()==1){
|
---|
| 1837 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 1838 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1839 | suggestionMap.put(list[i], (String)alist.get(0));
|
---|
| 1840 | }
|
---|
| 1841 | else if(alist.size()>1){
|
---|
| 1842 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 1843 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 1844 | suggestionMap.put(list[i], (String)alist.get(0));
|
---|
| 1845 | }
|
---|
| 1846 | else{
|
---|
| 1847 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 1848 | out.write("<td>No Source Available\r\n");
|
---|
| 1849 | suggestionMap.put(list[i],"No Source Available");
|
---|
| 1850 | }
|
---|
| 1851 | }
|
---|
| 1852 | }
|
---|
| 1853 |
|
---|
| 1854 | }
|
---|
| 1855 |
|
---|
| 1856 |
|
---|
| 1857 | else{
|
---|
| 1858 |
|
---|
| 1859 | ArrayList alist= sl.CreateIndentifierLinkPage(title, list[i],IDENTIFIER, collectionFolder,valueMap,linkMap);
|
---|
| 1860 |
|
---|
| 1861 | if(list[i].startsWith(" ")){
|
---|
| 1862 | String elements = list[i];
|
---|
| 1863 | list[i] = list[i].substring(1);
|
---|
| 1864 |
|
---|
| 1865 | if(alist.size()==1){
|
---|
| 1866 | out.write("<td>"+(counter+1)+"<td>"+spaceLeft+space+spaceRight+list[i]+
|
---|
| 1867 | "<td><a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1868 | suggestionMap.put(list[i], (String)alist.get(0));
|
---|
| 1869 | }
|
---|
| 1870 | else if(alist.size()>1){
|
---|
| 1871 | out.write("<td>"+(counter+1)+"<td>"+spaceLeft+space+spaceRight+list[i]+
|
---|
| 1872 | "<td><a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 1873 | suggestionMap.put(list[i], (String)alist.get(0));
|
---|
| 1874 | }
|
---|
| 1875 | else{
|
---|
| 1876 | out.write("<td>"+(counter+1)+"<td>"+spaceLeft+space+spaceRight+list[i]+"<td>No Source Available\r\n");
|
---|
| 1877 | suggestionMap.put(elements,"No Source Available");
|
---|
| 1878 | }
|
---|
| 1879 |
|
---|
| 1880 | }
|
---|
| 1881 | else{
|
---|
| 1882 | if(alist.size()==1){
|
---|
| 1883 | out.write("<td>"+(counter+1)+"<td>"+list[i]+"<td><a href=\""+alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1884 | suggestionMap.put(list[i],(String)alist.get(0));
|
---|
| 1885 | }
|
---|
| 1886 | else if(alist.size()>1){
|
---|
| 1887 | out.write("<td>"+(counter+1)+"<td>"+list[i]+"<td><a href=\""+alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 1888 | suggestionMap.put(list[i],(String)alist.get(0));
|
---|
| 1889 | }
|
---|
| 1890 | else{
|
---|
| 1891 | out.write("<td>"+(counter+1)+"<td>"+list[i]+"<td>No Source Available\r\n");
|
---|
| 1892 | suggestionMap.put(list[i],"No Source Available");
|
---|
| 1893 | }
|
---|
| 1894 | //out.write("<td>"+(counter+1)+"<td>"+list[i]+"\r\n");
|
---|
| 1895 | }
|
---|
| 1896 | }
|
---|
| 1897 | }
|
---|
| 1898 | counter++;
|
---|
| 1899 | out.write("<td onclick=\"GD(this)\">View");
|
---|
| 1900 | }
|
---|
| 1901 | if(suggestionMap.size()>1 && !title.equals(IDENTIFIER)){
|
---|
| 1902 | status = true;
|
---|
| 1903 | }
|
---|
| 1904 | }
|
---|
| 1905 | else{
|
---|
| 1906 |
|
---|
| 1907 |
|
---|
| 1908 | out.write("<table border=\"1\" align=\"center\" width=\"800\">\r\n");
|
---|
| 1909 | out.write ("<h2 align=\"center\">"+ title+"</h2>\r\n");
|
---|
| 1910 | out.write ("<th class=\"tam\"> \r\n");
|
---|
| 1911 | out.write ("<th class=\"tam\">Frequency\r\n");
|
---|
| 1912 | out.write ("<th class=\"tam\">Element Values\r\n");
|
---|
| 1913 | out.write ("<th class=\"tam\">Source Documents\r\n");
|
---|
| 1914 | out.write ("<th class=\"tam\">Internal Link\r\n");
|
---|
| 1915 | out.write ("<a name='topFive'>\r\n");
|
---|
| 1916 |
|
---|
| 1917 | HashMap xMap = dm.getDistinctValueMap(title);
|
---|
| 1918 | int counter = 0;
|
---|
| 1919 | for(int i = 0; i<list.length; i++){
|
---|
| 1920 | if(list.length<=5 && i==0){
|
---|
| 1921 | out.write ("<a name='lastFive'>\r\n");
|
---|
| 1922 | }
|
---|
| 1923 | else if((list.length>5) && (list.length-5==i)){
|
---|
| 1924 | out.write ("<a name='lastFive'>\r\n");
|
---|
| 1925 | }
|
---|
| 1926 |
|
---|
| 1927 | InternalLink il= (InternalLink)internalIDMap.get(list[i]);
|
---|
| 1928 | ArrayList alist2 = il.retrieveList();
|
---|
| 1929 | String id = (String)alist2.get(0);
|
---|
| 1930 | id = id.substring(4);
|
---|
| 1931 | out.write("<tr id=\""+id+"\" >\r\n");
|
---|
| 1932 |
|
---|
| 1933 | out.write("<td>"+(counter+1)+"<th> "+((Integer)xMap.get(list[i])).toString()+"\r\n");
|
---|
| 1934 |
|
---|
| 1935 | if(list[i].length()>=201){
|
---|
| 1936 |
|
---|
| 1937 | if(list[i].startsWith("http://")){
|
---|
| 1938 | if(title.equals(IDENTIFIER)){
|
---|
| 1939 | if(list[i].length()>=100){
|
---|
| 1940 | out.write("<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 1941 | }
|
---|
| 1942 | else{
|
---|
| 1943 | out.write("<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 1944 | }
|
---|
| 1945 |
|
---|
| 1946 | out.write("<td><a href=\""+list[i]+"\">Source</a>\r\n");
|
---|
| 1947 | }
|
---|
| 1948 | else{
|
---|
| 1949 | ArrayList alist= sl.CreateIndentifierLinkPage(title, list[i],IDENTIFIER, collectionFolder,valueMap,linkMap);
|
---|
| 1950 | if(list[i].length()>=100){
|
---|
| 1951 | if(alist.size()==1){
|
---|
| 1952 | out.write("<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 1953 | out.write("<td><a href=\""+alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1954 | }
|
---|
| 1955 | else if (alist.size()>1){
|
---|
| 1956 | out.write("<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 1957 | out.write("<td><a href=\""+alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 1958 | }
|
---|
| 1959 | else{
|
---|
| 1960 | out.write("<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 1961 | out.write("<td>No Source Available\r\n");
|
---|
| 1962 | }
|
---|
| 1963 |
|
---|
| 1964 | }
|
---|
| 1965 | else{
|
---|
| 1966 | out.write("<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 1967 | }
|
---|
| 1968 | }
|
---|
| 1969 | }
|
---|
| 1970 |
|
---|
| 1971 |
|
---|
| 1972 |
|
---|
| 1973 |
|
---|
| 1974 | else{
|
---|
| 1975 | ArrayList alist= sl.CreateIndentifierLinkPage(title, list[i],IDENTIFIER, collectionFolder,valueMap,linkMap);
|
---|
| 1976 |
|
---|
| 1977 | if(list[i].startsWith(" ")){
|
---|
| 1978 | list[i]=list[i].substring(1);
|
---|
| 1979 | if(alist.size()==1){
|
---|
| 1980 | out.write("<td>"+spaceLeft+space+spaceRight+list[i].substring(0,200)+"...<td>"+
|
---|
| 1981 | "<a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1982 | }
|
---|
| 1983 | else if(alist.size()>1){
|
---|
| 1984 | out.write("<td>"+spaceLeft+space+spaceRight+list[i].substring(0,200)+"...<td>"+
|
---|
| 1985 | "<a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 1986 | }
|
---|
| 1987 | else{
|
---|
| 1988 | out.write("<td>"+spaceLeft+space+spaceRight+list[i].substring(0,200)+"...<td>No Source Available\r\n");
|
---|
| 1989 | }
|
---|
| 1990 | }
|
---|
| 1991 | else{
|
---|
| 1992 |
|
---|
| 1993 | if(alist.size()==1){
|
---|
| 1994 | out.write("<td>"+list[i].substring(0,200)+"...<td>" +
|
---|
| 1995 | "<a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 1996 | }
|
---|
| 1997 | else if(alist.size()>1){
|
---|
| 1998 | out.write("<td>"+list[i].substring(0,200)+"...<td>"+
|
---|
| 1999 | "<a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 2000 | }
|
---|
| 2001 | else{
|
---|
| 2002 | out.write("<td>"+list[i].substring(0,200)+"...<td>No Source Available\r\n");
|
---|
| 2003 | }
|
---|
| 2004 | }
|
---|
| 2005 | }
|
---|
| 2006 | }
|
---|
| 2007 | else{
|
---|
| 2008 | if(list[i].startsWith("http://")){
|
---|
| 2009 | if(title.equals(IDENTIFIER)){
|
---|
| 2010 | if(list[i].length()>=100){
|
---|
| 2011 | out.write("<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 2012 | }
|
---|
| 2013 | else{
|
---|
| 2014 | out.write("<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 2015 | }
|
---|
| 2016 | out.write("<td><a href=\""+list[i]+"\">Source</a>\r\n");
|
---|
| 2017 | }
|
---|
| 2018 | else{
|
---|
| 2019 | //ArrayList alist= sl.CreateIndentifierLinkPage(title, list[i],"dc.Identifier", collectionFolder,valueMap,linkMap);
|
---|
| 2020 | ArrayList alist= sl.CreateIndentifierLinkPage(title, list[i],IDENTIFIER, collectionFolder,valueMap,linkMap);
|
---|
| 2021 |
|
---|
| 2022 | if(list[i].length()>=100){
|
---|
| 2023 | if(alist.size()==1){
|
---|
| 2024 | out.write("<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 2025 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 2026 | }
|
---|
| 2027 | else if(alist.size()>1){
|
---|
| 2028 | out.write("<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 2029 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 2030 | }
|
---|
| 2031 | else{
|
---|
| 2032 | out.write("<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 2033 | out.write("<td>No Source Available\r\n");
|
---|
| 2034 | }
|
---|
| 2035 | }
|
---|
| 2036 | else{
|
---|
| 2037 | if(alist.size()==1){
|
---|
| 2038 | out.write("<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 2039 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 2040 | }
|
---|
| 2041 | else if(alist.size()>1){
|
---|
| 2042 | out.write("<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 2043 | out.write("<td><a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 2044 | }
|
---|
| 2045 | else{
|
---|
| 2046 | out.write("<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 2047 | out.write("<td>No Source Available\r\n");
|
---|
| 2048 | }
|
---|
| 2049 | }
|
---|
| 2050 |
|
---|
| 2051 | }
|
---|
| 2052 |
|
---|
| 2053 | }
|
---|
| 2054 | else{
|
---|
| 2055 |
|
---|
| 2056 | ArrayList alist= sl.CreateIndentifierLinkPage(title, list[i],IDENTIFIER, collectionFolder,valueMap,linkMap);
|
---|
| 2057 |
|
---|
| 2058 | if(list[i].startsWith(" ")){
|
---|
| 2059 | list[i]=list[i].substring(1);
|
---|
| 2060 | if(alist.size()==1){
|
---|
| 2061 | out.write("<td>"+spaceLeft+space+spaceRight+list[i]+
|
---|
| 2062 | "<td><a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 2063 | }
|
---|
| 2064 | else if(alist.size()>1){
|
---|
| 2065 | out.write("<td>"+spaceLeft+space+spaceRight+list[i]+
|
---|
| 2066 | "<td><a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 2067 | }
|
---|
| 2068 | else{
|
---|
| 2069 | out.write("<td>"+spaceLeft+space+spaceRight+list[i]+"<td>No Source Available\r\n");
|
---|
| 2070 | }
|
---|
| 2071 | }
|
---|
| 2072 | else{
|
---|
| 2073 | if(alist.size()==1){
|
---|
| 2074 | out.write("<td>"+list[i]+"<td><a href=\""+(String)alist.get(0)+"\">Source</a>\r\n");
|
---|
| 2075 | }
|
---|
| 2076 | else if(alist.size()>1){
|
---|
| 2077 | out.write("<td>"+list[i]+"<td><a href=\""+(String)alist.get(0)+"\">Source</a>...\r\n");
|
---|
| 2078 | }
|
---|
| 2079 | else{
|
---|
| 2080 | out.write("<td>"+list[i]+"<td>No Source Available\r\n");
|
---|
| 2081 | }
|
---|
| 2082 | }
|
---|
| 2083 | }
|
---|
| 2084 | }
|
---|
| 2085 | counter++;
|
---|
| 2086 | out.write("<td onclick=\"GD(this)\">View");
|
---|
| 2087 | }
|
---|
| 2088 | }
|
---|
| 2089 | out.write("</table>\r\n");
|
---|
| 2090 | }
|
---|
| 2091 | else{
|
---|
| 2092 | out.write("<p>Sorry! The list is empty</p>");
|
---|
| 2093 | }
|
---|
| 2094 | out.write("<tr>\r\n");
|
---|
| 2095 |
|
---|
| 2096 |
|
---|
| 2097 | out.write("<p><a href=\" Overall.html \">Summary</a>");
|
---|
| 2098 | out.write("»");
|
---|
| 2099 | ////////////////////////////////////////////////////////////////////////////////////
|
---|
| 2100 | if(metadataSetName.equalsIgnoreCase("dublin")){
|
---|
| 2101 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 2102 | }
|
---|
| 2103 | else if (metadataSetName.equalsIgnoreCase("extracted")){
|
---|
| 2104 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 2105 | }
|
---|
| 2106 | else{
|
---|
| 2107 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSetName+")</a>");
|
---|
| 2108 | }
|
---|
| 2109 | out.write("»");
|
---|
| 2110 | out.write("<a href=\""+title+".html\">"+title+"</a></p>");
|
---|
| 2111 | out.write("</body></html>\r\n");
|
---|
| 2112 | out.close();
|
---|
| 2113 | fstream.close();
|
---|
| 2114 | }catch(Exception e){
|
---|
| 2115 |
|
---|
| 2116 | e.printStackTrace(outx);
|
---|
| 2117 | }
|
---|
| 2118 |
|
---|
| 2119 | if(status){
|
---|
| 2120 | return suggestionMap;
|
---|
| 2121 | }
|
---|
| 2122 | else{
|
---|
| 2123 | return new HashMap();
|
---|
| 2124 | }
|
---|
| 2125 | }
|
---|
| 2126 |
|
---|
| 2127 |
|
---|
| 2128 | private void setupMetadataLink(String fileName){
|
---|
| 2129 |
|
---|
| 2130 | String destination = globalProperty.getGSDL3Home()+fileSeparator+"mat"+fileSeparator+"script"+fileSeparator+fileName+".xml";
|
---|
| 2131 |
|
---|
| 2132 | try{
|
---|
| 2133 | DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
|
---|
| 2134 | DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
|
---|
| 2135 | Document doc = docBuilder.newDocument();
|
---|
| 2136 | //doc = docBuilder.parse (new File("/research/cc108/greenstone3/web/mat/script/"+fileName+".xml"));
|
---|
| 2137 | doc = docBuilder.parse (destination);
|
---|
| 2138 | Element rootNode = doc.getDocumentElement();
|
---|
| 2139 |
|
---|
| 2140 | NodeList listOfName = rootNode.getElementsByTagName("metadataElement");
|
---|
| 2141 | url = new HashMap();
|
---|
| 2142 | for(int i = 0; i<listOfName.getLength(); i++){
|
---|
| 2143 | Node NameNode = listOfName.item(i);
|
---|
| 2144 | Element docElement = (Element)NameNode;
|
---|
| 2145 | NodeList valueList = docElement.getElementsByTagName("URL");
|
---|
| 2146 | Node urlParentNode = valueList.item(0);
|
---|
| 2147 | String urlText = urlParentNode.getChildNodes().item(0).getNodeValue();
|
---|
| 2148 |
|
---|
| 2149 | valueList = docElement.getElementsByTagName("name");
|
---|
| 2150 | Node urlNameParentNode = valueList.item(0);
|
---|
| 2151 | String urlNameText = urlNameParentNode.getChildNodes().item(0).getNodeValue();
|
---|
| 2152 |
|
---|
| 2153 | url.put(urlNameText, urlText);
|
---|
| 2154 |
|
---|
| 2155 | }
|
---|
| 2156 |
|
---|
| 2157 |
|
---|
| 2158 | }catch(Exception e){
|
---|
| 2159 | e.printStackTrace(printWriter);
|
---|
| 2160 | }
|
---|
| 2161 | }
|
---|
| 2162 |
|
---|
| 2163 | private void createIncompletedList(String fileName, String metadataSetName, String collectionFolder,PrintWriter outx){
|
---|
| 2164 |
|
---|
| 2165 | HashMap hp = dm.getIdentifierLink(linkIdentifier);
|
---|
| 2166 | String[] ids = dm.getDocumentIDList(fileName);
|
---|
| 2167 |
|
---|
| 2168 | for(int i = 0; i<ids.length; i++){
|
---|
| 2169 | hp.remove(ids[i]);
|
---|
| 2170 | }
|
---|
| 2171 |
|
---|
| 2172 | try{
|
---|
| 2173 | FileWriter fstream = new FileWriter(destination+fileName+"_IncompletedList.html");
|
---|
| 2174 | BufferedWriter out = new BufferedWriter(fstream);
|
---|
| 2175 |
|
---|
| 2176 | out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
|
---|
| 2177 | out.write ("<html>\r\n");
|
---|
| 2178 | out.write("<head>\r\n<title>Incompleted Document List</title>\r\n");
|
---|
| 2179 | out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n");
|
---|
| 2180 | out.write("<style type=\"text/css\">\r\n");
|
---|
| 2181 | out.write("td{height:20; text-align:left;padding-left:5px;}\r\n");
|
---|
| 2182 | out.write(".tam{height:20; text-align:center}\r\n");
|
---|
| 2183 | out.write("th{height:20; text-align:center;}\r\n");
|
---|
| 2184 | out.write("body{font-family: Arial;}\r\n");
|
---|
| 2185 | out.write("</style>\r\n");
|
---|
| 2186 | out.write("</head><body>\r\n");
|
---|
| 2187 |
|
---|
| 2188 | out.write("<p><a href=\" Overall.html \">Summary</a>");
|
---|
| 2189 | out.write("»");
|
---|
| 2190 | if(metadataSetName.equalsIgnoreCase("dublin")){
|
---|
| 2191 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 2192 | }
|
---|
| 2193 | else if (metadataSetName.equalsIgnoreCase("extracted")){
|
---|
| 2194 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 2195 | }
|
---|
| 2196 | else{
|
---|
| 2197 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSetName+")</a>");
|
---|
| 2198 | }
|
---|
| 2199 | out.write("»");
|
---|
| 2200 | out.write("<a href=\""+fileName+".html \">"+fileName+"</a>");
|
---|
| 2201 |
|
---|
| 2202 | out.write("<h3 align=center>"+fileName+" does not appear in the following documents</h3>");
|
---|
| 2203 | int counter = 0;
|
---|
| 2204 | Set s = hp.keySet();
|
---|
| 2205 | Iterator i = s.iterator();
|
---|
| 2206 | out.write("<table border=1 align=center><tr><th>Document ID<th>Source Link\r\n");
|
---|
| 2207 | while(i.hasNext()){
|
---|
| 2208 | counter++;
|
---|
| 2209 | String keys = (String)i.next();
|
---|
| 2210 | InternalLink il = (InternalLink) hp.get(keys);
|
---|
| 2211 | ArrayList alist = il.retrieveList();
|
---|
| 2212 | String url = (String)alist.get(0);
|
---|
| 2213 | out.write("<tr><td>"+counter+"<td><a href=\""+url+"\">"+url+"</a>\r\n");
|
---|
| 2214 | }
|
---|
| 2215 | out.write("</table></body></html>\r\n");
|
---|
| 2216 |
|
---|
| 2217 |
|
---|
| 2218 | out.write("<p><a href=\" Overall.html \">Summary</a>");
|
---|
| 2219 | out.write("»");
|
---|
| 2220 | if(metadataSetName.equalsIgnoreCase("dublin")){
|
---|
| 2221 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 2222 | }
|
---|
| 2223 | else if (metadataSetName.equalsIgnoreCase("extracted")){
|
---|
| 2224 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 2225 | }
|
---|
| 2226 | else{
|
---|
| 2227 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSetName+")</a>");
|
---|
| 2228 | }
|
---|
| 2229 | out.write("»");
|
---|
| 2230 | out.write("<a href=\""+fileName+".html \">"+fileName+"</a>");
|
---|
| 2231 |
|
---|
| 2232 | out.close();
|
---|
| 2233 | fstream.close();
|
---|
| 2234 | }catch(IOException ex){ex.printStackTrace();}
|
---|
| 2235 |
|
---|
| 2236 |
|
---|
| 2237 | }
|
---|
| 2238 |
|
---|
| 2239 | public boolean compareElement(String fileName,String collectionFolder,HashMap suggestionMap, String metadataSetName){
|
---|
| 2240 |
|
---|
| 2241 | boolean status = false;
|
---|
| 2242 |
|
---|
| 2243 | Set kset = suggestionMap.keySet();
|
---|
| 2244 | ArrayList arrayList = new ArrayList();
|
---|
| 2245 | Iterator is = kset.iterator();
|
---|
| 2246 | while(is.hasNext()){
|
---|
| 2247 | arrayList.add((String)is.next());
|
---|
| 2248 | }
|
---|
| 2249 | HashMap distanceMap = new HashMap();
|
---|
| 2250 |
|
---|
| 2251 | int totalLength = 0;
|
---|
| 2252 |
|
---|
| 2253 | int arrayListLength = arrayList.size();
|
---|
| 2254 | int counter = 0;
|
---|
| 2255 |
|
---|
| 2256 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 2257 | printWriter.flush();
|
---|
| 2258 | double distance ;
|
---|
| 2259 | try{
|
---|
| 2260 | for(int i = 0; i<arrayListLength; i++){
|
---|
| 2261 | String keyword = (String)arrayList.get(i);
|
---|
| 2262 |
|
---|
| 2263 | int spaceCounterFront1 = 0;
|
---|
| 2264 | int spaceCounterEnd1 = 0;
|
---|
| 2265 | String keywordClone = keyword;
|
---|
| 2266 | String _keywordClone = keyword;
|
---|
| 2267 | String bkKeyWord = keyword;
|
---|
| 2268 |
|
---|
| 2269 | keywordClone = removeUnusedCharacter(keywordClone);
|
---|
| 2270 |
|
---|
| 2271 | while(true){
|
---|
| 2272 |
|
---|
| 2273 | if(_keywordClone.length()>1){
|
---|
| 2274 | if(_keywordClone.charAt(0)==' '){
|
---|
| 2275 | _keywordClone = _keywordClone.substring(1);
|
---|
| 2276 | spaceCounterFront1++;
|
---|
| 2277 | }
|
---|
| 2278 | else{
|
---|
| 2279 | if(_keywordClone.charAt(_keywordClone.length()-1)==' '){
|
---|
| 2280 | _keywordClone = _keywordClone.substring(0,_keywordClone.length()-1);
|
---|
| 2281 | spaceCounterEnd1++;
|
---|
| 2282 | }
|
---|
| 2283 | else{
|
---|
| 2284 | break;
|
---|
| 2285 | }
|
---|
| 2286 | }
|
---|
| 2287 | }
|
---|
| 2288 | else{
|
---|
| 2289 | break;
|
---|
| 2290 | }
|
---|
| 2291 | }
|
---|
| 2292 |
|
---|
| 2293 | int keywordLength = keywordClone.length();
|
---|
| 2294 | totalLength = totalLength + keywordLength;
|
---|
| 2295 | for(int j = i+1; j<arrayListLength; j++){
|
---|
| 2296 | String keyword2 = (String)arrayList.get(j);
|
---|
| 2297 | counter ++;
|
---|
| 2298 | double pre_cost = 0;
|
---|
| 2299 | String keywordClone2 = keyword2;
|
---|
| 2300 | String _keywordClone2 = keyword2;
|
---|
| 2301 | String bkKeyWord2 = keyword2;
|
---|
| 2302 | costModel cm = new costModel();
|
---|
| 2303 | cm = removeUnusedCharacter(keywordClone2,pre_cost);
|
---|
| 2304 | keywordClone2 = cm.getString();
|
---|
| 2305 | pre_cost = cm.getCost();
|
---|
| 2306 |
|
---|
| 2307 | int spaceCounterFront2 = 0;
|
---|
| 2308 | int spaceCounterEnd2 = 0;
|
---|
| 2309 |
|
---|
| 2310 | while(true){
|
---|
| 2311 | if(_keywordClone2.length()>1){
|
---|
| 2312 | if(_keywordClone2.charAt(0)==' '){
|
---|
| 2313 | _keywordClone2 = _keywordClone2.substring(1);
|
---|
| 2314 | spaceCounterFront2++;
|
---|
| 2315 | }
|
---|
| 2316 | else{
|
---|
| 2317 | if(_keywordClone2.charAt(_keywordClone2.length()-1)==' '){
|
---|
| 2318 | _keywordClone2 = _keywordClone2.substring(0,_keywordClone2.length()-1);
|
---|
| 2319 | spaceCounterEnd2++;
|
---|
| 2320 | }
|
---|
| 2321 | else{
|
---|
| 2322 | break;
|
---|
| 2323 | }
|
---|
| 2324 | }}
|
---|
| 2325 | else{
|
---|
| 2326 | break;
|
---|
| 2327 | }
|
---|
| 2328 | }
|
---|
| 2329 |
|
---|
| 2330 | if(counter == 50000){
|
---|
| 2331 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 2332 | printWriter.flush();
|
---|
| 2333 | counter = 0;
|
---|
| 2334 | }
|
---|
| 2335 | int keyword2Length = keywordClone2.length();
|
---|
| 2336 |
|
---|
| 2337 | if(keywordLength>(keyword2Length+2) || (keywordLength+2)<keyword2Length ){}
|
---|
| 2338 | else{
|
---|
| 2339 |
|
---|
| 2340 | distance = calculateEditDistance(keywordClone.toLowerCase().toCharArray(),keywordClone2.toLowerCase().toCharArray());
|
---|
| 2341 |
|
---|
| 2342 | distance = distance + pre_cost;
|
---|
| 2343 |
|
---|
| 2344 | if(distance<=2){
|
---|
| 2345 | if(distanceMap.containsKey(_keywordClone)){
|
---|
| 2346 | InternalLink il = (InternalLink)distanceMap.get(_keywordClone);
|
---|
| 2347 |
|
---|
| 2348 | String keywordHolder = _keywordClone2;
|
---|
| 2349 |
|
---|
| 2350 | while(true){
|
---|
[18149] | 2351 | if(keywordHolder.indexOf(" ")!=-1){
|
---|
[18107] | 2352 | keywordHolder = keywordHolder.replaceFirst(" ",spaceLeft+space+spaceRight+" ");
|
---|
| 2353 | }
|
---|
| 2354 | else{
|
---|
| 2355 | break;
|
---|
| 2356 | }
|
---|
| 2357 | }
|
---|
| 2358 |
|
---|
| 2359 | for(int a = 0; a<spaceCounterFront2; a++){
|
---|
| 2360 | keywordHolder = spaceLeft+space+spaceRight+keywordHolder;
|
---|
| 2361 | }
|
---|
| 2362 | for(int a = 0; a<spaceCounterEnd2; a++){
|
---|
| 2363 | keywordHolder = keywordHolder+spaceLeft+space+spaceRight;
|
---|
| 2364 | }
|
---|
| 2365 |
|
---|
| 2366 | InternalLink il2 = new InternalLink();
|
---|
| 2367 | il2.setValue(keywordHolder);
|
---|
| 2368 | if(suggestionMap.containsKey(bkKeyWord2)){
|
---|
| 2369 | il2.increaseElement((String)suggestionMap.get(bkKeyWord2));
|
---|
| 2370 | //System.out.println("input this url(3):"+(String)alistkw2.get(0));
|
---|
| 2371 | }
|
---|
| 2372 | else{
|
---|
| 2373 | il2.increaseElement(" ");
|
---|
| 2374 | }
|
---|
| 2375 |
|
---|
| 2376 | il.increaseNode(il2);
|
---|
| 2377 |
|
---|
| 2378 | distanceMap.put(_keywordClone, il);
|
---|
| 2379 |
|
---|
| 2380 | }
|
---|
| 2381 | else{
|
---|
| 2382 | InternalLink il = new InternalLink();
|
---|
| 2383 | String keywordHolder = _keywordClone;
|
---|
| 2384 |
|
---|
| 2385 | while(true){
|
---|
[18149] | 2386 | if(keywordHolder.indexOf(" ")!=-1){
|
---|
[18107] | 2387 | keywordHolder = keywordHolder.replaceFirst(" ",spaceLeft+space+spaceRight+" ");
|
---|
| 2388 | }
|
---|
| 2389 | else{
|
---|
| 2390 | break;
|
---|
| 2391 | }
|
---|
| 2392 | }
|
---|
| 2393 |
|
---|
| 2394 | for(int a = 0; a<spaceCounterFront1; a++){
|
---|
| 2395 | keywordHolder = spaceLeft+space+spaceRight+keywordHolder;
|
---|
| 2396 | }
|
---|
| 2397 | for(int a = 0; a<spaceCounterEnd1; a++){
|
---|
| 2398 | keywordHolder = keywordHolder+spaceLeft+space+spaceRight;
|
---|
| 2399 | }
|
---|
| 2400 |
|
---|
| 2401 | InternalLink il2 = new InternalLink();
|
---|
| 2402 | il2.setValue(keywordHolder);
|
---|
| 2403 | if(suggestionMap.containsKey(bkKeyWord)){
|
---|
| 2404 | il2.increaseElement((String)suggestionMap.get(bkKeyWord));
|
---|
| 2405 |
|
---|
| 2406 | }
|
---|
| 2407 | else{
|
---|
| 2408 | il2.increaseElement(" ");
|
---|
| 2409 | }
|
---|
| 2410 |
|
---|
| 2411 | il.increaseNode(il2);
|
---|
| 2412 |
|
---|
| 2413 |
|
---|
| 2414 | keywordHolder = _keywordClone2;
|
---|
| 2415 |
|
---|
| 2416 | while(true){
|
---|
[18149] | 2417 | if(keywordHolder.indexOf(" ")!=-1){
|
---|
[18107] | 2418 | keywordHolder = keywordHolder.replaceFirst(" ",spaceLeft+space+spaceRight+" ");
|
---|
| 2419 | }
|
---|
| 2420 | else{
|
---|
| 2421 | break;
|
---|
| 2422 | }
|
---|
| 2423 | }
|
---|
| 2424 | for(int a = 0; a<spaceCounterFront2; a++){
|
---|
| 2425 | keywordHolder = spaceLeft+space+spaceRight+keywordHolder;
|
---|
| 2426 | }
|
---|
| 2427 | for(int a = 0; a<spaceCounterEnd2; a++){
|
---|
| 2428 | keywordHolder = keywordHolder+spaceLeft+space+spaceRight;
|
---|
| 2429 | }
|
---|
| 2430 |
|
---|
| 2431 | InternalLink il3 = new InternalLink();
|
---|
| 2432 | il3.setValue(keywordHolder);
|
---|
| 2433 | if(suggestionMap.containsKey(bkKeyWord2)){
|
---|
| 2434 | il3.increaseElement((String)suggestionMap.get(bkKeyWord2));
|
---|
| 2435 |
|
---|
| 2436 | }
|
---|
| 2437 | else{
|
---|
| 2438 | il3.increaseElement(" ");
|
---|
| 2439 | }
|
---|
| 2440 |
|
---|
| 2441 | il.increaseNode(il3);
|
---|
| 2442 |
|
---|
| 2443 | distanceMap.put(_keywordClone, il);
|
---|
| 2444 | }
|
---|
| 2445 | }
|
---|
| 2446 | }
|
---|
| 2447 |
|
---|
| 2448 | }
|
---|
| 2449 |
|
---|
| 2450 | }
|
---|
| 2451 |
|
---|
| 2452 |
|
---|
| 2453 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 2454 | printWriter.flush();
|
---|
| 2455 |
|
---|
| 2456 | if(distanceMap.size()!=0){
|
---|
| 2457 | generateHTML(distanceMap,fileName,metadataSetName);
|
---|
| 2458 | status = true;
|
---|
| 2459 | }
|
---|
| 2460 | }catch(Exception ex){ex.printStackTrace();}
|
---|
| 2461 | return status;
|
---|
| 2462 |
|
---|
| 2463 | }
|
---|
| 2464 |
|
---|
| 2465 |
|
---|
| 2466 | private void generateHTML(HashMap distanceMap, String fileName,String metadataSetName){
|
---|
| 2467 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 2468 | printWriter.flush();
|
---|
| 2469 |
|
---|
| 2470 | String collectionFolder = mds.getCollectionName();
|
---|
| 2471 |
|
---|
| 2472 | try{
|
---|
| 2473 | FileWriter fstream = new FileWriter(destination+fileName+"_Suggestion.html");
|
---|
| 2474 | BufferedWriter out = new BufferedWriter(fstream);
|
---|
| 2475 | out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
|
---|
| 2476 | out.write ("<html>\r\n");
|
---|
| 2477 | out.write("<head>\r\n<title>Potential Duplicate List</title>\r\n");
|
---|
| 2478 | out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n");
|
---|
| 2479 | out.write("<style type=\"text/css\">\r\n");
|
---|
| 2480 | out.write("td{height:20; text-align:left;padding-left:5px;}\r\n");
|
---|
| 2481 | out.write(".tam{height:20; text-align:center}\r\n");
|
---|
| 2482 | out.write("th{height:20; text-align:left;}\r\n");
|
---|
| 2483 | out.write("body{font-family: Arial;}\r\n");
|
---|
| 2484 | out.write("</style>\r\n");
|
---|
| 2485 | out.write("</head><body>\r\n");
|
---|
| 2486 | out.write("<p><a href=\" Overall.html \">Summary</a>");
|
---|
| 2487 | out.write("»");
|
---|
| 2488 | if(metadataSetName.equalsIgnoreCase("dublin")){
|
---|
| 2489 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 2490 | }
|
---|
| 2491 | else if (metadataSetName.equalsIgnoreCase("extracted")){
|
---|
| 2492 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 2493 | }
|
---|
| 2494 | else{
|
---|
| 2495 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSetName+")</a>");
|
---|
| 2496 | }
|
---|
| 2497 | out.write("»");
|
---|
| 2498 | out.write("<a href=\""+fileName+".html \">"+fileName+"</a>");
|
---|
| 2499 | out.write("<h3 align=center>Potential Duplicate List</h3>");
|
---|
| 2500 | out.write("<table border=1 align=center>\r\n");
|
---|
| 2501 |
|
---|
| 2502 | Set s = distanceMap.keySet();
|
---|
| 2503 | Iterator i = s.iterator();
|
---|
| 2504 | while(i.hasNext()){
|
---|
| 2505 |
|
---|
| 2506 | String keyword = (String)i.next();
|
---|
| 2507 | InternalLink il = (InternalLink)distanceMap.get(keyword);
|
---|
| 2508 |
|
---|
| 2509 | ArrayList alist = il.retrieveNodeList();
|
---|
| 2510 |
|
---|
| 2511 | out.write("<tr><th>Original Text<th>Source Link\r\n");
|
---|
| 2512 | for(int a = 0; a<alist.size(); a++){
|
---|
| 2513 | InternalLink il2 = new InternalLink();
|
---|
| 2514 | il2 = (InternalLink)alist.get(a);
|
---|
| 2515 | String url = (String)il2.retrieveList().get(0);
|
---|
| 2516 | out.write("<tr><td>"+il2.getValue()+"<td><a href=\""+url+"\">"+url+"</a>");
|
---|
| 2517 |
|
---|
| 2518 | }
|
---|
| 2519 | out.write("</tr>");
|
---|
| 2520 |
|
---|
| 2521 | }
|
---|
| 2522 | out.write("</table>\r\n");
|
---|
| 2523 |
|
---|
| 2524 | out.write("<p><a href=\" Overall.html \">Summary</a>");
|
---|
| 2525 | out.write("»");
|
---|
| 2526 | if(metadataSetName.equalsIgnoreCase("dublin")){
|
---|
| 2527 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 2528 | }
|
---|
| 2529 | else if (metadataSetName.equalsIgnoreCase("extracted")){
|
---|
| 2530 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 2531 | }
|
---|
| 2532 | else{
|
---|
| 2533 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSetName+")</a>");
|
---|
| 2534 | }
|
---|
| 2535 | out.write("»");
|
---|
| 2536 | out.write("<a href=\""+fileName+".html \">"+fileName+"</a>");
|
---|
| 2537 | out.write("</body></html>\r\n");
|
---|
| 2538 | out.close();
|
---|
| 2539 | fstream.close();
|
---|
| 2540 | }catch(IOException ex){ex.printStackTrace();}
|
---|
| 2541 |
|
---|
| 2542 | }
|
---|
| 2543 |
|
---|
| 2544 | public int calculateEditDistance(char[] args1, char[] args2){
|
---|
| 2545 |
|
---|
| 2546 | int n = args1.length;
|
---|
| 2547 | int m = args2.length;
|
---|
| 2548 | if (n == 0) {
|
---|
| 2549 | return m;
|
---|
| 2550 | }
|
---|
| 2551 | else if (m == 0) {
|
---|
| 2552 | return n;
|
---|
| 2553 | }
|
---|
| 2554 |
|
---|
| 2555 | int[] p = new int[n + 1];
|
---|
| 2556 | int[] d = new int[n + 1];
|
---|
| 2557 | int[] _d;
|
---|
| 2558 |
|
---|
| 2559 |
|
---|
| 2560 | int i;
|
---|
| 2561 | int j;
|
---|
| 2562 |
|
---|
| 2563 | int cost; // cost
|
---|
| 2564 |
|
---|
| 2565 | for (i = 0; i <= n; i++) {
|
---|
| 2566 | p[i] = i;
|
---|
| 2567 | }
|
---|
| 2568 | for (j = 1; j <= m; j++) {
|
---|
| 2569 |
|
---|
| 2570 | d[0] = j;
|
---|
| 2571 | for (i = 1; i <= n; i++) {
|
---|
| 2572 | cost = (args1[i-1] == args2[j-1]) ? 0 : 1;
|
---|
| 2573 | d[i] = Math.min(Math.min(d[i - 1] + 1, p[i] + 1),
|
---|
| 2574 | p[i - 1] + cost);
|
---|
| 2575 | }
|
---|
| 2576 |
|
---|
| 2577 | // copy current distance counts to 'previous row' distance counts
|
---|
| 2578 | _d = p;
|
---|
| 2579 | p = d;
|
---|
| 2580 | d = _d;
|
---|
| 2581 | }
|
---|
| 2582 | // our last action in the above loop was to switch d and p, so p now
|
---|
| 2583 | // actually has the most recent cost counts
|
---|
| 2584 | return p[n];
|
---|
| 2585 | }
|
---|
| 2586 |
|
---|
| 2587 | private String removeUnusedCharacter(String target){
|
---|
| 2588 | //printWriter.write("<!-- generating all possible page-->");
|
---|
| 2589 | //printWriter.flush();
|
---|
| 2590 |
|
---|
| 2591 | // remove \n
|
---|
| 2592 | while(true){
|
---|
[18149] | 2593 | if(target.indexOf("\\n")!=-1){
|
---|
[18107] | 2594 | target = target.replaceFirst("\\\\n","");
|
---|
| 2595 | }
|
---|
| 2596 | else{
|
---|
| 2597 | break;
|
---|
| 2598 | }
|
---|
| 2599 | }
|
---|
| 2600 |
|
---|
| 2601 | //remove spaces at the end of string
|
---|
| 2602 | if(target.length()>1){
|
---|
| 2603 | while(true){
|
---|
| 2604 | if(target.length()>1){
|
---|
| 2605 | if(target.charAt(target.length()-1)==' '){
|
---|
| 2606 | target = target.substring(0,target.length()-1);
|
---|
| 2607 | }
|
---|
| 2608 | else{
|
---|
| 2609 | break;
|
---|
| 2610 | }
|
---|
| 2611 | }
|
---|
| 2612 | else{
|
---|
| 2613 | break;
|
---|
| 2614 | }
|
---|
| 2615 | }
|
---|
| 2616 | }
|
---|
| 2617 | //remove leading spaces
|
---|
| 2618 | if(target.length()>1){
|
---|
| 2619 | while(true){
|
---|
| 2620 |
|
---|
| 2621 | if(target.length()>1){
|
---|
| 2622 | if(target.charAt(0)==' '){
|
---|
| 2623 | target = target.substring(1,target.length());
|
---|
| 2624 | }
|
---|
| 2625 | else{
|
---|
| 2626 | break;
|
---|
| 2627 | }}
|
---|
| 2628 | else{
|
---|
| 2629 | break;
|
---|
| 2630 | }
|
---|
| 2631 | }
|
---|
| 2632 | }
|
---|
| 2633 | //remove multiple spaces between words
|
---|
| 2634 | while(true){
|
---|
[18149] | 2635 | if(target.indexOf(" ")!=-1){
|
---|
[18107] | 2636 | target = target.replaceFirst(" "," ");
|
---|
| 2637 | }
|
---|
| 2638 | else{
|
---|
| 2639 | break;
|
---|
| 2640 | }
|
---|
| 2641 | }
|
---|
| 2642 |
|
---|
| 2643 | return target;
|
---|
| 2644 | }
|
---|
| 2645 |
|
---|
| 2646 |
|
---|
| 2647 | private costModel removeUnusedCharacter(String target, double cost){
|
---|
| 2648 |
|
---|
| 2649 |
|
---|
| 2650 | costModel cm = new costModel();
|
---|
| 2651 |
|
---|
| 2652 | // remove \n plus cost
|
---|
| 2653 | while(true){
|
---|
| 2654 |
|
---|
[18149] | 2655 | if(target.indexOf("\\n")!=-1){
|
---|
[18107] | 2656 | target = target.replaceFirst("\\\\n","");
|
---|
| 2657 | cost = cost + 0.2;
|
---|
| 2658 | }
|
---|
| 2659 | else{
|
---|
| 2660 | break;
|
---|
| 2661 | }
|
---|
| 2662 | }
|
---|
| 2663 |
|
---|
| 2664 | //remove spaces at the end of string
|
---|
| 2665 | if(target.length()>1){
|
---|
| 2666 | while(true){
|
---|
| 2667 | if(target.length()>1){
|
---|
| 2668 | if(target.charAt(target.length()-1)==' '){
|
---|
| 2669 | target = target.substring(0,target.length()-1);
|
---|
| 2670 | cost = cost + 0.2;
|
---|
| 2671 | }
|
---|
| 2672 | else{
|
---|
| 2673 | break;
|
---|
| 2674 | }}
|
---|
| 2675 | else{
|
---|
| 2676 | break;
|
---|
| 2677 | }
|
---|
| 2678 | }
|
---|
| 2679 | }
|
---|
| 2680 | //remove leading spaces
|
---|
| 2681 | if(target.length()>1){
|
---|
| 2682 | while(true){
|
---|
| 2683 |
|
---|
| 2684 | if(target.length()>1){
|
---|
| 2685 | if(target.charAt(0)==' '){
|
---|
| 2686 | target = target.substring(1,target.length());
|
---|
| 2687 | cost = cost + 0.2;
|
---|
| 2688 | }
|
---|
| 2689 | else{
|
---|
| 2690 | break;
|
---|
| 2691 | }}
|
---|
| 2692 | else{
|
---|
| 2693 | break;
|
---|
| 2694 | }
|
---|
| 2695 | }
|
---|
| 2696 | }
|
---|
| 2697 | //remove multiple spaces between words
|
---|
| 2698 | while(true){
|
---|
| 2699 |
|
---|
[18149] | 2700 | if(target.indexOf(" ")!=-1){
|
---|
[18107] | 2701 | target = target.replaceFirst(" "," ");
|
---|
| 2702 | cost = cost + 0.2;
|
---|
| 2703 | }
|
---|
| 2704 | else{
|
---|
| 2705 | break;
|
---|
| 2706 | }
|
---|
| 2707 | }
|
---|
| 2708 |
|
---|
| 2709 | cm.setCost(cost);
|
---|
| 2710 | cm.setString(target);
|
---|
| 2711 |
|
---|
| 2712 | return cm;
|
---|
| 2713 | }
|
---|
| 2714 |
|
---|
| 2715 |
|
---|
| 2716 |
|
---|
| 2717 | private HashMap generateMetadataElementSortListNoIdentifier(String title, String sort, String metadataSetName,PrintWriter outx){
|
---|
| 2718 |
|
---|
| 2719 | String fileName = title+"_"+sort;
|
---|
| 2720 | String collectionFolder = mds.getCollectionName();
|
---|
| 2721 | System.out.println("level 3");
|
---|
| 2722 | SearchLink sl = new SearchLink(mds.StatsDirectory);
|
---|
| 2723 | System.out.println("level 4");
|
---|
| 2724 | HashMap suggestionMap = new HashMap();
|
---|
| 2725 |
|
---|
| 2726 | HashMap internalIDMap = dm.getInternalIdentifier(title);
|
---|
| 2727 | boolean status = false;
|
---|
| 2728 |
|
---|
| 2729 | try{
|
---|
| 2730 | printWriter.write("<!-- generating all possible page-->");
|
---|
| 2731 | printWriter.flush();
|
---|
| 2732 |
|
---|
| 2733 | FileWriter fstream = new FileWriter(destination+fileName+".html");
|
---|
| 2734 | BufferedWriter out = new BufferedWriter(fstream);
|
---|
| 2735 |
|
---|
| 2736 | out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
|
---|
| 2737 | out.write ("<html>\r\n");
|
---|
| 2738 | out.write("<head>\r\n<title>Metadata Element Sort List</title>\r\n");
|
---|
| 2739 | out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n");
|
---|
| 2740 | out.write("<script type=\"text/javascript\" src=\"../script/getInfomation.js\"></script>\r\n");
|
---|
| 2741 | out.write("<script type=\"text/javascript\" src=\"http://yui.yahooapis.com/2.4.1/build/yahoo/yahoo-min.js\"></script>\r\n");
|
---|
| 2742 | out.write("<script type=\"text/javascript\" src=\"http://yui.yahooapis.com/2.4.1/build/event/event-min.js\"></script>\r\n");
|
---|
| 2743 | out.write("<script type=\"text/javascript\" src=\"http://yui.yahooapis.com/2.4.1/build/connection/connection-min.js\"></script>\r\n");
|
---|
| 2744 |
|
---|
| 2745 | out.write("<style type=\"text/css\">\r\n");
|
---|
| 2746 | out.write("td{height:20; text-align:left;padding-left:5px;}\r\n");
|
---|
| 2747 | out.write(".tam{height:20; text-align:center}\r\n");
|
---|
| 2748 | out.write("th{height:20; text-align:center;}\r\n");
|
---|
| 2749 | out.write("body{font-family: Arial;}\r\n");
|
---|
| 2750 | out.write("</style>\r\n");
|
---|
| 2751 | out.write("</head><body id=\""+collectionFolder+"\">\r\n");
|
---|
| 2752 |
|
---|
| 2753 | out.write("<td><div style=\"float:left;\"><a href=\" Overall.html \">Summary</a>");
|
---|
| 2754 | out.write("»");
|
---|
| 2755 |
|
---|
| 2756 | if(metadataSetName.equalsIgnoreCase("dublin")){
|
---|
| 2757 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 2758 | }
|
---|
| 2759 | else if (metadataSetName.equalsIgnoreCase("extracted")){
|
---|
| 2760 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 2761 | }
|
---|
| 2762 | else{
|
---|
| 2763 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSetName+")</a>");
|
---|
| 2764 | }
|
---|
| 2765 | out.write("»");
|
---|
| 2766 | out.write("<a href=\""+title+".html\">"+title+"</a></div>");
|
---|
| 2767 |
|
---|
| 2768 | out.write("<div style=\"float:right;\"><a href=\"http://chnm.gmu.edu/tools/surveys/4386/\">Please send feedback about the Mat tool</a></div></td><br>");
|
---|
| 2769 |
|
---|
| 2770 |
|
---|
| 2771 | String[] list = dm.getSortList(title, sort);
|
---|
| 2772 |
|
---|
| 2773 |
|
---|
| 2774 |
|
---|
| 2775 | if(list.length>=1){
|
---|
| 2776 |
|
---|
| 2777 |
|
---|
| 2778 | if(sort.equals("ASCII")){
|
---|
| 2779 |
|
---|
| 2780 | out.write("<table border=\"1\" align=\"center\" width=\"800\">\r\n");
|
---|
| 2781 | out.write ("<h2 align=\"center\">"+ title+"</h2>\r\n");
|
---|
| 2782 | out.write ("<th class=\"tam\">ASCII Sort\r\n");
|
---|
| 2783 | out.write ("<th class=\"tam\">Element Values\r\n");
|
---|
| 2784 | out.write ("<th class=\"tam\">Source Documents\r\n");
|
---|
| 2785 | out.write ("<th class=\"tam\">Internal Link\r\n");
|
---|
| 2786 |
|
---|
| 2787 | out.write ("<a name='topFive'>\r\n");
|
---|
| 2788 |
|
---|
| 2789 | int counter = 0;
|
---|
| 2790 |
|
---|
| 2791 | for(int i = 0; i<list.length; i++){
|
---|
| 2792 |
|
---|
| 2793 | if(list.length<=5 && i==0){
|
---|
| 2794 | out.write ("<a name='lastFive'>\r\n");
|
---|
| 2795 | }
|
---|
| 2796 | else if((list.length>5) && (list.length-5==i)){
|
---|
| 2797 | out.write ("<a name='lastFive'>\r\n");
|
---|
| 2798 | }
|
---|
| 2799 |
|
---|
| 2800 |
|
---|
| 2801 | InternalLink il= (InternalLink)internalIDMap.get(list[i]);
|
---|
| 2802 | ArrayList alist2 = il.retrieveList();
|
---|
| 2803 | String id = (String)alist2.get(0);
|
---|
| 2804 | id = id.substring(4);
|
---|
| 2805 | out.write("<tr id=\""+id+"\" >\r\n");
|
---|
| 2806 |
|
---|
| 2807 | if(list[i].length()>=201){
|
---|
| 2808 | if(list[i].startsWith("http://")){
|
---|
| 2809 |
|
---|
| 2810 | if(list[i].length()>=100){
|
---|
| 2811 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 2812 | out.write("<td><a href=\""+list[i]+"\">Source</a>\r\n");
|
---|
| 2813 | }
|
---|
| 2814 | else{
|
---|
| 2815 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 2816 | out.write("<td><a href=\""+list[i]+"\">Source</a>\r\n");
|
---|
| 2817 | }
|
---|
| 2818 |
|
---|
| 2819 | }
|
---|
| 2820 | else{
|
---|
| 2821 |
|
---|
| 2822 | if(list[i].startsWith(" ")){
|
---|
| 2823 | String elements = list[i];
|
---|
| 2824 | list[i] = list[i].substring(1);
|
---|
| 2825 | out.write("<td>"+(counter+1)+"<td>"+spaceLeft+space+spaceRight+list[i].substring(0, 200)+"...<td>No Source Available \r\n");
|
---|
| 2826 | }
|
---|
| 2827 | else{
|
---|
| 2828 | out.write("<td>"+(counter+1)+"<td>"+list[i].substring(0, 200)+"... <td>No Source Available\r\n");
|
---|
| 2829 | }
|
---|
| 2830 | }
|
---|
| 2831 |
|
---|
| 2832 | }
|
---|
| 2833 | else{
|
---|
| 2834 |
|
---|
| 2835 |
|
---|
| 2836 | if(list[i].startsWith("http://")){
|
---|
| 2837 |
|
---|
| 2838 | if(list[i].length()>=100){
|
---|
| 2839 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"...</a>");
|
---|
| 2840 | }
|
---|
| 2841 | else{
|
---|
| 2842 | out.write("<td>"+(counter+1)+"<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 2843 | }
|
---|
| 2844 | out.write("<td><a href=\""+list[i]+"\">Source</a>\r\n");
|
---|
| 2845 |
|
---|
| 2846 | }
|
---|
| 2847 |
|
---|
| 2848 |
|
---|
| 2849 |
|
---|
| 2850 | else{
|
---|
| 2851 |
|
---|
| 2852 | if(list[i].startsWith(" ")){
|
---|
| 2853 | String elements = list[i];
|
---|
| 2854 | list[i] = list[i].substring(1);
|
---|
| 2855 |
|
---|
| 2856 | out.write("<td>"+(counter+1)+"<td>"+spaceLeft+space+spaceRight+list[i]+"<td>No Source Available\r\n");
|
---|
| 2857 | suggestionMap.put(elements,"No Source Available");
|
---|
| 2858 |
|
---|
| 2859 | }
|
---|
| 2860 | else{
|
---|
| 2861 | out.write("<td>"+(counter+1)+"<td>"+list[i]+"<td>No Source Available\r\n");
|
---|
| 2862 | }
|
---|
| 2863 | }
|
---|
| 2864 | }
|
---|
| 2865 | counter++;
|
---|
| 2866 | out.write("<td onclick=\"GD(this)\">View");
|
---|
| 2867 | }
|
---|
| 2868 |
|
---|
| 2869 | }
|
---|
| 2870 | else{
|
---|
| 2871 |
|
---|
| 2872 |
|
---|
| 2873 | out.write("<table border=\"1\" align=\"center\" width=\"800\">\r\n");
|
---|
| 2874 | out.write ("<h2 align=\"center\">"+ title+"</h2>\r\n");
|
---|
| 2875 | out.write ("<th class=\"tam\"> \r\n");
|
---|
| 2876 | out.write ("<th class=\"tam\">Frequency\r\n");
|
---|
| 2877 | out.write ("<th class=\"tam\">Element Values\r\n");
|
---|
| 2878 | out.write ("<th class=\"tam\">Source Documents\r\n");
|
---|
| 2879 | out.write ("<th class=\"tam\">Internal Link\r\n");
|
---|
| 2880 | out.write ("<a name='topFive'>\r\n");
|
---|
| 2881 |
|
---|
| 2882 | HashMap xMap = dm.getDistinctValueMap(title);
|
---|
| 2883 | int counter = 0;
|
---|
| 2884 | for(int i = 0; i<list.length; i++){
|
---|
| 2885 | if(list.length<=5 && i==0){
|
---|
| 2886 | out.write ("<a name='lastFive'>\r\n");
|
---|
| 2887 | }
|
---|
| 2888 | else if((list.length>5) && (list.length-5==i)){
|
---|
| 2889 | out.write ("<a name='lastFive'>\r\n");
|
---|
| 2890 | }
|
---|
| 2891 |
|
---|
| 2892 | InternalLink il= (InternalLink)internalIDMap.get(list[i]);
|
---|
| 2893 | ArrayList alist2 = il.retrieveList();
|
---|
| 2894 | String id = (String)alist2.get(0);
|
---|
| 2895 | id = id.substring(4);
|
---|
| 2896 | out.write("<tr id=\""+id+"\" >\r\n");
|
---|
| 2897 |
|
---|
| 2898 | out.write("<td>"+(counter+1)+"<th> "+((Integer)xMap.get(list[i])).toString()+"\r\n");
|
---|
| 2899 |
|
---|
| 2900 | if(list[i].length()>=201){
|
---|
| 2901 |
|
---|
| 2902 | if(list[i].startsWith("http://")){
|
---|
| 2903 | if(list[i].length()>=100){
|
---|
| 2904 | out.write("<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 2905 | }
|
---|
| 2906 | else{
|
---|
| 2907 | out.write("<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 2908 | }
|
---|
| 2909 |
|
---|
| 2910 | out.write("<td><a href=\""+list[i]+"\">Source</a>\r\n");
|
---|
| 2911 | }
|
---|
| 2912 |
|
---|
| 2913 |
|
---|
| 2914 |
|
---|
| 2915 |
|
---|
| 2916 | else{
|
---|
| 2917 | if(list[i].startsWith(" ")){
|
---|
| 2918 | list[i]=list[i].substring(1);
|
---|
| 2919 |
|
---|
| 2920 | out.write("<td>"+spaceLeft+space+spaceRight+list[i].substring(0,200)+"...<td>No Source Available\r\n");
|
---|
| 2921 |
|
---|
| 2922 | }
|
---|
| 2923 | else{
|
---|
| 2924 |
|
---|
| 2925 | out.write("<td>"+list[i].substring(0,200)+"...<td>No Source Available\r\n");
|
---|
| 2926 |
|
---|
| 2927 | }
|
---|
| 2928 | }
|
---|
| 2929 | }
|
---|
| 2930 | else{
|
---|
| 2931 | if(list[i].startsWith("http://")){
|
---|
| 2932 | if(list[i].length()>=100){
|
---|
| 2933 | out.write("<td><a href=\""+list[i]+"\">"+list[i].substring(0,100)+"</a>");
|
---|
| 2934 | }
|
---|
| 2935 | else{
|
---|
| 2936 | out.write("<td><a href=\""+list[i]+"\">"+list[i]+"</a>");
|
---|
| 2937 | }
|
---|
| 2938 | out.write("<td><a href=\""+list[i]+"\">Source</a>\r\n");
|
---|
| 2939 |
|
---|
| 2940 | }
|
---|
| 2941 | else{
|
---|
| 2942 |
|
---|
| 2943 | if(list[i].startsWith(" ")){
|
---|
| 2944 | list[i]=list[i].substring(1);
|
---|
| 2945 |
|
---|
| 2946 |
|
---|
| 2947 | out.write("<td>"+spaceLeft+space+spaceRight+list[i]+"<td>No Source Available\r\n");
|
---|
| 2948 |
|
---|
| 2949 | }
|
---|
| 2950 | else{
|
---|
| 2951 |
|
---|
| 2952 | out.write("<td>"+list[i]+"<td>No Source Available\r\n");
|
---|
| 2953 |
|
---|
| 2954 | }
|
---|
| 2955 | }
|
---|
| 2956 | }
|
---|
| 2957 | counter++;
|
---|
| 2958 | out.write("<td onclick=\"GD(this)\">View");
|
---|
| 2959 | }
|
---|
| 2960 | }
|
---|
| 2961 | out.write("</table>\r\n");
|
---|
| 2962 | }
|
---|
| 2963 | else{
|
---|
| 2964 | out.write("<p>Sorry! The list is empty</p>");
|
---|
| 2965 | }
|
---|
| 2966 | out.write("<tr>\r\n");
|
---|
| 2967 |
|
---|
| 2968 |
|
---|
| 2969 | out.write("<p><a href=\" Overall.html \">Summary</a>");
|
---|
| 2970 | out.write("»");
|
---|
| 2971 |
|
---|
| 2972 | if(metadataSetName.equalsIgnoreCase("dublin")){
|
---|
| 2973 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 2974 | }
|
---|
| 2975 | else if (metadataSetName.equalsIgnoreCase("extracted")){
|
---|
| 2976 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 2977 | }
|
---|
| 2978 | else{
|
---|
| 2979 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSetName+")</a>");
|
---|
| 2980 | }
|
---|
| 2981 | out.write("»");
|
---|
| 2982 | out.write("<a href=\""+title+".html\">"+title+"</a></p>");
|
---|
| 2983 | out.write("</body></html>\r\n");
|
---|
| 2984 | out.close();
|
---|
| 2985 | fstream.close();
|
---|
| 2986 | }catch(Exception e){
|
---|
| 2987 |
|
---|
| 2988 | e.printStackTrace(outx);
|
---|
| 2989 | }
|
---|
| 2990 |
|
---|
| 2991 | return new HashMap();
|
---|
| 2992 | }
|
---|
| 2993 |
|
---|
| 2994 |
|
---|
| 2995 |
|
---|
| 2996 |
|
---|
| 2997 |
|
---|
| 2998 |
|
---|
| 2999 |
|
---|
| 3000 |
|
---|
| 3001 |
|
---|
| 3002 |
|
---|
| 3003 |
|
---|
| 3004 |
|
---|
| 3005 |
|
---|
| 3006 |
|
---|
| 3007 |
|
---|
| 3008 |
|
---|
| 3009 |
|
---|
| 3010 |
|
---|
| 3011 |
|
---|
| 3012 |
|
---|
| 3013 |
|
---|
| 3014 |
|
---|
| 3015 |
|
---|
| 3016 |
|
---|
| 3017 |
|
---|
| 3018 |
|
---|
| 3019 |
|
---|
| 3020 |
|
---|
| 3021 |
|
---|
| 3022 |
|
---|
| 3023 |
|
---|
| 3024 |
|
---|
| 3025 | private void createIncompletedListNoIdentifier(String fileName, String metadataSetName, String collectionFolder,PrintWriter outx){
|
---|
| 3026 | //HashMap hp = dm.getIdentifierLink("dc.Identifier");
|
---|
| 3027 | HashMap hp = dm.getIdentifierLinkNoIdentifier();
|
---|
| 3028 | String[] ids = dm.getDocumentIDList(fileName);
|
---|
| 3029 | System.out.println("Length: "+ids.length+" "+fileName+ " "+hp.size());
|
---|
| 3030 |
|
---|
| 3031 | Set st = hp.keySet();
|
---|
| 3032 | Iterator it = st.iterator();
|
---|
| 3033 | while(it.hasNext()){
|
---|
| 3034 | System.out.println(it.next());
|
---|
| 3035 | }
|
---|
| 3036 | for(int i = 0; i<ids.length; i++){
|
---|
| 3037 | System.out.println("IDS:" +ids[i]);
|
---|
| 3038 | hp.remove(ids[i]);
|
---|
| 3039 | }
|
---|
| 3040 | System.out.println("Length: "+ids.length+" "+fileName+ " "+hp.size());
|
---|
| 3041 | //String collectionFolder = mds.getCollectionName();
|
---|
| 3042 | //System.out.println(hp.size());
|
---|
| 3043 | try{
|
---|
| 3044 | FileWriter fstream = new FileWriter(destination+fileName+"_IncompletedList.html");
|
---|
| 3045 | BufferedWriter out = new BufferedWriter(fstream);
|
---|
| 3046 |
|
---|
| 3047 | out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
|
---|
| 3048 | out.write ("<html>\r\n");
|
---|
| 3049 | out.write("<head>\r\n<title>Incompleted Document List</title>\r\n");
|
---|
| 3050 | out.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n");
|
---|
| 3051 | out.write("<style type=\"text/css\">\r\n");
|
---|
| 3052 | out.write("td{height:20; text-align:left;padding-left:5px;}\r\n");
|
---|
| 3053 | out.write(".tam{height:20; text-align:center}\r\n");
|
---|
| 3054 | out.write("th{height:20; text-align:center;}\r\n");
|
---|
| 3055 | out.write("body{font-family: Arial;}\r\n");
|
---|
| 3056 | out.write("</style>\r\n");
|
---|
| 3057 | out.write("</head><body>\r\n");
|
---|
| 3058 |
|
---|
| 3059 | out.write("<p><a href=\" Overall.html \">Summary</a>");
|
---|
| 3060 | out.write("»");
|
---|
| 3061 | if(metadataSetName.equalsIgnoreCase("dublin")){
|
---|
| 3062 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 3063 | }
|
---|
| 3064 | else if (metadataSetName.equalsIgnoreCase("extracted")){
|
---|
| 3065 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 3066 | }
|
---|
| 3067 | else{
|
---|
| 3068 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSetName+")</a>");
|
---|
| 3069 | }
|
---|
| 3070 | out.write("»");
|
---|
| 3071 | out.write("<a href=\""+fileName+".html \">"+fileName+"</a>");
|
---|
| 3072 |
|
---|
| 3073 | out.write("<h3 align=center>"+fileName+" does not appear in the following documents</h3>");
|
---|
| 3074 | int counter = 0;
|
---|
| 3075 | System.out.println("link.....");
|
---|
| 3076 | Set s = hp.keySet();
|
---|
| 3077 | Iterator i = s.iterator();
|
---|
| 3078 | System.out.println("link2.....");
|
---|
| 3079 | out.write("<table border=1 align=center><tr><th>Document ID<th>Source Link\r\n");
|
---|
| 3080 | while(i.hasNext()){
|
---|
| 3081 | //printWriter.write("<!-- generating all possible page-->");
|
---|
| 3082 | System.out.println("link.....3");
|
---|
| 3083 | counter++;
|
---|
| 3084 | String keys = (String)i.next();
|
---|
| 3085 | System.out.println("link.....4"+keys);
|
---|
| 3086 | InternalLink il = (InternalLink) hp.get(keys);
|
---|
| 3087 |
|
---|
| 3088 | ArrayList alist = il.retrieveList();
|
---|
| 3089 | System.out.println("link.....5"+alist.size());
|
---|
| 3090 | String url = (String)alist.get(0);
|
---|
| 3091 | out.write("<tr><td>"+counter+"<td><a href=\""+url+"\">"+url+"</a>\r\n");
|
---|
| 3092 | }
|
---|
| 3093 | out.write("</table></body></html>\r\n");
|
---|
| 3094 |
|
---|
| 3095 |
|
---|
| 3096 | out.write("<p><a href=\" Overall.html \">Summary</a>");
|
---|
| 3097 | out.write("»");
|
---|
| 3098 | if(metadataSetName.equalsIgnoreCase("dublin")){
|
---|
| 3099 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet1+")</a>");
|
---|
| 3100 | }
|
---|
| 3101 | else if (metadataSetName.equalsIgnoreCase("extracted")){
|
---|
| 3102 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSet2+")</a>");
|
---|
| 3103 | }
|
---|
| 3104 | else{
|
---|
| 3105 | out.write ("<a href=\""+metadataSetName+".html\">Metadata Detail ("+metadataSetName+")</a>");
|
---|
| 3106 | }
|
---|
| 3107 | out.write("»");
|
---|
| 3108 | out.write("<a href=\""+fileName+".html \">"+fileName+"</a>");
|
---|
| 3109 |
|
---|
| 3110 | out.close();
|
---|
| 3111 | fstream.close();
|
---|
| 3112 | }catch(IOException ex){ex.printStackTrace();}
|
---|
| 3113 |
|
---|
| 3114 |
|
---|
| 3115 | }
|
---|
| 3116 | ///////////////////////////////////////////////////////////////////////////////////////
|
---|
| 3117 | }
|
---|
| 3118 |
|
---|