This discussion is archived
3 Replies Latest reply: Sep 21, 2011 11:22 AM by 880207 RSS

Jena Side Performance Improvement

880207 Newbie
Currently Being Moderated
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 Pro
    Currently Being Moderated
    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 Newbie
    Currently Being Moderated
    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 Pro
    Currently Being Moderated
    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

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points