From 0f5fdf84deb88ef500412417f676c0852f40b359 Mon Sep 17 00:00:00 2001 From: bjl23 Date: Thu, 1 Apr 2010 14:31:13 +0000 Subject: [PATCH] minor changes for NIHVIVO-205 ontology upgrade --- .../vitro/webapp/ontology/update/ABoxUpdater.java | 11 +++++++++++ .../webapp/ontology/update/AtomicOntologyChange.java | 12 ++++++++++++ .../webapp/ontology/update/OntologyUpdater.java | 3 --- 3 files changed, 23 insertions(+), 3 deletions(-) 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 fc76d3efa..af7d467f9 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 @@ -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.Statement; 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.vocabulary.OWL; import com.hp.hpl.jena.vocabulary.RDF; @@ -113,6 +114,11 @@ public class ABoxUpdater { * */ public void renameClass(AtomicOntologyChange change) throws IOException { + + aboxModel.enterCriticalSection(Lock.WRITE); + + try { + OntModel additions = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); OntModel retractions = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); @@ -150,6 +156,11 @@ public class ABoxUpdater { record.recordRetractions(retractions); aboxModel.add(additions); record.recordAdditions(additions); + + } finally { + aboxModel.leaveCriticalSection(); + } + } /** diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/AtomicOntologyChange.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/AtomicOntologyChange.java index 48c972fce..4e86c0d4b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/AtomicOntologyChange.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/AtomicOntologyChange.java @@ -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() { return this.sourceURI; } @@ -37,6 +43,12 @@ public class AtomicOntologyChange { 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() { return this.destinationURI; } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/OntologyUpdater.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/OntologyUpdater.java index 68e3000b2..fd89a89ec 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/OntologyUpdater.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/ontology/update/OntologyUpdater.java @@ -26,9 +26,6 @@ import com.hp.hpl.jena.shared.Lock; * Performs knowledge base updates if necessary to align with a * new ontology version. * - * This class assumes that config and mapping data files are available - * at DATA_DIR. - * * @author bjl23 * */