1 Reply Latest reply on Apr 25, 2016 5:14 AM by alwu-Oracle

    Jena Batch Loader freezes when loading N3 files

    3180035

      I have used the sample code  of batch loader from the examples to load N3 files. The code looks like

       

      public class BatchLoader {

       

        public static void main(String[] args) throws Exception {

           String szJdbcURL = "jdbc:oracle:thin:@localhost:1521/projowldone";

           String szUser    = "";

           String szPasswd  = "";

           String szModelName = "locationMisc";

       

           Oracle oracle = new Oracle(szJdbcURL, szUser, szPasswd);

        

           GraphOracleSem graph = new GraphOracleSem(oracle, szModelName);

           PrintStream psOut = System.out;

           String dirname = "C:\\Users\\karan\\Desktop\\rdffiles\\locationMisc";

           File fileDir = new File(dirname);

           String[] szAllFiles = fileDir.list();

        

           long start = System.currentTimeMillis();

           for (int idx = 0; idx < szAllFiles.length; idx++) {

             String szIndFileName = dirname + File.separator + szAllFiles[idx];

             psOut.println("process to [ID = " + idx + " ] file " + szIndFileName);

             psOut.flush();

          

             try{

             InputStream is = new FileInputStream(szIndFileName);

               graph.getBulkUpdateHandler().prepareBulk(

                   is,                    // input stream

                   "",  // base URI

                   "N-TRIPLE",             // data file type: can be RDF/XML, N-TRIPLE, etc.

                   "rdf_users",               // tablespace

                   null,                  // flags

                   null,                  // listener

                   null                   // staging table name.

                   );

               is.close();

             }catch(Throwable  t){

             psOut.println("Hit exception " + t.getMessage());   

             }

           }

           graph.getBulkUpdateHandler().completeBulk(

             null,  // flags for invoking SEM_APIS.bulk_load_from_staging_table

             null   // staging table name

           );

           long end = System.currentTimeMillis();

       

           System.out.println("Took : " + ((end - start) / 1000));

           //graph.commitTransaction();

           graph.close();

           //oracle.executeSQL("commit");

           oracle.dispose();

        }

      }

       

      the files look like

      Screenshot (119).png

       

      When I run single file (one at a time it works) but when I iterate through all of them it does not move ahead ( it kind of freezes i think) at file 2. There are no errors . Is it because the files are too large ? but then shouldnt it load really quick? Not sure why?