Changeset 8287 for trunk/gsdl3
- Timestamp:
- 2004-10-12T12:13:33+13:00 (20 years ago)
- Location:
- trunk/gsdl3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/extensions/vishnu/src/vishnu/server/VisServlet.java
r8189 r8287 41 41 final String INITIALIZATION_ACTION = "initialise"; 42 42 43 protected Document doc=null;44 43 protected String COLLS_HOME=null; 45 46 DataBlock data = null; 44 47 45 Hashtable collH; 48 46 … … 88 86 public void doPost(HttpServletRequest req, HttpServletResponse resp) 89 87 { 90 DataBlock data = null;91 88 Object obj; 92 89 … … 131 128 descriptions = search_engine.getDocDescriptions(); 132 129 System.out.println(docNums.size() + " documents in VisServlet"); 133 Cluster c = new Cluster(); 134 String results = c.getCluster(collection_home,docNums); 135 Packaging p = new Packaging(); 136 data = p.getDataPackage(results, descriptions); 137 response.addElement(data); 130 DataBlock data = generateDataBlock(collection_home, docNums, descriptions); 131 if (data != null) { 132 response.addElement(data); 133 } 138 134 sendObject(resp,response); 139 135 search_engine = null; 140 c = null; 141 p = null; 136 data = null; 137 docNums = null; 138 descriptions = null; 139 142 140 } 143 141 else if( action.equals(DOCUMENT_FETCH_ACTION) ){ … … 179 177 Vector colls = new Vector(); 180 178 collH = new Hashtable(); 179 Document doc = null; 181 180 182 181 File dir = new File(COLLS_HOME); … … 217 216 } 218 217 } 218 doc = null; 219 219 return colls; 220 220 } 221 222 private DataBlock generateDataBlock(String collection_home, Vector docNums, Vector descriptions) { 223 224 DataBlock data = new DataBlock(); 225 226 CKServer ck_server = new CKServer(collection_home); 227 228 /**** set data fields one by one and pass one what ever gets assembled ****/ 229 230 try{ 231 232 ck_server.setDescriptions(descriptions); 233 234 /**** get candidate keywords ****/ 235 236 String[] keywords = ck_server.computeKeywords(docNums); 237 238 data.words = keywords; 239 240 241 /**** get sparse document * keyword matrix ****/ 242 243 SparseMatrix matrix = ck_server.getSparseMatrix(docNums); 244 245 data.matrix = matrix; 246 247 248 /**** get document indices, this is a subset of the original ****/ 249 /**** those without keywords are excluded ****/ 250 251 int[] docs = ck_server.getHitDocuments(); 252 253 data.docs = docs; 254 255 256 String[] desc = ck_server.getHitDescriptions(); 257 258 data.descriptions = desc; 259 260 261 /**** get 10 or so clusters ****/ 262 263 Vector[] clusters = ck_server.getClusters(); 264 265 data.clusters = clusters; 266 267 268 double[][] centroids = ck_server.getCentroids(); 269 270 271 /**** send their centroids through sammon mapping ****/ 272 273 Point2D[] sammon = ck_server.getSammonMap(centroids); 274 275 System.out.println("Num descriptions: " + descriptions.size()); 276 System.out.println("Num docs: " + docs.length); 277 System.out.println("Num desc: " + desc.length); 278 279 data.sammon = sammon; 280 281 } catch (Exception e) { 282 System.err.println("VisServlet: computing clustering Error: "+e); 283 } 284 ck_server = null; 285 return data; 286 } 221 287 } 222 288 -
trunk/gsdl3/packages/vishnu/src/vishnu/server/VisServlet.java
r8189 r8287 41 41 final String INITIALIZATION_ACTION = "initialise"; 42 42 43 protected Document doc=null;44 43 protected String COLLS_HOME=null; 45 46 DataBlock data = null; 44 47 45 Hashtable collH; 48 46 … … 88 86 public void doPost(HttpServletRequest req, HttpServletResponse resp) 89 87 { 90 DataBlock data = null;91 88 Object obj; 92 89 … … 131 128 descriptions = search_engine.getDocDescriptions(); 132 129 System.out.println(docNums.size() + " documents in VisServlet"); 133 Cluster c = new Cluster(); 134 String results = c.getCluster(collection_home,docNums); 135 Packaging p = new Packaging(); 136 data = p.getDataPackage(results, descriptions); 137 response.addElement(data); 130 DataBlock data = generateDataBlock(collection_home, docNums, descriptions); 131 if (data != null) { 132 response.addElement(data); 133 } 138 134 sendObject(resp,response); 139 135 search_engine = null; 140 c = null; 141 p = null; 136 data = null; 137 docNums = null; 138 descriptions = null; 139 142 140 } 143 141 else if( action.equals(DOCUMENT_FETCH_ACTION) ){ … … 179 177 Vector colls = new Vector(); 180 178 collH = new Hashtable(); 179 Document doc = null; 181 180 182 181 File dir = new File(COLLS_HOME); … … 217 216 } 218 217 } 218 doc = null; 219 219 return colls; 220 220 } 221 222 private DataBlock generateDataBlock(String collection_home, Vector docNums, Vector descriptions) { 223 224 DataBlock data = new DataBlock(); 225 226 CKServer ck_server = new CKServer(collection_home); 227 228 /**** set data fields one by one and pass one what ever gets assembled ****/ 229 230 try{ 231 232 ck_server.setDescriptions(descriptions); 233 234 /**** get candidate keywords ****/ 235 236 String[] keywords = ck_server.computeKeywords(docNums); 237 238 data.words = keywords; 239 240 241 /**** get sparse document * keyword matrix ****/ 242 243 SparseMatrix matrix = ck_server.getSparseMatrix(docNums); 244 245 data.matrix = matrix; 246 247 248 /**** get document indices, this is a subset of the original ****/ 249 /**** those without keywords are excluded ****/ 250 251 int[] docs = ck_server.getHitDocuments(); 252 253 data.docs = docs; 254 255 256 String[] desc = ck_server.getHitDescriptions(); 257 258 data.descriptions = desc; 259 260 261 /**** get 10 or so clusters ****/ 262 263 Vector[] clusters = ck_server.getClusters(); 264 265 data.clusters = clusters; 266 267 268 double[][] centroids = ck_server.getCentroids(); 269 270 271 /**** send their centroids through sammon mapping ****/ 272 273 Point2D[] sammon = ck_server.getSammonMap(centroids); 274 275 System.out.println("Num descriptions: " + descriptions.size()); 276 System.out.println("Num docs: " + docs.length); 277 System.out.println("Num desc: " + desc.length); 278 279 data.sammon = sammon; 280 281 } catch (Exception e) { 282 System.err.println("VisServlet: computing clustering Error: "+e); 283 } 284 ck_server = null; 285 return data; 286 } 221 287 } 222 288
Note:
See TracChangeset
for help on using the changeset viewer.