/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package org.biohackathon.SPARQLBuilder.OWL; /** * * @author atsuko */ import java.util.*; import java.io.*; public class OWLLabelReader { static Map readLabels(String dir){ Map labels = new HashMap (); File fdir = new File(dir); if ( fdir.exists() ){ File[] files = fdir.listFiles(); for (int i = 0 ; i < files.length; i++ ){ try{ BufferedReader in = new BufferedReader(new FileReader(files[i])); String buf; while( (buf = in.readLine()) != null){ String[] data1 = buf.split("[\\s]+"); String[] data2 = buf.split("\""); labels.put(data1[0].substring(1,data1[0].length() - 1 ), data2[1]); } in.close(); }catch(IOException e){ System.err.println(e); } } } return labels; } }