<% // agafem l'instancia de l'induccio javakate.consultation.induction.KInductionStatic ind = (javakate.consultation.induction.KInductionStatic)request.getSession().getValue("consultation"); // agafem el query kateservlet.javakate.OneCaseServlet casQuery = (kateservlet.javakate.OneCaseServlet)request.getSession().getValue("casQuery"); // agafen l'instancia de l'induccio java.util.Vector query = (java.util.Vector)request.getSession().getValue("query"); java.util.Enumeration listValues = request.getParameterNames(); int countValues = 0; while(listValues.hasMoreElements()) { String[] resultValue = null; String slotId = (String)listValues.nextElement(); javakate.casuel.KSlot slot = javakate.casuel.KModel.getNode(slotId).getKSlot(); if(!slot.isError()) { countValues++; try { // agafem els valors dels parametres del request resultValue = request.getParameterValues(slotId); if(resultValue != null && resultValue.length > 0) { String values = ""; for(int j = 0; j < resultValue.length;j++) { if(j == resultValue.length -1) values += resultValue[j]; else values += resultValue[j] + javakate.session.CBSession.getDelimiter(); } javakate.casuel.KValue kvalue = slot.getType().stringIdToValue(values); // posem els valors en el cas del query casQuery.setValue(slot,kvalue); if(countValues > 1) // esborrem els valors en el cas del query query.removeAllElements(); else // posem el valor en el cas del query query.addElement(slot); } } catch(Exception e) {} } } ind.start(casQuery); int flag = 0; while(ind.hasMoreQuery() && flag ==0) { javakate.casuel.KModelNode slotNode = ind.nextQuery(); if(slotNode.getSlotCode() != 0) { if(!query.contains(slotNode.getKSlot())) { if(slotNode.isSlot()) { if(flag == 0) { out.println("
"); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println("

"); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); javakate.consultation.caseValue cValue = null; javakate.casuel.KValueSymbol kValue = null; switch( slot.getTypeBasic()) { case 0 : case 1 : // enter // imprimim el camp de l'eslot cValue = casQuery.getValue(slotId); %> <% break; case 2 : // Free Text cValue = casQuery.getValue(slotId); %> <% break; case 3 : case 4 : // symbol && ordered symbol // imprimim el camp de l'eslot javakate.casuel.KTypeSymbol typeSymbol = slot.getTypeSymbol(); javakate.casuel.SymbolValue[] sValues = typeSymbol.getSortedList(); cValue = casQuery.getValue(slotId); kValue = (javakate.casuel.KValueSymbol)cValue.getValue(); if (sValues.length <= 9) { %> <% } else { %> <% } break; case 5 : // taxo // imprimim el camp de l'eslot javakate.casuel.KTypeTaxonomy slotTaxo = slot.getTypeTaxonomy(); java.util.Vector listKValues = slotTaxo.getSortKValues(); %> <% break; case 9 : // symbol multivalued // imprimim el camp de l'eslot javakate.casuel.KTypeSymbol typeSymbolMulti = slot.getTypeSymbol(); javakate.casuel.SymbolValue[] sValuesMulti = typeSymbolMulti.getSortedList(); if (sValuesMulti.length <= 9) { %> <% } else { cValue = casQuery.getValue(slotId); kValue = (javakate.casuel.KValueSymbol)cValue.getValue(); %> <% } break; case 11 : %><% break; default : %><% } } } } } if(flag == 0) { out.println(" "); out.println("
"); } flag = 1; javakate.casuel.KSlot slot = slotNode.getKSlot(); String slotId = slot.getSlotId(); // imprimim el nom de l'eslot out.println(""); out.println("
"); out.print(slot.getName(false) + ":"); out.println(" <% for(int i = 0; i < sValues.length; i++) { javakate.casuel.SymbolValue value = sValues[i]; if (i%3 == 2) out.println(" "); %> <% } %>
value=? name="<%=slotId%>">indifférent
value="<%=value.getValueId()%>" name="<%=slotId%>"><%=value.getName()%>
<% cValue = casQuery.getValue(slotId); kValue = (javakate.casuel.KValueSymbol)cValue.getValue(); for(int i = 0; i < sValuesMulti.length; i++) { javakate.casuel.SymbolValue value = sValuesMulti[i]; if (i % 3 == 0) out.println(" "); %> <% } %>
value="<%=value.getValueId()%>" name="<%=slotId%>"><%=value.getName()%>
String no esta implementat tipus no suportat
"); out.println(" "); out.println(" "); out.println(" "); // engem l'induccio i mostrem els resultats javakate.consultation.cbr.ListCBRCases listCbrCases = ind.getCBRResults(); out.println(""); out.println(""); out.println(""); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(""); for(int index=0; index < listCbrCases.numberOfCases(); index++) { String result = ""; String resultRequest = ""; javakate.consultation.OneCase currentCase = listCbrCases.getOneCase(index); // display the similarity image and the similarity (%) float sim = listCbrCases.getSimilarity(index); String nameImage = "0"; if(sim >= 0.05 && sim < 0.15) nameImage = "10"; if(sim >= 0.15 && sim < 0.25) nameImage = "20"; if(sim >= 0.25 && sim < 0.35) nameImage = "30"; if(sim >= 0.35 && sim < 0.45) nameImage = "40"; if(sim >= 0.45 && sim < 0.55) nameImage = "50"; if(sim >= 0.55 && sim < 0.65) nameImage = "60"; if(sim >= 0.65 && sim < 0.75) nameImage = "70"; if(sim >= 0.75 && sim < 0.85) nameImage = "80"; if(sim >= 0.85 && sim < 0.95) nameImage = "90"; if(sim >= 0.95 && sim <= 1) nameImage = "100"; out.println(" "); out.print(" "); out.println(" "); out.print(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); } out.println("
has cerca :
"); String Request = ""; for(int indexClass=0; indexClass < javakate.casuel.KModel.getNbClass(); indexClass++) { javakate.casuel.KModelNode node = javakate.casuel.KModel.getNodeClass(indexClass); for(int indexSlot =0; indexSlot < node.getChildCount(); indexSlot++) { javakate.casuel.KModelNode slotNode = (javakate.casuel.KModelNode)node.getChildAt(indexSlot); String slotId = slotNode.getId(); if(slotNode.isSlot()) { javakate.consultation.caseValue cValue = casQuery.getValue(slotId); javakate.casuel.KValue kValue = cValue.getValue(); Request = kValue.getName(); if(!Request.equals("?") && !Request.equals("")) out.print(" " + Request + ","); } } } out.println("


Resultat de la cerca :
"); out.println("

"); out.println("
"); out.println("

"); out.print(javakate.userinterface.InterfaceProperties.showProba(listCbrCases.getSimilarity(index)*100) + "%"); out.println("

"); // mostrem el cas for(int indexClass=0; indexClass < javakate.casuel.KModel.getNbClass(); indexClass++) { javakate.casuel.KModelNode node = javakate.casuel.KModel.getNodeClass(indexClass); for(int indexSlot =0; indexSlot < node.getChildCount(); indexSlot++) { javakate.casuel.KModelNode slotNode = (javakate.casuel.KModelNode)node.getChildAt(indexSlot); String slotId = slotNode.getId(); if(slotNode.isSlot()) { // llegim els valors del cas javakate.consultation.caseValue cValue = currentCase.getValue(slotId); javakate.casuel.KValue kValue = cValue.getValue(); result = kValue.getName(); // llegim el valor del cas javakate.consultation.caseValue cValueRequest = casQuery.getValue(slotId); javakate.casuel.KValue kValueRequest = cValueRequest.getValue(); resultRequest = kValueRequest.getName(); // comparar els valors del cas if(resultRequest.equals("?") || resultRequest.equals("")) out.print(" "); else { if(result.equals(resultRequest)) out.print(" "); else out.print(" "); } if(!result.equals("?") && !result.equals("")) out.print(" " + result + ","); else out.print(""); out.println(""); } } } out.println("

"); out.println("
"); out.print(" "); out.print("" + listCbrCases.numberOfCases()); out.print(" productes que coincideixem amb la petició
"); out.println(" "); out.println(" "); out.println("

"); out.println("

"); out.println("

"); } else { out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println("

"); out.println("

"); out.println(" "); } %>
Main page
Final project, Toni Martinez Arteaga 2000