pyowl2.class_expression.data_has_value
Implements a Web Ontology Language (OWL) class expression that restricts individuals to those possessing a specific data property with a defined literal value.
Description
The software models a specific type of restriction within the Web Ontology Language known as a data value restriction, which defines a class consisting of individuals that have a particular data property filled with a specific literal. By extending the abstract class expression interface, this implementation encapsulates a data property expression and a literal value to enforce constraints where an individual must possess an exact data attribute match to be considered a member of the class. The design utilizes property getters and setters to manage the internal state, allowing the associated property and literal to be modified dynamically after instantiation. Furthermore, a string representation method is provided to generate a human-readable functional syntax output, which aids in debugging and serialization by displaying the restriction type alongside its constituent property and value.
Classes
This class represents a restriction in the Web Ontology Language (OWL) that defines a class of individuals based on the existence of a specific data property value. It asserts that an individual belongs to the defined class if it possesses a particular data property filled with a specific literal value, such as having an age of exactly 30. By encapsulating a data property expression and a target literal, this entity enables the precise formulation of class definitions that depend on concrete data assertions within an ontology. |
Module Contents
UML Class Diagram for OWLDataHasValue
- class OWLDataHasValue(
- expression: pyowl2.abstracts.data_property_expression.OWLDataPropertyExpression,
- literal: pyowl2.literal.literal.OWLLiteral,
Bases:
pyowl2.abstracts.class_expression.OWLClassExpression
This class represents a restriction in the Web Ontology Language (OWL) that defines a class of individuals based on the existence of a specific data property value. It asserts that an individual belongs to the defined class if it possesses a particular data property filled with a specific literal value, such as having an age of exactly 30. By encapsulating a data property expression and a target literal, this entity enables the precise formulation of class definitions that depend on concrete data assertions within an ontology.
- Parameters:
data_property_expression (OWLDataPropertyExpression) – The data property expression that defines the relationship between the subject individual and the specific literal value required by the restriction.
literal (OWLLiteral) – The specific literal value that the data property expression must take for the restriction to be satisfied.
- __str__() str[source]
Returns a human-readable string representation of the data property value restriction, formatted in a functional syntax style. The resulting string concatenates the class name with the string representations of the underlying data property expression and the literal value, separated by a space within parentheses. This representation is useful for debugging and logging, and it has no side effects on the object’s internal state.
- Returns:
A string representation of the object, formatted as ‘DataHasValue(data_property_expression literal)’.
- Return type:
str
- _data_property_expression: pyowl2.abstracts.data_property_expression.OWLDataPropertyExpression
- _literal: pyowl2.literal.literal.OWLLiteral
- property data_property_expression: pyowl2.abstracts.data_property_expression.OWLDataPropertyExpression
Assigns the specified data property expression to this OWLDataHasValue restriction, updating the internal state of the object. This method replaces any previously associated data property expression with the provided value, which must be an instance of OWLDataPropertyExpression. The modification effectively changes which data property is being constrained by this specific class expression.
- Parameters:
value (OWLDataPropertyExpression) – The OWL data property expression to assign to the object.
- property literal: pyowl2.literal.literal.OWLLiteral
Updates the specific literal value associated with this data property restriction. The method accepts an OWLLiteral object and assigns it to the internal state, effectively defining the concrete value that the data property must match. This operation overwrites any previously stored literal and does not return a value.
- Parameters:
value (OWLLiteral) – The OWL literal value to set.