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