owlapy.fast_instance_checker.OWLReasoner_FastInstanceChecker

class owlapy.fast_instance_checker.OWLReasoner_FastInstanceChecker(ontology: owlapy.model.OWLOntology, base_reasoner: owlapy.model.OWLReasoner, *, property_cache=True, negation_default=False)[source]

Bases: owlapy.ext.OWLReasonerEx

Tries to check instances fast (but maybe incomplete)

Fast instance checker

Parameters:
  • ontology – Ontology to use

  • base_reasoner – Reasoner to get instances/types from

  • property_cache – Whether to cache property values

  • negation_default – Whether to assume a missing fact means it is false (“closed world view”)

Methods

all_data_property_values

Gets all values for the given data property expression that appear in the knowledge base.

data_property_domains

Gets the class expressions that are the direct or indirect domains of this property with respect to the imports closure of the root ontology.

data_property_ranges

Gets the data ranges that are the direct or indirect ranges of this property with respect to the imports closure of the root ontology.

data_property_values

Gets the data property values for the specified individual and data property expression.

different_individuals

Gets the individuals that are different from the specified individual with respect to the set of reasoner axioms.

disjoint_classes

Gets the named classes that are disjoint with specified class expression with respect to the set of reasoner axioms.

disjoint_data_properties

Gets the data properties that are disjoint with the specified data property with respect to the set of reasoner axioms.

disjoint_object_properties

Gets the simplified object properties that are disjoint with the specified object property with respect to the set of reasoner axioms.

equivalent_classes

Gets the named classes that are equivalent to the specified class expression with respect to the set of reasoner axioms.

equivalent_data_properties

Gets the data properties that are equivalent to the specified data property with respect to the set of reasoner axioms.

equivalent_object_properties

Gets the simplified object properties that are equivalent to the specified object property with respect to the set of reasoner axioms.

flush

Flushes any changes stored in the buffer, which causes the reasoner to take into consideration the changes the current root ontology specified by the changes

get_root_ontology

Gets the “root” ontology that is loaded into this reasoner.

ind_data_properties

Gets all data properties for the given individual that appear in the knowledge base.

ind_object_properties

Gets all object properties for the given individual that appear in the knowledge base.

instances

Gets the individuals which are instances of the specified class expression.

object_property_domains

Gets the class expressions that are the direct or indirect domains of this property with respect to the imports closure of the root ontology.

object_property_ranges

Gets the class expressions that are the direct or indirect ranges of this property with respect to the imports closure of the root ontology.

object_property_values

Gets the object property values for the specified individual and object property expression.

reset

The reset method shall reset any cached state

same_individuals

Gets the individuals that are the same as the specified individual with respect to the set of reasoner axioms.

sub_classes

Gets the set of named classes that are the strict (potentially direct) subclasses of the specified class expression with respect to the reasoner axioms.

sub_data_properties

Gets the set of named data properties that are the strict (potentially direct) subproperties of the specified data property expression with respect to the imports closure of the root ontology.

sub_object_properties

Gets the stream of simplified object property expressions that are the strict (potentially direct) subproperties of the specified object property expression with respect to the imports closure of the root ontology.

super_classes

Gets the stream of named classes that are the strict (potentially direct) super classes of the specified class expression with respect to the imports closure of the root ontology.

types

Gets the named classes which are (potentially direct) types of the specified named individual.

all_data_property_values(pe: owlapy.model.OWLDataProperty)Iterable[owlapy.model.OWLLiteral][source]

Gets all values for the given data property expression that appear in the knowledge base.

Parameters:

pe – The data property expression whose values are to be retrieved

Returns:

A set of OWLLiterals containing literals such that for each literal l in the set, the set of reasoner axioms entails DataPropertyAssertion(pe ind l) for any ind.

data_property_domains(pe: owlapy.model.OWLDataProperty, direct: bool = False)Iterable[owlapy.model.OWLClassExpression][source]

Gets the class expressions that are the direct or indirect domains of this property with respect to the imports closure of the root ontology.

Parameters:
  • pe – The property expression whose domains are to be retrieved.

  • direct – Specifies if the direct domains should be retrieved (True), or if all domains should be retrieved (False).

Returns:

Let N = equivalent_classes(DataSomeValuesFrom(pe rdfs:Literal)). If direct is True: then if N is not empty then the return value is N, else the return value is the result of super_classes(DataSomeValuesFrom(pe rdfs:Literal), true). If direct is False: then the result of super_classes(DataSomeValuesFrom(pe rdfs:Literal), false) together with N if N is non-empty. (Note, rdfs:Literal is the top datatype).

data_property_ranges(pe: owlapy.model.OWLDataProperty, direct: bool = False)Iterable[owlapy.model.OWLDataRange][source]

Gets the data ranges that are the direct or indirect ranges of this property with respect to the imports closure of the root ontology.

Parameters:
  • pe – The property expression whose ranges are to be retrieved.

  • direct – Specifies if the direct ranges should be retrieved (True), or if all ranges should be retrieved (False).

Returns:

data_property_values(ind: owlapy.model.OWLNamedIndividual, pe: owlapy.model.OWLDataProperty)Iterable[owlapy.model.OWLLiteral][source]

Gets the data property values for the specified individual and data property expression.

Parameters:
  • ind – The individual that is the subject of the data property values

  • pe – The data property expression whose values are to be retrieved for the specified individual

Returns:

A set of OWLLiterals containing literals such that for each literal l in the set, the set of reasoner axioms entails DataPropertyAssertion(pe ind l).

different_individuals(ce: owlapy.model.OWLNamedIndividual)Iterable[owlapy.model.OWLNamedIndividual][source]

Gets the individuals that are different from the specified individual with respect to the set of reasoner axioms.

Parameters:

ind – The individual whose different individuals are to be retrieved.

Returns:

All individuals x where the set of reasoner axioms entails DifferentIndividuals(ind x).

disjoint_classes(ce: owlapy.model.OWLClassExpression)Iterable[owlapy.model.OWLClass][source]

Gets the named classes that are disjoint with specified class expression with respect to the set of reasoner axioms.

Parameters:

ce – The class expression whose disjoint classes are to be retrieved.

Returns:

All named classes D where the set of reasoner axioms entails EquivalentClasses(D ObjectComplementOf(ce)) or StrictSubClassOf(D ObjectComplementOf(ce)).

disjoint_data_properties(dp: owlapy.model.OWLDataProperty)Iterable[owlapy.model.OWLDataProperty][source]

Gets the data properties that are disjoint with the specified data property with respect to the set of reasoner axioms.

Parameters:

dp – The data property whose disjoint data properties are to be retrieved.

Returns:

All data properties e where the root ontology imports closure entails EquivalentDataProperties(e DataPropertyComplementOf(dp)) or StrictSubDataPropertyOf(e DataPropertyComplementOf(dp)).

disjoint_object_properties(dp: owlapy.model.OWLObjectPropertyExpression)Iterable[owlapy.model.OWLObjectPropertyExpression][source]

Gets the simplified object properties that are disjoint with the specified object property with respect to the set of reasoner axioms.

Parameters:

op – The object property whose disjoint object properties are to be retrieved.

Returns:

All simplified object properties e where the root ontology imports closure entails EquivalentObjectProperties(e ObjectPropertyComplementOf(op)) or StrictSubObjectPropertyOf(e ObjectPropertyComplementOf(op)).

equivalent_classes(ce: owlapy.model.OWLClassExpression)Iterable[owlapy.model.OWLClass][source]

Gets the named classes that are equivalent to the specified class expression with respect to the set of reasoner axioms.

Parameters:

ce – The class expression whose equivalent classes are to be retrieved.

Returns:

All named classes C where the root ontology imports closure entails EquivalentClasses(ce C). If ce is not a class name (i.e. it is an anonymous class expression) and there are no such classes C then there will be no result. If ce is unsatisfiable with respect to the set of reasoner axioms then owl:Nothing, i.e. the bottom node, will be returned.

equivalent_data_properties(dp: owlapy.model.OWLDataProperty)Iterable[owlapy.model.OWLDataProperty][source]

Gets the data properties that are equivalent to the specified data property with respect to the set of reasoner axioms.

Parameters:

dp – The data property whose equivalent data properties are to be retrieved.

Returns:

All data properties e where the root ontology imports closure entails EquivalentDataProperties(dp e). If dp is unsatisfiable with respect to the set of reasoner axioms then owl:bottomDataProperty will be returned.

equivalent_object_properties(dp: owlapy.model.OWLObjectPropertyExpression)Iterable[owlapy.model.OWLObjectPropertyExpression][source]

Gets the simplified object properties that are equivalent to the specified object property with respect to the set of reasoner axioms.

Parameters:

op – The object property whose equivalent object properties are to be retrieved.

Returns:

All simplified object properties e where the root ontology imports closure entails EquivalentObjectProperties(op e). If op is unsatisfiable with respect to the set of reasoner axioms then owl:bottomDataProperty will be returned.

flush()None[source]

Flushes any changes stored in the buffer, which causes the reasoner to take into consideration the changes the current root ontology specified by the changes

get_root_ontology()owlapy.model.OWLOntology[source]

Gets the “root” ontology that is loaded into this reasoner. The reasoner takes into account the axioms in this ontology and its imports closure.

ind_data_properties(ind: owlapy.model.OWLNamedIndividual)Iterable[owlapy.model.OWLDataProperty]

Gets all data properties for the given individual that appear in the knowledge base.

Parameters:

ind – The named individual whose data properties are to be retrieved

Returns:

All data properties pe where the set of reasoner axioms entails DataPropertyAssertion(pe ind l) for atleast one l.

ind_object_properties(ind: owlapy.model.OWLNamedIndividual)Iterable[owlapy.model.OWLObjectProperty]

Gets all object properties for the given individual that appear in the knowledge base.

Parameters:

ind – The named individual whose object properties are to be retrieved

Returns:

All data properties pe where the set of reasoner axioms entails ObjectPropertyAssertion(pe ind ind2) for atleast one ind2.

instances(ce: owlapy.model.OWLClassExpression, direct: bool = False)Iterable[owlapy.model.OWLNamedIndividual][source]

Gets the individuals which are instances of the specified class expression.

Parameters:
  • ce – The class expression whose instances are to be retrieved.

  • direct – Specifies if the direct instances should be retrieved (True), or if all instances should be retrieved (False).

Returns:

If direct is True, each named individual j where the set of reasoner axioms entails DirectClassAssertion(ce, j). If direct is False, each named individual j where the set of reasoner axioms entails ClassAssertion(ce, j). If ce is unsatisfiable with respect to the set of reasoner axioms then nothing returned.

object_property_domains(pe: owlapy.model.OWLObjectProperty, direct: bool = False)Iterable[owlapy.model.OWLClassExpression][source]

Gets the class expressions that are the direct or indirect domains of this property with respect to the imports closure of the root ontology.

Parameters:
  • pe – The property expression whose domains are to be retrieved.

  • direct – Specifies if the direct domains should be retrieved (True), or if all domains should be retrieved (False).

Returns:

Let N = equivalent_classes(ObjectSomeValuesFrom(pe owl:Thing)). If direct is True: then if N is not empty then the return value is N, else the return value is the result of super_classes(ObjectSomeValuesFrom(pe owl:Thing), true). If direct is False: then the result of super_classes(ObjectSomeValuesFrom(pe owl:Thing), false) together with N if N is non-empty.

object_property_ranges(pe: owlapy.model.OWLObjectProperty, direct: bool = False)Iterable[owlapy.model.OWLClassExpression][source]

Gets the class expressions that are the direct or indirect ranges of this property with respect to the imports closure of the root ontology.

Parameters:
  • pe – The property expression whose ranges are to be retrieved.

  • direct – Specifies if the direct ranges should be retrieved (True), or if all ranges should be retrieved (False).

Returns:

Let N = equivalent_classes(ObjectSomeValuesFrom(ObjectInverseOf(pe) owl:Thing)). If direct is True: then if N is not empty then the return value is N, else the return value is the result of super_classes(ObjectSomeValuesFrom(ObjectInverseOf(pe) owl:Thing), true). If direct is False: then the result of super_classes(ObjectSomeValuesFrom(ObjectInverseOf(pe) owl:Thing), false) together with N if N is non-empty.

object_property_values(ind: owlapy.model.OWLNamedIndividual, pe: owlapy.model.OWLObjectPropertyExpression)Iterable[owlapy.model.OWLNamedIndividual][source]

Gets the object property values for the specified individual and object property expression.

Parameters:
  • ind – The individual that is the subject of the object property values

  • pe – The object property expression whose values are to be retrieved for the specified individual

