updates for NIHVIVO-3271 and NIHVIVO-3207
This commit is contained in:
parent
5c8d787720
commit
f25ffeffaf
3 changed files with 8 additions and 25 deletions
|
@ -8,9 +8,7 @@ import com.hp.hpl.jena.ontology.OntClass;
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.ontology.OntModelSpec;
|
import com.hp.hpl.jena.ontology.OntModelSpec;
|
||||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
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.Resource;
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
|
||||||
|
|
||||||
|
|
||||||
public class DisplayVocabulary {
|
public class DisplayVocabulary {
|
||||||
|
|
|
@ -146,48 +146,33 @@ public class ABoxUpdater {
|
||||||
|
|
||||||
StmtIterator iter = aboxModel.listStatements(oldClass, (Property) null, (RDFNode) null);
|
StmtIterator iter = aboxModel.listStatements(oldClass, (Property) null, (RDFNode) null);
|
||||||
|
|
||||||
int renameCount = 0;
|
|
||||||
int removeCount = 0;
|
int removeCount = 0;
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Statement oldStatement = iter.next();
|
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++;
|
removeCount++;
|
||||||
retractions.add(oldStatement);
|
retractions.add(oldStatement);
|
||||||
}
|
}
|
||||||
//logChange(oldStatement, false);
|
|
||||||
//logChange(newStatement,true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//log summary of changes
|
//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) {
|
if (removeCount > 0) {
|
||||||
logger.log("Removed " + removeCount + " subject reference" + ((removeCount > 1) ? "s" : "") + " to the " + oldClass.getURI() + " class");
|
logger.log("Removed " + removeCount + " subject reference" + ((removeCount > 1) ? "s" : "") + " to the " + oldClass.getURI() + " class");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change class references in the objects of rdf:type statements
|
// 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()) {
|
while (iter.hasNext()) {
|
||||||
renameCount++;
|
renameCount++;
|
||||||
Statement oldStatement = iter.next();
|
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);
|
retractions.add(oldStatement);
|
||||||
additions.add(newStatement);
|
additions.add(newStatement);
|
||||||
}
|
}
|
||||||
|
|
||||||
//log summary of changes
|
//log summary of changes
|
||||||
if (renameCount > 0) {
|
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);
|
aboxModel.remove(retractions);
|
||||||
|
|
|
@ -1024,7 +1024,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
* then reconciled with the inference graph used by the
|
* then reconciled with the inference graph used by the
|
||||||
* application. The model reconciliation must be done
|
* application. The model reconciliation must be done
|
||||||
* without reading the whole inference models into
|
* 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.
|
* inference models.
|
||||||
*/
|
*/
|
||||||
public synchronized void recomputeABox() {
|
public synchronized void recomputeABox() {
|
||||||
|
@ -1390,7 +1390,7 @@ public class SimpleReasoner extends StatementListener {
|
||||||
log.info("received BulkUpdateEvent(begin)");
|
log.info("received BulkUpdateEvent(begin)");
|
||||||
|
|
||||||
if (batchMode1 || batchMode2) {
|
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;
|
return;
|
||||||
} else {
|
} else {
|
||||||
batchMode1 = true;
|
batchMode1 = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue