チェンジセット 283 : SPARQLBuilderWWW/src/java
- 更新日時:
- 2016/06/13 10:52:55 (8 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/OWL/OWLClassGraph.java
r281 r283 10 10 */ 11 11 import java.util.*; 12 13 public class OWLClassGraph extends LabeledMultiDigraph{ 12 import java.io.Serializable; 13 14 public class OWLClassGraph extends LabeledMultiDigraph implements Serializable{ 14 15 int nsteps = 4; 15 int limit = 100;16 //int limit = 100; 16 17 17 18 List<String> nodeType; … … 52 53 nodeType = new LinkedList<String>(); 53 54 } 54 55 55 56 public OWLClassGraph(RDFSchemaAnalyzer rdfsa){ // for experiment 56 57 super(); … … 220 221 addNode(classes[i].getClassURI()); 221 222 nodeType.add("class"); 223 nodeweight.add(classes[i].getNumOfInstances()); 222 224 } 223 225 // setEdges 224 226 for (int i = 0 ; i < classes.length; i++ ){ 225 227 try{ 226 ClassLink[] classLinks = rdfsa.getNextClass(null, classes[i].getClassURI(), limit, true);228 ClassLink[] classLinks = rdfsa.getNextClass(null, classes[i].getClassURI(), 10000, true); 227 229 for (int j = 0 ; j < classLinks.length; j++){ 228 230 Integer n = labelednodes.get(classLinks[j].getLinkedClassURI()); … … 242 244 System.err.println(e); 243 245 } 244 } 246 } 245 247 } 246 248 … … 249 251 this.sparqlEndpoint = sparqlEndpoint; 250 252 visited = new HashSet<Integer>(); 251 //edgeweight = new LinkedList<Map<Integer,Integer>>();252 253 nodeweight = new LinkedList<Integer>(); 253 254 // setNodes for all classes … … 261 262 addNode(classes[i].getClassURI()); 262 263 nodeType.add("class"); 263 //edgeweight.add(new HashMap<Integer,Integer>());264 264 nodeweight.add(classes[i].getNumOfInstances()); 265 265 } … … 275 275 Integer crr = nit.next(); 276 276 try{ 277 ClassLink[] classLinks = rdfsa.getNextClass(null, labels.get(crr), limit, true);277 ClassLink[] classLinks = rdfsa.getNextClass(null, labels.get(crr), 10000, true); 278 278 for (int j = 0 ; j < classLinks.length; j++){ 279 279 Integer nn = labelednodes.get(classLinks[j].getLinkedClassURI()); … … 294 294 nodes = nextnodes; 295 295 visited.addAll(nodes); 296 if ( visited.size() > labelednodes.size()){ 297 System.out.println(); 298 } 296 299 } 297 300 // cut visited … … 337 340 if ( c1 < 0.5 && c2 < 0.5 ){ chk = false;} 338 341 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());344 //classes[labelednodes.get(prev.getLinkedClassURI())].getNumOfInstances();345 // System.out.println(prev.getPropertyURI());346 //}347 342 double prob3 = 1.0 - Math.pow(prob2, (double) prev.getNumOfLinkedClassInstances()); 348 //if ( prob3 > 1.0 ){349 // System.out.println("Prob3 > 1");350 // System.out.println(prev.getLinkedClassURI());351 //classes[labelednodes.get(prev.getLinkedClassURI())].getNumOfInstances();352 // System.out.println(prev.getPropertyURI());353 //}354 343 prob = prob * prob3 ; 355 344 prev = crr;