- 更新日時:
- 2015/03/24 18:18:00 (10 年 前)
- パス:
- SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www
- ファイル:
-
- 3 変更
凡例:
- 変更なし
- 追加
- 削除
-
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/CLServlet.java
r228 r248 74 74 PrintWriter out = response.getWriter(); 75 75 String ep = request.getParameter("ep"); 76 String classURI = request.getParameter("class"); 76 77 HttpSession session = request.getSession(); 77 78 QueryPathGenerator qpg = (QueryPathGenerator)session.getAttribute("qpg"); … … 82 83 qpg.setSPARQLendpoint(ep); 83 84 //OWLClassGraph ocg = qpg.getOWLClassGraph(); 85 if ( classURI != null ){ 86 qpg.setOWLClassGraph(classURI); 87 } 88 84 89 SClass[] classes = qpg.getClasses(null); 85 90 for (int i = 0 ; i < classes.length; i++ ){ … … 88 93 // continue; 89 94 //} 95 if ( classURI != null ){ 96 if ( qpg.getOWLClassGraph().visitedNode(classURI) == false ){ 97 continue; 98 } 99 } 90 100 Label[] labels = classes[i].getLabels(); 91 101 String label = null; … … 113 123 JsonArrayBuilder jab = jbfactory.createArrayBuilder(); 114 124 Iterator<String> cit = sortedClasses.iterator(); 125 List<String> tmpclasses = new LinkedList<String>(); 126 JsonObjectBuilder job = jbfactory.createObjectBuilder(); 115 127 while( cit.hasNext() ){ 116 JsonObjectBuilder job = jbfactory.createObjectBuilder(); 128 String classinfo = cit.next(); 129 String[] data = classinfo.split(" "); 130 if (data.length != 3 ){ 131 System.out.println("data is wrong?"); 132 } 133 if (data[0].matches("^[0-9]*$")){ 134 tmpclasses.add(classinfo); 135 }else{ 136 job.add("uri", data[2]); 137 job.add("label", data[0]); 138 job.add("number", data[1]); 139 jab.add(job); 140 } 141 } 142 cit = tmpclasses.iterator(); 143 while( cit.hasNext() ){ 117 144 String classinfo = cit.next(); 118 145 String[] data = classinfo.split(" "); … … 124 151 job.add("number", data[1]); 125 152 jab.add(job); 126 } 153 } 127 154 JsonArray ja = jab.build(); 128 155 out.print(ja); -
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/PLServlet.java
r221 r248 74 74 String st = request.getParameter("startclass"); 75 75 String en = request.getParameter("endclass"); 76 String ask = request.getParameter("ask"); 76 77 77 78 HttpSession session = request.getSession(); … … 81 82 } 82 83 SClass[] classes = qpg.getClasses(null); 83 Path[] paths = qpg.getPaths(st, en, true); 84 Path[] paths = null; 85 if ( ask == null ){ 86 paths = qpg.getPaths(st, en, false); 87 }else if ( ask.equalsIgnoreCase("true")){ 88 paths = qpg.getPaths(st, en, true); 89 }else{ 90 paths = qpg.getPaths(st, en, false); 91 } 92 84 93 String jsonstr = "["; 85 94 for(int i = 0; i< paths.length; i++){ -
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/SPServlet.java
r229 r248 179 179 180 180 private String convertPath2SPARQL(Path path) throws Exception{ 181 182 ArrayList<String> classname =new ArrayList<String>() ; 183 181 ArrayList<String> classname =new ArrayList<String>() ; 184 182 if( path == null ){ 185 183 throw new Exception("Path is null.");