チェンジセット 24 : BH13SPARQLBuilder/src
- 更新日時:
- 2014/01/30 16:28:03 (11 年 前)
- パス:
- BH13SPARQLBuilder/src/hozo
- ファイル:
-
- 2 変更
凡例:
- 変更なし
- 追加
- 削除
-
BH13SPARQLBuilder/src/hozo/maptool/MapFactory.java
r17 r24 91 91 92 92 public void loadPathList(Path[] pathlist){ 93 if(pathlist.length==0){ 94 JOptionPane.showMessageDialog(null, "NO PATH!!"); 95 return; 96 } 93 97 Path path = pathlist[0]; 94 98 -
BH13SPARQLBuilder/src/hozo/sparql/gui/SparqlBuilderPanel.java
r17 r24 20 20 import org.biohackathon.SPARQLBuilder.OWL.OWLQueryBuilderImpl; 21 21 import org.biohackathon.SPARQLBuilder.OWL.Path; 22 import org.biohackathon.SPARQLBuilder.OWL.SClass; 22 23 23 24 … … 30 31 MapFactory map; 31 32 SparqlSearchPanel search_panel; 33 OWLQueryBuilderImpl builder; 32 34 33 35 // public SparqlBuilderPanel(SparqlAccessorForm parent) { … … 37 39 // } 38 40 39 41 public OWLQueryBuilderImpl getOWLQueryBuilderImpl(){ 42 makeOWLQueryBuilderImpl(); 43 44 return builder; 45 } 46 40 47 /* SparqlBuilderPanel(SparqlAccessorForm sparqlAccessorForm){ 41 48 super(); … … 119 126 // TODO Auto-generated method stub 120 127 System.out.println("jb_start action"); 121 128 searchClass(jtf_start_class.getText()); 129 String classURI = searchClass(jtf_start_class.getText()); 130 jtf_start_class.setText(classURI); 122 131 } 123 132 … … 131 140 jp2.add(jtf_end_class); 132 141 JButton jb_end = new JButton("Select"); 142 jb_end.addActionListener(new ActionListener(){ 143 144 @Override 145 public void actionPerformed(ActionEvent arg0) { 146 // TODO Auto-generated method stub 147 System.out.println("jb_end action"); 148 String classURI = searchClass(jtf_end_class.getText()); 149 jtf_end_class.setText(classURI); 150 } 151 152 }); 153 154 133 155 jp2.add(jb_end); 134 156 … … 151 173 152 174 try { 153 OWLQueryBuilderImpl builder = makeOWLQueryBuilderImpl();154 175 System.out.println("getPaths:::>>>>"+jtf_start_class.getText() 155 176 +"<===>"+jtf_end_class.getText()); 156 Path[] path = builder.getPaths(jtf_start_class.getText(), jtf_end_class.getText());177 Path[] path = getOWLQueryBuilderImpl().getPaths(jtf_start_class.getText(), jtf_end_class.getText()); 157 178 System.out.println("RESULT:::>>>>"+path.length); 158 179 … … 183 204 184 205 206 String searchClass(String keyword){ 207 System.out.println("SearcClass for..."+keyword); 208 String classURL =""; 209 try { 210 SClass[] classes = this.getOWLQueryBuilderImpl().getOWLClasses(null, keyword); 211 DefaultListModel model = new DefaultListModel(); 212 for(int i=0;i<classes.length;i++){ 213 model.addElement(classes[i].getClassURI()); 214 } 215 JList list = new JList(model); 216 217 JScrollPane listScrollPane = new JScrollPane(list); 218 219 Object[] msg ={"Select a Class:",listScrollPane}; 220 221 222 int isOK = JOptionPane.showConfirmDialog(null,msg,"Select Class",JOptionPane.OK_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE); 223 224 if(isOK==JOptionPane.OK_OPTION){ 225 int index = list.getSelectedIndex(); 226 classURL = model.getElementAt(index).toString(); 227 } 228 229 } catch (Exception e) { 230 // TODO Auto-generated catch block 231 e.printStackTrace(); 232 } 233 234 235 return classURL; 236 } 185 237 186 238 public void setSPARQL(Path path,int num) throws Exception{ … … 190 242 } 191 243 192 OWLQueryBuilderImpl makeOWLQueryBuilderImpl() {244 void makeOWLQueryBuilderImpl() { 193 245 // String sparqlEndpoint = "http://lsd.dbcls.jp/sparql"; 194 246 String sparqlEndpoint = search_panel.getSparqlAccessorForm().getCurrentEndPoint(); 195 196 247 197 248 // String sparqlEndpoint = "http://dbpedia.org/sparql"; … … 199 250 System.out.println("Create OWLQueryBuilder for "+sparqlEndpoint); 200 251 201 OWLQueryBuilderbuilder = new OWLQueryBuilderImpl(sparqlEndpoint);252 builder = new OWLQueryBuilderImpl(sparqlEndpoint); 202 253 /* 203 254 … … 242 293 }*/ 243 294 244 return (OWLQueryBuilderImpl) builder;295 //return (OWLQueryBuilderImpl) builder; 245 296 } 246 297