3 Replies Latest reply: Sep 21, 2011 1:22 PM by 880207 RSS

    Jena Side Performance Improvement

    880207
      Hi,

      I have below Jena code and i am using Oracle 11g Release 2:

      String [] modelNames = {"MD_1"};
      String[] rbs = {"OWLPRIME", "OWLSIF","RDFS++","OWL2RL"};
                          
      Attachment attachment = Attachment.createInstance(
                          modelNames,
                     rbs,
                InferenceMaintenanceMode.NO_UPDATE,
                QueryOptions.ALLOW_QUERY_VALID_AND_DUP );
                          
      GraphOracleSem g = new GraphOracleSem(oracle, "MD_2",attachment);
      g.performInference();
      ModelOracleSem m = new ModelOracleSem(g);
      Model model = m.asModel(g);


      String queryString = SPARQL QUERY
      Query query = QueryFactory.create(queryString,Syntax.syntaxARQ);
      QueryExecution qexec = QueryExecutionFactory.create(query, model);
           

      ResultSet results = qexec.execSelect();
           
           
      ResultSetFormatter.out(System.out, results,query);
      model.close();

      Is there any function in jena that i can call which will help me in improving Performance?
        • 1. Re: Jena Side Performance Improvement
          alwu-Oracle
          Hi,

          Why do you have so many rulebases selected? Please pick one, say OWLPRIME as a start.

          Also, you need to run

          graph.analyze() after finishing a non-trivial piece of data loading work,

          and

          graph.analyzeInferredGraph() after the performInference call.

          You don't need the following line. An ModelOracleSem object can be used as a regular Jena model.

          Model model = m.asModel(g);

          Thanks,

          Zhe Wu
          • 2. Re: Jena Side Performance Improvement
            880207
            Hi Zhe,

            Thanks for the answer. One more thing where should i add this code graph.analyze()? can you provide a sample.

            Thanks and Regards,
            Manish Hardasmalani
            • 3. Re: Jena Side Performance Improvement
              alwu-Oracle
              Hi,

              You can add that API after you introduce a significant change to your data (say after adding a large chunk of data or removing a large chunk of data).

              e.g.

              g.dropApplicationTableIndex();
              g.getBulkUpdateHandler().addInBulk(GraphUtil.findAll(jenaModelToBeLoaded.getGraph()), tbs);
              g.rebuildApplicationTableIndex();
              g.analyze();

              Thanks,

              Zhe