axiom.object_expression ======================= .. py:module:: axiom.object_expression .. autoapi-nested-parse:: OWL 2 object class-expression and class-axiom structural elements. This module models object-side mirrors of the data-range patterns in :mod:`rdflib_reasoning.axiom.datatype`, plus Seq-backed class axioms that share the same owned-list mapping style. Class expressions (subclasses of :class:`ClassExpression`): - :class:`ObjectIntersectionOf` --- ``ObjectIntersectionOf( CE1 ... CEn )``, ``n >= 2``; owns an :class:`~rdflib_reasoning.axiom.structural_element.Seq` fragment. - :class:`ObjectUnionOf` --- ``ObjectUnionOf( CE1 ... CEn )``, ``n >= 2``; owns an :class:`~rdflib_reasoning.axiom.structural_element.Seq` fragment. - :class:`ObjectComplementOf` --- ``ObjectComplementOf( CE )``; the operand is a cross-axiom node reference. - :class:`ObjectOneOf` --- ``ObjectOneOf( a1 ... an )``, ``n >= 1``; owns an :class:`~rdflib_reasoning.axiom.structural_element.Seq` fragment of individual resources (not literals). Object property expression: - :class:`ObjectInverseOf` --- ``ObjectInverseOf( OP )``; RDF mapping emits only ``_:x owl:inverseOf OP`` (no ``rdf:type`` triple). Class axioms: - :class:`DisjointClasses` --- binary ``DisjointClasses( CE1 CE2 )`` via ``owl:disjointWith``. - :class:`EquivalentClasses` --- binary ``EquivalentClasses( CE1 CE2 )`` via ``owl:equivalentClass`` (n-ary structural forms serialize to multiple triples; reverse parse yields binaries). - :class:`DisjointClassesNary` --- ``DisjointClasses( CE1 ... CEn )``, ``n > 2``; ``owl:AllDisjointClasses`` with owned ``owl:members`` Seq. - :class:`DisjointUnion` --- ``DisjointUnion( C CE1 ... CEn )``, ``n >= 2``; named class with owned ``owl:disjointUnionOf`` Seq. :class:`ClassExpression` is an abstract umbrella: it blocks direct instantiation, provides the shared ``owl:Class`` declaration triple 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 ------- .. autoapisummary:: axiom.object_expression.ClassExpression axiom.object_expression.ObjectIntersectionOf axiom.object_expression.ObjectUnionOf axiom.object_expression.ObjectComplementOf axiom.object_expression.ObjectOneOf axiom.object_expression.ObjectInverseOf axiom.object_expression.DisjointClasses axiom.object_expression.EquivalentClasses axiom.object_expression.DisjointClassesNary axiom.object_expression.DisjointUnion Module Contents --------------- .. py:class:: ClassExpression Bases: :py:obj:`axiom.structural_element.DeclarationElement`, :py:obj:`abc.ABC` Abstract umbrella for OWL 2 class expressions that declare ``owl:Class``. Not directly instantiable. Concrete subclasses include ``ObjectIntersectionOf``, ``ObjectUnionOf``, ``ObjectComplementOf``, and ``ObjectOneOf``. All concrete class expressions declare ``rdf:type owl:Class`` for ``name``. .. py:property:: rdf_type :type: rdflib.IdentifiedNode .. py:class:: ObjectIntersectionOf Bases: :py:obj:`ClassExpression` Element ``ObjectIntersectionOf( CE1 ... CEn )`` 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 class expression operands. Triples:: _:x rdf:type owl:Class . _:x owl:intersectionOf T(SEQ CE1 ... CEn) . .. py:attribute:: kind :type: Literal['ObjectIntersectionOf'] :value: 'ObjectIntersectionOf' .. py:attribute:: intersection_of :type: axiom.structural_element.Seq .. py:property:: as_triples :type: collections.abc.Sequence[axiom.common.Triple] .. py:class:: ObjectUnionOf Bases: :py:obj:`ClassExpression` Element ``ObjectUnionOf( CE1 ... CEn )`` 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 class expression operands. Triples:: _:x rdf:type owl:Class . _:x owl:unionOf T(SEQ CE1 ... CEn) . .. py:attribute:: kind :type: Literal['ObjectUnionOf'] :value: 'ObjectUnionOf' .. py:attribute:: union_of :type: axiom.structural_element.Seq .. py:property:: as_triples :type: collections.abc.Sequence[axiom.common.Triple] .. py:class:: ObjectComplementOf Bases: :py:obj:`ClassExpression` Element ``ObjectComplementOf( CE )`` 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 class expression (IRI or blank node); ``as_triples`` emits only this axiom's triples (shallow projection). Declaration and other triples for ``CE`` belong in a separate axiom instance or graph partition, not inlined here. Triples:: _:x rdf:type owl:Class . _:x owl:complementOf CE . .. py:attribute:: kind :type: Literal['ObjectComplementOf'] :value: 'ObjectComplementOf' .. py:attribute:: complement_of :type: axiom.common.N3Resource .. py:property:: as_triples :type: collections.abc.Sequence[axiom.common.Triple] .. py:class:: ObjectOneOf Bases: :py:obj:`ClassExpression` Element ``ObjectOneOf( a1 ... an )`` 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 individuals as ``rdf:first`` values (IRIs or blank nodes, not literals); the fragment shares this element's ``context``. OWL 2 structural syntax requires n >= 1 individual operands. Triples:: _:x rdf:type owl:Class . _:x owl:oneOf T(SEQ a1 ... an) . .. py:attribute:: kind :type: Literal['ObjectOneOf'] :value: 'ObjectOneOf' .. py:attribute:: one_of :type: axiom.structural_element.Seq .. py:property:: as_triples :type: collections.abc.Sequence[axiom.common.Triple] .. py:class:: ObjectInverseOf Bases: :py:obj:`axiom.structural_element.StructuralElement` Element ``ObjectInverseOf( OP )`` of the OWL 2 structural specification. The main RDF node is an anonymous blank node (written ``_:x`` below). ``inverse_of`` is the RDF node of the inverted object property expression; ``as_triples`` emits only this axiom's triples (shallow projection). The OWL 2 RDF mapping does not emit an ``rdf:type`` triple for this form. Triples:: _:x owl:inverseOf OP . .. py:attribute:: kind :type: Literal['ObjectInverseOf'] :value: 'ObjectInverseOf' .. py:attribute:: name_value :type: axiom.common.N3Resource :value: None .. py:attribute:: inverse_of :type: axiom.common.N3Resource .. py:property:: name :type: rdflib.IdentifiedNode Inverse property expression node identifier (alias of ``name_value``). .. py:property:: as_triples :type: collections.abc.Sequence[axiom.common.Triple] .. py:class:: DisjointClasses Bases: :py:obj:`axiom.structural_element.StructuralElement` Element ``DisjointClasses( CE1 CE2 )`` of the OWL 2 structural specification. Both operands are RDF node references. If an operand is itself represented by another structural element, that element belongs to a separate partition. Triples:: CE1 owl:disjointWith CE2 . .. py:attribute:: kind :type: Literal['DisjointClasses'] :value: 'DisjointClasses' .. py:attribute:: class_expression_1 :type: axiom.common.N3Resource .. py:attribute:: class_expression_2 :type: axiom.common.N3Resource .. py:property:: name :type: rdflib.IdentifiedNode .. py:property:: as_triples :type: collections.abc.Sequence[axiom.common.Triple] .. py:class:: EquivalentClasses Bases: :py:obj:`axiom.structural_element.StructuralElement` Element ``EquivalentClasses( CE1 CE2 )`` of the OWL 2 structural specification. Binary form only. An n-ary structural ``EquivalentClasses( CE1 ... CEn )`` serializes to n-1 ``owl:equivalentClass`` triples; OWL 2 RDF reverse mapping parses each triple as a binary axiom. This class models that binary parse shape. Shares ``owl:equivalentClass`` with :class:`~rdflib_reasoning.axiom.property_axiom.DatatypeDefinition`. Both operands are RDF node references. If an operand is itself represented by another structural element, that element belongs to a separate partition. Triples:: CE1 owl:equivalentClass CE2 . .. py:attribute:: kind :type: Literal['EquivalentClasses'] :value: 'EquivalentClasses' .. py:attribute:: class_expression_1 :type: axiom.common.N3Resource .. py:attribute:: class_expression_2 :type: axiom.common.N3Resource .. py:property:: name :type: rdflib.IdentifiedNode .. py:property:: as_triples :type: collections.abc.Sequence[axiom.common.Triple] .. py:class:: DisjointClassesNary Bases: :py:obj:`axiom.structural_element.StructuralElement` Element ``DisjointClasses( CE1 ... CEn )``, n > 2, of the OWL 2 structural specification. The RDF subject is typically an anonymous blank node (written ``_:x`` below) of type ``owl:AllDisjointClasses``. ``members`` is an owned ``Seq`` fragment carrying the class expression operands; the fragment shares this element's ``context``. Triples:: _:x rdf:type owl:AllDisjointClasses . _:x owl:members T(SEQ CE1 ... CEn) . .. py:attribute:: kind :type: Literal['DisjointClassesNary'] :value: 'DisjointClassesNary' .. py:attribute:: name_value :type: axiom.common.N3Resource :value: None .. py:attribute:: members :type: axiom.structural_element.Seq .. py:property:: name :type: rdflib.IdentifiedNode AllDisjointClasses node identifier (alias of ``name_value``). .. py:property:: as_triples :type: collections.abc.Sequence[axiom.common.Triple] .. py:class:: DisjointUnion Bases: :py:obj:`axiom.structural_element.StructuralElement` Element ``DisjointUnion( C CE1 ... CEn )`` of the OWL 2 structural specification. ``union_class`` is the named class ``C``. ``disjoint_union_of`` is an owned ``Seq`` fragment carrying the covering class expression operands (``n >= 2``); the fragment shares this element's ``context``. The OWL 2 RDF mapping does not emit an ``rdf:type`` triple for this axiom. Triples:: C owl:disjointUnionOf T(SEQ CE1 ... CEn) . .. py:attribute:: kind :type: Literal['DisjointUnion'] :value: 'DisjointUnion' .. py:attribute:: union_class :type: axiom.common.N3Resource .. py:attribute:: disjoint_union_of :type: axiom.structural_element.Seq .. py:property:: name :type: rdflib.IdentifiedNode .. py:property:: as_triples :type: collections.abc.Sequence[axiom.common.Triple]