minor changes for NIHVIVO-205 ontology upgrade

This commit is contained in:
bjl23 2010-04-01 14:31:13 +00:00
parent 9779f76d68
commit 0f5fdf84de
3 changed files with 23 additions and 3 deletions

View file

@ -19,6 +19,7 @@ import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.ResourceFactory; 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.util.iterator.ExtendedIterator; import com.hp.hpl.jena.util.iterator.ExtendedIterator;
import com.hp.hpl.jena.vocabulary.OWL; import com.hp.hpl.jena.vocabulary.OWL;
import com.hp.hpl.jena.vocabulary.RDF; import com.hp.hpl.jena.vocabulary.RDF;
@ -113,6 +114,11 @@ public class ABoxUpdater {
* *
*/ */
public void renameClass(AtomicOntologyChange change) throws IOException { public void renameClass(AtomicOntologyChange change) throws IOException {
aboxModel.enterCriticalSection(Lock.WRITE);
try {
OntModel additions = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); OntModel additions = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
OntModel retractions = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); OntModel retractions = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
@ -150,6 +156,11 @@ public class ABoxUpdater {
record.recordRetractions(retractions); record.recordRetractions(retractions);
aboxModel.add(additions); aboxModel.add(additions);
record.recordAdditions(additions); record.recordAdditions(additions);
} finally {
aboxModel.leaveCriticalSection();
}
} }
/** /**

View file

@ -29,6 +29,12 @@ public class AtomicOntologyChange {
} }
/**
* Contains the URI of a class or property in the previous version of
* the ontology, or null if a new class or property was introduced
* in the current version of the ontology.
* @return
*/
public String getSourceURI() { public String getSourceURI() {
return this.sourceURI; return this.sourceURI;
} }
@ -37,6 +43,12 @@ public class AtomicOntologyChange {
this.sourceURI = sourceURI; this.sourceURI = sourceURI;
} }
/**
* Contains the URI of a class or property in the current version of
* the ontology, or null if a class or property was removed from the
* previous version of the ontology.
* @return
*/
public String getDestinationURI() { public String getDestinationURI() {
return this.destinationURI; return this.destinationURI;
} }

View file

@ -26,9 +26,6 @@ import com.hp.hpl.jena.shared.Lock;
* Performs knowledge base updates if necessary to align with a * Performs knowledge base updates if necessary to align with a
* new ontology version. * new ontology version.
* *
* This class assumes that config and mapping data files are available
* at DATA_DIR.
*
* @author bjl23 * @author bjl23
* *
*/ */