updates for NIHVIVO-3271 and NIHVIVO-3207

This commit is contained in:
stellamit 2011-11-02 21:21:24 +00:00
parent 5c8d787720
commit f25ffeffaf
3 changed files with 8 additions and 25 deletions

View file

@ -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 {

View file

@ -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);

View file

@ -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;