- 更新日時:
- 2016/03/15 18:40:34 (9 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
SPARQLBuilderWWW2016/src/java/org/biohackathon/SPARQLBuilder/www/CLServlet.java
r268 r273 75 75 PrintWriter out = response.getWriter(); 76 76 String ep = request.getParameter("ep"); 77 String classURI = request.getParameter("class"); 77 78 78 79 HttpSession session = request.getSession(); 79 80 QueryPathGenerator qpg = (QueryPathGenerator)session.getAttribute("qpg"); 80 81 SortedSet<String> sortedClasses = null; 82 SClass[] classes = null; 83 JsonBuilderFactory jbfactory = Json.createBuilderFactory(null); 84 JsonObjectBuilder job = jbfactory.createObjectBuilder(); 85 JsonArray ja = null; 81 86 82 87 if ( qpg == null ){ 83 88 qpg = new QueryPathGenerator(); 84 89 } 85 if ( ep == null ){ 86 JsonBuilderFactory jbfactory = Json.createBuilderFactory(null); 87 JsonObjectBuilder job = jbfactory.createObjectBuilder(); 88 89 String[] eplist = qpg.getFactory().getEndpointURIList(); 90 for ( int i = 0; i < eplist.length; i++ ){ 91 try{ 92 SClass[] classes = qpg.getClassesByEndpoint(eplist[i]); 93 sortedClasses = qpg.getSortedClasses(classes); 94 JsonArray ja = getJsonArrayFromSortedClasses(jbfactory, sortedClasses); 95 job.add(eplist[i], ja); 96 }catch(Exception e){ 97 System.err.println(e); 98 } 90 if ( classURI == null ){ 91 try{ 92 classes = qpg.getClasses(); 93 }catch(Exception e){ 94 System.err.println(e); 99 95 } 100 JsonObject jo = job.build();101 out.print(jo);102 return;103 }104 String classURI = request.getParameter("class");105 SClass[] classes = null;106 if ( classURI != null ){107 //qpg.setOWLClassGraph(classURI); // KOKO108 //classes = qpg.getReachableClasses();109 96 }else{ 110 classes = qpg.getClasses(null);97 //classes = qpg.getAdjclasses(classURI); 111 98 } 112 99 sortedClasses = qpg.getSortedClasses(classes); 113 114 JsonBuilderFactory jbfactory = Json.createBuilderFactory(null); 115 JsonArray ja = getJsonArrayFromSortedClasses(jbfactory, sortedClasses); 100 ja = getJsonArrayFromSortedClasses(jbfactory, sortedClasses); 116 101 out.print(ja); 117 102 } … … 148 133 while( cit.hasNext() ){ 149 134 String classinfo = cit.next(); 150 String[] data = classinfo.split(" 135 String[] data = classinfo.split("\t"); 151 136 if (data.length != 3 ){ 152 137 System.out.println("data is wrong?"); … … 164 149 while( cit.hasNext() ){ 165 150 String classinfo = cit.next(); 166 String[] data = classinfo.split(" 151 String[] data = classinfo.split("\t"); 167 152 if (data.length != 3 ){ 168 153 System.out.println("data is wrong?");