チェンジセット 47 : BH13SPARQLBuilder/src
- 更新日時:
- 2014/02/17 16:31:43 (11 年 前)
- ファイル:
-
- 1 変更
凡例:
- 変更なし
- 追加
- 削除
-
BH13SPARQLBuilder/src/org/biohackathon/SPARQLBuilder/OWL/OWLClassGraph.java
r45 r47 17 17 int limit; 18 18 int th; 19 double cut; 19 double concut; 20 double divcut; 20 21 21 22 public class LinkAndPath{ … … 45 46 limit = 1000; 46 47 th = 0; 47 cut = 2.0; 48 concut = 2.0; 49 divcut = 2.0; 48 50 } 49 51 … … 61 63 62 64 public Path[] getPaths(OWLQueryBuilderImpl qb, int mode, boolean countLink){ 63 List<List<ClassLink>> paths = searchPaths(qb, mode, countLink); 65 List<List<ClassLink>> paths = null; 66 if ( mode <= 1){ 67 paths = searchPaths(qb, mode, countLink); 68 }else if ( mode == 2 ){ 69 paths = searchPathsWithCut(qb); 70 }else{ 71 System.err.println("Mode is not correct"); 72 return null; 73 } 64 74 Path[] patharray = new Path[paths.size()]; 65 75 ListIterator<List<ClassLink>> pit = paths.listIterator(); … … 86 96 private List<List<ClassLink>> searchPaths(OWLQueryBuilderImpl qb, int mode, boolean countLinks){ 87 97 List<List<ClassLink>> paths = new ArrayList<>(); 88 ClassLink crrLink = new ClassLink(null,startClass,Direction.both,0 );98 ClassLink crrLink = new ClassLink(null,startClass,Direction.both,0,0,0); 89 99 List<LinkAndPath> lp = new LinkedList<>(); 90 100 lp.add(new LinkAndPath(crrLink, new LinkedList<ClassLink>())); … … 125 135 private List<List<ClassLink>> searchPathsWithCut(OWLQueryBuilderImpl qb){ 126 136 List<List<ClassLink>> paths = new ArrayList<>(); 127 ClassLink crrLink = new ClassLink(null,startClass,Direction.both,0 );137 ClassLink crrLink = new ClassLink(null,startClass,Direction.both,0,0,0); 128 138 List<LinkAndPath> lp = new LinkedList<>(); 129 139 lp.add(new LinkAndPath(crrLink, new LinkedList<ClassLink>())); … … 144 154 } 145 155 boolean con = false; 146 double cont = 1.0; 147 if ( cont > th ){ // shrink 156 boolean div = false; 157 double conv = getValueForConvergence(classLinks[j].getNumOfOriginInstances(), 158 classLinks[j].getNumOfLinkedInstances(), 159 classLinks[j].getNumOfLinks()); 160 double divv = getValueForDivergence(classLinks[j].getNumOfOriginInstances(), 161 classLinks[j].getNumOfLinkedInstances(), 162 classLinks[j].getNumOfLinks()); 163 if ( conv > concut ){ // converge 148 164 con = true; 149 165 } 150 if ( crrlp.converge == true && con == false ){ // converge & 縲diverge 166 if ( divv > divcut ){ 167 div = true; 168 } 169 if ( crrlp.converge == true && div == true ){ // converge & 縲diverge 151 170 continue; // cut 152 171 } … … 161 180 return paths; 162 181 } 182 183 private double getValueForConvergence(int numOfOriginInstances, int numOfLinkedInstances, int numOfLinks){ 184 return (double) numOfLinks / (double) numOfLinkedInstances ; 185 } 163 186 187 private double getValueForDivergence(int numOfOriginInstances, int numOfLinkedInstances, int numOfLinks){ 188 return (double) numOfLinks / (double) numOfOriginInstances ; 189 } 164 190 }