- 更新日時:
- 2016/06/14 13:23:04 (8 年 前)
- パス:
- SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www
- ファイル:
-
- 3 変更
凡例:
- 変更なし
- 追加
- 削除
-
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/CLServlet.java
r277 r285 9 9 import java.io.IOException; 10 10 import java.io.PrintWriter; 11 import java.math.BigDecimal;12 11 import java.util.*; 13 12 import javax.json.*; … … 94 93 qpg.setSPARQLendpoint(eplist[i]); 95 94 SClass[] cls = qpg.getClasses(null); 96 qpg.setClassLabels(cls); // HENKO TODO95 qpg.setClassLabels(cls); 97 96 for (int j = 0; j < cls.length; j++ ){ 98 97 classes.add(qpg.getClassLabel(cls[j].getClassURI()).concat("\t") … … 107 106 } 108 107 }else{ // classURI 109 return; // TODO 108 Map<String, String> epclist = new HashMap<String, String>(); 109 // KOKO TODO TODO 110 110 } 111 111 JsonArray ja = getJsonArrayFromClasses(jbfactory, classes); … … 116 116 SClass[] classes = null; 117 117 if ( classURI != null ){ 118 qpg.setOWLClassGraph(classURI); 118 qpg.setOWLClassGraph(classURI); //koko part? chk? 119 119 classes = qpg.getReachableClasses(); 120 120 }else{ -
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/DSServlet.java
r265 r285 6 6 package org.biohackathon.SPARQLBuilder.www; 7 7 8 import java.io.IOException; 9 import java.io.PrintWriter; 8 import java.io.*; 10 9 import javax.servlet.ServletException; 11 10 import javax.servlet.annotation.WebServlet; … … 97 96 private String getDSList(){ 98 97 StringBuilder sb = new StringBuilder(); 98 File dsf = new File("dstable.txt"); 99 try{ 100 BufferedReader br = new BufferedReader(new FileReader(dsf)); 101 }catch(IOException e){ 102 e.printStackTrace(); 103 } 99 104 100 105 return sb.toString(); -
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/EPServlet.java
r228 r285 7 7 package org.biohackathon.SPARQLBuilder.www; 8 8 9 import java.io. IOException;10 import java. io.PrintWriter;9 import java.io.*; 10 import java.math.BigDecimal; 11 11 import javax.servlet.ServletException; 12 12 import javax.servlet.annotation.WebServlet; … … 80 80 response.setHeader("Access-Control-Max-Age", "-1"); 81 81 PrintWriter out = response.getWriter(); 82 82 83 String ds = request.getParameter("ds"); 84 83 85 String[] elist = qpg.getFactory().getEndpointURIList(); 84 86 SortedSet<String> sortedelist = new TreeSet<String>(); 85 87 for (int i = 0; i < elist.length; i++ ){ 86 88 sortedelist.add(elist[i]); 87 } 89 } 88 90 JsonBuilderFactory jbfactory = Json.createBuilderFactory(null); 89 91 JsonArrayBuilder jab = jbfactory.createArrayBuilder(); 90 Iterator<String> eit = sortedelist.iterator(); 91 while( eit.hasNext() ){ 92 jab.add(eit.next()); 92 if ( ds == null ){ 93 Iterator<String> eit = sortedelist.iterator(); 94 while( eit.hasNext() ){ 95 jab.add(eit.next()); 96 } 97 JsonArray ja = jab.build(); 98 out.print(ja); 99 }else{ 100 File dsf = new File("dstable.txt"); 101 HashMap<String, String> demap = new HashMap<String, String>(); 102 try{ 103 BufferedReader br = new BufferedReader(new FileReader(dsf)); 104 String buf; 105 while ( (buf = br.readLine()) != null ){ 106 String[] data = buf.split(","); 107 if (data.length != 2 ){ continue; } 108 demap.put(data[0],data[1]); 109 } 110 }catch(IOException e){ 111 e.printStackTrace(); 112 } 113 Iterator<String> eit = sortedelist.iterator(); 114 while( eit.hasNext() ){ 115 JsonObjectBuilder job = jbfactory.createObjectBuilder(); 116 String duri = eit.next(); 117 String euri = duri; 118 String ep = demap.get(duri); 119 if ( ep != null ){ 120 euri = ep; 121 } 122 job.add("label", duri); 123 job.add("uri", euri); 124 jab.add(job); 125 } 126 JsonArray ja = jab.build(); 127 out.print(ja); 93 128 } 94 JsonArray ja = jab.build();95 out.print(ja);96 129 session.setAttribute("qpg", qpg); 97 130 } 98 99 131 /** 100 132 * Handles the HTTP <code>POST</code> method.