チェンジセット 149 : SPARQLBuilderWWW/src

差分発生行の前後
無視リスト:
更新日時:
2014/09/25 11:06:29 (10 年 前)
更新者:
atsuko
ログメッセージ:

QueryPathGenerator? にgetFactory を追加

パス:
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www
ファイル:
3 変更

凡例:

変更なし
追加
削除
  • SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/CLServlet.java

    r130 r149  
    1616import javax.servlet.http.HttpServletRequest; 
    1717import javax.servlet.http.HttpServletResponse; 
     18import javax.servlet.http.HttpSession; 
    1819import org.biohackathon.SPARQLBuilder.OWL.*; 
    1920 
     
    6970        PrintWriter out = response.getWriter(); 
    7071        String ep = request.getParameter("ep"); 
    71         QueryPathGenerator qpg = new QueryPathGenerator(ep, FILENAME); 
     72        HttpSession session = request.getSession(); 
     73        QueryPathGenerator qpg = (QueryPathGenerator)session.getAttribute("qpg"); 
     74        if ( qpg == null ){ 
     75            qpg = new QueryPathGenerator(); 
     76        } 
     77        qpg.setSPARQLendpoint(ep); 
    7278        SClass[] classes = qpg.getClasses(null); 
    7379        JsonBuilderFactory jbfactory = Json.createBuilderFactory(null); 
  • SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/EPServlet.java

    r133 r149  
    1414import javax.servlet.http.HttpServletRequest; 
    1515import javax.servlet.http.HttpServletResponse; 
     16import javax.servlet.http.HttpSession; 
    1617import org.biohackathon.SPARQLBuilder.OWL.*; 
    1718import javax.json.*; 
     
    2627public class EPServlet extends HttpServlet { 
    2728 
    28     private RDFSchemaAnalyzerFactory factory = null; 
     29    //private RDFSchemaAnalyzerFactory factory = null; 
     30    private QueryPathGenerator qpg = null; 
    2931    private static final String FILENAME = "cdata/"; 
    3032     
     
    7173        response.setContentType("application/json;charset=UTF-8"); 
    7274        PrintWriter out = response.getWriter(); 
    73         if ( factory == null ){ 
    74             factory = new RDFSchemaAnalyzerFactory(FILENAME); 
     75        if ( qpg == null ){ 
     76            qpg = new QueryPathGenerator(); 
    7577        } 
    76         String[] elist = factory.getEndpointURIList(); 
     78        String[] elist = qpg.getFactory().getEndpointURIList(); 
    7779        JsonBuilderFactory jbfactory = Json.createBuilderFactory(null); 
    7880        JsonArrayBuilder jab = jbfactory.createArrayBuilder(); 
     
    8284        JsonArray ja = jab.build(); 
    8385        out.print(ja); 
     86        HttpSession session = request.getSession(); 
     87        session.setAttribute("qpg", qpg); 
    8488    } 
    8589 
  • SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/PLServlet.java

    r123 r149  
    1414import javax.servlet.http.HttpServletRequest; 
    1515import javax.servlet.http.HttpServletResponse; 
     16import javax.servlet.http.HttpSession; 
    1617import org.biohackathon.SPARQLBuilder.OWL.*; 
    1718 
     
    7071        String en = request.getParameter("endclass"); 
    7172         
    72         QueryPathGenerator qpg = new QueryPathGenerator(ep, FILENAME); 
     73        HttpSession session = request.getSession(); 
     74        QueryPathGenerator qpg = (QueryPathGenerator)session.getAttribute("qpg"); 
     75        if ( qpg == null ){ 
     76            qpg = new QueryPathGenerator(ep); 
     77        } 
    7378        Path[] paths = qpg.getPaths(st, en, true); 
    7479        String jsonstr = "{\"paths\":["; 
     
    8388        System.out.println(jsonstr); 
    8489        out.print(jsonstr); 
     90        //List<Path> 
     91        //session.setAttribute("pathlist", pathlist); 
    8592    } 
    8693