ontolearn.refinement_operators

Refinement Operators for refinement-based concept learners.

Classes

LengthBasedRefinement

A top-down length based ("no semantic information leveraged) refinement operator in ALC.

ModifiedCELOERefinement

A top down/downward refinement operator in SHIQ(D).

ExpressRefinement

A top-down refinement operator in ALCHIQ(D).

Module Contents

class ontolearn.refinement_operators.LengthBasedRefinement(knowledge_base: KnowledgeBase, use_inverse: bool = True, use_data_properties: bool = False, use_card_restrictions: bool = True, use_nominals: bool = True, min_cardinality_restriction: int = 2, max_cardinality_restriction: int = 5)[source]

Bases: ontolearn.abstracts.BaseRefinement

A top-down length based (“no semantic information leveraged) refinement operator in ALC.

use_inverse
use_data_properties
use_card_restrictions
use_nominals
top_refinements: set = None
pos = None
neg = None
set_input_examples(pos: frozenset, neg: frozenset)[source]
refine_top() Iterable[source]

Refine Top Class Expression

rho(T)

  1. Most General OWL Named Concepts

2. Complement of Least General OWL Named Concepts General 3- Intersection and Union of (1) and (2) 4. Restriction: SomeValuesFrom and AllValuesFrom 4.1. For each object property, return SomeValuesFrom AllValuesFrom with (1) / (2) as fillers 4.2. For each inverse of object property, return SomeValuesFrom AllValuesFrom with (1) / (2) as fillers 4.3. For each object property, return OWLObjectMinCardinality 4.4. For each inverse of object property, return OWLObjectMinCardinality

refine_atomic_concept(class_expression: owlapy.class_expression.OWLClass) Generator[owlapy.class_expression.OWLObjectIntersectionOf, None, None][source]
refine_complement_of(class_expression: owlapy.class_expression.OWLObjectComplementOf) Generator[owlapy.class_expression.OWLObjectComplementOf, None, None][source]
refine_object_some_values_from(class_expression: owlapy.class_expression.OWLObjectSomeValuesFrom) Iterable[owlapy.class_expression.OWLClassExpression][source]
refine_object_all_values_from(class_expression: owlapy.class_expression.OWLObjectAllValuesFrom) Iterable[owlapy.class_expression.OWLClassExpression][source]
refine_object_union_of(class_expression: owlapy.class_expression.OWLObjectUnionOf) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine OWLObjectUnionof by refining each operands:

refine_object_intersection_of(class_expression: owlapy.class_expression.OWLObjectIntersectionOf) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine OWLObjectIntersectionOf by refining each operands:

refine(class_expression) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine a given concept.

Parameters:

ce (OWLClassExpression) – Concept to refine.

Returns:

New refined concepts.

static from_iterables(cls, a_operands, b_operands)[source]
class ontolearn.refinement_operators.ModifiedCELOERefinement(knowledge_base: KnowledgeBase, value_splitter: AbstractValueSplitter | None = None, max_child_length: int = 10, use_negation: bool = True, use_all_constructor: bool = True, use_inverse: bool = True, use_card_restrictions: bool = True, use_numeric_datatypes: bool = True, use_time_datatypes: bool = True, use_boolean_datatype: bool = True, card_limit: int = 10)[source]

Bases: ontolearn.abstracts.BaseRefinement[ontolearn.search.OENode]

A top down/downward refinement operator in SHIQ(D).

__slots__ = ('max_child_length', 'use_negation', 'use_all_constructor', 'use_inverse',...
kb: KnowledgeBase
value_splitter: AbstractValueSplitter | None
max_child_length: int
use_negation: bool
use_all_constructor: bool
use_card_restrictions: bool
use_numeric_datatypes: bool
use_time_datatypes: bool
use_boolean_datatype: bool
card_limit: int
max_nr_fillers: DefaultDict[owlapy.owl_property.OWLObjectPropertyExpression, int]
dp_splits: Dict[owlapy.owl_property.OWLDataPropertyExpression, List[owlapy.owl_literal.OWLLiteral]]
generator: ConceptGenerator
use_inverse
refine_atomic_concept(ce: owlapy.class_expression.OWLClass, max_length: int, current_domain: owlapy.class_expression.OWLClassExpression | None = None) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refinement operator implementation in CELOE-DL-learner, distinguishes the refinement of atomic concepts and start concept(they called Top concept). [1] Concept learning, Lehmann et. al

  1. Generate all subconcepts given C, Denoted by (SH_down(C)),

(2) Generate {A AND C | A in SH_down(C)}, (2) Generate {A OR C | A in SH_down(C)}, (3) Generate {not A | A in SH_down(C) AND_logical not exist B in T : B sqsubset A}, (4) Generate restrictions, (5) Intersect and union (1),(2),(3),(4), (6) Create negation of all leaf_concepts.

(***) The most general relation is not available.

Parameters:
  • ce – Atomic concept to refine.

  • max_length – Refine up to this concept length.

  • current_domain – Domain.

Returns:

Iterable of refined concepts.

refine_complement_of(ce: owlapy.class_expression.OWLObjectComplementOf) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine owl:complementOf.

Parameters:

ce (OWLObjectComplementOf) – owl:complementOf - class expression.

Returns:

Iterable of refined concepts.

refine_object_some_values_from(ce: owlapy.class_expression.OWLObjectSomeValuesFrom, max_length: int) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine owl:someValuesFrom.

Parameters:
  • ce (OWLObjectSomeValuesFrom) – owl:someValuesFrom class expression.

  • max_length (int) – Refine up to this concept length.

Returns:

Iterable of refined concepts.

refine_object_all_values_from(ce: owlapy.class_expression.OWLObjectAllValuesFrom, max_length: int) Iterable[owlapy.class_expression.OWLObjectAllValuesFrom][source]

Refine owl:allValuesFrom.

Parameters:
  • ce (OWLObjectAllValuesFrom) – owl:allValuesFrom - class expression.

  • max_length (int) – Refine up to this concept length.

Returns:

Iterable of refined concepts.

refine_object_min_card_restriction(ce: owlapy.class_expression.OWLObjectMinCardinality, max_length: int) Iterable[owlapy.class_expression.OWLObjectMinCardinality][source]

Refine owl:minCardinality.

Parameters:
  • ce (OWLObjectMinCardinality) – owl:minCardinality - class expression.

  • max_length (int) – Refine up to this concept length.

Returns:

Iterable of refined concepts.

refine_object_max_card_restriction(ce: owlapy.class_expression.OWLObjectMaxCardinality, max_length: int) Iterable[owlapy.class_expression.OWLObjectMaxCardinality][source]

Refine owl:maxCardinality.

Parameters:
  • ce (OWLObjectMaxCardinality) – owl:maxCardinality - class expression.

  • max_length (int) – Refine up to this concept length.

Returns:

Iterable of refined concepts.

refine_object_union_of(ce: owlapy.class_expression.OWLObjectUnionOf, max_length: int, current_domain: owlapy.class_expression.OWLClassExpression | None) Iterable[owlapy.class_expression.OWLObjectUnionOf][source]

Refine owl:unionOf.

Given a node corresponding a concepts that comprises union operation: 1) Obtain two concepts A, B, 2) Refine A and union refinements with B, 3) Repeat (2) for B.

