root/SPARQLBuilderWWW/src/java/org/biohackathon/SPARQLBuilder/OWL/OWLLabelReader.java @ 260

リビジョン 259, 1.2 KB (コミッタ: atsuko, 9 年 前)

パス探索関数を改良&古い変数を削除

行番号 
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6package org.biohackathon.SPARQLBuilder.OWL;
7
8/**
9 *
10 * @author atsuko
11 */
12
13import java.util.*;
14import java.io.*;
15
16public class OWLLabelReader {
17    static Map<String, String> readLabels(String dir){
18        Map<String, String> labels = new HashMap<String, String> ();
19        File fdir = new File(dir);
20        if ( fdir.exists() ){
21            File[] files = fdir.listFiles();
22            for (int i = 0 ; i < files.length; i++ ){
23                try{
24                    BufferedReader in = new BufferedReader(new FileReader(files[i]));
25                    String buf;
26                    while( (buf = in.readLine()) != null){
27                        String[] data1 = buf.split("[\\s]+");
28                        String[] data2 = buf.split("\"");
29                        labels.put(data1[0].substring(1,data1[0].length() - 1 ), data2[1]);
30                    }
31                    in.close();
32                }catch(IOException e){
33                    System.err.println(e);
34                }
35            }
36        }
37        return labels;
38    }
39}
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。