- 更新日時:
- 2015/03/24 18:18:00 (10 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
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);