Returns:

The named individuals such that for each individual j, the set of reasoner axioms entails ObjectPropertyAssertion(pe ind j).

reset()[source]

The reset method shall reset any cached state

same_individuals(ce: owlapy.model.OWLNamedIndividual)Iterable[owlapy.model.OWLNamedIndividual][source]

Gets the individuals that are the same as the specified individual with respect to the set of reasoner axioms.

Parameters:

ind – The individual whose same individuals are to be retrieved.

Returns:

All individuals x where the root ontology imports closure entails SameIndividual(ind x).

sub_classes(ce: owlapy.model.OWLClassExpression, direct: bool = False)Iterable[owlapy.model.OWLClass][source]

Gets the set of named classes that are the strict (potentially direct) subclasses of the specified class expression with respect to the reasoner axioms.

Parameters:
  • ce – The class expression whose strict (direct) subclasses are to be retrieved.

  • direct – Specifies if the direct subclasses should be retrieved (True) or if the all subclasses (descendant) classes should be retrieved (False).

Returns:

If direct is True, each class C where reasoner axioms entails DirectSubClassOf(C, ce). If direct is False, each class C where reasoner axioms entails StrictSubClassOf(C, ce). If ce is equivalent to owl:Nothing then nothing will be returned.

sub_data_properties(dp: owlapy.model.OWLDataProperty, direct: bool = False)Iterable[owlapy.model.OWLDataProperty][source]

Gets the set of named data properties that are the strict (potentially direct) subproperties of the specified data property expression with respect to the imports closure of the root ontology.

Parameters:
  • dp – The data property whose strict (direct) subproperties are to be retrieved.

  • direct – Specifies if the direct subproperties should be retrieved (True) or if the all subproperties (descendants) should be retrieved (False).

Returns:

If direct is True, each property P where the set of reasoner axioms entails DirectSubDataPropertyOf(P, pe). If direct is False, each property P where the set of reasoner axioms entails StrictSubDataPropertyOf(P, pe). If pe is equivalent to owl:bottomDataProperty then nothing will be returned.

sub_object_properties(op: owlapy.model.OWLObjectPropertyExpression, direct: bool = False)Iterable[owlapy.model.OWLObjectPropertyExpression][source]

Gets the stream of simplified object property expressions that are the strict (potentially direct) subproperties of the specified object property expression with respect to the imports closure of the root ontology.

Parameters:
  • op – The object property expression whose strict (direct) subproperties are to be retrieved.

  • direct – Specifies if the direct subproperties should be retrieved (True) or if the all subproperties (descendants) should be retrieved (False).

Returns:

If direct is True, simplified object property expressions, such that for each simplified object property expression, P, the set of reasoner axioms entails DirectSubObjectPropertyOf(P, pe). If direct is False, simplified object property expressions, such that for each simplified object property expression, P, the set of reasoner axioms entails StrictSubObjectPropertyOf(P, pe). If pe is equivalent to owl:bottomObjectProperty then nothing will be returned.

super_classes(ce: owlapy.model.OWLClassExpression, direct: bool = False)Iterable[owlapy.model.OWLClass][source]

Gets the stream of named classes that are the strict (potentially direct) super classes of the specified class expression with respect to the imports closure of the root ontology.

Parameters:
  • ce – The class expression whose strict (direct) super classes are to be retrieved.

  • direct – Specifies if the direct super classes should be retrieved (True) or if the all super classes (ancestors) classes should be retrieved (False).

Returns:

If direct is True, each class C where the set of reasoner axioms entails DirectSubClassOf(ce, C). If direct is False, each class C where set of reasoner axioms entails StrictSubClassOf(ce, C). If ce is equivalent to owl:Thing then nothing will be returned.

types(ind: owlapy.model.OWLNamedIndividual, direct: bool = False)Iterable[owlapy.model.OWLClass][source]

Gets the named classes which are (potentially direct) types of the specified named individual.

Parameters:
  • ind – The individual whose types are to be retrieved.

  • direct – Specifies if the direct types should be retrieved (True), or if all types should be retrieved (False).

Returns:

If direct is True, each named class C where the set of reasoner axioms entails DirectClassAssertion(C, ind). If direct is False, each named class C where the set of reasoner axioms entails ClassAssertion(C, ind).