Skip to content

Commit

Permalink
Added execution time logging to isConsistent.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferada committed Oct 10, 2011
1 parent b404ff0 commit 5fe691a
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/board/Whiteboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,9 @@ private GraphStore getPrivateStore (Client client) {
}

/**
* Checks whether a model is consistent with respect to the given
* ontology. This works by using the {@link InfModel#validate} method of
* the ontology model and checking the result using
* {@link ValidityResult#isClean}. Although some of the errors may just
* be warnings, we consider them as errors. This is method is
* particularly slow, so using it is suggested only for testing purposes.
* Implements the {@link #isConsistent} method for profiling purposes.
*/
public boolean isConsistent (MateOntology ontology, com.hp.hpl.jena.reasoner.Reasoner reasoner, Model model) {
public boolean isConsistentHelper (MateOntology ontology, com.hp.hpl.jena.reasoner.Reasoner reasoner, Model model) {
// consistency checking on every posted model
InfModel infmodel = ModelFactory.createInfModel (reasoner, model);
ValidityReport validity = infmodel.validate ();
Expand All @@ -462,6 +457,22 @@ public boolean isConsistent (MateOntology ontology, com.hp.hpl.jena.reasoner.Rea
return false;
}

/**
* Checks whether a model is consistent with respect to the given
* ontology. This works by using the {@link InfModel#validate} method of
* the ontology model and checking the result using
* {@link ValidityResult#isClean}. Although some of the errors may just
* be warnings, we consider them as errors. This is method is
* particularly slow, so using it is suggested only for testing purposes.
*/
public boolean isConsistent (MateOntology ontology, com.hp.hpl.jena.reasoner.Reasoner reasoner, Model model) {
long start = System.nanoTime ();
boolean result = isConsistentHelper (ontology, reasoner, model);
long estimate = System.nanoTime () - start;
logger.trace ("isConsistent took about " + (estimate / 1000000000.0) + "s");
return result;
}

/**
* Extracting a List of resources starting at the given position.
*/
Expand Down

0 comments on commit 5fe691a

Please sign in to comment.