- 更新日時:
- 2016/05/27 10:57:22 (8 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/OWL/OWLClassGraph.java
r280 r281 99 99 } 100 100 } 101 path.setMin(min); 101 102 // using length of path 102 103 //int rankwidth = (int) ( ( min * nsteps )/ crrpath.size() ); 103 path.setWidth(500000 - crrpath.size()*100000 - min); 104 //path.setWidth(500000 - crrpath.size()*100000 - min); 105 double prob = computePrOfPath(path); 106 path.setWidth(prob); 104 107 sortedpaths.add(path); 105 108 j++; … … 280 283 if ( !visited.contains(nn) ){ 281 284 nextnodes.add(nn); 285 //visited.add(nn); 282 286 } 283 287 addEdge(crr, nn, classLinks[j]); … … 305 309 */ 306 310 } 307 308 /* 309 private void updateWeight(Integer node1, Integer node2, ClassLink edge){ 310 Map<Integer, Integer> weight = edgeweight.get(node1); 311 Integer crr = weight.get(node2); 312 if (crr == null ){ 313 crr = edge.getNumOfLinkedClassInstances(); 314 weight.put(node2, crr); 315 } 316 if ( crr < edge.getNumOfLinkedClassInstances() ){ 317 crr = edge.getNumOfLinkedClassInstances(); 318 weight.put(node2, crr); 319 } 320 weight = edgeweight.get(node2); 321 crr = weight.get(node1); 322 if (crr == null ){ 323 crr = edge.getNumOfOriginClassInstances(); 324 weight.put(node1, crr); 325 } 326 if ( crr < edge.getNumOfOriginClassInstances() ){ 327 crr = edge.getNumOfOriginInstances(); 328 weight.put(node1, crr); 329 } 330 } 331 */ 332 311 333 312 public List<String> getReachableClasses(){ 334 313 List<String> clURIs = new LinkedList<String>(); … … 348 327 ClassLink prev = lit.next(); 349 328 double prob = 1.0; 329 boolean chk = true; 330 double c1, c2; 350 331 while( lit.hasNext() ){ 351 332 ClassLink crr = lit.next(); 352 double prob2 = 1.0 - 353 ((double) ( crr.getNumOfOriginClassInstances())/ 354 (double) ( nodeweight.get(labelednodes.get(prev.getLinkedClassURI())) )); 355 if ( prob2 > 1.0 ){ 356 System.out.println("Prob2 > 1"); 357 System.out.println(prev.getLinkedClassURI()); 333 c1 = (double) ( crr.getNumOfOriginClassInstances()) / 334 (double) ( nodeweight.get(labelednodes.get(prev.getLinkedClassURI()))); 335 c2 = (double) ( prev.getNumOfLinkedClassInstances()) / 336 (double) ( nodeweight.get(labelednodes.get(prev.getLinkedClassURI()))); 337 if ( c1 < 0.5 && c2 < 0.5 ){ chk = false;} 338 double prob2 = 1.0 - c1; 339 //((double) ( crr.getNumOfOriginClassInstances())/ 340 //(double) ( nodeweight.get(labelednodes.get(prev.getLinkedClassURI())) )); 341 //if ( prob2 > 1.0 || prob2 < 0 ){ 342 // System.out.println("Prob2 > 1 or Prob2 < 0"); 343 // System.out.println(prev.getLinkedClassURI()); 358 344 //classes[labelednodes.get(prev.getLinkedClassURI())].getNumOfInstances(); 359 System.out.println(prev.getPropertyURI());360 }345 // System.out.println(prev.getPropertyURI()); 346 //} 361 347 double prob3 = 1.0 - Math.pow(prob2, (double) prev.getNumOfLinkedClassInstances()); 362 if ( prob3 > 1.0 ){363 System.out.println("Prob3 > 1");364 System.out.println(prev.getLinkedClassURI());348 //if ( prob3 > 1.0 ){ 349 // System.out.println("Prob3 > 1"); 350 // System.out.println(prev.getLinkedClassURI()); 365 351 //classes[labelednodes.get(prev.getLinkedClassURI())].getNumOfInstances(); 366 System.out.println(prev.getPropertyURI());367 }352 // System.out.println(prev.getPropertyURI()); 353 //} 368 354 prob = prob * prob3 ; 369 } 355 prev = crr; 356 } 357 path.setChk(chk); 370 358 return prob; 371 359 }