miscellaneous small updates made while testing the 1.0 to 1.1 upgrade process.
This commit is contained in:
parent
4241506730
commit
42b0b79377
4 changed files with 95 additions and 96 deletions
|
@ -110,7 +110,7 @@ public class ABoxUpdater {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Update a knowledge based on a class rename in the ontology. All references to the
|
* Update the knowledge base for a class rename in the ontology. All references to the
|
||||||
* old class URI in either the subject or the object position of a statement are
|
* old class URI in either the subject or the object position of a statement are
|
||||||
* changed to use the new class URI.
|
* changed to use the new class URI.
|
||||||
*
|
*
|
||||||
|
@ -212,7 +212,7 @@ public class ABoxUpdater {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Examine a knowledge based on a class addition to the ontology and
|
* Examine the knowledge base for a class addition to the ontology and
|
||||||
* add messages to the change log indicating where manual review is
|
* add messages to the change log indicating where manual review is
|
||||||
* recommended. If the added class has a direct parent in the new ontology
|
* recommended. If the added class has a direct parent in the new ontology
|
||||||
* that is not OWL.Thing, and if the knowledge base contains individuals
|
* that is not OWL.Thing, and if the knowledge base contains individuals
|
||||||
|
@ -275,6 +275,7 @@ public class ABoxUpdater {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Update a knowledge base to account for a class deletion in the ontology.
|
* Update a knowledge base to account for a class deletion in the ontology.
|
||||||
|
@ -328,6 +329,7 @@ public class ABoxUpdater {
|
||||||
renameClass(chg);
|
renameClass(chg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void processPropertyChanges(List<AtomicOntologyChange> changes) throws IOException {
|
public void processPropertyChanges(List<AtomicOntologyChange> changes) throws IOException {
|
||||||
Iterator<AtomicOntologyChange> propItr = changes.iterator();
|
Iterator<AtomicOntologyChange> propItr = changes.iterator();
|
||||||
while(propItr.hasNext()){
|
while(propItr.hasNext()){
|
||||||
|
@ -452,7 +454,7 @@ public class ABoxUpdater {
|
||||||
record.recordRetractions(renamePropRetractModel);
|
record.recordRetractions(renamePropRetractModel);
|
||||||
|
|
||||||
if (renamePropRetractModel.size() > 0) {
|
if (renamePropRetractModel.size() > 0) {
|
||||||
logger.log(renamePropRetractModel.size() + " statment" +
|
logger.log(renamePropRetractModel.size() + " statement" +
|
||||||
((renamePropRetractModel.size() > 1) ? "s" : "") +
|
((renamePropRetractModel.size() > 1) ? "s" : "") +
|
||||||
" with predicate " + propObj.getSourceURI() + " " +
|
" with predicate " + propObj.getSourceURI() + " " +
|
||||||
((renamePropRetractModel.size() > 1) ? "were" : "was")
|
((renamePropRetractModel.size() > 1) ? "were" : "was")
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.ontology.update;
|
package edu.cornell.mannlib.vitro.webapp.ontology.update;
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* We need to document what is in source and destinationURI for each
|
* We need to document what is in source and destinationURI for each
|
||||||
|
|
|
@ -12,14 +12,8 @@ import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
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.OntProperty;
|
|
||||||
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;
|
||||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
||||||
|
@ -27,9 +21,6 @@ import com.hp.hpl.jena.query.QueryFactory;
|
||||||
import com.hp.hpl.jena.query.Syntax;
|
import com.hp.hpl.jena.query.Syntax;
|
||||||
import com.hp.hpl.jena.rdf.model.Model;
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Statement;
|
import com.hp.hpl.jena.rdf.model.Statement;
|
||||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||||
import com.hp.hpl.jena.shared.Lock;
|
import com.hp.hpl.jena.shared.Lock;
|
||||||
|
@ -45,9 +36,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.jena.JenaIngestUtils;
|
||||||
*/
|
*/
|
||||||
public class OntologyUpdater {
|
public class OntologyUpdater {
|
||||||
|
|
||||||
|
//private final Log log = LogFactory.getLog(OntologyUpdater.class);
|
||||||
|
|
||||||
private final Log log = LogFactory.getLog(OntologyUpdater.class);
|
|
||||||
|
|
||||||
private OntologyUpdateSettings settings;
|
private OntologyUpdateSettings settings;
|
||||||
private OntologyChangeLogger logger;
|
private OntologyChangeLogger logger;
|
||||||
|
@ -55,10 +44,8 @@ public class OntologyUpdater {
|
||||||
|
|
||||||
public OntologyUpdater(OntologyUpdateSettings settings) {
|
public OntologyUpdater(OntologyUpdateSettings settings) {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.logger = new SimpleOntologyChangeLogger(settings.getLogFile(),
|
this.logger = new SimpleOntologyChangeLogger(settings.getLogFile(), settings.getErrorLogFile());
|
||||||
settings.getErrorLogFile());
|
this.record = new SimpleOntologyChangeRecord(settings.getAddedDataFile(), settings.getRemovedDataFile());
|
||||||
this.record = new SimpleOntologyChangeRecord(
|
|
||||||
settings.getAddedDataFile(), settings.getRemovedDataFile());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean update() throws IOException {
|
public boolean update() throws IOException {
|
||||||
|
@ -67,7 +54,13 @@ public class OntologyUpdater {
|
||||||
|
|
||||||
boolean updateRequired = updateRequired();
|
boolean updateRequired = updateRequired();
|
||||||
if (updateRequired) {
|
if (updateRequired) {
|
||||||
|
|
||||||
|
try {
|
||||||
performUpdate();
|
performUpdate();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.logError(e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
if (!logger.errorsWritten()) {
|
if (!logger.errorsWritten()) {
|
||||||
// add assertions to the knowledge base showing that the
|
// add assertions to the knowledge base showing that the
|
||||||
|
@ -78,6 +71,7 @@ public class OntologyUpdater {
|
||||||
|
|
||||||
record.writeChanges();
|
record.writeChanges();
|
||||||
logger.closeLogs();
|
logger.closeLogs();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return updateRequired;
|
return updateRequired;
|
||||||
|
@ -86,16 +80,13 @@ public class OntologyUpdater {
|
||||||
|
|
||||||
private void performUpdate() throws IOException {
|
private void performUpdate() throws IOException {
|
||||||
|
|
||||||
performSparqlConstructs(settings.getSparqlConstructsDir(),
|
performSparqlConstructs(settings.getSparqlConstructsDir(), settings.getOntModelSelector().getABoxModel());
|
||||||
settings.getOntModelSelector().getABoxModel());
|
|
||||||
|
|
||||||
List<AtomicOntologyChange> rawChanges = getAtomicOntologyChanges();
|
List<AtomicOntologyChange> rawChanges = getAtomicOntologyChanges();
|
||||||
|
|
||||||
AtomicOntologyChangeLists changes =
|
AtomicOntologyChangeLists changes = new AtomicOntologyChangeLists(rawChanges,
|
||||||
new AtomicOntologyChangeLists(rawChanges,
|
|
||||||
settings.getNewTBoxModel(),
|
settings.getNewTBoxModel(),
|
||||||
settings.getOldTBoxModel());
|
settings.getOldTBoxModel());
|
||||||
|
|
||||||
//process the TBox before the ABox
|
//process the TBox before the ABox
|
||||||
updateTBoxAnnotations();
|
updateTBoxAnnotations();
|
||||||
|
|
||||||
|
@ -195,7 +186,8 @@ public class OntologyUpdater {
|
||||||
|
|
||||||
private void updateABox(AtomicOntologyChangeLists changes)
|
private void updateABox(AtomicOntologyChangeLists changes)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
// TODO get models from somewhere
|
|
||||||
|
|
||||||
OntModel oldTBoxModel = settings.getOldTBoxModel();
|
OntModel oldTBoxModel = settings.getOldTBoxModel();
|
||||||
OntModel newTBoxModel = settings.getNewTBoxModel();
|
OntModel newTBoxModel = settings.getNewTBoxModel();
|
||||||
OntModel ABoxModel = settings.getOntModelSelector().getABoxModel();
|
OntModel ABoxModel = settings.getOntModelSelector().getABoxModel();
|
||||||
|
@ -204,7 +196,7 @@ public class OntologyUpdater {
|
||||||
settings.getNewTBoxAnnotationsModel(), logger, record);
|
settings.getNewTBoxAnnotationsModel(), logger, record);
|
||||||
aboxUpdater.processPropertyChanges(changes.getAtomicPropertyChanges());
|
aboxUpdater.processPropertyChanges(changes.getAtomicPropertyChanges());
|
||||||
aboxUpdater.processClassChanges(changes.getAtomicClassChanges());
|
aboxUpdater.processClassChanges(changes.getAtomicClassChanges());
|
||||||
// run additional SPARQL CONSTRUCTS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTBoxAnnotations() throws IOException {
|
private void updateTBoxAnnotations() throws IOException {
|
||||||
|
@ -255,6 +247,7 @@ public class OntologyUpdater {
|
||||||
|
|
||||||
private void assertSuccess() throws FileNotFoundException, IOException {
|
private void assertSuccess() throws FileNotFoundException, IOException {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Model m = settings.getOntModelSelector().getApplicationMetadataModel();
|
Model m = settings.getOntModelSelector().getApplicationMetadataModel();
|
||||||
File successAssertionsFile =
|
File successAssertionsFile =
|
||||||
new File(settings.getSuccessAssertionsFile());
|
new File(settings.getSuccessAssertionsFile());
|
||||||
|
@ -292,35 +285,33 @@ public class OntologyUpdater {
|
||||||
OntModel oldTboxModel) throws IOException {
|
OntModel oldTboxModel) throws IOException {
|
||||||
|
|
||||||
Iterator<AtomicOntologyChange> listItr = changeList.iterator();
|
Iterator<AtomicOntologyChange> listItr = changeList.iterator();
|
||||||
while(listItr.hasNext()){
|
|
||||||
|
while(listItr.hasNext()) {
|
||||||
AtomicOntologyChange changeObj = listItr.next();
|
AtomicOntologyChange changeObj = listItr.next();
|
||||||
if(changeObj.getSourceURI() != null){
|
if (changeObj.getSourceURI() != null){
|
||||||
if(oldTboxModel.getOntProperty(changeObj.
|
|
||||||
getSourceURI()) != null){
|
if (oldTboxModel.getOntProperty(changeObj.getSourceURI()) != null){
|
||||||
atomicPropertyChanges.add(changeObj);
|
atomicPropertyChanges.add(changeObj);
|
||||||
}
|
}
|
||||||
else if(oldTboxModel.getOntClass(changeObj.
|
else if (oldTboxModel.getOntClass(changeObj.getSourceURI()) != null) {
|
||||||
getSourceURI()) != null) {
|
|
||||||
atomicClassChanges.add(changeObj);
|
atomicClassChanges.add(changeObj);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
logger.logError("Source URI is neither a Property" +
|
logger.logError("Source URI is neither a Property" +
|
||||||
" nor a Class. " + "Change Object skipped");
|
" nor a Class. " + "Change Object skipped for sourceURI: " + changeObj.getSourceURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(changeObj.getDestinationURI() != null){
|
else if(changeObj.getDestinationURI() != null){
|
||||||
if(newTboxModel.getOntProperty(changeObj.
|
|
||||||
getDestinationURI()) != null){
|
if (newTboxModel.getOntProperty(changeObj.getDestinationURI()) != null) {
|
||||||
atomicPropertyChanges.add(changeObj);
|
atomicPropertyChanges.add(changeObj);
|
||||||
}
|
} else if(newTboxModel.getOntClass(changeObj.
|
||||||
else if(newTboxModel.getOntClass(changeObj.
|
getDestinationURI()) != null) {
|
||||||
getDestinationURI()) != null){
|
|
||||||
atomicClassChanges.add(changeObj);
|
atomicClassChanges.add(changeObj);
|
||||||
}
|
} else{
|
||||||
else{
|
|
||||||
logger.logError("Destination URI is neither a Property" +
|
logger.logError("Destination URI is neither a Property" +
|
||||||
" nor a Class. " + "Change Object skipped");
|
" nor a Class. " + "Change Object skipped for destinationURI: " + changeObj.getDestinationURI());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -22,8 +22,8 @@ import com.hp.hpl.jena.shared.Lock;
|
||||||
*/
|
*/
|
||||||
public class TBoxUpdater {
|
public class TBoxUpdater {
|
||||||
|
|
||||||
private OntModel oldTboxModel;
|
private OntModel oldTboxAnnotationsModel;
|
||||||
private OntModel newTboxModel;
|
private OntModel newTboxAnnotationsModel;
|
||||||
private OntModel siteModel;
|
private OntModel siteModel;
|
||||||
private OntologyChangeLogger logger;
|
private OntologyChangeLogger logger;
|
||||||
private OntologyChangeRecord record;
|
private OntologyChangeRecord record;
|
||||||
|
@ -32,8 +32,8 @@ public class TBoxUpdater {
|
||||||
*
|
*
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param oldTboxModel - previous version of the ontology
|
* @param oldTboxAnnotationsModel - previous version of the annotations in the ontology
|
||||||
* @param newTboxModel - new version of the ontology
|
* @param newTboxAnnotationsModel - new version of the annotations in the ontology
|
||||||
* @param siteModel - the knowledge base to be updated
|
* @param siteModel - the knowledge base to be updated
|
||||||
* @param logger - for writing to the change log
|
* @param logger - for writing to the change log
|
||||||
* and the error log.
|
* and the error log.
|
||||||
|
@ -41,14 +41,14 @@ public class TBoxUpdater {
|
||||||
* and the retractions model.
|
* and the retractions model.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public TBoxUpdater(OntModel oldTboxModel,
|
public TBoxUpdater(OntModel oldTboxAnnotationsModel,
|
||||||
OntModel newTboxModel,
|
OntModel newTboxAnnotationsModel,
|
||||||
OntModel siteModel,
|
OntModel siteModel,
|
||||||
OntologyChangeLogger logger,
|
OntologyChangeLogger logger,
|
||||||
OntologyChangeRecord record) {
|
OntologyChangeRecord record) {
|
||||||
|
|
||||||
this.oldTboxModel = oldTboxModel;
|
this.oldTboxAnnotationsModel = oldTboxAnnotationsModel;
|
||||||
this.newTboxModel = newTboxModel;
|
this.newTboxAnnotationsModel = newTboxAnnotationsModel;
|
||||||
this.siteModel = siteModel;
|
this.siteModel = siteModel;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.record = record;
|
this.record = record;
|
||||||
|
@ -56,12 +56,12 @@ public class TBoxUpdater {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Update a knowledge base to align with changes vitro annotation property default
|
* Update a knowledge base to align with changes to vitro annotation property default
|
||||||
* values in a new version of the ontology. The two versions of the ontology and the
|
* values in a new version of the ontology. The two versions of the ontology and the
|
||||||
* knowledge base to be updated are provided in the class constructor and are
|
* knowledge base to be updated are provided in the class constructor and are
|
||||||
* referenced via class level variables.
|
* referenced via class level variables.
|
||||||
*
|
*
|
||||||
* If the default value (i.e. the value that is provided in the vivo-core-
|
* If the default value (i.e. the value that is provided in the vivo-core
|
||||||
* annotations files) of a vitro annotation property has been changed for a vivo
|
* annotations files) of a vitro annotation property has been changed for a vivo
|
||||||
* core class, and that default value has not been changed in the site knowledge
|
* core class, and that default value has not been changed in the site knowledge
|
||||||
* base, then update the value in the site knowledge base to be the new default.
|
* base, then update the value in the site knowledge base to be the new default.
|
||||||
|
@ -76,7 +76,7 @@ public class TBoxUpdater {
|
||||||
* Writes to the change log file, the error log file, and the incremental change
|
* Writes to the change log file, the error log file, and the incremental change
|
||||||
* knowledge base.
|
* knowledge base.
|
||||||
*
|
*
|
||||||
* Note: as specified, this method for now assume that no new vitro annotation
|
* Note: as specified, this method for now assumes that no new vitro annotation
|
||||||
* properties have been introduced. This should be updated for future versions.
|
* properties have been introduced. This should be updated for future versions.
|
||||||
*/
|
*/
|
||||||
public void updateVitroPropertyDefaultValues() throws IOException {
|
public void updateVitroPropertyDefaultValues() throws IOException {
|
||||||
|
@ -92,7 +92,7 @@ public class TBoxUpdater {
|
||||||
// if the default has changed in the new version of the ontology AND if
|
// if the default has changed in the new version of the ontology AND if
|
||||||
// the site hasn't overidden the previous default in their knowledge base.
|
// the site hasn't overidden the previous default in their knowledge base.
|
||||||
|
|
||||||
StmtIterator iter = oldTboxModel.listStatements();
|
StmtIterator iter = oldTboxAnnotationsModel.listStatements();
|
||||||
|
|
||||||
int stmtCount = 0;
|
int stmtCount = 0;
|
||||||
|
|
||||||
|
@ -104,39 +104,49 @@ public class TBoxUpdater {
|
||||||
Property predicate = stmt.getPredicate();
|
Property predicate = stmt.getPredicate();
|
||||||
RDFNode oldObject = stmt.getObject();
|
RDFNode oldObject = stmt.getObject();
|
||||||
|
|
||||||
NodeIterator objects = newTboxModel.listObjectsOfProperty(subject, predicate);
|
NodeIterator newObjects = newTboxAnnotationsModel.listObjectsOfProperty(subject, predicate);
|
||||||
|
|
||||||
if ((objects == null) || (!objects.hasNext()) ) {
|
if ((newObjects == null) || (!newObjects.hasNext()) ) {
|
||||||
retractions.add(siteModel.listStatements(subject, predicate, (RDFNode) null));
|
retractions.add(siteModel.listStatements(subject, predicate, (RDFNode) null));
|
||||||
//logger.log("Error: found a statement for subject = " + subject.getURI() +
|
|
||||||
// " and property = " + predicate.getURI() +
|
|
||||||
// " in the old version but not the new version of the ontology.");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
RDFNode newObject = objects.next();
|
RDFNode newObject = newObjects.next();
|
||||||
if (objects.hasNext()) {
|
|
||||||
logger.logError("Error: found " + objects.toList().size() +
|
int i = 1;
|
||||||
|
while (newObjects.hasNext()) {
|
||||||
|
i++;
|
||||||
|
newObjects.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i > 1) {
|
||||||
|
logger.log("WARNING: found " + i +
|
||||||
" statements with subject = " + subject.getURI() +
|
" statements with subject = " + subject.getURI() +
|
||||||
" and property = " + predicate.getURI() +
|
" and property = " + predicate.getURI() +
|
||||||
" in the new version of the ontology. (maximum of one is expected)");
|
" in the new version of the annotations ontology. (maximum of one is expected)");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!newObject.equals(oldObject)) {
|
if (!newObject.equals(oldObject)) {
|
||||||
objects = siteModel.listObjectsOfProperty(subject,predicate);
|
NodeIterator siteObjects = siteModel.listObjectsOfProperty(subject,predicate);
|
||||||
|
|
||||||
if (!objects.hasNext()) {
|
if (siteObjects == null || !siteObjects.hasNext()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
RDFNode siteObject = objects.next();
|
RDFNode siteObject = siteObjects.next();
|
||||||
if (objects.hasNext()) {
|
|
||||||
logger.logError("Warning: found " + objects.toList().size() +
|
i = 1;
|
||||||
|
while (siteObjects.hasNext()) {
|
||||||
|
i++;
|
||||||
|
siteObjects.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i > 1) {
|
||||||
|
logger.log("WARNING: found " + i +
|
||||||
" statements with subject = " + subject.getURI() +
|
" statements with subject = " + subject.getURI() +
|
||||||
" and property = " + predicate.getURI() +
|
" and property = " + predicate.getURI() +
|
||||||
" in the site model (maximum of one is expected). +" +
|
" in the site annotations model. (maximum of one is expected). ");
|
||||||
" did not perform any update on this property");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +190,7 @@ public class TBoxUpdater {
|
||||||
// log summary of changes
|
// log summary of changes
|
||||||
if (actualAdditions.size() > 0) {
|
if (actualAdditions.size() > 0) {
|
||||||
logger.log("Updated the default vitro annotation value for " +
|
logger.log("Updated the default vitro annotation value for " +
|
||||||
actualAdditions.size() + " statments in the knowledge base.");
|
actualAdditions.size() + " statements in the knowledge base.");
|
||||||
}
|
}
|
||||||
|
|
||||||
long numRemoved = actualRetractions.size() - actualAdditions.size();
|
long numRemoved = actualRetractions.size() - actualAdditions.size();
|
||||||
|
@ -193,15 +203,22 @@ public class TBoxUpdater {
|
||||||
// into the site model.
|
// into the site model.
|
||||||
//
|
//
|
||||||
|
|
||||||
Model newAnnotationSettings = newTboxModel.difference(oldTboxModel);
|
Model newAnnotationSettings = newTboxAnnotationsModel.difference(oldTboxAnnotationsModel);
|
||||||
Model newAnnotationSettingsToAdd = ModelFactory.createDefaultModel();
|
Model newAnnotationSettingsToAdd = ModelFactory.createDefaultModel();
|
||||||
StmtIterator newStmtIt = newAnnotationSettings.listStatements();
|
StmtIterator newStmtIt = newAnnotationSettings.listStatements();
|
||||||
while (newStmtIt.hasNext()) {
|
while (newStmtIt.hasNext()) {
|
||||||
Statement stmt = newStmtIt.next();
|
Statement stmt = newStmtIt.next();
|
||||||
if (!siteModel.contains(stmt)) {
|
if (!siteModel.contains(stmt)) {
|
||||||
newAnnotationSettingsToAdd.add(stmt);
|
newAnnotationSettingsToAdd.add(stmt);
|
||||||
|
|
||||||
|
// TODO remove this for production
|
||||||
|
logger.log( "adding Statement: subject = " + stmt.getSubject().getURI() +
|
||||||
|
" property = " + stmt.getPredicate().getURI() +
|
||||||
|
" object = " + (stmt.getObject().isLiteral() ? ((Literal)stmt.getObject()).getLexicalForm()
|
||||||
|
: ((Resource)stmt.getObject()).getURI()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
siteModel.add(newAnnotationSettingsToAdd);
|
siteModel.add(newAnnotationSettingsToAdd);
|
||||||
record.recordAdditions(newAnnotationSettingsToAdd);
|
record.recordAdditions(newAnnotationSettingsToAdd);
|
||||||
|
|
||||||
|
@ -213,16 +230,6 @@ public class TBoxUpdater {
|
||||||
"existing annotation properties applied to existing classes where they weren't applied before, or existing " +
|
"existing annotation properties applied to existing classes where they weren't applied before, or existing " +
|
||||||
"properties applied to new classes. No new annotation properties have been introduced.");
|
"properties applied to new classes. No new annotation properties have been introduced.");
|
||||||
}
|
}
|
||||||
//details
|
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
Statement statement = iter.next();
|
|
||||||
|
|
||||||
logger.log( "added Statement: subject = " + statement.getSubject().getURI() +
|
|
||||||
" property = " + statement.getPredicate().getURI() +
|
|
||||||
" object = " + (statement.getObject().isLiteral() ? ((Resource)statement.getObject()).getURI()
|
|
||||||
: ((Literal)statement.getObject()).getLexicalForm()));
|
|
||||||
}
|
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
siteModel.leaveCriticalSection();
|
siteModel.leaveCriticalSection();
|
||||||
|
|
Loading…
Add table
Reference in a new issue