チェンジセット 273 : SPARQLBuilderWWW2016/src/java/org/biohackathon/SPARQLBuilder/OWL/QueryPathGenerator.java
- 更新日時:
- 2016/03/15 18:40:34 (9 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
SPARQLBuilderWWW2016/src/java/org/biohackathon/SPARQLBuilder/OWL/QueryPathGenerator.java
r271 r273 17 17 public class QueryPathGenerator { 18 18 private RDFSchemaAnalyzerFactory factory = null; 19 private HashMap<String, RDFSchemaAnalyzer> analyzers= null;19 RDFSchemaAnalyzer analyzer = null; 20 20 private OWLClassGraph graph; 21 21 … … 24 24 private static final String CDIR = "cdata"; 25 25 private static final String ODIR = "owldata"; 26 26 27 27 public QueryPathGenerator(){ 28 28 factory = new RDFSchemaAnalyzerFactory(CDIR); 29 try{ 30 analyzer = factory.create(); 31 }catch(Exception e){ 32 System.err.println(e); 33 } 29 34 } 30 35 31 /* 32 public QueryPathGenerator(String sparqlEndpoint){ 33 factory = new RDFSchemaAnalyzerFactory(CDIR); 34 setSPARQLendpoint(sparqlEndpoint); 35 } 36 */ 37 38 /*public void setOWLClassGraph(String startClass){ 39 graph = new OWLClassGraph(analyzer, sparqlEndpoint, startClass); 40 }*/ 41 42 public SClass[] getClassesByEndpoint(String ep){ 43 RDFSchemaAnalyzer analyzer = analyzers.get(ep); 44 try { 45 return analyzer.getOWLClasses(null, null); 46 }catch(Exception e){ 47 System.err.println(e); 48 return null; 49 } 50 } 51 52 public SClass[] getClasses(String keyword){ 53 return getClassList(keyword).toArray(new SClass[0]); 36 public SClass[] getClasses(){ 37 return getClassList().toArray(new SClass[0]); 54 38 } 55 39 56 public List<SClass> getClassList(String keyword){ 57 Iterator<RDFSchemaAnalyzer> ait = analyzers.values().iterator(); 58 List<SClass> cl = new LinkedList<SClass>(); 40 public List<SClass> getClassList(){ 41 List<SClass> cl = null; 59 42 try { 60 while ( ait.hasNext() ){ 61 RDFSchemaAnalyzer analyzer = ait.next(); 62 cl.addAll(analyzer.getOWLClassList(null, null)); 63 } 43 cl = new LinkedList<SClass>(analyzer.getOWLClassList(null, null)); 64 44 }catch(Exception e){ 65 45 System.err.println(e); … … 79 59 } 80 60 81 /*82 public void setSPARQLendpoint(String sparqlEndpoint){83 this.sparqlEndpoint = sparqlEndpoint;84 setAnalyzer();85 }86 */87 88 61 public RDFSchemaAnalyzerFactory getFactory(){ 89 62 return factory; 90 63 } 91 92 /*93 private void setAnalyzer(){94 try {95 analyzer = factory.create(sparqlEndpoint);96 } catch (Exception e) {97 System.err.println(e);98 }99 }100 */101 64 102 65 public String getClassLabel(String classURI){ … … 210 173 String label = getClassLabel(uri); 211 174 StringBuilder classbuilder = new StringBuilder(label); 212 classbuilder.append(" 175 classbuilder.append("\t"); 213 176 classbuilder.append(classes[i].getNumOfInstances()); 214 classbuilder.append(" 177 classbuilder.append("\t"); 215 178 classbuilder.append(uri); 216 179 sortedClasses.add(classbuilder.toString());