diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/ABoxUpdater.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/ABoxUpdater.java index de39c4cfa..fa892d93b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/ABoxUpdater.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/ABoxUpdater.java @@ -344,46 +344,21 @@ public class ABoxUpdater { Model retractions = ModelFactory.createDefaultModel(); - // Remove statements where the deleted class is the subject (e.g. statements with vitro annotation properties as the predicate) - aboxModel.enterCriticalSection(Lock.WRITE); - try { - int count = 0; - StmtIterator iter = aboxModel.listStatements(deletedClass, (Property) null, (RDFNode) null); - - while (iter.hasNext()) { - Statement oldStatement = iter.next(); - count++; - retractions.add(oldStatement); - //logChange(oldStatement, false); - } - - if (count > 0) { - logger.log("Removed " + count + " subject reference" + ((count > 1) ? "s" : "") + " to the " + deletedClass.getURI() + " class"); - } - } finally { - aboxModel.leaveCriticalSection(); - } - // Remove instances of the deleted class aboxModel.enterCriticalSection(Lock.WRITE); try { - int count = 0; - StmtIterator iter = aboxModel.listStatements((Resource) null, RDF.type, deletedClass); + int count = 0; + StmtIterator iter = aboxModel.listStatements((Resource) null, RDF.type, deletedClass); - while (iter.hasNext()) { + while (iter.hasNext()) { count++; Statement typeStmt = iter.next(); retractions.add(typeStmt); - - StmtIterator iter2 = aboxModel.listStatements(typeStmt.getSubject(), (Property) null, (RDFNode) null); - while (iter2.hasNext()) { - retractions.add(iter2.next()); - } - } + } //log summary of changes if (count > 0) { - logger.log("Removed " + count + " instance" + ((count > 1) ? "s" : "") + " of the " + deletedClass.getURI() + " class"); + logger.log("Removed " + count + " " + deletedClass.getURI() + " type assertion" + ((count > 1) ? "s" : "")); } aboxModel.remove(retractions); @@ -392,30 +367,6 @@ public class ABoxUpdater { } finally { aboxModel.leaveCriticalSection(); } - - // Remove other object references to the deleted class - what would these be? nothing, I think. - aboxModel.enterCriticalSection(Lock.WRITE); - try { - int count = 0; - StmtIterator iter = aboxModel.listStatements((Resource) null, (Property) null, deletedClass); - - while (iter.hasNext()) { - count++; - Statement oldStatement = iter.next(); - retractions.add(oldStatement); - //logChange(oldStatement, false); - } - - //log summary of changes - if (count > 0) { - logger.log("Removed " + count + " object reference" + ((count > 1) ? "s" : "") + " to the " + deletedClass.getURI() + " class"); - } - - aboxModel.remove(retractions); - record.recordRetractions(retractions); - } finally { - aboxModel.leaveCriticalSection(); - } } public void processPropertyChanges(List changes) throws IOException { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/KnowledgeBaseUpdater.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/KnowledgeBaseUpdater.java index 33b6fb0bc..4da8e45eb 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/KnowledgeBaseUpdater.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/KnowledgeBaseUpdater.java @@ -91,7 +91,7 @@ public class KnowledgeBaseUpdater { log.info("\tperforming SPARQL construct additions (abox)"); performSparqlConstructAdditions(settings.getSparqlConstructAdditionsDir(), settings.getAssertionOntModelSelector().getABoxModel()); - log.info("\tperforming SPARQL construct deletions (infenences)"); + log.info("\tperforming SPARQL construct deletions (inferences)"); performSparqlConstructRetractions(settings.getSparqlConstructDeletionsDir(), settings.getInferenceOntModelSelector().getABoxModel()); List rawChanges = getAtomicOntologyChanges(); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java index 9216b3c2b..fa453b6d2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java @@ -933,6 +933,7 @@ public class SimpleReasoner extends StatementListener { setMostSpecificTypes(stmt.getSubject(), inferenceRebuildModel); } + /* log.info("Computing property-based ABox inferences"); iter = tboxModel.listStatements((Resource) null, RDFS.subPropertyOf, (RDFNode) null); int numStmts = 0; @@ -974,6 +975,7 @@ public class SimpleReasoner extends StatementListener { log.info("Still computing property-based ABox inferences..."); } } + */ } catch (Exception e) { log.error("Exception while recomputing ABox inference model", e); inferenceRebuildModel.removeAll(); // don't do this in the finally, it's needed in the case @@ -985,6 +987,7 @@ public class SimpleReasoner extends StatementListener { inferenceRebuildModel.leaveCriticalSection(); } + // reflect the recomputed inferences into the application inference // model. inferenceRebuildModel.enterCriticalSection(Lock.WRITE); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/UpdateKnowledgeBase.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/UpdateKnowledgeBase.java index d8cf9bd4d..dd5b5727a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/UpdateKnowledgeBase.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/UpdateKnowledgeBase.java @@ -245,7 +245,7 @@ public class UpdateKnowledgeBase implements ServletContextListener { private static String timestampedFileName(String prefix, String suffix) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH-mm-sss"); - return prefix + "." + sdf.format(new Date()) + suffix; + return prefix + "." + sdf.format(new Date()) + "." + suffix; } private class ModelDirectoryNotFoundException extends RuntimeException {