<%@ page info="Simple Demo: OBSERVER execution" language="java" import="observer.ontServer.mapTrans.*,observer.ontServer.*,observer.observer.*,java.io.*,java.util.*" %> <%! private Mapping getMapConcept(String o, String kb) { String line,search,rel =null; Vector v1,v2; BufferedReader f = null; Mapping map = null; try{ f= new BufferedReader( new InputStreamReader ( new FileInputStream(ObserverCONST.ONTOLOGIES+"/"+kb+".mapping"))); }catch(FileNotFoundException fnfe){ log("ONT_SERVER***** ERROR: Mapping file (" + ObserverCONST.ONTOLOGIES + "/" + kb + ".mapping"+") not found !!!!"); return null; } try{ search = "CONCEPT " + o; while( (line=f.readLine()) != null && line.trim().compareToIgnoreCase(search) != 0); if ( line != null) { rel = f.readLine(); while ( (line =f.readLine()) != null && ( line.startsWith(" ") || line.startsWith("\t") ) ) rel = rel + f.readLine(); v1 = new Vector(); v1.addElement(line); v2 = new Vector(); v2.addElement(f.readLine()); map = new Mapping(rel,v1,v2); }else{ map = null; } f.close(); }catch(Exception e){ log("ONT_SERVER***** ERROR: Reading mapping file (" + ObserverCONST.ONTOLOGIES + "/" + kb + ".mapping" + ") !!!!"); return null; } return map; } /** * Given an role name and a name of ontology mapping file it returns the mapping of * that concept or null if it doesn't exist */ private Mapping getMapRole(String o, String kb) { String line,search; BufferedReader f = null; Mapping map = null; Vector v1,v2,v3,v4; String rel = null; try{ f= new BufferedReader( new InputStreamReader ( new FileInputStream(ObserverCONST.ONTOLOGIES+"/"+kb+".mapping"))); }catch(FileNotFoundException fnfe){ log("ONT_SERVER***** ERROR: Mapping file (" + ObserverCONST.ONTOLOGIES + "/" + kb + ".mapping"+") not found !!!!"); return null; } try{ search = "ROLE " + o; while( (line=f.readLine()) != null && line.trim().compareToIgnoreCase(search) != 0); if ( line != null) { rel = f.readLine(); while ( ( line =f.readLine() ) != null && ( line.startsWith(" ") || line.startsWith("\t") ) ) rel = rel + f.readLine(); v1 = new Vector(); v1.addElement(line); v2 = new Vector(); v2.addElement(f.readLine()); String string; int indice; //Role Names string=f.readLine(); v3 = new Vector(); while ((indice=string.indexOf(","))!=-1){ v3.addElement(string.substring(0,indice)); string=string.substring(indice+1); } v3.addElement(string); //Role Type string=f.readLine(); v4 = new Vector(); while ((indice=string.indexOf(","))!=-1){ v4.addElement(string.substring(0,indice)); string=string.substring(indice+1); } v4.addElement(string); //Funcion de Transformacion Vector ft= new Vector(); string =f.readLine(); while ((indice=string.indexOf(","))!=-1){ ft.addElement(string.substring(0,indice)); string=string.substring(indice+1); } ft.addElement(string); map = new Mapping(rel,v1,v2,v3,v4,ft); }else{ map = null; } f.close(); }catch(Exception e){ log("ONT_SERVER***** ERROR: Reading mapping file (" + ObserverCONST.ONTOLOGIES + "/" + kb + ".mapping" + ") !!!!"); return null; } return map; } %> Simple Demo: OBSERVER execution

Simple Demo: OBSERVER execution



Last update: June 16, 2003

This is the mapping information for the term <%=request.getParameter("name") %> in <%=request.getParameter("ont")%> ontology:

<% Mapping map = getMapConcept( request.getParameter("name"),request.getParameter("ont")); if (map == null){ map = getMapRole( request.getParameter("name"),request.getParameter("ont")); } %>

<%=map%>

joalroyo@unizar.es
June 16, 2003