チェンジセット 280 : SPARQLBuilderWWW/src
- 更新日時:
- 2016/05/02 17:43:57 (9 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/OWL/OWLClassGraph.java
r263 r280 246 246 this.sparqlEndpoint = sparqlEndpoint; 247 247 visited = new HashSet<Integer>(); 248 edgeweight = new LinkedList<Map<Integer,Integer>>();248 //edgeweight = new LinkedList<Map<Integer,Integer>>(); 249 249 nodeweight = new LinkedList<Integer>(); 250 250 // setNodes for all classes … … 258 258 addNode(classes[i].getClassURI()); 259 259 nodeType.add("class"); 260 edgeweight.add(new HashMap<Integer,Integer>());260 //edgeweight.add(new HashMap<Integer,Integer>()); 261 261 nodeweight.add(classes[i].getNumOfInstances()); 262 262 } … … 282 282 } 283 283 addEdge(crr, nn, classLinks[j]); 284 updateWeight(crr, nn, classLinks[j]);284 //updateWeight(crr, nn, classLinks[j]); 285 285 } 286 286 }catch(Exception e){ … … 292 292 } 293 293 // cut visited 294 /* 294 295 Iterator<Integer> nit = visited.iterator(); 295 296 while(nit.hasNext()){ … … 302 303 } 303 304 } 304 } 305 */ 306 } 305 307 308 /* 306 309 private void updateWeight(Integer node1, Integer node2, ClassLink edge){ 307 310 Map<Integer, Integer> weight = edgeweight.get(node1); … … 326 329 } 327 330 } 331 */ 328 332 329 333 public List<String> getReachableClasses(){ … … 339 343 return clURIs; 340 344 } 345 346 public double computePrOfPath(Path path){ 347 ListIterator<ClassLink> lit = path.getClassLinks().listIterator(); 348 ClassLink prev = lit.next(); 349 double prob = 1.0; 350 while( lit.hasNext() ){ 351 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()); 358 //classes[labelednodes.get(prev.getLinkedClassURI())].getNumOfInstances(); 359 System.out.println(prev.getPropertyURI()); 360 } 361 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()); 365 //classes[labelednodes.get(prev.getLinkedClassURI())].getNumOfInstances(); 366 System.out.println(prev.getPropertyURI()); 367 } 368 prob = prob * prob3 ; 369 } 370 return prob; 371 } 372 341 373 }