Class ABoxUpdater


  • public class ABoxUpdater
    extends Object
    Performs knowledge base updates to the abox to align with a new ontology version
    • Constructor Detail

      • ABoxUpdater

        public ABoxUpdater​(UpdateSettings settings,
                           ChangeLogger logger,
                           ChangeRecord record)
        Constructor
        Parameters:
        settings - - Update settings
        logger - - 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
      • 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)