[Pellet-users] Slow reasoning & getting status info

Rinke Hoekstra hoekstra at uva.nl
Thu Mar 29 15:26:19 UTC 2007


Hi Holger, others,

Holger Knublauch wrote:
> Rinke Hoekstra wrote:

  * snip *

> 
> Here is a test case to illustrate this:
> 
> public class RinkeTestCase extends TestCase {
> 
> 	public void testRinke() {
> 		OntModel ontModel = 
> ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
> 		ontModel.read("http://www.estrellaproject.org/lkif-core/lkif-core.owl");
> 		OntModelSpec spec = PelletReasonerFactory.THE_SPEC;
> 		InfModel infModel = ModelFactory.createOntologyModel(spec, ontModel);
> 		long startTime = System.currentTimeMillis();
> 		int count = 0;
> 		StmtIterator it = infModel.listStatements();
> 		while(it.hasNext()) {
> 			it.nextStatement();
> 			count++;
> 		}
> 		long endTime = System.currentTimeMillis();
> 		System.out.println("Elapsed: " + (endTime - startTime));
> 	}
> }

I had a look at your code and compared it to Pellet.java in the Pellet 
1.4 distribution. Differences are that TB creates an OntModel, loads the 
file, then creates an InfModel with a PeleltReasoner, and iterates over 
all statements. Pellet on the other hand, loads the file into a regular 
Model and then creates an OntModel with the reasoner and the Model, but 
does not iterate over the statements in that model. They rather 
'extract' the reasoner from the created OntModel, call classify() and 
realize(), again extract a model from the reasoner and *then* iterate 
over the statements.

See testRinke2 and testRinke3 below. The first just adjusts the TB way 
of handling the model to the Pellet way, but still iterates over the 
original model (slow). The second only iterates over the model which is 
given back by the reasoner (really fast).

The first gives back thousands of statements (I added a counter), and 
the second returns only 11 (?).

Hmmm


-Rinke



	public void testRinke2() {
		Model pModel = null;
		ModelReader modelReader = new ModelReader();
		pModel = 
modelReader.read("http://www.estrellaproject.org/lkif-core/lkif-core.owl");
		System.out.println("Read ontology");

		long startTime1 = System.currentTimeMillis();		
		OntModel oModel;

		oModel = 
ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, pModel);
		System.out.println("Created Ontology Model");
		OWLReasoner reasoner = ((PelletInfGraph) 
oModel.getGraph()).getOWLReasoner();
		System.out.println("Got back my reasoner");
		long endTime1 = System.currentTimeMillis();
		System.out.println("Elapsed: " + (endTime1 - startTime1));
		
		long startTime = System.currentTimeMillis();
		int count = 0;
		StmtIterator it = oModel.listStatements();
		
		while(it.hasNext()) {
			it.nextStatement();
			count++;
			System.out.println(count);
		}
		long endTime = System.currentTimeMillis();
		System.out.println("Elapsed: " + (endTime - startTime));
		
		
	}


	public void testRinke3() {
		Model pModel = null;
		ModelReader modelReader = new ModelReader();
		pModel = 
modelReader.read("http://www.estrellaproject.org/lkif-core/lkif-core.owl");
		System.out.println("Read ontology");

		long startTime1 = System.currentTimeMillis();		
		OntModel oModel;

		oModel = 
ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, pModel);
		System.out.println("Created Ontology Model");
		OWLReasoner reasoner = ((PelletInfGraph) 
oModel.getGraph()).getOWLReasoner();
		System.out.println("Got back my reasoner");
		long endTime1 = System.currentTimeMillis();
		System.out.println("Elapsed: " + (endTime1 - startTime1));
		
		long startTime = System.currentTimeMillis();
		int count = 0;
		
		reasoner.classify();
		reasoner.realize();
		
		Model eModel = reasoner.extractModel(false); // not verbose
		
		StmtIterator it = eModel.listStatements();
		
		while(it.hasNext()) {
			it.nextStatement();
			count++;
			System.out.println(count);
		}
		long endTime = System.currentTimeMillis();
		System.out.println("Elapsed: " + (endTime - startTime));
		
		
	}



> 
> This is similar to what we are doing in TopBraid, and it really takes 
> minutes to list all triples.  The messages
> 
> Sub Count: 13786
> Sat Count: 83
> 
> are printed out after 30 seconds, similar to what Rinke states, but then 
> it becomes very slow.
> 
> Assuming Rinke's command line test does a comparable job, then either 
> the Pellet-Jena bridge is very inefficient or I am creating the model in 
> a wrong way.  Please advise.
> 
> Thanks,
> Holger
> _______________________________________________
> Pellet-users mailing list
> Pellet-users at lists.owldl.com
> http://lists.owldl.com/mailman/listinfo/pellet-users
> _______________________________________________
> 
> Sponsored by Clark & Parsia, LLC http://clarkparsia.com/

-- 
----------------------------------------------
Drs. Rinke Hoekstra

Email: hoekstra at uva.nl   Skype:  rinkehoekstra
Phone: +31-20-5253499    Fax:   +31-20-5253495
Web:   http://www.leibnizcenter.nl/users/rinke

Leibniz Center for Law,         Faculty of Law
University of Amsterdam,           PO Box 1030
1000 BA  Amsterdam,            The Netherlands
----------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hoekstra.vcf
Type: text/x-vcard
Size: 317 bytes
Desc: not available
Url : http://lists.owldl.com/pipermail/pellet-users/attachments/20070329/78d10675/attachment-0001.vcf 


More information about the Pellet-users mailing list