additional logging messages to vivo.all.log during knowledge base migration
This commit is contained in:
parent
e16052a7a0
commit
6fac9339d6
1 changed files with 14 additions and 4 deletions
|
@ -13,6 +13,9 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.query.Query;
|
import com.hp.hpl.jena.query.Query;
|
||||||
import com.hp.hpl.jena.query.QueryExecution;
|
import com.hp.hpl.jena.query.QueryExecution;
|
||||||
|
@ -36,7 +39,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.jena.JenaIngestUtils;
|
||||||
*/
|
*/
|
||||||
public class KnowledgeBaseUpdater {
|
public class KnowledgeBaseUpdater {
|
||||||
|
|
||||||
//private final Log log = LogFactory.getLog(OntologyUpdater.class);
|
private final Log log = LogFactory.getLog(KnowledgeBaseUpdater.class);
|
||||||
|
|
||||||
private UpdateSettings settings;
|
private UpdateSettings settings;
|
||||||
private ChangeLogger logger;
|
private ChangeLogger logger;
|
||||||
|
@ -62,6 +65,7 @@ public class KnowledgeBaseUpdater {
|
||||||
|
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
System.out.println("Migrating the knowledge base");
|
System.out.println("Migrating the knowledge base");
|
||||||
|
log.info("Migrating the knowledge base");
|
||||||
logger.log("Started knowledge base migration");
|
logger.log("Started knowledge base migration");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -82,6 +86,7 @@ public class KnowledgeBaseUpdater {
|
||||||
|
|
||||||
long elapsedSecs = (System.currentTimeMillis() - startTime)/1000;
|
long elapsedSecs = (System.currentTimeMillis() - startTime)/1000;
|
||||||
System.out.println("Finished knowledge base migration in " + elapsedSecs + " second" + (elapsedSecs != 1 ? "s" : ""));
|
System.out.println("Finished knowledge base migration in " + elapsedSecs + " second" + (elapsedSecs != 1 ? "s" : ""));
|
||||||
|
log.info("Finished knowledge base migration in " + elapsedSecs + " second" + (elapsedSecs != 1 ? "s" : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
return updateRequired;
|
return updateRequired;
|
||||||
|
@ -91,7 +96,9 @@ public class KnowledgeBaseUpdater {
|
||||||
private void performUpdate() throws IOException {
|
private void performUpdate() throws IOException {
|
||||||
|
|
||||||
performSparqlConstructAdditions(settings.getSparqlConstructAdditionsDir(), settings.getAssertionOntModelSelector().getABoxModel());
|
performSparqlConstructAdditions(settings.getSparqlConstructAdditionsDir(), settings.getAssertionOntModelSelector().getABoxModel());
|
||||||
|
log.info("finished sparql construct additions");
|
||||||
performSparqlConstructRetractions(settings.getSparqlConstructDeletionsDir(), settings.getInferenceOntModelSelector().getABoxModel());
|
performSparqlConstructRetractions(settings.getSparqlConstructDeletionsDir(), settings.getInferenceOntModelSelector().getABoxModel());
|
||||||
|
log.info("finished sparql construct retractions");
|
||||||
|
|
||||||
List<AtomicOntologyChange> rawChanges = getAtomicOntologyChanges();
|
List<AtomicOntologyChange> rawChanges = getAtomicOntologyChanges();
|
||||||
|
|
||||||
|
@ -99,8 +106,10 @@ public class KnowledgeBaseUpdater {
|
||||||
|
|
||||||
//process the TBox before the ABox
|
//process the TBox before the ABox
|
||||||
updateTBoxAnnotations();
|
updateTBoxAnnotations();
|
||||||
|
log.info("finished updating tbox annotations");
|
||||||
updateABox(changes);
|
|
||||||
|
updateABox(changes);
|
||||||
|
log.info("finished updating abox");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void performSparqlConstructAdditions(String sparqlConstructDir, OntModel aboxModel) throws IOException {
|
private void performSparqlConstructAdditions(String sparqlConstructDir, OntModel aboxModel) throws IOException {
|
||||||
|
@ -186,6 +195,7 @@ public class KnowledgeBaseUpdater {
|
||||||
fileContents.append(ln).append('\n');
|
fileContents.append(ln).append('\n');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
log.info("processing SPARQL construct query from file " + sparqlFiles[i].getName());
|
||||||
Query q = QueryFactory.create(fileContents.toString(), Syntax.syntaxARQ);
|
Query q = QueryFactory.create(fileContents.toString(), Syntax.syntaxARQ);
|
||||||
aboxModel.enterCriticalSection(Lock.WRITE);
|
aboxModel.enterCriticalSection(Lock.WRITE);
|
||||||
try {
|
try {
|
||||||
|
@ -200,7 +210,7 @@ public class KnowledgeBaseUpdater {
|
||||||
" statement" + ((num > 1) ? "s" : "") +
|
" statement" + ((num > 1) ? "s" : "") +
|
||||||
" using the SPARQL construct query from file " + sparqlFiles[i].getName());
|
" using the SPARQL construct query from file " + sparqlFiles[i].getName());
|
||||||
}
|
}
|
||||||
|
qe.close();
|
||||||
} finally {
|
} finally {
|
||||||
aboxModel.leaveCriticalSection();
|
aboxModel.leaveCriticalSection();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue