Class ABoxUpdater
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.ontology.update.ABoxUpdater
-
public class ABoxUpdater extends Object
Performs knowledge base updates to the abox to align with a new ontology version
-
-
Constructor Summary
Constructors Constructor Description ABoxUpdater(UpdateSettings settings, ChangeLogger logger, ChangeRecord record)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClass(AtomicOntologyChange change)Examine the knowledge base for a class addition to the ontology and add messages to the change log indicating where manual review is recommended.protected intdeleteIndividual(org.apache.jena.rdf.model.Resource individual)voiddeleteIndividualsOfType(AtomicOntologyChange change)Remove all instances of the given class from the abox of the knowledge base.voidlogChange(org.apache.jena.rdf.model.Statement statement, boolean add)voidlogChanges(org.apache.jena.rdf.model.Statement oldStatement, org.apache.jena.rdf.model.Statement newStatement)voidprocessClassChanges(List<AtomicOntologyChange> changes)Update a knowledge base to align with changes in the class definitions in a new version of the ontology.voidprocessPropertyChanges(List<AtomicOntologyChange> changes)voidrenameClass(AtomicOntologyChange change)Update the knowledge base for a class rename in the ontology.voidrenameClassToParent(AtomicOntologyChange change)Update a knowledge base to account for a class deletion in the ontology.static StringstmtString(org.apache.jena.rdf.model.Resource subject, org.apache.jena.rdf.model.Property predicate, org.apache.jena.rdf.model.RDFNode object)static StringstmtString(org.apache.jena.rdf.model.Statement statement)
-
-
-
Constructor Detail
-
ABoxUpdater
public ABoxUpdater(UpdateSettings settings, ChangeLogger logger, ChangeRecord record)
Constructor- Parameters:
settings- - Update settingslogger- - for writing to the change log and the error log.record- - for writing to the additions model and the retractions model.
-
-
Method Detail
-
processClassChanges
public void processClassChanges(List<AtomicOntologyChange> changes) throws IOException
Update a knowledge base to align with changes in the class definitions 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 referenced via class level variables.- Parameters:
changes- - a list of AtomicOntologyChange objects, each representing one change in class definition in the new version of the ontology. Writes to the change log file, the error log file, and the incremental change knowledge base.- Throws:
IOException
-
renameClass
public void renameClass(AtomicOntologyChange change) throws IOException
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 changed to use the new class URI.- Parameters:
change- - an AtomicOntologyChange object representing a class rename operation.- Throws:
IOException
-
addClass
public void addClass(AtomicOntologyChange change) throws IOException
Examine the knowledge base for a class addition to the ontology and add messages to the change log indicating where manual review is 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 asserted to be in the parent class, then log a message recommending review of those individuals to see whether they are of the new class type.- Parameters:
change- - an AtomicOntologyChange object representing a class addition operation.- Throws:
IOException
-
renameClassToParent
public void renameClassToParent(AtomicOntologyChange change) throws IOException
Update a knowledge base to account for a class deletion in the ontology. All references to the deleted class URI in either the subject or the object position of a statement are changed to use the closest available parent of the deleted class from the previous ontology that remains in the new version of the ontology. Note that the closest available parent may be owl:Thing. If the deleted class has more than one closest available parent, then change individuals that were asserted to be of the deleted class to be asserted to be of both parent classes.- Parameters:
change- - an AtomicOntologyChange object representing a class delete operation.- Throws:
IOException
-
deleteIndividualsOfType
public void deleteIndividualsOfType(AtomicOntologyChange change) throws IOException
Remove all instances of the given class from the abox of the knowledge base.- Parameters:
change- - an AtomicOntologyChange object representing a class delete operation.- Throws:
IOException
-
deleteIndividual
protected int deleteIndividual(org.apache.jena.rdf.model.Resource individual) throws IOException- Throws:
IOException
-
processPropertyChanges
public void processPropertyChanges(List<AtomicOntologyChange> changes) throws IOException
- Throws:
IOException
-
logChanges
public void logChanges(org.apache.jena.rdf.model.Statement oldStatement, org.apache.jena.rdf.model.Statement newStatement) throws IOException- Throws:
IOException
-
logChange
public void logChange(org.apache.jena.rdf.model.Statement statement, boolean add) throws IOException- Throws:
IOException
-
stmtString
public static String stmtString(org.apache.jena.rdf.model.Statement statement)
-
stmtString
public static String stmtString(org.apache.jena.rdf.model.Resource subject, org.apache.jena.rdf.model.Property predicate, org.apache.jena.rdf.model.RDFNode object)
-
-