Parameters:
  • ce (OWLObjectUnionOf) – owl:unionOf - class expression.

  • current_domain (OWLClassExpression) – Domain.

  • max_length (int) – Refine up to this concept length.

Returns:

Iterable of refined concepts.

refine_object_intersection_of(ce: owlapy.class_expression.OWLObjectIntersectionOf, max_length: int, current_domain: owlapy.class_expression.OWLClassExpression | None) Iterable[owlapy.class_expression.OWLObjectIntersectionOf][source]

Refine owl:intersectionOf.

Parameters:
  • ce (OWLObjectIntersectionOf) – owl:intersectionOf - class expression.

  • current_domain (int) – Domain.

Returns:

Iterable of refined concepts.

refine_data_some_values_from(ce: owlapy.class_expression.OWLDataSomeValuesFrom) Iterable[owlapy.class_expression.OWLDataSomeValuesFrom][source]

Refine owl:someValuesFrom for data properties.

Parameters:

ce (OWLDataSomeValuesFrom) – owl:someValuesFrom - class expression.

Returns:

Iterable of refined concepts.

refine_data_has_value(ce: owlapy.class_expression.OWLDataHasValue) Iterable[owlapy.class_expression.OWLDataHasValue][source]

Refine owl:hasValue.

Parameters:

