Class ReasonOperation


  • public class ReasonOperation
    extends Object
    Reason over an ontology and add axioms.
    Author:
    James A. Overton
    • Constructor Summary

      Constructors 
      Constructor Description
      ReasonOperation()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Map<String,​String> getDefaultOptions()
      Return a map from option name to default option value, for all the available reasoner options.
      static org.semanticweb.owlapi.reasoner.OWLReasoner getTautologyChecker​(boolean structural)
      Create a tautology checker.
      static boolean isTautological​(org.semanticweb.owlapi.model.OWLAxiom axiom, org.semanticweb.owlapi.reasoner.OWLReasoner tautologyChecker, boolean structural)
      Given an OWLAxiom, a tautology checker reasoner, and a boolean, determine if the axiom is a tautology.
      static void reason​(org.semanticweb.owlapi.model.OWLOntology ontology, org.semanticweb.owlapi.reasoner.OWLReasonerFactory reasonerFactory)
      Given an ontology and a reasoner factory, return the ontology with inferred axioms added after reasoning.
      static void reason​(org.semanticweb.owlapi.model.OWLOntology ontology, org.semanticweb.owlapi.reasoner.OWLReasonerFactory reasonerFactory, Map<String,​String> options)
      Given an ontology, a reasoner factory, and a map of options, return the ontology with inferred axioms added after reasoning.
      static void removeRedundantSubClassAxioms​(org.semanticweb.owlapi.reasoner.OWLReasoner reasoner)
      Remove subClassAxioms where there is a more direct axiom, and the subClassAxiom does not have any annotations.
      static void removeRedundantSubClassAxioms​(org.semanticweb.owlapi.reasoner.OWLReasoner reasoner, Map<String,​String> options)
      Remove subClassAxioms where there is a more direct axiom, and the subClassAxiom does not have any annotations.
    • Constructor Detail

      • ReasonOperation

        public ReasonOperation()
    • Method Detail

      • getDefaultOptions

        public static Map<String,​String> getDefaultOptions()
        Return a map from option name to default option value, for all the available reasoner options.
        Returns:
        a map with default values for all available options
      • reason

        public static void reason​(org.semanticweb.owlapi.model.OWLOntology ontology,
                                  org.semanticweb.owlapi.reasoner.OWLReasonerFactory reasonerFactory)
                           throws OntologyLogicException,
                                  org.semanticweb.owlapi.model.OWLOntologyCreationException,
                                  InvalidReferenceException
        Given an ontology and a reasoner factory, return the ontology with inferred axioms added after reasoning. Use default options.
        Parameters:
        ontology - the ontology to reason over
        reasonerFactory - the factory to create a reasoner instance from
        Throws:
        OntologyLogicException - if the ontology contains unsatisfiable classes, properties or inconsistencies
        org.semanticweb.owlapi.model.OWLOntologyCreationException - if ontology cannot be created
        InvalidReferenceException - if the reference checker fails
      • reason

        public static void reason​(org.semanticweb.owlapi.model.OWLOntology ontology,
                                  org.semanticweb.owlapi.reasoner.OWLReasonerFactory reasonerFactory,
                                  Map<String,​String> options)
                           throws OntologyLogicException,
                                  org.semanticweb.owlapi.model.OWLOntologyCreationException,
                                  InvalidReferenceException
        Given an ontology, a reasoner factory, and a map of options, return the ontology with inferred axioms added after reasoning.
        Parameters:
        ontology - the ontology to reason over
        reasonerFactory - the factory to create a reasoner instance from
        options - a map of option strings, or null
        Throws:
        OntologyLogicException - if the ontology contains unsatisfiable classes, properties or inconsistencies
        org.semanticweb.owlapi.model.OWLOntologyCreationException - if ontology cannot be created
        InvalidReferenceException - if the reference checker fails
      • getTautologyChecker

        public static org.semanticweb.owlapi.reasoner.OWLReasoner getTautologyChecker​(boolean structural)
                                                                               throws org.semanticweb.owlapi.model.OWLOntologyCreationException
        Create a tautology checker.
        Parameters:
        structural - if true, return null - we do not need a checker for the structural patterns
        Returns:
        new OWLReasoner for empty ontology or null
        Throws:
        org.semanticweb.owlapi.model.OWLOntologyCreationException - on issue creating empty ontology
      • isTautological

        public static boolean isTautological​(org.semanticweb.owlapi.model.OWLAxiom axiom,
                                             org.semanticweb.owlapi.reasoner.OWLReasoner tautologyChecker,
                                             boolean structural)
        Given an OWLAxiom, a tautology checker reasoner, and a boolean, determine if the axiom is a tautology.
        Parameters:
        axiom - OWLAxiom to check
        tautologyChecker - OWLReasoner for empty ontology
        structural - if true, only check for hard-coded structural patterns (checker can be null)
        Returns:
        true if axiom is tautological
      • removeRedundantSubClassAxioms

        public static void removeRedundantSubClassAxioms​(org.semanticweb.owlapi.reasoner.OWLReasoner reasoner)
        Remove subClassAxioms where there is a more direct axiom, and the subClassAxiom does not have any annotations.

        Example: genotyping assay - asserted in dev: assay - inferred by reasoner: analyte assay - asserted after fill: assay, analyte assay - asserted after removeRedundantSubClassAxioms: analyte assay

        Parameters:
        reasoner - an OWL reasoner, initialized with a root ontology; the ontology will be modified
      • removeRedundantSubClassAxioms

        public static void removeRedundantSubClassAxioms​(org.semanticweb.owlapi.reasoner.OWLReasoner reasoner,
                                                         Map<String,​String> options)
        Remove subClassAxioms where there is a more direct axiom, and the subClassAxiom does not have any annotations.

        Example: genotyping assay - asserted in dev: assay - inferred by reasoner: analyte assay - asserted after fill: assay, analyte assay - asserted after removeRedundantSubClassAxioms: analyte assay

        Parameters:
        reasoner - an OWL reasoner, initialized with a root ontology; the ontology will be modified
        options - map of options for reasoning