From f25ffeffafd1d56fc693d02ae5822425b08364d2 Mon Sep 17 00:00:00 2001 From: stellamit Date: Wed, 2 Nov 2011 21:21:24 +0000 Subject: [PATCH] updates for NIHVIVO-3271 and NIHVIVO-3207 --- .../vitro/webapp/dao/DisplayVocabulary.java | 2 -- .../webapp/ontology/update/ABoxUpdater.java | 27 +++++-------------- .../vitro/webapp/reasoner/SimpleReasoner.java | 4 +-- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java index 1ba46e224..6684e9af6 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/DisplayVocabulary.java @@ -8,9 +8,7 @@ import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.ontology.OntModelSpec; import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.Resource; -import com.hp.hpl.jena.rdf.model.ResourceFactory; public class DisplayVocabulary { 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 16a19f4d1..fa651d5a1 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 @@ -146,48 +146,33 @@ public class ABoxUpdater { StmtIterator iter = aboxModel.listStatements(oldClass, (Property) null, (RDFNode) null); - int renameCount = 0; int removeCount = 0; while (iter.hasNext()) { Statement oldStatement = iter.next(); - if (newTBoxAnnotationsModel.contains(oldStatement)) { - continue; - // if this statement was loaded from the new annotations, - // don't attempt to remove it. - // This happens in cases where a class hasn't really - // been removed, but we just want to map any ABox - // data using it to use a different class instead. - } else { - removeCount++; - retractions.add(oldStatement); - } - //logChange(oldStatement, false); - //logChange(newStatement,true); + removeCount++; + retractions.add(oldStatement); } //log summary of changes - if (renameCount > 0) { - logger.log("Changed " + renameCount + " subject reference" + ((renameCount > 1) ? "s" : "") + " from type" + oldClass.getURI() + " to type " + newClass.getURI()); - } if (removeCount > 0) { logger.log("Removed " + removeCount + " subject reference" + ((removeCount > 1) ? "s" : "") + " to the " + oldClass.getURI() + " class"); } // Change class references in the objects of rdf:type statements - iter = aboxModel.listStatements((Resource) null, (Property) null, oldClass); + iter = aboxModel.listStatements((Resource) null, RDF.type, oldClass); - renameCount = 0; + int renameCount = 0; while (iter.hasNext()) { renameCount++; Statement oldStatement = iter.next(); - Statement newStatement = ResourceFactory.createStatement(oldStatement.getSubject(), oldStatement.getPredicate(), newClass); + Statement newStatement = ResourceFactory.createStatement(oldStatement.getSubject(), RDF.type, newClass); retractions.add(oldStatement); additions.add(newStatement); } //log summary of changes if (renameCount > 0) { - logger.log("Renamed " + renameCount + " object reference" + ((renameCount > 1) ? "s" : "") + " from type " + oldClass.getURI() + " to type " + newClass.getURI()); + logger.log("Retyped " + renameCount + " individual" + ((renameCount > 1) ? "s" : "") + " from type " + oldClass.getURI() + " to type " + newClass.getURI()); } aboxModel.remove(retractions); 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 456699436..8cbe88543 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/reasoner/SimpleReasoner.java @@ -1024,7 +1024,7 @@ public class SimpleReasoner extends StatementListener { * then reconciled with the inference graph used by the * application. The model reconciliation must be done * without reading the whole inference models into - * memory since we are supporting very large ABox + * memory in order to support very large ABox * inference models. */ public synchronized void recomputeABox() { @@ -1390,7 +1390,7 @@ public class SimpleReasoner extends StatementListener { log.info("received BulkUpdateEvent(begin)"); if (batchMode1 || batchMode2) { - log.info("received a BulkUpdateEvent(begin) while already in batch update mode; this event will be ignored."); + log.info("received a BulkUpdateEvent(begin) while already in batch update mode; this event will be ignored (and processing in batch mode will continue until there are no pending updates)"); return; } else { batchMode1 = true;