owlapy.class_expression.restriction

OWL Restrictions

Module Contents

Classes

OWLRestriction

Represents an Object Property Restriction or Data Property Restriction in the OWL 2 specification.

OWLHasValueRestriction

Represent a HasValue restriction in the OWL 2

OWLObjectRestriction

Represents an Object Property Restriction in the OWL 2 specification.

OWLQuantifiedRestriction

Represents a quantified restriction.

OWLCardinalityRestriction

Base interface for owl min and max cardinality restriction.

OWLQuantifiedObjectRestriction

Represents a quantified object restriction.

OWLObjectCardinalityRestriction

Represents Object Property Cardinality Restrictions in the OWL 2 specification.

OWLObjectMinCardinality

A minimum cardinality expression ObjectMinCardinality( n OPE CE ) consists of a nonnegative integer n, an object

OWLObjectMaxCardinality

A maximum cardinality expression ObjectMaxCardinality( n OPE CE ) consists of a nonnegative integer n, an object

OWLObjectExactCardinality

An exact cardinality expression ObjectExactCardinality( n OPE CE ) consists of a nonnegative integer n, an object

OWLObjectSomeValuesFrom

An existential class expression ObjectSomeValuesFrom( OPE CE ) consists of an object property expression OPE and

OWLObjectAllValuesFrom

A universal class expression ObjectAllValuesFrom( OPE CE ) consists of an object property expression OPE and a

OWLObjectHasSelf

A self-restriction ObjectHasSelf( OPE ) consists of an object property expression OPE,

OWLObjectHasValue

A has-value class expression ObjectHasValue( OPE a ) consists of an object property expression OPE and an

OWLObjectOneOf

An enumeration of individuals ObjectOneOf( a1 ... an ) contains exactly the individuals ai with 1 ≤ i ≤ n.

OWLDataRestriction

Represents a Data Property Restriction.

OWLQuantifiedDataRestriction

Represents a quantified data restriction.

OWLDataCardinalityRestriction

Represents Data Property Cardinality Restrictions.

OWLDataMinCardinality

A minimum cardinality expression DataMinCardinality( n DPE DR ) consists of a nonnegative integer n, a data

OWLDataMaxCardinality

A maximum cardinality expression ObjectMaxCardinality( n OPE CE ) consists of a nonnegative integer n, an object

OWLDataExactCardinality

An exact cardinality expression ObjectExactCardinality( n OPE CE ) consists of a nonnegative integer n, an

OWLDataSomeValuesFrom

An existential class expression DataSomeValuesFrom( DPE1 ... DPEn DR ) consists of n data property expressions

OWLDataAllValuesFrom

A universal class expression DataAllValuesFrom( DPE1 ... DPEn DR ) consists of n data property expressions DPEi,

OWLDataHasValue

A has-value class expression DataHasValue( DPE lt ) consists of a data property expression DPE and a literal lt,

OWLDataOneOf

An enumeration of literals DataOneOf( lt1 ... ltn ) contains exactly the explicitly specified literals lti with

OWLDatatypeRestriction

A datatype restriction DatatypeRestriction( DT F1 lt1 ... Fn ltn ) consists of a unary datatype DT and n pairs

OWLFacetRestriction

A facet restriction is used to restrict a particular datatype.

Attributes

Literals

owlapy.class_expression.restriction.Literals
class owlapy.class_expression.restriction.OWLRestriction[source]

Bases: owlapy.class_expression.class_expression.OWLAnonymousClassExpression

Represents an Object Property Restriction or Data Property Restriction in the OWL 2 specification.

__slots__ = ()
abstract get_property() owlapy.owl_property.OWLPropertyExpression[source]
Returns:

Property being restricted.

is_data_restriction() bool[source]

Determines if this is a data restriction.

Returns:

True if this is a data restriction.

is_object_restriction() bool[source]

Determines if this is an object restriction.

Returns:

True if this is an object restriction.