ce (OWLDataHasValue) – owl:hasValue - class expression.

Returns:

Iterable of refined concepts.

refine(ce: owlapy.class_expression.OWLClassExpression, max_length: int, current_domain: owlapy.class_expression.OWLClassExpression | None = None) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine a given concept.

Parameters:
  • ce – Concept to refine.

  • max_length – Refine up to this concept length.

  • current_domain – Domain.

Returns:

Iterable of refined concepts.

class ontolearn.refinement_operators.ExpressRefinement(knowledge_base, downsample: bool = True, expressivity: float = 0.8, sample_fillers_count: int = 5, value_splitter: AbstractValueSplitter | None = None, max_child_length: int = 10, use_inverse: bool = True, use_card_restrictions: bool = True, use_numeric_datatypes: bool = True, use_time_datatypes: bool = True, use_boolean_datatype: bool = True, card_limit: int = 10)[source]

Bases: ModifiedCELOERefinement

A top-down refinement operator in ALCHIQ(D).

__slots__ = ('expressivity', 'downsample', 'sample_fillers_count', 'generator')
expressivity: float
downsample: bool
sample_fillers_count: int
generator: ConceptGenerator
refine_atomic_concept(ce: owlapy.class_expression.OWLClass) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine atomic concept. :param ce: Atomic concept to refine.

Returns:

Iterable of refined concepts.

refine_complement_of(ce: owlapy.class_expression.OWLObjectComplementOf) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine owl:complementOf.

Parameters:

ce (OWLObjectComplementOf) – owl:complementOf - class expression.

Returns:

Iterable of refined concepts.

refine_object_some_values_from(ce: owlapy.class_expression.OWLObjectSomeValuesFrom) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine owl:someValuesFrom.

Parameters:

ce (OWLObjectSomeValuesFrom) – owl:someValuesFrom class expression.

Returns:

Iterable of refined concepts.

refine_object_all_values_from(ce: owlapy.class_expression.OWLObjectAllValuesFrom) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine owl:allValuesFrom.

Parameters:

ce (OWLObjectAllValuesFrom) – owl:allValuesFrom - class expression.

Returns:

Iterable of refined concepts.

refine_object_min_card_restriction(ce: owlapy.class_expression.OWLObjectMinCardinality) Iterable[owlapy.class_expression.OWLObjectMinCardinality][source]

Refine owl:allValuesFrom.

Parameters:

ce (OWLObjectAllValuesFrom) – owl:allValuesFrom - class expression.

Returns:

Iterable of refined concepts.

refine_object_max_card_restriction(ce: owlapy.class_expression.OWLObjectMaxCardinality) Iterable[owlapy.class_expression.OWLObjectMaxCardinality][source]

Refine owl:maxCardinality.

Parameters:

ce (OWLObjectMaxCardinality) – owl:maxCardinality - class expression.

Returns:

Iterable of refined concepts.

refine_object_union_of(ce: owlapy.class_expression.OWLObjectUnionOf) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine owl:unionOf.

Parameters:

ce (OWLObjectUnionOf) – owl:unionOf - class expression.

Returns:

Iterable of refined concepts.

refine_object_intersection_of(ce: owlapy.class_expression.OWLObjectIntersectionOf) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine owl:intersectionOf.

Parameters:

ce (OWLObjectIntersectionOf) – owl:intersectionOf - class expression.

Returns:

Iterable of refined concepts.

refine_data_some_values_from(ce: owlapy.class_expression.OWLDataSomeValuesFrom) Iterable[owlapy.class_expression.OWLDataSomeValuesFrom][source]

Refine owl:someValuesFrom for data properties.

Parameters:

ce (OWLDataSomeValuesFrom) – owl:someValuesFrom - class expression.

Returns:

Iterable of refined concepts.

refine_data_has_value(ce: owlapy.class_expression.OWLDataHasValue) Iterable[owlapy.class_expression.OWLDataHasValue][source]

Refine owl:hasValue.

Parameters:

ce (OWLDataHasValue) – owl:hasValue - class expression.

Returns:

Iterable of refined concepts.

refine(ce, **kwargs) Iterable[owlapy.class_expression.OWLClassExpression][source]

Refine a given concept.

Parameters:

ce – Concept to refine

Returns:

Iterable of refined concepts.