publicclassowlcount{publicstaticvoidmain(String[]args)throwsException{System.out.println("owl");Stringpath="D:\\本体运行数据和结果\\owl\\owl1";FileWriterbw=newFileWriter(...
public class owlcount
{
public static void main(String []args) throws Exception
{
System.out.println("owl") ;
String path="D:\\本体运行数据和结果\\owl\\owl1";
FileWriter bw = new FileWriter("D:\\本体运行数据和结果\\owlresult1individual.txt");
File dir = new File(path);
String children[] = dir.list();
System.out.println("ok");
System.out.println(children.length);
for(int i=0;i
{
if(i/800==1||i/800==2||i/800==3||i/800==4||i/800==5||i/800==6||i/800==7||i/800==8||i/800==9||i/800==10||i/800==11||i/800==12||i/800==13||i/800==14||i/800==15||i/800==16||i/800==17||i/800==18||i/800==19||i/800==20||i/800==21||i/800==22||i/800==23||i/800==24||i/800==25)
{
System.gc();
}
int countclass=0;
int countproperty=0;
int countindividual=0;
String filename=children[i];
System.out.println(filename);
String folderpath = "file:"+path+"\\"+children[i];
OntModel ontmodel=ModelFactory.createOntologyModel();
ontmodel.read(folderpath);
try{
for(Iteratorm=ontmodel.listIndividuals();m.hasNext();)
{
Individual oc2=m.next();
System.out.println(oc2.getLocalName());
System.out.println("individual");
countindividual++;
}
}catch(Exception e)
{
e.printStackTrace();
}
String content=filename+" individual "+countindividual;
bw.write(content);
bw.write("\r\n"); //换行
bw.flush();
}
System.out.println("ok");
bw.close();
}
请问怎么才能读入取值超过一万个文件呢?总是产生内存不足的错误!
展开