class owlapy.class_expression.restriction.OWLHasValueRestriction(value: _T)[source]

Bases: Generic[_T], OWLRestriction, owlapy.meta_classes.HasFiller[_T]

Represent a HasValue restriction in the OWL 2

Parameters:

_T – The value type.

__slots__ = ()
__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

get_filler() _T[source]

Gets the filler for this restriction. In the case of an object restriction this will be an individual, in the case of a data restriction this will be a constant (data value). For quantified restriction this will be a class expression or a data range.

Returns:

the value

class owlapy.class_expression.restriction.OWLObjectRestriction[source]

Bases: OWLRestriction

Represents an Object Property Restriction in the OWL 2 specification.

__slots__ = ()
is_object_restriction() bool[source]

Determines if this is an object restriction.

Returns:

True if this is an object restriction.

abstract get_property() owlapy.owl_property.OWLObjectPropertyExpression[source]
Returns:

Property being restricted.

class owlapy.class_expression.restriction.OWLQuantifiedRestriction[source]

Bases: Generic[_T], OWLRestriction, owlapy.meta_classes.HasFiller[_T]

Represents a quantified restriction.

Parameters:

_T – value type

__slots__ = ()
class owlapy.class_expression.restriction.OWLCardinalityRestriction(cardinality: int, filler: _F)[source]

Bases: Generic[_F], OWLQuantifiedRestriction[_F], owlapy.meta_classes.HasCardinality

Base interface for owl min and max cardinality restriction.

Parameters:

_F – Type of filler.

__slots__ = ()
get_cardinality() int[source]

Gets the cardinality of a restriction.

Returns:

The cardinality. A non-negative integer.

get_filler() _F[source]

Gets the filler for this restriction. In the case of an object restriction this will be an individual, in the case of a data restriction this will be a constant (data value). For quantified restriction this will be a class expression or a data range.

Returns:

the value

class owlapy.class_expression.restriction.OWLQuantifiedObjectRestriction(filler: owlapy.class_expression.class_expression.OWLClassExpression)[source]

Bases: OWLQuantifiedRestriction[owlapy.class_expression.class_expression.OWLClassExpression], OWLObjectRestriction

Represents a quantified object restriction.

__slots__ = ()
get_filler() owlapy.class_expression.class_expression.OWLClassExpression[source]

Gets the filler for this restriction. In the case of an object restriction this will be an individual, in the case of a data restriction this will be a constant (data value). For quantified restriction this will be a class expression or a data range.

Returns:

the value

class owlapy.class_expression.restriction.OWLObjectCardinalityRestriction(cardinality: int, property: owlapy.owl_property.OWLObjectPropertyExpression, filler: owlapy.class_expression.class_expression.OWLClassExpression)[source]

Bases: OWLCardinalityRestriction[owlapy.class_expression.class_expression.OWLClassExpression], OWLQuantifiedObjectRestriction

Represents Object Property Cardinality Restrictions in the OWL 2 specification.

__slots__ = ()
get_property() owlapy.owl_property.OWLObjectPropertyExpression[source]
Returns:

Property being restricted.

__repr__()[source]

Return repr(self).

__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

class owlapy.class_expression.restriction.OWLObjectMinCardinality(cardinality: int, property: owlapy.owl_property.OWLObjectPropertyExpression, filler: owlapy.class_expression.class_expression.OWLClassExpression)[source]

Bases: OWLObjectCardinalityRestriction

A minimum cardinality expression ObjectMinCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE to at least n different individuals that are instances of CE. (https://www.w3.org/TR/owl2-syntax/#Minimum_Cardinality)

__slots__ = ('_cardinality', '_filler', '_property')
type_index: Final = 3008
class owlapy.class_expression.restriction.OWLObjectMaxCardinality(cardinality: int, property: owlapy.owl_property.OWLObjectPropertyExpression, filler: owlapy.class_expression.class_expression.OWLClassExpression)[source]

Bases: OWLObjectCardinalityRestriction

A maximum cardinality expression ObjectMaxCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE

to at most n different individuals that are instances of CE. (https://www.w3.org/TR/owl2-syntax/#Maximum_Cardinality)

__slots__ = ('_cardinality', '_filler', '_property')
type_index: Final = 3010
class owlapy.class_expression.restriction.OWLObjectExactCardinality(cardinality: int, property: owlapy.owl_property.OWLObjectPropertyExpression, filler: owlapy.class_expression.class_expression.OWLClassExpression)[source]

Bases: OWLObjectCardinalityRestriction

An exact cardinality expression ObjectExactCardinality( n OPE CE ) consists of a nonnegative integer n, an object

property expression OPE, and a class expression CE, and it contains all those individuals that are connected by to exactly n different individuals that are instances of CE.

(https://www.w3.org/TR/owl2-syntax/#Exact_Cardinality)

__slots__ = ('_cardinality', '_filler', '_property')
type_index: Final = 3009
as_intersection_of_min_max() owlapy.class_expression.nary_boolean_expression.OWLObjectIntersectionOf[source]

Obtains an equivalent form that is a conjunction of a min cardinality and max cardinality restriction.

Returns:

The semantically equivalent but structurally simpler form (= 1 R C) = >= 1 R C and <= 1 R C.

class owlapy.class_expression.restriction.OWLObjectSomeValuesFrom(property: owlapy.owl_property.OWLObjectPropertyExpression, filler: owlapy.class_expression.class_expression.OWLClassExpression)[source]

Bases: OWLQuantifiedObjectRestriction

An existential class expression ObjectSomeValuesFrom( OPE CE ) consists of an object property expression OPE and a class expression CE, and it contains all those individuals that are connected by OPE to an individual that is an instance of CE.

__slots__ = ('_property', '_filler')
type_index: Final = 3005
__repr__()[source]

Return repr(self).

__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

get_property() owlapy.owl_property.OWLObjectPropertyExpression[source]
Returns:

Property being restricted.

class owlapy.class_expression.restriction.OWLObjectAllValuesFrom(property: owlapy.owl_property.OWLObjectPropertyExpression, filler: owlapy.class_expression.class_expression.OWLClassExpression)[source]

Bases: OWLQuantifiedObjectRestriction

A universal class expression ObjectAllValuesFrom( OPE CE ) consists of an object property expression OPE and a class expression CE, and it contains all those individuals that are connected by OPE only to individuals that are instances of CE. (https://www.w3.org/TR/owl2-syntax/#Universal_Quantification)

__slots__ = ('_property', '_filler')
type_index: Final = 3006
__repr__()[source]

Return repr(self).

__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

get_property() owlapy.owl_property.OWLObjectPropertyExpression[source]
Returns:

Property being restricted.

class owlapy.class_expression.restriction.OWLObjectHasSelf(property: owlapy.owl_property.OWLObjectPropertyExpression)[source]

Bases: OWLObjectRestriction

A self-restriction ObjectHasSelf( OPE ) consists of an object property expression OPE, and it contains all those individuals that are connected by OPE to themselves. (https://www.w3.org/TR/owl2-syntax/#Self-Restriction)

__slots__ = '_property'
type_index: Final = 3011
get_property() owlapy.owl_property.OWLObjectPropertyExpression[source]
Returns:

Property being restricted.

__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

__repr__()[source]

Return repr(self).

class owlapy.class_expression.restriction.OWLObjectHasValue(property: owlapy.owl_property.OWLObjectPropertyExpression, individual: owlapy.owl_individual.OWLIndividual)[source]

Bases: OWLHasValueRestriction[owlapy.owl_individual.OWLIndividual], OWLObjectRestriction

A has-value class expression ObjectHasValue( OPE a ) consists of an object property expression OPE and an individual a, and it contains all those individuals that are connected by OPE to a. Each such class expression can be seen as a syntactic shortcut for the class expression ObjectSomeValuesFrom( OPE ObjectOneOf( a ) ). (https://www.w3.org/TR/owl2-syntax/#Individual_Value_Restriction)

__slots__ = ('_property', '_v')
type_index: Final = 3007
get_property() owlapy.owl_property.OWLObjectPropertyExpression[source]
Returns:

Property being restricted.

as_some_values_from() owlapy.class_expression.class_expression.OWLClassExpression[source]

A convenience method that obtains this restriction as an existential restriction with a nominal filler.

Returns:

The existential equivalent of this value restriction. simp(HasValue(p a)) = some(p {a}).

__repr__()[source]

Return repr(self).

class owlapy.class_expression.restriction.OWLObjectOneOf(values: owlapy.owl_individual.OWLIndividual | Iterable[owlapy.owl_individual.OWLIndividual])[source]

Bases: owlapy.class_expression.class_expression.OWLAnonymousClassExpression, owlapy.meta_classes.HasOperands[owlapy.owl_individual.OWLIndividual]

An enumeration of individuals ObjectOneOf( a1 … an ) contains exactly the individuals ai with 1 ≤ i ≤ n. (https://www.w3.org/TR/owl2-syntax/#Enumeration_of_Individuals)

__slots__ = '_values'
type_index: Final = 3004
individuals() Iterable[owlapy.owl_individual.OWLIndividual][source]

Gets the individuals that are in the oneOf. These individuals represent the exact instances (extension) of this class expression.

Returns:

The individuals that are the values of this {@code ObjectOneOf} class expression.

operands() Iterable[owlapy.owl_individual.OWLIndividual][source]

Gets the operands - e.g., the individuals in a sameAs axiom, or the classes in an equivalent classes axiom.

Returns:

The operands.

as_object_union_of() owlapy.class_expression.class_expression.OWLClassExpression[source]

Simplifies this enumeration to a union of singleton nominals.

Returns:

This enumeration in a more standard DL form. simp({a}) = {a} simp({a0, … , {an}) = unionOf({a0}, … , {an})

__hash__()[source]

Return hash(self).

__eq__(other)[source]

Return self==value.

__repr__()[source]

Return repr(self).

class owlapy.class_expression.restriction.OWLDataRestriction[source]

Bases: OWLRestriction

Represents a Data Property Restriction.

__slots__ = ()
is_data_restriction() bool[source]

Determines if this is a data restriction.

Returns:

True if this is a data restriction.

class owlapy.class_expression.restriction.OWLQuantifiedDataRestriction(filler: owlapy.owl_data_ranges.OWLDataRange)[source]

Bases: OWLQuantifiedRestriction[owlapy.owl_data_ranges.OWLDataRange], OWLDataRestriction

Represents a quantified data restriction.

__slots__ = ()
get_filler() owlapy.owl_data_ranges.OWLDataRange[source]

Gets the filler for this restriction. In the case of an object restriction this will be an individual, in the case of a data restriction this will be a constant (data value). For quantified restriction this will be a class expression or a data range.

Returns:

the value

class owlapy.class_expression.restriction.OWLDataCardinalityRestriction(cardinality: int, property: owlapy.owl_property.OWLDataPropertyExpression, filler: owlapy.owl_data_ranges.OWLDataRange)[source]

Bases: OWLCardinalityRestriction[owlapy.owl_data_ranges.OWLDataRange], OWLQuantifiedDataRestriction, OWLDataRestriction

Represents Data Property Cardinality Restrictions.

__slots__ = ()
get_property() owlapy.owl_property.OWLDataPropertyExpression[source]
Returns:

Property being restricted.

__repr__()[source]

Return repr(self).

__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

class owlapy.class_expression.restriction.OWLDataMinCardinality(cardinality: int, property: owlapy.owl_property.OWLDataPropertyExpression, filler: owlapy.owl_data_ranges.OWLDataRange)[source]

Bases: OWLDataCardinalityRestriction

A minimum cardinality expression DataMinCardinality( n DPE DR ) consists of a nonnegative integer n, a data property expression DPE, and a unary data range DR, and it contains all those individuals that are connected by DPE to at least n different literals in DR. (https://www.w3.org/TR/owl2-syntax/#Minimum_Cardinality)

__slots__ = ('_cardinality', '_filler', '_property')
type_index: Final = 3015
class owlapy.class_expression.restriction.OWLDataMaxCardinality(cardinality: int, property: owlapy.owl_property.OWLDataPropertyExpression, filler: owlapy.owl_data_ranges.OWLDataRange)[source]

Bases: OWLDataCardinalityRestriction

A maximum cardinality expression ObjectMaxCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected by OPE to at most n different individuals that are instances of CE. (https://www.w3.org/TR/owl2-syntax/#Maximum_Cardinality)

__slots__ = ('_cardinality', '_filler', '_property')
type_index: Final = 3017
class owlapy.class_expression.restriction.OWLDataExactCardinality(cardinality: int, property: owlapy.owl_property.OWLDataPropertyExpression, filler: owlapy.owl_data_ranges.OWLDataRange)[source]

Bases: OWLDataCardinalityRestriction

An exact cardinality expression ObjectExactCardinality( n OPE CE ) consists of a nonnegative integer n, an object property expression OPE, and a class expression CE, and it contains all those individuals that are connected

by OPE to exactly n different individuals that are instances of CE (https://www.w3.org/TR/owl2-syntax/#Exact_Cardinality)

__slots__ = ('_cardinality', '_filler', '_property')
type_index: Final = 3016
as_intersection_of_min_max() owlapy.class_expression.nary_boolean_expression.OWLObjectIntersectionOf[source]

Obtains an equivalent form that is a conjunction of a min cardinality and max cardinality restriction.

Returns:

The semantically equivalent but structurally simpler form (= 1 R D) = >= 1 R D and <= 1 R D.

class owlapy.class_expression.restriction.OWLDataSomeValuesFrom(property: owlapy.owl_property.OWLDataPropertyExpression, filler: owlapy.owl_data_ranges.OWLDataRange)[source]

Bases: OWLQuantifiedDataRestriction

An existential class expression DataSomeValuesFrom( DPE1 … DPEn DR ) consists of n data property expressions DPEi, 1 ≤ i ≤ n, and a data range DR whose arity must be n. Such a class expression contains all those individuals that are connected by DPEi to literals lti, 1 ≤ i ≤ n, such that the tuple ( lt1 , …, ltn ) is in DR. A class expression of the form DataSomeValuesFrom( DPE DR ) can be seen as a syntactic shortcut for the class expression DataMinCardinality( 1 DPE DR ). (https://www.w3.org/TR/owl2-syntax/#Existential_Quantification_2)

__slots__ = '_property'
type_index: Final = 3012
__repr__()[source]

Return repr(self).

__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

get_property() owlapy.owl_property.OWLDataPropertyExpression[source]
Returns:

Property being restricted.

class owlapy.class_expression.restriction.OWLDataAllValuesFrom(property: owlapy.owl_property.OWLDataPropertyExpression, filler: owlapy.owl_data_ranges.OWLDataRange)[source]

Bases: OWLQuantifiedDataRestriction

A universal class expression DataAllValuesFrom( DPE1 … DPEn DR ) consists of n data property expressions DPEi, 1 ≤ i ≤ n, and a data range DR whose arity must be n. Such a class expression contains all those individuals that

are connected by DPEi only to literals lti, 1 ≤ i ≤ n, such that each tuple ( lt1 , …, ltn ) is in DR. A class

expression of the form DataAllValuesFrom( DPE DR ) can be seen as a syntactic shortcut for the class expression DataMaxCardinality( 0 DPE DataComplementOf( DR ) ). (https://www.w3.org/TR/owl2-syntax/#Universal_Quantification_2)

__slots__ = '_property'
type_index: Final = 3013
__repr__()[source]

Return repr(self).

__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

get_property() owlapy.owl_property.OWLDataPropertyExpression[source]
Returns:

Property being restricted.

class owlapy.class_expression.restriction.OWLDataHasValue(property: owlapy.owl_property.OWLDataPropertyExpression, value: owlapy.owl_literal.OWLLiteral)[source]

Bases: OWLHasValueRestriction[owlapy.owl_literal.OWLLiteral], OWLDataRestriction

A has-value class expression DataHasValue( DPE lt ) consists of a data property expression DPE and a literal lt, and it contains all those individuals that are connected by DPE to lt. Each such class expression can be seen as a syntactic shortcut for the class expression DataSomeValuesFrom( DPE DataOneOf( lt ) ). (https://www.w3.org/TR/owl2-syntax/#Literal_Value_Restriction)

__slots__ = '_property'
type_index: Final = 3014
__repr__()[source]

Return repr(self).

__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

as_some_values_from() owlapy.class_expression.class_expression.OWLClassExpression[source]

A convenience method that obtains this restriction as an existential restriction with a nominal filler.

Returns:

The existential equivalent of this value restriction. simp(HasValue(p a)) = some(p {a}).

get_property() owlapy.owl_property.OWLDataPropertyExpression[source]
Returns:

Property being restricted.

class owlapy.class_expression.restriction.OWLDataOneOf(values: owlapy.owl_literal.OWLLiteral | Iterable[owlapy.owl_literal.OWLLiteral])[source]

Bases: owlapy.owl_data_ranges.OWLDataRange, owlapy.meta_classes.HasOperands[owlapy.owl_literal.OWLLiteral]

An enumeration of literals DataOneOf( lt1 … ltn ) contains exactly the explicitly specified literals lti with 1 ≤ i ≤ n. The resulting data range has arity one. (https://www.w3.org/TR/owl2-syntax/#Enumeration_of_Literals)

type_index: Final = 4003
values() Iterable[owlapy.owl_literal.OWLLiteral][source]

Gets the values that are in the oneOf.

Returns:

The values of this {@code DataOneOf} class expression.

operands() Iterable[owlapy.owl_literal.OWLLiteral][source]

Gets the operands - e.g., the individuals in a sameAs axiom, or the classes in an equivalent classes axiom.

Returns:

The operands.

__hash__()[source]

Return hash(self).

__eq__(other)[source]

Return self==value.

__repr__()[source]

Return repr(self).

class owlapy.class_expression.restriction.OWLDatatypeRestriction(type_: owlapy.owl_datatype.OWLDatatype, facet_restrictions: OWLFacetRestriction | Iterable[OWLFacetRestriction])[source]

Bases: owlapy.owl_data_ranges.OWLDataRange

A datatype restriction DatatypeRestriction( DT F1 lt1 … Fn ltn ) consists of a unary datatype DT and n pairs ( Fi , lti ). The resulting data range is unary and is obtained by restricting the value space of DT according to the semantics of all ( Fi , vi ) (multiple pairs are interpreted conjunctively), where vi are the data values of the literals lti. (https://www.w3.org/TR/owl2-syntax/#Datatype_Restrictions)

__slots__ = ('_type', '_facet_restrictions')
type_index: Final = 4006
get_datatype() owlapy.owl_datatype.OWLDatatype[source]
get_facet_restrictions() Sequence[OWLFacetRestriction][source]
__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

__repr__()[source]

Return repr(self).

class owlapy.class_expression.restriction.OWLFacetRestriction(facet: owlapy.vocab.OWLFacet, literal: Literals)[source]

Bases: owlapy.owl_object.OWLObject

A facet restriction is used to restrict a particular datatype.

__slots__ = ('_facet', '_literal')
type_index: Final = 4007
get_facet() owlapy.vocab.OWLFacet[source]
get_facet_value() owlapy.owl_literal.OWLLiteral[source]
__eq__(other)[source]

Return self==value.

__hash__()[source]

Return hash(self).

__repr__()[source]

Return repr(self).