チェンジセット 228 : SPARQLBuilderWWW/src/java/org
- 更新日時:
- 2014/12/30 22:36:45 (10 年 前)
- パス:
- SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder
- ファイル:
-
- 4 変更
凡例:
- 変更なし
- 追加
- 削除
-
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/OWL/OWLClassGraph.java
r221 r228 14 14 //String startClass; 15 15 //String endClass; 16 int nsteps = 5;16 int nsteps = 4; 17 17 int limit = 100; 18 18 int th = 1; … … 77 77 */ 78 78 79 public OWLClassGraph(){ 80 super(); 81 nodeType = new LinkedList<String>(); 82 //setClassGraph(rdfsa); 83 //connectionTable = createConnectionTable(); 84 } 85 86 79 87 public OWLClassGraph(RDFSchemaAnalyzer rdfsa){ 80 88 super(); 81 89 nodeType = new LinkedList<String>(); 82 setClassGraph(rdfsa);83 connectionTable = createConnectionTable();90 //setClassGraph(rdfsa); 91 //connectionTable = createConnectionTable(); 84 92 } 85 93 … … 376 384 } 377 385 } 386 387 public void setPartClassGraph(RDFSchemaAnalyzer rdfsa, String startClass){ 388 // setNodes 389 SClass[] classes = null; 390 try{ 391 classes = rdfsa.getOWLClasses(null, null, null, true); 392 }catch(Exception e){ 393 System.err.println(e); return; 394 } 395 for (int i = 0 ; i < classes.length; i++){ 396 addNode(classes[i].getClassURI()); 397 nodeType.add("class"); 398 } 399 int nedge = 0; 400 Integer snode = labelednodes.get(startClass); 401 Set<Integer> nodes = new HashSet<Integer>(); 402 nodes.add(snode); 403 Set<Integer> visited = new HashSet<Integer>(); 404 for (int i = 0 ; i < nsteps; i++ ){ 405 Iterator<Integer> nit = nodes.iterator(); 406 Set<Integer> nextnodes = new HashSet<Integer>(); 407 while ( nit.hasNext() ){ 408 Integer crr = nit.next(); 409 visited.add(crr); 410 try{ 411 ClassLink[] classLinks = rdfsa.getNextClass(null, labels.get(crr), limit, true); 412 for (int j = 0 ; j < classLinks.length; j++){ 413 Integer nn = labelednodes.get(classLinks[j].getLinkedClassURI()); 414 if ( !visited.contains(nn) ){ 415 nextnodes.add(nn); 416 } 417 if ( nn != null ){ 418 addEdge(crr, nn, classLinks[j]); 419 /* 420 }else{ 421 nn = labelednodes.get(classLinks[j].getLinkedLiteralDatatypeURI()); 422 if ( nn == null ){ 423 addNode(classLinks[j].getLinkedLiteralDatatypeURI()); 424 n = nodeType.size(); 425 nodeType.add("literal"); 426 } 427 addEdge(i, n, classLinks[j]); 428 /* 429 ClassLink rev = new ClassLink( classLinks[j].getPropertyURI(), 430 //classLinks[j].getLinkedClassURI(), 431 classes[i].getClassURI(), 432 classLinks[j].getLinkedLiteralDatatypeURI(), 433 classLinks[j].getDirection(), classLinks[j].getNumOfLinks(), 434 classLinks[j].getNumOfOriginInstances(), classLinks[j].getNumOfLinkedInstances(), 435 classLinks[j].getNumOfOriginClassInstances(), classLinks[j].getNumOfLinkedClassInstances(), 436 classLinks[j].isDomainClassLimitedQ(), classLinks[j].isRangeClassLimitedQ() ); 437 rev.setDirection(Direction.reverse); 438 addEdge(n, i, rev); 439 */ 440 } 441 } 442 }catch(Exception e){ 443 e.printStackTrace(); 444 } 445 } 446 nodes = nextnodes; 447 } 448 } 378 449 379 450 private ArrayList<HashSet<Integer>> createConnectionTable(){ -
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/OWL/QueryPathGenerator.java
r226 r228 83 83 setOWLClassGraph(); 84 84 } 85 graph.setPartClassGraph(analyzer, startClass); 85 86 return graph.getPaths(startClass, endClass); 87 //return graph.getPaths(startClass, endClass, analyzer); 86 88 //return graph.getPaths_old(analyzer, true, startClass, endClass); 87 89 } -
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/CLServlet.java
r226 r228 81 81 SortedSet<String> sortedClasses = new TreeSet<String>(); // display + url 82 82 qpg.setSPARQLendpoint(ep); 83 OWLClassGraph ocg = qpg.getOWLClassGraph();83 //OWLClassGraph ocg = qpg.getOWLClassGraph(); 84 84 SClass[] classes = qpg.getClasses(null); 85 85 for (int i = 0 ; i < classes.length; i++ ){ 86 86 String uri = classes[i].getClassURI(); 87 if ( ocg.getNumberOfEdge(uri) == 0 ){88 continue;89 }87 //if ( ocg.getNumberOfEdge(uri) == 0 ){ 88 // continue; 89 //} 90 90 Label[] labels = classes[i].getLabels(); 91 91 String label = null; -
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/www/EPServlet.java
r227 r228 71 71 // Initialize the session 72 72 session.removeAttribute("qpg"); 73 session.removeAttribute("graph");73 //session.removeAttribute("graph"); 74 74 QueryPathGenerator qpg = new QueryPathGenerator(); 75 75