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