チェンジセット 84 : BH13SPARQLBuilder/src
- 更新日時:
- 2014/06/18 17:23:13 (10 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
BH13SPARQLBuilder/src/hozo/sparql/gui/SparqlBuilderPanel.java
r74 r84 14 14 import hozo.sparql.SparqlQueryListener; 15 15 16 import org.biohackathon.SPARQLBuilder.OWL.*; 17 18 /* 16 19 import org.biohackathon.SPARQLBuilder.OWL.ClassLink; 17 20 import org.biohackathon.SPARQLBuilder.OWL.Direction; … … 21 24 import org.biohackathon.SPARQLBuilder.OWL.Path; 22 25 import org.biohackathon.SPARQLBuilder.OWL.SClass; 23 26 */ 24 27 25 28 … … 34 37 MapFactory map; 35 38 SparqlSearchPanel search_panel; 36 OWLQueryBuilderImpl builder; 39 //OWLQueryBuilderImpl builder; 40 QueryPathGenerator generator; 37 41 38 42 // public SparqlBuilderPanel(SparqlAccessorForm parent) { … … 41 45 // this.parent = parent; 42 46 // } 43 47 /* 44 48 public OWLQueryBuilderImpl getOWLQueryBuilderImpl(){ 45 49 makeOWLQueryBuilderImpl(); 46 50 47 51 return builder; 48 } 49 52 }*/ 53 54 public QueryPathGenerator getQueryPathGenerator(){ 55 if ( generator == null ){ 56 makeQueryPathGenerator(); 57 } 58 return generator; 59 } 60 50 61 /* SparqlBuilderPanel(SparqlAccessorForm sparqlAccessorForm){ 51 62 super(); … … 197 208 198 209 boolean count_ins = jcb_count_ins.isSelected(); 199 210 /* 200 211 Path[] path = getOWLQueryBuilderImpl().getPaths( 201 212 jtf_start_class.getText(), jtf_end_class.getText(), 202 213 mode, !count_ins); 214 */ 215 Path[] path = getQueryPathGenerator().getPaths(jtf_start_class.getText(), jtf_end_class.getText(), !count_ins); 203 216 System.out.println("RESULT:::>>>>"+path.length); 204 217 … … 233 246 String classURL =""; 234 247 try { 235 SClass[] classes = this.getOWLQueryBuilderImpl().getOWLClasses(null, null, keyword, false); 248 //SClass[] classes = this.getOWLQueryBuilderImpl().getOWLClasses(null, null, keyword, false); 249 SClass[] classes = this.generator.getClasses(); 236 250 DefaultListModel model = new DefaultListModel(); 237 251 for(int i=0;i<classes.length;i++){ … … 269 283 } 270 284 271 void makeOWLQueryBuilderImpl() { 285 /* 286 void makeOWLQueryBuilderImpl() { 272 287 // String sparqlEndpoint = "http://lsd.dbcls.jp/sparql"; 273 288 String sparqlEndpoint = search_panel.getSparqlAccessorForm().getCurrentEndPoint(); … … 278 293 279 294 builder = new OWLQueryBuilderImpl(sparqlEndpoint); 280 /*281 295 282 296 String keyword = "\"artiste\"@fr"; … … 318 332 System.out.println(e.toString()); 319 333 e.printStackTrace(); 334 } 335 336 //return (OWLQueryBuilderImpl) builder; 337 } 338 */ 339 340 void makeQueryPathGenerator() { 341 // String sparqlEndpoint = "http://lsd.dbcls.jp/sparql"; 342 String sparqlEndpoint = search_panel.getSparqlAccessorForm().getCurrentEndPoint(); 343 344 // String sparqlEndpoint = "http://dbpedia.org/sparql"; 345 346 System.out.println("Create OWLQueryBuilder for "+sparqlEndpoint); 347 348 generator = new QueryPathGenerator(); 349 generator.setSPARQLendpoint(sparqlEndpoint); 350 351 352 //String keyword = "\"artiste\"@fr"; 353 //String[] graphURIs = new String[0]; 354 /* 355 try { 356 357 // OWLQueryBuilder builder = new OWLQueryBuilderImpl(sparqlEndpoint); 358 359 String[] clsURIs; 360 clsURIs = builder.getOWLClasses(graphURIs, keyword); 361 for(String cls: clsURIs){ 362 System.out.println(cls); 363 } 364 365 System.out.println("CLS"); 366 ClassLink[] cls = builder.getNextClass(null, clsURIs[0], 0); 367 if( cls != null ){ 368 for( ClassLink cl: cls){ 369 System.out.println(cl.toString()); 370 } 371 } 372 373 System.out.println("CLS-INS"); 374 cls = builder.getNextClassViaInstanceLink(null, clsURIs[0], 100); 375 if( cls != null ){ 376 for( ClassLink cl: cls){ 377 System.out.println(cl.toString()); 378 } 379 } 380 381 System.out.println("Instances"); 382 Instance[] ins = builder.getInstances(null, "\"A.C. Reed\"@en"); 383 if( ins != null ){ 384 for( Instance in: ins){ 385 System.out.println(in.toString()); 386 } 387 } 388 } catch (Exception e) { 389 // TODO Auto-generated catch block 390 System.out.println(e.toString()); 391 e.printStackTrace(); 320 392 }*/ 321 393 … … 323 395 } 324 396 325 public String createSPARQL(Path path) throws Exception { 326 return createSPARQL(path, 0); 327 } 328 329 public String createSPARQL(Path path, int num) throws Exception { 397 398 public String createSPARQL(Path path) throws Exception { 399 return createSPARQL(path, 0); 400 } 401 402 public String createSPARQL(Path path, int num) throws Exception { 330 403 331 404 if( path == null ){