| 222 | |
| 223 | public SClass[] getReachableClasses(){ |
| 224 | List<String> clURIs = graph.getReachableClasses(); |
| 225 | SClass[] orgclasses = null; |
| 226 | try { |
| 227 | orgclasses = analyzer.getOWLClasses(null, null, null, true); |
| 228 | }catch( Exception e ){ |
| 229 | System.err.println(e); |
| 230 | return null; |
| 231 | } |
| 232 | HashMap<String, SClass> orgmap = new HashMap<String, SClass>(); |
| 233 | for (int i = 0; i < orgclasses.length; i++ ){ |
| 234 | orgmap.put(orgclasses[i].getClassURI(), orgclasses[i]); |
| 235 | } |
| 236 | |
| 237 | SClass[] classes = new SClass[clURIs.size()]; |
| 238 | int j = 0; |
| 239 | ListIterator<String> uit = clURIs.listIterator(); |
| 240 | while(uit.hasNext()){ |
| 241 | String u = uit.next(); |
| 242 | SClass cl = orgmap.get(u); |
| 243 | classes[j] = cl; |
| 244 | j++; |
| 245 | } |
| 246 | return classes; |
| 247 | } |
| 248 | |
| 249 | public SortedSet<String> getSortedClasses(SClass[] classes){ |
| 250 | setClassLabels(classes); |
| 251 | SortedSet<String> sortedClasses = new TreeSet<String>(); |
| 252 | for (int i = 0 ; i < classes.length; i++ ){ |
| 253 | String uri = classes[i].getClassURI(); |
| 254 | String label = getClassLabel(uri); |
| 255 | StringBuilder classbuilder = new StringBuilder(label); |
| 256 | classbuilder.append(" "); |
| 257 | classbuilder.append(classes[i].getNumOfInstances()); |
| 258 | classbuilder.append(" "); |
| 259 | classbuilder.append(uri); |
| 260 | sortedClasses.add(classbuilder.toString()); |
| 261 | } |
| 262 | |
| 263 | return sortedClasses; |
| 264 | } |