Results 1 to 2 of 2
  1. #1
    somer81 is offline Member
    Join Date
    Mar 2012
    Posts
    3
    Rep Power
    0

    Default 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

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default 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
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. reading a file problem
    By aianta in forum New To Java
    Replies: 3
    Last Post: 08-03-2011, 08:22 PM
  2. Reading from file problem
    By BillyB in forum New To Java
    Replies: 10
    Last Post: 03-18-2011, 05:09 AM
  3. problem reading file
    By jmoutia in forum New To Java
    Replies: 0
    Last Post: 10-31-2010, 03:19 AM
  4. Problem reading from a file
    By sarapeace in forum New To Java
    Replies: 13
    Last Post: 10-03-2010, 03:08 PM
  5. Reg: File Reading Problem
    By balaji csc in forum New To Java
    Replies: 0
    Last Post: 11-06-2009, 05:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •