axiom.datatype

OWL 2 Data Range and data-property class-expression structural elements.

This module models two related families of OWL 2 structural elements plus the owned StructuralFragment scaffolding their RDF mappings require.

Data Range expressions (subclasses of DataRange):

  • DeclarationDatatype — Declaration( Datatype( DT ) ); the fallback when no richer data range can be reconstructed from the graph.

  • DataIntersectionOf — DataIntersectionOf( DR1 ... DRn ), n >= 2; owns an Seq fragment.

  • DataUnionOf — DataUnionOf( DR1 ... DRn ), n >= 2; owns an Seq fragment.

  • DataComplementOf — DataComplementOf( DR ); the operand is a cross-axiom node reference.

  • DataOneOf — DataOneOf( lt1 ... ltn ), n >= 1; owns an Seq fragment of literals.

  • DatatypeRestriction — DatatypeRestriction( DT F1 lt1 ... Fn ltn ); owns a FacetList fragment carrying both the cons-cell chain and the per-facet (_:yi Fi lti) triples.

Data property class expressions (subclasses of DataRestriction):

Owned scaffolding fragments defined here:

DataRange and DataRestriction are abstract umbrellas: both block direct instantiation, both provide the shared declaration triple (rdfs:Datatype for DataRange subclasses, owl:Restriction for DataRestriction subclasses) via as_triples, and concrete subclasses extend that projection with their own predicate-specific triples. Owned fragments share their owning element’s context and contribute their as_triples to the owner’s RDF partition; cross-axiom operands are RDF node identifiers via the package’s annotated aliases.

Classes

DataRange

Abstract umbrella for OWL 2 Data Range expressions.

DeclarationDatatype

Element Declaration( Datatype( DT ) ) of the structural specification.

DataIntersectionOf

Element DataIntersectionOf( DR1 ... DRn ) of the OWL 2 structural specification.

DataUnionOf

Element DataUnionOf( DR1 ... DRn ) of the OWL 2 structural specification.

DataComplementOf

Element DataComplementOf( DR ) of the OWL 2 structural specification.

DataOneOf

Element DataOneOf( lt1 ... ltn ) of the OWL 2 structural specification.

DataRestriction

Abstract base for OWL 2 class expressions that restrict a data property.

DataSomeValuesFrom

Element DataSomeValuesFrom (data existential restriction) in the OWL 2 structural specification.

DataSomeValuesFromNary

Element DataSomeValuesFrom( DPE1 ... DPEn DR ), n >= 2, in the OWL 2 structural specification.

DataAllValuesFrom

Element DataAllValuesFrom( DPE DR ) in the OWL 2 structural specification.

DataAllValuesFromNary

Element DataAllValuesFrom( DPE1 ... DPEn DR ), n >= 2, in the OWL 2 structural specification.

DataHasValue

Element DataHasValue( DPE lt ) in the OWL 2 structural specification.

DataMinCardinality

Element DataMinCardinality( n DPE ) in the OWL 2 structural specification.

DataMinCardinalityQualified

Element DataMinCardinality( n DPE DR ) in the OWL 2 structural specification.

DataMaxCardinality

Element DataMaxCardinality( n DPE ) in the OWL 2 structural specification.

DataMaxCardinalityQualified

Element DataMaxCardinality( n DPE DR ) in the OWL 2 structural specification.

DataExactCardinality

Element DataExactCardinality( n DPE ) in the OWL 2 structural specification.

DataExactCardinalityQualified

Element DataExactCardinality( n DPE DR ) in the OWL 2 structural specification.

FacetEntry

One facet row in a DatatypeRestriction operand list.

FacetList

Owned rdf:List scaffolding for the operand list of DatatypeRestriction.

DatatypeRestriction

Element DatatypeRestriction( DT F1 lt1 ... Fn ltn ) in the OWL 2 structural specification.

Module Contents

class axiom.datatype.DataRange(/, **data: Any)

Bases: axiom.structural_element.DeclarationElement, abc.ABC

Abstract umbrella for OWL 2 Data Range expressions.

Not directly instantiable. Concrete subclasses include DeclarationDatatype (the fallback when no richer data range can be constructed from the graph) and the richer expressions DataIntersectionOf, DataUnionOf, DataComplementOf, DataOneOf, and DatatypeRestriction. All concrete data ranges declare rdf:type rdfs:Datatype for name.

property rdf_type: rdflib.IdentifiedNode

rdf:type object for the declaration triple.

class axiom.datatype.DeclarationDatatype(/, **data: Any)

Bases: DataRange

Element Declaration( Datatype( DT ) ) of the structural specification.

Note that all of our DataRange classes share the same properties as a DeclarationDatatype instance, but we keep this as a separate axiom so that OWL axioms can partition a graph. _This_ axiom is only constructed if we are lacking the necessary triples to construct a different DataRange axiom.

kind: Literal['DeclarationDatatype'] = 'DeclarationDatatype'
class axiom.datatype.DataIntersectionOf(/, **data: Any)

Bases: DataRange

Element DataIntersectionOf( DR1 ... DRn ) of the OWL 2 structural specification.

The main RDF node is an anonymous blank node (written _:x below). OWL 2 structural syntax requires n >= 2 data range operands.

Triples:

_:x rdf:type rdfs:Datatype .
_:x owl:intersectionOf T(SEQ DR1 ... DRn) .
kind: Literal['DataIntersectionOf'] = 'DataIntersectionOf'
intersection_of: axiom.structural_element.Seq
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Single name rdf:type rdf_type declaration triple.

class axiom.datatype.DataUnionOf(/, **data: Any)

Bases: DataRange

Element DataUnionOf( DR1 ... DRn ) of the OWL 2 structural specification.

The main RDF node is an anonymous blank node (written _:x below). OWL 2 structural syntax requires n >= 2 data range operands.

Triples:

_:x rdf:type rdfs:Datatype .
_:x owl:unionOf T(SEQ DR1 ... DRn) .
kind: Literal['DataUnionOf'] = 'DataUnionOf'
union_of: axiom.structural_element.Seq
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Single name rdf:type rdf_type declaration triple.

class axiom.datatype.DataComplementOf(/, **data: Any)

Bases: DataRange

Element DataComplementOf( DR ) of the OWL 2 structural specification.

The main RDF node is an anonymous blank node (written _:x below). complement_of is the RDF subject of the complemented datatype description (IRI or blank node); as_triples emits only this axiom’s triples (shallow projection per DR-031). Declaration and other triples for DR belong in a separate axiom instance or graph partition, not inlined here.

Triples:

_:x rdf:type rdfs:Datatype .
_:x owl:complementOf DR .
kind: Literal['DataComplementOf'] = 'DataComplementOf'
complement_of: axiom.common.N3Resource
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Single name rdf:type rdf_type declaration triple.

class axiom.datatype.DataOneOf(/, **data: Any)

Bases: DataRange

Element DataOneOf( lt1 ... ltn ) of the OWL 2 structural specification.

The main RDF node is an anonymous blank node (written _:x below). one_of is an owned Seq fragment carrying the enumerated RDF literals as rdf:first values; the fragment shares this element’s context. OWL 2 structural syntax requires n >= 1 literal operands.

Triples:

_:x rdf:type rdfs:Datatype .
_:x owl:oneOf T(SEQ lt1 ... ltn) .
kind: Literal['DataOneOf'] = 'DataOneOf'
one_of: axiom.structural_element.Seq
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Single name rdf:type rdf_type declaration triple.

class axiom.datatype.DataRestriction(/, **data: Any)

Bases: axiom.structural_element.StructuralElement, abc.ABC

Abstract base for OWL 2 class expressions that restrict a data property.

Not directly instantiable. Each concrete subclass declares a node of rdf:type owl:Restriction and pairs owl:onProperty (or owl:onProperties for n-ary forms) with a range or value predicate per the OWL 2 RDF mapping. name is the RDF subject of the restriction node (typically a blank node).

name_value: axiom.common.N3Resource = None
property name: rdflib.IdentifiedNode

Restriction node identifier (alias of name_value).

property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.DataSomeValuesFrom(/, **data: Any)

Bases: DataRestriction

Element DataSomeValuesFrom (data existential restriction) in the OWL 2 structural specification.

The RDF subject is typically an anonymous blank node (written _:x below).

Triples:

_:x rdf:type owl:Restriction .
_:x owl:onProperty DPE .
_:x owl:someValuesFrom DR .
kind: Literal['DataSomeValuesFrom'] = 'DataSomeValuesFrom'
on_property: axiom.common.N3IRIRef
some_values_from: axiom.common.N3Resource
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.DataSomeValuesFromNary(/, **data: Any)

Bases: DataRestriction

Element DataSomeValuesFrom( DPE1 ... DPEn DR ), n >= 2, in the OWL 2 structural specification.

The RDF subject is typically an anonymous blank node (written _:x below). on_properties is an owned Seq fragment carrying the data property expressions; the fragment shares this element’s context.

Triples:

_:x rdf:type owl:Restriction .
_:x owl:onProperties T(SEQ DPE1 ... DPEn) .
_:x owl:someValuesFrom DR .
kind: Literal['DataSomeValuesFromNary'] = 'DataSomeValuesFromNary'
on_properties: axiom.structural_element.Seq
some_values_from: axiom.common.N3Resource
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.DataAllValuesFrom(/, **data: Any)

Bases: DataRestriction

Element DataAllValuesFrom( DPE DR ) in the OWL 2 structural specification.

The RDF subject is typically an anonymous blank node (written _:x below).

Triples:

_:x rdf:type owl:Restriction .
_:x owl:onProperty DPE .
_:x owl:allValuesFrom DR .
kind: Literal['DataAllValuesFrom'] = 'DataAllValuesFrom'
on_property: axiom.common.N3IRIRef
all_values_from: axiom.common.N3Resource
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.DataAllValuesFromNary(/, **data: Any)

Bases: DataRestriction

Element DataAllValuesFrom( DPE1 ... DPEn DR ), n >= 2, in the OWL 2 structural specification.

The RDF subject is typically an anonymous blank node (written _:x below). on_properties is an owned Seq fragment carrying the data property expressions; the fragment shares this element’s context.

Triples:

_:x rdf:type owl:Restriction .
_:x owl:onProperties T(SEQ DPE1 ... DPEn) .
_:x owl:allValuesFrom DR .
kind: Literal['DataAllValuesFromNary'] = 'DataAllValuesFromNary'
on_properties: axiom.structural_element.Seq
all_values_from: axiom.common.N3Resource
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.DataHasValue(/, **data: Any)

Bases: DataRestriction

Element DataHasValue( DPE lt ) in the OWL 2 structural specification.

The RDF subject is typically an anonymous blank node (written _:x below). has_value is a literal.

Triples:

_:x rdf:type owl:Restriction .
_:x owl:onProperty DPE .
_:x owl:hasValue lt .
kind: Literal['DataHasValue'] = 'DataHasValue'
on_property: axiom.common.N3IRIRef
has_value: axiom.common.N3Node
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.DataMinCardinality(/, **data: Any)

Bases: DataRestriction

Element DataMinCardinality( n DPE ) in the OWL 2 structural specification.

Triples:

_:x rdf:type owl:Restriction .
_:x owl:onProperty DPE .
_:x owl:minCardinality "n"^^xsd:nonNegativeInteger .
kind: Literal['DataMinCardinality'] = 'DataMinCardinality'
on_property: axiom.common.N3IRIRef
min_cardinality: axiom.common.N3Node
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.DataMinCardinalityQualified(/, **data: Any)

Bases: DataRestriction

Element DataMinCardinality( n DPE DR ) in the OWL 2 structural specification.

Triples:

_:x rdf:type owl:Restriction .
_:x owl:onProperty DPE .
_:x owl:minQualifiedCardinality "n"^^xsd:nonNegativeInteger .
_:x owl:onDataRange DR .
kind: Literal['DataMinCardinalityQualified'] = 'DataMinCardinalityQualified'
on_property: axiom.common.N3IRIRef
min_qualified_cardinality: axiom.common.N3Node
on_data_range: axiom.common.N3Resource
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.DataMaxCardinality(/, **data: Any)

Bases: DataRestriction

Element DataMaxCardinality( n DPE ) in the OWL 2 structural specification.

Triples:

_:x rdf:type owl:Restriction .
_:x owl:onProperty DPE .
_:x owl:maxCardinality "n"^^xsd:nonNegativeInteger .
kind: Literal['DataMaxCardinality'] = 'DataMaxCardinality'
on_property: axiom.common.N3IRIRef
max_cardinality: axiom.common.N3Node
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.DataMaxCardinalityQualified(/, **data: Any)

Bases: DataRestriction

Element DataMaxCardinality( n DPE DR ) in the OWL 2 structural specification.

Triples:

_:x rdf:type owl:Restriction .
_:x owl:onProperty DPE .
_:x owl:maxQualifiedCardinality "n"^^xsd:nonNegativeInteger .
_:x owl:onDataRange DR .
kind: Literal['DataMaxCardinalityQualified'] = 'DataMaxCardinalityQualified'
on_property: axiom.common.N3IRIRef
max_qualified_cardinality: axiom.common.N3Node
on_data_range: axiom.common.N3Resource
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.DataExactCardinality(/, **data: Any)

Bases: DataRestriction

Element DataExactCardinality( n DPE ) in the OWL 2 structural specification.

Triples:

_:x rdf:type owl:Restriction .
_:x owl:onProperty DPE .
_:x owl:cardinality "n"^^xsd:nonNegativeInteger .
kind: Literal['DataExactCardinality'] = 'DataExactCardinality'
on_property: axiom.common.N3IRIRef
cardinality: axiom.common.N3Node
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.DataExactCardinalityQualified(/, **data: Any)

Bases: DataRestriction

Element DataExactCardinality( n DPE DR ) in the OWL 2 structural specification.

Triples:

_:x rdf:type owl:Restriction .
_:x owl:onProperty DPE .
_:x owl:qualifiedCardinality "n"^^xsd:nonNegativeInteger .
_:x owl:onDataRange DR .
kind: Literal['DataExactCardinalityQualified'] = 'DataExactCardinalityQualified'
on_property: axiom.common.N3IRIRef
qualified_cardinality: axiom.common.N3Node
on_data_range: axiom.common.N3Resource
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Triples representing this element as RDF; MUST NOT recurse into related elements.

class axiom.datatype.FacetEntry(/, **data: Any)

Bases: pydantic.BaseModel

One facet row in a DatatypeRestriction operand list.

cell is the rdf:List cons-cell node (the _:li in the OWL 2 mapping). anchor is the facet anchor node referenced by the cons-cell’s rdf:first (the _:yi). facet is the facet predicate (for example xsd:minInclusive) and value is the facet literal.

The terminal sentinel row uses cell == rdf:nil with anchor, facet, and value all None and emits no facet or list-membership triple from FacetList.as_triples. Non-sentinel rows MUST supply all three of anchor, facet, and value.

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

cell: axiom.common.N3Resource = None
anchor: axiom.common.N3Resource | None = None
facet: axiom.common.N3IRIRef | None = None
value: axiom.common.N3Node | None = None
check_rdf_nil_or_facet_value() → Self

Require rdf:nil rows to be empty and facet rows to supply anchor, facet, and value.

class axiom.datatype.FacetList(/, **data: Any)

Bases: axiom.structural_element.StructuralFragment

Owned rdf:List scaffolding for the operand list of DatatypeRestriction.

Encodes both the cons-cell chain of facet anchor nodes and each per-facet (_:yi Fi lti) triple in a single as_triples projection (all rows belong to the owning DatatypeRestriction’s partition per DR-031).

Triples (omit rdf:first and facet rows where cell == rdf:nil):

Ei.cell rdf:first Ei.anchor .          # when row is non-sentinel
Ei.anchor Ei.facet Ei.value .          # when row is non-sentinel
Ei.cell rdf:rest entries[i+1].cell .   # i < len(entries)-1
kind: Literal['facet_list'] = 'facet_list'
entries: collections.abc.Sequence[FacetEntry] = None
property name: rdflib.IdentifiedNode

Facet list head node taken from the first FacetEntry cell.

property as_triples: collections.abc.Sequence[axiom.common.Triple]

Emit list scaffolding and per-facet constraint triples for DatatypeRestriction.

check_list_integrity() → Self

Validate non-empty entries, a terminal rdf:nil, and unique list cells.

class axiom.datatype.DatatypeRestriction(/, **data: Any)

Bases: DataRange

Element DatatypeRestriction( DT F1 lt1 ... Fn ltn ) in the OWL 2 structural specification.

The main RDF node is an anonymous blank node (written _:x below). on_datatype is the constrained datatype IRI; with_restrictions is an owned FacetList fragment that carries the facet anchor nodes and their per-facet (_:yi Fi lti) triples.

Triples:

_:x rdf:type rdfs:Datatype .
_:x owl:onDatatype DT .
_:x owl:withRestrictions T(SEQ _:y1 ... _:yn) .
_:y1 F1 lt1 .
...
_:yn Fn ltn .
kind: Literal['DatatypeRestriction'] = 'DatatypeRestriction'
on_datatype: axiom.common.N3IRIRef
with_restrictions: FacetList
property as_triples: collections.abc.Sequence[axiom.common.Triple]

Single name rdf:type rdf_type declaration triple.