チェンジセット 3 : BH13SPARQLBuilder
- 更新日時:
- 2014/01/30 10:31:23 (11 年 前)
- パス:
- BH13SPARQLBuilder/src/org/biohackathon/SPARQLBuilder/OWL
- ファイル:
-
- 2 変更
凡例:
- 変更なし
- 追加
- 削除
-
BH13SPARQLBuilder/src/org/biohackathon/SPARQLBuilder/OWL/OWLClassGraph.java
r2 r3 14 14 String startClass; 15 15 String endClass; 16 int startNode;17 int endNode;18 16 int nsteps; 19 17 int limit; 20 21 List<OWLEdge> allOWLEdge;22 18 23 public class OWLEdge{24 String startClass;25 ClassLink classLink;26 public OWLEdge(String startClass, ClassLink classLink){27 this.startClass = startClass;28 this.classLink = classLink;29 }30 }31 32 19 public class LinkAndPath{ 33 20 ClassLink classLink; … … 39 26 } 40 27 41 public OWLClassGraph(String p_startClass, String p_endClass){28 public OWLClassGraph(String startClass, String endClass){ 42 29 super(); 43 startClass = p_startClass; 44 adjlist.add(new LinkedList<LabeledEdge>()); 45 labels.add(startClass); 46 endClass = p_endClass; 47 labels.add(endClass); 48 nsteps = 3; 49 limit = 100; 50 allOWLEdge= new LinkedList<OWLEdge>(); 30 this.startClass = startClass; 31 addNode(startClass); 32 this.endClass = endClass; 33 addNode(endClass); 34 nsteps = 2; 35 limit = 1000; 51 36 } 52 37 53 public void generateGraph( ){54 // atode38 public void generateGraph(List<List<ClassLink>> paths){ 39 55 40 } 56 41 57 42 public Path[] getPaths(OWLQueryBuilderImpl qb){ 58 List<List<ClassLink>> paths = searchPathsFromOWL(qb); 43 //List<List<ClassLink>> paths = searchPathsFromOWL(qb); 44 List<List<ClassLink>> paths = searchPathsFromInstances(qb); 59 45 Path[] patharray = new Path[paths.size()]; 60 46 ListIterator<List<ClassLink>> pit = paths.listIterator(); 61 47 int i = 0; 62 48 while ( pit.hasNext() ){ 49 patharray[i] = new Path(); 63 50 patharray[i].setStartClass(startClass); 64 51 List<ClassLink> path = pit.next(); 65 path.remove(0);66 52 patharray[i].setClassLinks(path); 67 53 i++; … … 71 57 72 58 private List<List<ClassLink>> searchPathsFromOWL(OWLQueryBuilderImpl qb){ 59 return searchPathsEngine(qb, 0); 60 } 61 62 private List<List<ClassLink>> searchPathsFromInstances(OWLQueryBuilderImpl qb){ 63 return searchPathsEngine(qb, 1); 64 } 65 66 private List<List<ClassLink>> searchPathsEngine(OWLQueryBuilderImpl qb, int mode){ 73 67 List<List<ClassLink>> paths = new ArrayList<List<ClassLink>>(); 74 68 ClassLink crrLink = new ClassLink(null,startClass,Direction.both); … … 82 76 LinkAndPath crrlp = lit.next(); 83 77 if ( crrlp.classLink.getLinkedClassURI().equals(endClass) ){ continue; } 84 ClassLink[] classLinks = qb.getNextClass(null, crrlp.classLink.getLinkedClassURI(), limit); 78 ClassLink[] classLinks = null; 79 // Mode 80 if ( mode == 0 ){ 81 classLinks = qb.getNextClass(null, crrlp.classLink.getLinkedClassURI(), limit); 82 }else if ( mode == 1 ){ 83 classLinks = qb.getNextClassViaInstanceLink(null, crrlp.classLink.getLinkedClassURI(), limit); 84 }else{ System.err.println("Mode is not correct."); } 85 85 for ( int j = 0 ; j < classLinks.length; j++ ){ 86 86 List<ClassLink> crrpath = new LinkedList<ClassLink>(crrlp.path); … … 92 92 } 93 93 } 94 lp = nextlp; 94 95 } 95 96 }catch(Exception e){ System.err.println(e);} 96 return paths; 97 return paths; 97 98 } 98 99 } -
BH13SPARQLBuilder/src/org/biohackathon/SPARQLBuilder/OWL/Path.java
r2 r3 4 4 5 5 /** 6 * 襍キ轤ケ縺ィ縺ェ繧九Μ繧ス繝シ繧ケ縺九i騾先ャ。逧 �↓隍�焚繝ェ繝ウ繧ッ縺ァ邨らせ繝ェ繧ス繝シ繧ケ縺セ縺ァ謗・邯壹&繧後k荳縺、縺ョ繝代せ繧定ィ倩ソー縺吶k6 * 襍キ轤ケ縺ィ縺ェ繧九Μ繧ス繝シ繧ケ縺九i騾先ャ。逧?↓隍?焚繝ェ繝ウ繧ッ縺ァ邨らせ繝ェ繧ス繝シ繧ケ縺セ縺ァ謗・邯壹&繧後k荳?縺、縺ョ繝代せ繧定ィ倩ソー縺吶k 7 7 * @author Yamaguchi 8 8 * @since 28.01.2014 … … 17 17 18 18 /** 19 * 繝代せ縺ョ襍キ轤ケ縺九i邨らせ縺ォ蜷代°縺」縺ヲ騾先ャ。逧 �↓縺、縺ェ縺後k繧ッ繝ゥ繧ケ髢薙Μ繝ウ繧ッ縺ョ繝ェ繧ケ繝�19 * 繝代せ縺ョ襍キ轤ケ縺九i邨らせ縺ォ蜷代°縺」縺ヲ騾先ャ。逧?↓縺、縺ェ縺後k繧ッ繝ゥ繧ケ髢薙Μ繝ウ繧ッ縺ョ繝ェ繧ケ繝? 20 20 */ 21 21 private List<ClassLink> classLinks; … … 48 48 } 49 49 50 public void setStartClas (String startClass){50 public void setStartClass(String startClass){ 51 51 this.startClass = startClass; 52 52 }