チェンジセット 149 : SPARQLBuilderWWW/src/java
- 更新日時:
- 2014/09/25 11:06:29 (10 年 前)
- パス:
- SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www
- ファイル:
-
- 3 変更
凡例:
- 変更なし
- 追加
- 削除
-
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/CLServlet.java
r130 r149 16 16 import javax.servlet.http.HttpServletRequest; 17 17 import javax.servlet.http.HttpServletResponse; 18 import javax.servlet.http.HttpSession; 18 19 import org.biohackathon.SPARQLBuilder.OWL.*; 19 20 … … 69 70 PrintWriter out = response.getWriter(); 70 71 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); 72 78 SClass[] classes = qpg.getClasses(null); 73 79 JsonBuilderFactory jbfactory = Json.createBuilderFactory(null); -
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/EPServlet.java
r133 r149 14 14 import javax.servlet.http.HttpServletRequest; 15 15 import javax.servlet.http.HttpServletResponse; 16 import javax.servlet.http.HttpSession; 16 17 import org.biohackathon.SPARQLBuilder.OWL.*; 17 18 import javax.json.*; … … 26 27 public class EPServlet extends HttpServlet { 27 28 28 private RDFSchemaAnalyzerFactory factory = null; 29 //private RDFSchemaAnalyzerFactory factory = null; 30 private QueryPathGenerator qpg = null; 29 31 private static final String FILENAME = "cdata/"; 30 32 … … 71 73 response.setContentType("application/json;charset=UTF-8"); 72 74 PrintWriter out = response.getWriter(); 73 if ( factory== null ){74 factory = new RDFSchemaAnalyzerFactory(FILENAME);75 if ( qpg == null ){ 76 qpg = new QueryPathGenerator(); 75 77 } 76 String[] elist = factory.getEndpointURIList();78 String[] elist = qpg.getFactory().getEndpointURIList(); 77 79 JsonBuilderFactory jbfactory = Json.createBuilderFactory(null); 78 80 JsonArrayBuilder jab = jbfactory.createArrayBuilder(); … … 82 84 JsonArray ja = jab.build(); 83 85 out.print(ja); 86 HttpSession session = request.getSession(); 87 session.setAttribute("qpg", qpg); 84 88 } 85 89 -
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/PLServlet.java
r123 r149 14 14 import javax.servlet.http.HttpServletRequest; 15 15 import javax.servlet.http.HttpServletResponse; 16 import javax.servlet.http.HttpSession; 16 17 import org.biohackathon.SPARQLBuilder.OWL.*; 17 18 … … 70 71 String en = request.getParameter("endclass"); 71 72 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 } 73 78 Path[] paths = qpg.getPaths(st, en, true); 74 79 String jsonstr = "{\"paths\":["; … … 83 88 System.out.println(jsonstr); 84 89 out.print(jsonstr); 90 //List<Path> 91 //session.setAttribute("pathlist", pathlist); 85 92 } 86 93