reading & parsing problem with rdf file which is approximately 1GB
Hello I am in trouble when I try to read geowordnet.rdf file with java when I use
InputStream in = FileManager.get().open(inputFileName);
but I can read it when I use following codes ;
f = new File ("geowordnetX.rdf");
long length = f.length();
long readedBytes = 0;
System.out.println(length);
try {
BufferedReader fr = new BufferedReader(new FileReader(f));
line = "";
while((fr.readLine().toString()) != null){
readedBytes += line.getBytes().length;
if(readedBytes > length){
break;
}else{
line += fr.readLine().toString() ;
System.out.println(line);
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
But the problem is I can easily able to parse the rdf when file when I use first way Inputstream, Of course
I dont use whole file, instead I copy some info of rdf to another file and I can read it. Inputstream does not read
geowordnet because file size 700 Mb.
I can read whole file with second buffered way but this time it gives error when I try to parse it. The error is like that ;
Content is not allowed in prolog.
Exception in thread "main" com.hp.hpl.jena.shared.JenaException: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHand ler.fatalError(RDFDefaultErrorHandler.java:45)
at com.hp.hpl.jena.rdf.arp.impl.ARPSaxErrorHandler.fa talError(ARPSaxErrorHandler.java:35)
at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.warning(XM LHandler.java:225)
I do not know how to solve ? do you have any idea please ?
thanks
Re: reading & parsing problem with rdf file which is approximately 1GB
Don't double post. The other thread you started in Advanced Java with the identical same question has been removed.
Also, look around the FAQs section of this site and discover how to use code tags to preserve the formatting of your code.
db