use crate::{
annotations::{Annotation, AnnotationValue},
entities::{AnnotationProperty, AnonymousIndividual, Class, Datatype, Entity, Individual},
error::ApiError,
expressions::{ClassExpression, DataPropertyExpression, ObjectPropertyExpression},
fmt::DisplayPretty,
literals::Literal,
ranges::DataRange,
values::{CardinalityConstraintViolation, UnlimitedNatural},
};
use rdftk_iri::Iri;
use strum::{EnumIs, EnumTryAs};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
#[derive(Clone, Debug, PartialEq, EnumIs, EnumTryAs)]
pub enum Axiom {
Declaration(Declaration),
ClassAxiom(ClassAxiom),
ObjectPropertyAxiom(ObjectPropertyAxiom),
DataPropertyAxiom(DataPropertyAxiom),
DatatypeDefinition(DatatypeDefinition),
HasKey(HasKey),
Assertion(Assertion),
AnnotationAxiom(AnnotationAxiom),
}
#[derive(Clone, Debug, PartialEq)]
pub struct Declaration {
axiom_annotations: Vec<Annotation>,
entity: Entity,
}
#[derive(Clone, Debug, PartialEq, EnumIs, EnumTryAs)]
pub enum ClassAxiom {
SubClassOf(SubClassOf),
EquivalentClass(EquivalentClass),
DisjointClasses(DisjointClasses),
DisjointUnion(DisjointUnion),
}
#[derive(Clone, Debug, PartialEq)]
pub struct SubClassOf {
axiom_annotations: Vec<Annotation>,
sub_class_expression: ClassExpression,
super_class_expression: ClassExpression,
}
#[derive(Clone, Debug, PartialEq)]
pub struct EquivalentClass {
axiom_annotations: Vec<Annotation>,
class_expressions: Vec<ClassExpression>, }
#[derive(Clone, Debug, PartialEq)]
pub struct DisjointClasses {
axiom_annotations: Vec<Annotation>,
class_expressions: Vec<ClassExpression>, }
#[derive(Clone, Debug, PartialEq)]
pub struct DisjointUnion {
axiom_annotations: Vec<Annotation>,
class: Class,
disjoint_class_expressions: Vec<ClassExpression>, }
#[derive(Clone, Debug, PartialEq, EnumIs, EnumTryAs)]
pub enum ObjectPropertyAxiom {
EquivalentObjectProperties(EquivalentObjectProperties),
DisjointObjectProperties(DisjointObjectProperties),
SubObjectPropertyOf(SubObjectPropertyOf),
ObjectPropertyDomain(ObjectPropertyDomain),
ObjectPropertyRange(ObjectPropertyRange),
InverseObjectProperties(InverseObjectProperties),
FunctionalObjectProperty(FunctionalObjectProperty),
InverseFunctionalObjectProperty(InverseFunctionalObjectProperty),
ReflexiveObjectProperty(ReflexiveObjectProperty),
IrreflexiveObjectProperty(IrreflexiveObjectProperty),
SymmetricObjectProperty(SymmetricObjectProperty),
AsymmetricObjectProperty(AsymmetricObjectProperty),
TransitiveObjectProperty(TransitiveObjectProperty),
}
#[derive(Clone, Debug, PartialEq)]
pub struct SubObjectPropertyOf {
axiom_annotations: Vec<Annotation>,
sub_object_property_expressions: SubObjectPropertyExpression,
super_object_property_expression: ObjectPropertyExpression,
}
#[derive(Clone, Debug, PartialEq, EnumIs, EnumTryAs)]
pub enum SubObjectPropertyExpression {
ObjectPropertyExpression(ObjectPropertyExpression),
PropertyExpressionChain(PropertyExpressionChain),
}
#[derive(Clone, Debug, PartialEq)]
pub struct PropertyExpressionChain {
object_property_expressions: Vec<ObjectPropertyExpression>, }
#[derive(Clone, Debug, PartialEq)]
pub struct EquivalentObjectProperties {
axiom_annotations: Vec<Annotation>,
object_property_expressions: Vec<ObjectPropertyExpression>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct DisjointObjectProperties {
axiom_annotations: Vec<Annotation>,
object_property_expressions: Vec<ObjectPropertyExpression>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct InverseObjectProperties {
axiom_annotations: Vec<Annotation>,
object_property_expression_1: ObjectPropertyExpression,
object_property_expression_2: ObjectPropertyExpression,
}
#[derive(Clone, Debug, PartialEq)]
pub struct ObjectPropertyDomain {
axiom_annotations: Vec<Annotation>,
object_property_expression: ObjectPropertyExpression,
domain: ClassExpression,
}
#[derive(Clone, Debug, PartialEq)]
pub struct ObjectPropertyRange {
axiom_annotations: Vec<Annotation>,
object_property_expression: ObjectPropertyExpression,
range: ClassExpression,
}
#[derive(Clone, Debug, PartialEq)]
pub struct FunctionalObjectProperty {
axiom_annotations: Vec<Annotation>,
object_property_expression: ObjectPropertyExpression,
}
#[derive(Clone, Debug, PartialEq)]
pub struct InverseFunctionalObjectProperty {
axiom_annotations: Vec<Annotation>,
object_property_expression: ObjectPropertyExpression, }
#[derive(Clone, Debug, PartialEq)]
pub struct ReflexiveObjectProperty {
axiom_annotations: Vec<Annotation>,
object_property_expression: ObjectPropertyExpression,
}
#[derive(Clone, Debug, PartialEq)]
pub struct IrreflexiveObjectProperty {
axiom_annotations: Vec<Annotation>,
object_property_expression: ObjectPropertyExpression, }
#[derive(Clone, Debug, PartialEq)]
pub struct SymmetricObjectProperty {
axiom_annotations: Vec<Annotation>,
object_property_expression: ObjectPropertyExpression, }
#[derive(Clone, Debug, PartialEq)]
pub struct AsymmetricObjectProperty {
axiom_annotations: Vec<Annotation>,
object_property_expression: ObjectPropertyExpression, }
#[derive(Clone, Debug, PartialEq)]
pub struct TransitiveObjectProperty {
axiom_annotations: Vec<Annotation>,
object_property_expression: ObjectPropertyExpression, }
#[derive(Clone, Debug, PartialEq, EnumIs, EnumTryAs)]
pub enum DataPropertyAxiom {
SubDataPropertyOf(SubDataPropertyOf),
DisjointDataProperties(DisjointDataProperties),
EquivalentDataProperties(EquivalentDataProperties),
FunctionalDataProperty(FunctionalDataProperty),
DataPropertyDomain(DataPropertyDomain),
DataPropertyRange(DataPropertyRange),
}
#[derive(Clone, Debug, PartialEq)]
pub struct SubDataPropertyOf {
axiom_annotations: Vec<Annotation>,
sub_data_property_expression: DataPropertyExpression, super_data_property_expression: DataPropertyExpression, }
#[derive(Clone, Debug, PartialEq)]
pub struct EquivalentDataProperties {
axiom_annotations: Vec<Annotation>,
data_property_expressions: Vec<DataPropertyExpression>, }
#[derive(Clone, Debug, PartialEq)]
pub struct DisjointDataProperties {
axiom_annotations: Vec<Annotation>,
data_property_expressions: Vec<DataPropertyExpression>, }
#[derive(Clone, Debug, PartialEq)]
pub struct FunctionalDataProperty {
axiom_annotations: Vec<Annotation>,
data_property_expression: DataPropertyExpression, }
#[derive(Clone, Debug, PartialEq)]
pub struct DataPropertyDomain {
axiom_annotations: Vec<Annotation>,
data_property_expression: DataPropertyExpression, domain: ClassExpression,
}
#[derive(Clone, Debug, PartialEq)]
pub struct DataPropertyRange {
axiom_annotations: Vec<Annotation>,
data_property_expression: DataPropertyExpression, range: DataRange,
}
#[derive(Clone, Debug, PartialEq)]
pub struct DatatypeDefinition {
axiom_annotations: Vec<Annotation>,
datatype: Datatype,
data_range: DataRange,
}
#[derive(Clone, Debug, PartialEq)]
pub struct HasKey {
axiom_annotations: Vec<Annotation>,
class_expression: ClassExpression,
object_property_expressions: Vec<ObjectPropertyExpression>,
data_property_expressions: Vec<DataPropertyExpression>,
}
#[derive(Clone, Debug, PartialEq, EnumIs, EnumTryAs)]
pub enum Assertion {
SameIndividual(SameIndividual),
DifferentIndividuals(DifferentIndividuals),
ClassAssertion(ClassAssertion),
ObjectPropertyAssertion(ObjectPropertyAssertion),
NegativeObjectPropertyAssertion(NegativeObjectPropertyAssertion),
DataPropertyAssertion(DataPropertyAssertion),
NegativeDataPropertyAssertion(NegativeDataPropertyAssertion),
}
#[derive(Clone, Debug, PartialEq)]
pub struct SameIndividual {
axiom_annotations: Vec<Annotation>,
individuals: Vec<Individual>, }
#[derive(Clone, Debug, PartialEq)]
pub struct DifferentIndividuals {
axiom_annotations: Vec<Annotation>,
individuals: Vec<Individual>, }
#[derive(Clone, Debug, PartialEq)]
pub struct ClassAssertion {
axiom_annotations: Vec<Annotation>,
individual: Individual,
class_expression: ClassExpression,
}
#[derive(Clone, Debug, PartialEq)]
pub struct ObjectPropertyAssertion {
axiom_annotations: Vec<Annotation>,
source_individual: Individual,
target_individual: Individual,
object_property_expression: ObjectPropertyExpression,
}
#[derive(Clone, Debug, PartialEq)]
pub struct NegativeObjectPropertyAssertion {
axiom_annotations: Vec<Annotation>,
source_individual: Individual,
target_individual: Individual,
object_property_expression: ObjectPropertyExpression,
}
#[derive(Clone, Debug, PartialEq)]
pub struct DataPropertyAssertion {
axiom_annotations: Vec<Annotation>,
source_individual: Individual,
target_value: Literal,
data_property_expression: DataPropertyExpression,
}
#[derive(Clone, Debug, PartialEq)]
pub struct NegativeDataPropertyAssertion {
axiom_annotations: Vec<Annotation>,
source_individual: Individual,
target_value: Literal,
data_property_expression: DataPropertyExpression,
}
#[derive(Clone, Debug, PartialEq, EnumIs, EnumTryAs)]
pub enum AnnotationAxiom {
SubAnnotationOf(SubAnnotationOf),
AnnotationPropertyDomain(AnnotationPropertyDomain),
AnnotationPropertyRange(AnnotationPropertyRange),
AnnotationAssertion(AnnotationAssertion),
}
#[derive(Clone, Debug, PartialEq)]
pub struct AnnotationAssertion {
axiom_annotations: Vec<Annotation>,
annotation_property: AnnotationProperty,
annotation_subject: AnnotationSubject,
annotation_value: AnnotationValue,
}
#[derive(Clone, Debug, PartialEq)]
pub enum AnnotationSubject {
Iri(Iri),
AnonymousIndividual(AnonymousIndividual),
}
#[derive(Clone, Debug, PartialEq)]
pub struct SubAnnotationOf {
axiom_annotations: Vec<Annotation>,
sub_annotation_property: AnnotationProperty,
super_annotation_property: AnnotationProperty,
}
#[derive(Clone, Debug, PartialEq)]
pub struct AnnotationPropertyDomain {
axiom_annotations: Vec<Annotation>,
annotation_property: AnnotationProperty,
domain: Iri,
}
#[derive(Clone, Debug, PartialEq)]
pub struct AnnotationPropertyRange {
axiom_annotations: Vec<Annotation>,
annotation_property: AnnotationProperty,
range: Iri,
}
impl_display_pretty!(
Axiom enum Declaration,
ClassAxiom,
ObjectPropertyAxiom,
DataPropertyAxiom,
DatatypeDefinition,
HasKey,
Assertion,
AnnotationAxiom);
impl_has_annotations!(
Axiom enum Declaration,
ClassAxiom,
ObjectPropertyAxiom,
DataPropertyAxiom,
DatatypeDefinition,
HasKey,
Assertion,
AnnotationAxiom);
impl_from_for_variant!(Axiom, Declaration);
impl_from_for_variant!(Axiom, ClassAxiom);
impl_from_for_variant!(Axiom, ObjectPropertyAxiom);
impl_from_for_variant!(Axiom, DataPropertyAxiom);
impl_from_for_variant!(Axiom, DatatypeDefinition);
impl_from_for_variant!(Axiom, HasKey);
impl_from_for_variant!(Axiom, Assertion);
impl_from_for_variant!(Axiom, AnnotationAxiom);
impl_display_pretty!(Declaration(@list axiom_annotations, entity));
impl_has_annotations!(Declaration, axiom_annotations);
impl<E: Into<Entity>> From<E> for Declaration {
fn from(entity: E) -> Self {
Self::new(entity.into())
}
}
impl Declaration {
pub fn new(entity: Entity) -> Self {
Self {
axiom_annotations: Default::default(),
entity,
}
}
pub fn new_with_annotations(ann: Vec<Annotation>, entity: Entity) -> Self {
Self {
axiom_annotations: ann,
entity,
}
}
pub fn entity(&self) -> &Entity {
&self.entity
}
}
impl_display_pretty!(
ClassAxiom enum SubClassOf,
EquivalentClass,
DisjointClasses,
DisjointUnion);
impl_has_annotations!(
ClassAxiom enum SubClassOf,
EquivalentClass,
DisjointClasses,
DisjointUnion);
impl_from_for_variant!(ClassAxiom, SubClassOf);
impl_from_for_variant!(ClassAxiom, EquivalentClass);
impl_from_for_variant!(ClassAxiom, DisjointClasses);
impl_from_for_variant!(ClassAxiom, DisjointUnion);
impl_display_pretty!(SubClassOf(@list axiom_annotations, sub_class_expression, super_class_expression));
impl_has_annotations!(SubClassOf, axiom_annotations);
impl SubClassOf {
pub fn new<CE1, CE2>(sub_class: CE1, super_class: CE2) -> Self
where
CE1: Into<ClassExpression>,
CE2: Into<ClassExpression>,
{
Self {
axiom_annotations: Default::default(),
sub_class_expression: sub_class.into(),
super_class_expression: super_class.into(),
}
}
pub fn new_with_annotations<CE1, CE2, I>(
annotations: I,
sub_class: CE1,
super_class: CE2,
) -> Self
where
I: IntoIterator<Item = Annotation>,
CE1: Into<ClassExpression>,
CE2: Into<ClassExpression>,
{
Self {
axiom_annotations: annotations.into_iter().collect(),
sub_class_expression: sub_class.into(),
super_class_expression: super_class.into(),
}
}
pub fn sub_class_expression(&self) -> &ClassExpression {
&self.sub_class_expression
}
pub fn super_class_expression(&self) -> &ClassExpression {
&self.super_class_expression
}
}
impl_display_pretty!(EquivalentClass( @list axiom_annotations, @list class_expressions ));
impl_has_annotations!(EquivalentClass, axiom_annotations);
impl EquivalentClass {
pub fn new<I: IntoIterator<Item = ClassExpression>>(classes: I) -> Result<Self, ApiError> {
let class_expressions: Vec<ClassExpression> = classes.into_iter().collect();
if class_expressions.len() >= 2 {
Ok(Self {
axiom_annotations: Default::default(),
class_expressions,
})
} else {
Err(CardinalityConstraintViolation::min_fail(
2,
UnlimitedNatural::Limited(class_expressions.len() as u128),
)
.into())
}
}
pub fn class_expressions(&self) -> impl Iterator<Item = &ClassExpression> {
self.class_expressions.iter()
}
}
impl_display_pretty!(DisjointClasses(@list axiom_annotations, @list class_expressions));
impl_has_annotations!(DisjointClasses, axiom_annotations);
impl DisjointClasses {
pub fn new<I: IntoIterator<Item = ClassExpression>>(classes: I) -> Result<Self, ApiError> {
let class_expressions: Vec<ClassExpression> = classes.into_iter().collect();
if class_expressions.len() >= 2 {
Ok(Self {
axiom_annotations: Default::default(),
class_expressions,
})
} else {
Err(CardinalityConstraintViolation::min_fail(
2,
UnlimitedNatural::Limited(class_expressions.len() as u128),
)
.into())
}
}
pub fn class_expressions(&self) -> impl Iterator<Item = &ClassExpression> {
self.class_expressions.iter()
}
}
impl_display_pretty!(DisjointUnion(@list axiom_annotations, class, @list disjoint_class_expressions));
impl_has_annotations!(DisjointUnion, axiom_annotations);
impl DisjointUnion {
pub fn new<I: IntoIterator<Item = ClassExpression>>(
class: Class,
disjoint_classes: I,
) -> Result<Self, ApiError> {
let disjoint_class_expressions: Vec<ClassExpression> =
disjoint_classes.into_iter().collect();
if disjoint_class_expressions.len() >= 2 {
Ok(Self {
axiom_annotations: Default::default(),
class,
disjoint_class_expressions,
})
} else {
Err(CardinalityConstraintViolation::min_fail(
2,
UnlimitedNatural::Limited(disjoint_class_expressions.len() as u128),
)
.into())
}
}
pub fn class(&self) -> &Class {
&self.class
}
pub fn disjoint_class_expressions(&self) -> impl Iterator<Item = &ClassExpression> {
self.disjoint_class_expressions.iter()
}
}
impl_display_pretty!(
ObjectPropertyAxiom enum EquivalentObjectProperties,
DisjointObjectProperties,
SubObjectPropertyOf,
ObjectPropertyDomain,
ObjectPropertyRange,
InverseObjectProperties,
FunctionalObjectProperty,
InverseFunctionalObjectProperty,
ReflexiveObjectProperty,
IrreflexiveObjectProperty,
SymmetricObjectProperty,
AsymmetricObjectProperty,
TransitiveObjectProperty);
impl_has_annotations!(
ObjectPropertyAxiom enum EquivalentObjectProperties,
DisjointObjectProperties,
SubObjectPropertyOf,
ObjectPropertyDomain,
ObjectPropertyRange,
InverseObjectProperties,
FunctionalObjectProperty,
InverseFunctionalObjectProperty,
ReflexiveObjectProperty,
IrreflexiveObjectProperty,
SymmetricObjectProperty,
AsymmetricObjectProperty,
TransitiveObjectProperty);
impl_from_for_variant!(ObjectPropertyAxiom, EquivalentObjectProperties);
impl_from_for_variant!(ObjectPropertyAxiom, DisjointObjectProperties);
impl_from_for_variant!(ObjectPropertyAxiom, SubObjectPropertyOf);
impl_from_for_variant!(ObjectPropertyAxiom, ObjectPropertyDomain);
impl_from_for_variant!(ObjectPropertyAxiom, ObjectPropertyRange);
impl_from_for_variant!(ObjectPropertyAxiom, InverseObjectProperties);
impl_from_for_variant!(ObjectPropertyAxiom, FunctionalObjectProperty);
impl_from_for_variant!(ObjectPropertyAxiom, InverseFunctionalObjectProperty);
impl_from_for_variant!(ObjectPropertyAxiom, ReflexiveObjectProperty);
impl_from_for_variant!(ObjectPropertyAxiom, IrreflexiveObjectProperty);
impl_from_for_variant!(ObjectPropertyAxiom, SymmetricObjectProperty);
impl_from_for_variant!(ObjectPropertyAxiom, AsymmetricObjectProperty);
impl_from_for_variant!(ObjectPropertyAxiom, TransitiveObjectProperty);
impl_display_pretty!(
EquivalentObjectProperties( @list axiom_annotations, @list object_property_expressions )
);
impl_has_annotations!(EquivalentObjectProperties, axiom_annotations);
impl EquivalentObjectProperties {
pub fn new<I: IntoIterator<Item = ObjectPropertyExpression>>(opes: I) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expressions: opes.into_iter().collect(),
}
}
pub fn new_with_annotations<I: IntoIterator<Item = ObjectPropertyExpression>>(
annotations: Vec<Annotation>,
opes: I,
) -> Self {
Self {
axiom_annotations: annotations,
object_property_expressions: opes.into_iter().collect(),
}
}
pub fn object_property_expressions(&self) -> impl Iterator<Item = &ObjectPropertyExpression> {
self.object_property_expressions.iter()
}
}
impl_display_pretty!(
DisjointObjectProperties, ObjectPropertyChain(
@list axiom_annotations, @list object_property_expressions
)
);
impl_has_annotations!(DisjointObjectProperties, axiom_annotations);
impl DisjointObjectProperties {
pub fn new<I: IntoIterator<Item = ObjectPropertyExpression>>(opes: I) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expressions: opes.into_iter().collect(),
}
}
pub fn new_with_annotations<I: IntoIterator<Item = ObjectPropertyExpression>>(
annotations: Vec<Annotation>,
opes: I,
) -> Self {
Self {
axiom_annotations: annotations,
object_property_expressions: opes.into_iter().collect(),
}
}
pub fn object_property_expressions(&self) -> impl Iterator<Item = &ObjectPropertyExpression> {
self.object_property_expressions.iter()
}
}
impl_display_pretty!(
SubObjectPropertyOf(
@list axiom_annotations, sub_object_property_expressions, super_object_property_expression
)
);
impl_has_annotations!(SubObjectPropertyOf, axiom_annotations);
impl SubObjectPropertyOf {
pub fn new(sub: SubObjectPropertyExpression, sup: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: Default::default(),
sub_object_property_expressions: sub,
super_object_property_expression: sup,
}
}
pub fn new_with_annotations(
annotations: Vec<Annotation>,
sub: SubObjectPropertyExpression,
sup: ObjectPropertyExpression,
) -> Self {
Self {
axiom_annotations: annotations,
sub_object_property_expressions: sub,
super_object_property_expression: sup,
}
}
}
impl_display_pretty!(
SubObjectPropertyExpression enum ObjectPropertyExpression, PropertyExpressionChain
);
impl_from_for_variant!(SubObjectPropertyExpression, ObjectPropertyExpression);
impl_from_for_variant!(SubObjectPropertyExpression, PropertyExpressionChain);
impl_display_pretty!(
PropertyExpressionChain, ObjectPropertyChain( @list object_property_expressions )
);
impl PropertyExpressionChain {
pub fn new<I: IntoIterator<Item = ObjectPropertyExpression>>(opes: I) -> Self {
Self {
object_property_expressions: opes.into_iter().collect(),
}
}
pub fn object_property_expressions(&self) -> impl Iterator<Item = &ObjectPropertyExpression> {
self.object_property_expressions.iter()
}
}
impl_display_pretty!(
ObjectPropertyDomain( @list axiom_annotations, object_property_expression, domain
));
impl_has_annotations!(ObjectPropertyDomain, axiom_annotations);
impl ObjectPropertyDomain {
pub fn new(ope: ObjectPropertyExpression, domain: ClassExpression) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression: ope,
domain,
}
}
pub fn new_with_annotations(
annotations: Vec<Annotation>,
ope: ObjectPropertyExpression,
domain: ClassExpression,
) -> Self {
Self {
axiom_annotations: annotations,
object_property_expression: ope,
domain,
}
}
pub fn object_property_expression(&self) -> &ObjectPropertyExpression {
&self.object_property_expression
}
pub fn domain(&self) -> &ClassExpression {
&self.domain
}
}
impl_display_pretty!(
ObjectPropertyRange( @list axiom_annotations, object_property_expression, range )
);
impl_has_annotations!(ObjectPropertyRange, axiom_annotations);
impl ObjectPropertyRange {
pub fn new(ope: ObjectPropertyExpression, range: ClassExpression) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression: ope,
range,
}
}
pub fn new_with_annotations(
annotations: Vec<Annotation>,
ope: ObjectPropertyExpression,
range: ClassExpression,
) -> Self {
Self {
axiom_annotations: annotations,
object_property_expression: ope,
range,
}
}
pub fn object_property_expression(&self) -> &ObjectPropertyExpression {
&self.object_property_expression
}
pub fn range(&self) -> &ClassExpression {
&self.range
}
}
impl_display_pretty!(
InverseObjectProperties(
@list axiom_annotations, object_property_expression_1, object_property_expression_2 )
);
impl_has_annotations!(InverseObjectProperties, axiom_annotations);
impl InverseObjectProperties {
pub fn new(ope1: ObjectPropertyExpression, ope2: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression_1: ope1,
object_property_expression_2: ope2,
}
}
pub fn new_with_annotations(
annotations: Vec<Annotation>,
ope1: ObjectPropertyExpression,
ope2: ObjectPropertyExpression,
) -> Self {
Self {
axiom_annotations: annotations,
object_property_expression_1: ope1,
object_property_expression_2: ope2,
}
}
pub fn object_property_expression_1(&self) -> &ObjectPropertyExpression {
&self.object_property_expression_1
}
pub fn object_property_expression_2(&self) -> &ObjectPropertyExpression {
&self.object_property_expression_2
}
}
impl_display_pretty!(
FunctionalObjectProperty( @list axiom_annotations, object_property_expression )
);
impl_has_annotations!(FunctionalObjectProperty, axiom_annotations);
impl FunctionalObjectProperty {
pub fn new(ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression: ope,
}
}
pub fn new_with_annotations(ann: Vec<Annotation>, ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: ann,
object_property_expression: ope,
}
}
pub fn object_property_expression(&self) -> &ObjectPropertyExpression {
&self.object_property_expression
}
}
impl_display_pretty!(
InverseFunctionalObjectProperty( @list axiom_annotations, object_property_expression )
);
impl_has_annotations!(InverseFunctionalObjectProperty, axiom_annotations);
impl InverseFunctionalObjectProperty {
pub fn new(ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression: ope,
}
}
pub fn new_with_annotations(ann: Vec<Annotation>, ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: ann,
object_property_expression: ope,
}
}
pub fn object_property_expression(&self) -> &ObjectPropertyExpression {
&self.object_property_expression
}
}
impl_display_pretty!(
ReflexiveObjectProperty( @list axiom_annotations, object_property_expression )
);
impl_has_annotations!(ReflexiveObjectProperty, axiom_annotations);
impl ReflexiveObjectProperty {
pub fn new(ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression: ope,
}
}
pub fn new_with_annotations(ann: Vec<Annotation>, ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: ann,
object_property_expression: ope,
}
}
pub fn object_property_expression(&self) -> &ObjectPropertyExpression {
&self.object_property_expression
}
}
impl_display_pretty!(
IrreflexiveObjectProperty( @list axiom_annotations, object_property_expression )
);
impl_has_annotations!(IrreflexiveObjectProperty, axiom_annotations);
impl IrreflexiveObjectProperty {
pub fn new(ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression: ope,
}
}
pub fn new_with_annotations(ann: Vec<Annotation>, ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: ann,
object_property_expression: ope,
}
}
pub fn object_property_expression(&self) -> &ObjectPropertyExpression {
&self.object_property_expression
}
}
impl_display_pretty!(
SymmetricObjectProperty( @list axiom_annotations, object_property_expression )
);
impl_has_annotations!(SymmetricObjectProperty, axiom_annotations);
impl SymmetricObjectProperty {
pub fn new(ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression: ope,
}
}
pub fn new_with_annotations(ann: Vec<Annotation>, ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: ann,
object_property_expression: ope,
}
}
pub fn object_property_expression(&self) -> &ObjectPropertyExpression {
&self.object_property_expression
}
}
impl_display_pretty!(
AsymmetricObjectProperty( @list axiom_annotations, object_property_expression )
);
impl_has_annotations!(AsymmetricObjectProperty, axiom_annotations);
impl AsymmetricObjectProperty {
pub fn new(ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression: ope,
}
}
pub fn new_with_annotations(ann: Vec<Annotation>, ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: ann,
object_property_expression: ope,
}
}
pub fn object_property_expression(&self) -> &ObjectPropertyExpression {
&self.object_property_expression
}
}
impl_display_pretty!(
TransitiveObjectProperty( @list axiom_annotations, object_property_expression )
);
impl_has_annotations!(TransitiveObjectProperty, axiom_annotations);
impl TransitiveObjectProperty {
pub fn new(ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression: ope,
}
}
pub fn new_with_annotations(ann: Vec<Annotation>, ope: ObjectPropertyExpression) -> Self {
Self {
axiom_annotations: ann,
object_property_expression: ope,
}
}
pub fn object_property_expression(&self) -> &ObjectPropertyExpression {
&self.object_property_expression
}
}
impl_display_pretty!(
DataPropertyAxiom enum SubDataPropertyOf,
DisjointDataProperties,
EquivalentDataProperties,
FunctionalDataProperty,
DataPropertyDomain,
DataPropertyRange);
impl_has_annotations!(
DataPropertyAxiom enum SubDataPropertyOf,
DisjointDataProperties,
EquivalentDataProperties,
FunctionalDataProperty,
DataPropertyDomain,
DataPropertyRange);
impl_from_for_variant!(DataPropertyAxiom, SubDataPropertyOf);
impl_from_for_variant!(DataPropertyAxiom, DisjointDataProperties);
impl_from_for_variant!(DataPropertyAxiom, EquivalentDataProperties);
impl_from_for_variant!(DataPropertyAxiom, FunctionalDataProperty);
impl_from_for_variant!(DataPropertyAxiom, DataPropertyDomain);
impl_from_for_variant!(DataPropertyAxiom, DataPropertyRange);
impl_display_pretty!(
SubDataPropertyOf(
@list axiom_annotations, sub_data_property_expression, super_data_property_expression
)
);
impl_has_annotations!(SubDataPropertyOf, axiom_annotations);
impl SubDataPropertyOf {
pub fn new(sub: DataPropertyExpression, sup: DataPropertyExpression) -> Self {
Self {
axiom_annotations: Default::default(),
sub_data_property_expression: sub,
super_data_property_expression: sup,
}
}
pub fn new_with_annotations(
ann: Vec<Annotation>,
sub: DataPropertyExpression,
sup: DataPropertyExpression,
) -> Self {
Self {
axiom_annotations: ann,
sub_data_property_expression: sub,
super_data_property_expression: sup,
}
}
}
impl_display_pretty!(
DisjointDataProperties( @list axiom_annotations, @list data_property_expressions )
);
impl_has_annotations!(DisjointDataProperties, axiom_annotations);
impl DisjointDataProperties {
pub fn new<I: IntoIterator<Item = DataPropertyExpression>>(dpes: I) -> Self {
Self {
axiom_annotations: Default::default(),
data_property_expressions: dpes.into_iter().collect(),
}
}
pub fn new_with_annotations<I: IntoIterator<Item = DataPropertyExpression>>(
ann: Vec<Annotation>,
dpes: I,
) -> Self {
Self {
axiom_annotations: ann,
data_property_expressions: dpes.into_iter().collect(),
}
}
pub fn data_property_expressions(&self) -> impl Iterator<Item = &DataPropertyExpression> {
self.data_property_expressions.iter()
}
}
impl_display_pretty!(
EquivalentDataProperties( @list axiom_annotations, @list data_property_expressions )
);
impl_has_annotations!(EquivalentDataProperties, axiom_annotations);
impl EquivalentDataProperties {
pub fn new<I: IntoIterator<Item = DataPropertyExpression>>(dpes: I) -> Self {
Self {
axiom_annotations: Default::default(),
data_property_expressions: dpes.into_iter().collect(),
}
}
pub fn new_with_annotations<I: IntoIterator<Item = DataPropertyExpression>>(
ann: Vec<Annotation>,
dpes: I,
) -> Self {
Self {
axiom_annotations: ann,
data_property_expressions: dpes.into_iter().collect(),
}
}
pub fn data_property_expressions(&self) -> impl Iterator<Item = &DataPropertyExpression> {
self.data_property_expressions.iter()
}
}
impl_display_pretty!(
FunctionalDataProperty( @list axiom_annotations, data_property_expression )
);
impl_has_annotations!(FunctionalDataProperty, axiom_annotations);
impl FunctionalDataProperty {
pub fn new(dpe: DataPropertyExpression) -> Self {
Self {
axiom_annotations: Default::default(),
data_property_expression: dpe,
}
}
pub fn new_with_annotations(ann: Vec<Annotation>, dpe: DataPropertyExpression) -> Self {
Self {
axiom_annotations: ann,
data_property_expression: dpe,
}
}
}
impl_display_pretty!(
DataPropertyDomain( @list axiom_annotations, data_property_expression, domain )
);
impl_has_annotations!(DataPropertyDomain, axiom_annotations);
impl DataPropertyDomain {
pub fn new(dpe: DataPropertyExpression, domain: ClassExpression) -> Self {
Self {
axiom_annotations: Default::default(),
data_property_expression: dpe,
domain,
}
}
pub fn new_with_annotations(
ann: Vec<Annotation>,
dpe: DataPropertyExpression,
domain: ClassExpression,
) -> Self {
Self {
axiom_annotations: ann,
data_property_expression: dpe,
domain,
}
}
}
impl_display_pretty!(
DataPropertyRange( @list axiom_annotations, data_property_expression, range )
);
impl_has_annotations!(DataPropertyRange, axiom_annotations);
impl DataPropertyRange {
pub fn new(dpe: DataPropertyExpression, range: DataRange) -> Self {
Self {
axiom_annotations: Default::default(),
data_property_expression: dpe,
range,
}
}
pub fn new_with_annotations(
ann: Vec<Annotation>,
dpe: DataPropertyExpression,
range: DataRange,
) -> Self {
Self {
axiom_annotations: ann,
data_property_expression: dpe,
range,
}
}
}
impl_display_pretty!(
DatatypeDefinition( @list axiom_annotations, datatype, data_range )
);
impl_has_annotations!(DatatypeDefinition, axiom_annotations);
impl DatatypeDefinition {
pub fn new(datatype: Datatype, data_range: DataRange) -> Self {
Self {
axiom_annotations: Default::default(),
datatype,
data_range,
}
}
pub fn new_with_annotations(
ann: Vec<Annotation>,
datatype: Datatype,
data_range: DataRange,
) -> Self {
Self {
axiom_annotations: ann,
datatype,
data_range,
}
}
}
impl_display_pretty!(
HasKey(
@list axiom_annotations,
class_expression,
@list object_property_expressions,
@list data_property_expressions
)
);
impl_has_annotations!(HasKey, axiom_annotations);
impl HasKey {
pub fn new<I, J>(ce: ClassExpression, opes: I, dpes: J) -> Self
where
I: IntoIterator<Item = ObjectPropertyExpression>,
J: IntoIterator<Item = DataPropertyExpression>,
{
Self {
axiom_annotations: Default::default(),
class_expression: ce,
object_property_expressions: opes.into_iter().collect(),
data_property_expressions: dpes.into_iter().collect(),
}
}
pub fn new_with_annotations<I, J>(
ann: Vec<Annotation>,
ce: ClassExpression,
opes: I,
dpes: J,
) -> Self
where
I: IntoIterator<Item = ObjectPropertyExpression>,
J: IntoIterator<Item = DataPropertyExpression>,
{
Self {
axiom_annotations: ann,
class_expression: ce,
object_property_expressions: opes.into_iter().collect(),
data_property_expressions: dpes.into_iter().collect(),
}
}
pub fn class_expression(&self) -> &ClassExpression {
&self.class_expression
}
pub fn object_property_expressions(&self) -> impl Iterator<Item = &ObjectPropertyExpression> {
self.object_property_expressions.iter()
}
pub fn data_property_expressions(&self) -> impl Iterator<Item = &DataPropertyExpression> {
self.data_property_expressions.iter()
}
}
impl_display_pretty!(
Assertion enum SameIndividual,
DifferentIndividuals,
ClassAssertion,
ObjectPropertyAssertion,
NegativeObjectPropertyAssertion,
DataPropertyAssertion,
NegativeDataPropertyAssertion);
impl_has_annotations!(
Assertion enum SameIndividual,
DifferentIndividuals,
ClassAssertion,
ObjectPropertyAssertion,
NegativeObjectPropertyAssertion,
DataPropertyAssertion,
NegativeDataPropertyAssertion);
impl_from_for_variant!(Assertion, SameIndividual);
impl_from_for_variant!(Assertion, DifferentIndividuals);
impl_from_for_variant!(Assertion, ClassAssertion);
impl_from_for_variant!(Assertion, ObjectPropertyAssertion);
impl_from_for_variant!(Assertion, NegativeObjectPropertyAssertion);
impl_from_for_variant!(Assertion, DataPropertyAssertion);
impl_from_for_variant!(Assertion, NegativeDataPropertyAssertion);
impl_display_pretty!(SameIndividual( @list axiom_annotations, @list individuals ));
impl_has_annotations!(SameIndividual, axiom_annotations);
impl SameIndividual {
pub fn new<I: IntoIterator<Item = Individual>>(individuals: I) -> Self {
Self {
axiom_annotations: Default::default(),
individuals: individuals.into_iter().collect(),
}
}
pub fn new_with_annotations<I: IntoIterator<Item = Individual>>(
ann: Vec<Annotation>,
individuals: I,
) -> Self {
Self {
axiom_annotations: ann,
individuals: individuals.into_iter().collect(),
}
}
pub fn individuals(&self) -> impl Iterator<Item = &Individual> {
self.individuals.iter()
}
}
impl_display_pretty!(DifferentIndividuals( @list axiom_annotations, @list individuals ));
impl_has_annotations!(DifferentIndividuals, axiom_annotations);
impl DifferentIndividuals {
pub fn new<I: IntoIterator<Item = Individual>>(individuals: I) -> Self {
Self {
axiom_annotations: Default::default(),
individuals: individuals.into_iter().collect(),
}
}
pub fn new_with_annotations<I: IntoIterator<Item = Individual>>(
ann: Vec<Annotation>,
individuals: I,
) -> Self {
Self {
axiom_annotations: ann,
individuals: individuals.into_iter().collect(),
}
}
pub fn individuals(&self) -> impl Iterator<Item = &Individual> {
self.individuals.iter()
}
}
impl_display_pretty!(ClassAssertion( @list axiom_annotations, individual, class_expression ));
impl_has_annotations!(ClassAssertion, axiom_annotations);
impl ClassAssertion {
pub fn new(ce: ClassExpression, individual: Individual) -> Self {
Self {
axiom_annotations: Default::default(),
class_expression: ce,
individual,
}
}
pub fn new_with_annotations(
ann: Vec<Annotation>,
ce: ClassExpression,
individual: Individual,
) -> Self {
Self {
axiom_annotations: ann,
class_expression: ce,
individual,
}
}
}
impl_display_pretty!(
ObjectPropertyAssertion(
@list axiom_annotations, source_individual, target_individual, object_property_expression
)
);
impl_has_annotations!(ObjectPropertyAssertion, axiom_annotations);
impl ObjectPropertyAssertion {
pub fn new(ope: ObjectPropertyExpression, source: Individual, target: Individual) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression: ope,
source_individual: source,
target_individual: target,
}
}
pub fn new_with_annotations(
ann: Vec<Annotation>,
ope: ObjectPropertyExpression,
source: Individual,
target: Individual,
) -> Self {
Self {
axiom_annotations: ann,
object_property_expression: ope,
source_individual: source,
target_individual: target,
}
}
}
impl_display_pretty!(
NegativeObjectPropertyAssertion(
@list axiom_annotations, source_individual, target_individual, object_property_expression
)
);
impl_has_annotations!(NegativeObjectPropertyAssertion, axiom_annotations);
impl NegativeObjectPropertyAssertion {
pub fn new(ope: ObjectPropertyExpression, source: Individual, target: Individual) -> Self {
Self {
axiom_annotations: Default::default(),
object_property_expression: ope,
source_individual: source,
target_individual: target,
}
}
pub fn new_with_annotations(
ann: Vec<Annotation>,
ope: ObjectPropertyExpression,
source: Individual,
target: Individual,
) -> Self {
Self {
axiom_annotations: ann,
object_property_expression: ope,
source_individual: source,
target_individual: target,
}
}
}
impl_display_pretty!(
DataPropertyAssertion(
@list axiom_annotations, source_individual, target_value, data_property_expression
)
);
impl_has_annotations!(DataPropertyAssertion, axiom_annotations);
impl DataPropertyAssertion {
pub fn new(dpe: DataPropertyExpression, source: Individual, value: Literal) -> Self {
Self {
axiom_annotations: Default::default(),
data_property_expression: dpe,
source_individual: source,
target_value: value,
}
}
pub fn new_with_annotations(
ann: Vec<Annotation>,
dpe: DataPropertyExpression,
source: Individual,
value: Literal,
) -> Self {
Self {
axiom_annotations: ann,
data_property_expression: dpe,
source_individual: source,
target_value: value,
}
}
}
impl_display_pretty!(
NegativeDataPropertyAssertion(
@list axiom_annotations, source_individual, target_value, data_property_expression
)
);
impl_has_annotations!(NegativeDataPropertyAssertion, axiom_annotations);
impl NegativeDataPropertyAssertion {
pub fn new(dpe: DataPropertyExpression, source: Individual, value: Literal) -> Self {
Self {
axiom_annotations: Default::default(),
data_property_expression: dpe,
source_individual: source,
target_value: value,
}
}
pub fn new_with_annotations(
ann: Vec<Annotation>,
dpe: DataPropertyExpression,
source: Individual,
value: Literal,
) -> Self {
Self {
axiom_annotations: ann,
data_property_expression: dpe,
source_individual: source,
target_value: value,
}
}
}
impl_display_pretty!(
AnnotationAxiom enum SubAnnotationOf,
AnnotationPropertyDomain,
AnnotationPropertyRange,
AnnotationAssertion
);
impl_has_annotations!(
AnnotationAxiom enum SubAnnotationOf,
AnnotationPropertyDomain,
AnnotationPropertyRange,
AnnotationAssertion
);
impl_from_for_variant!(AnnotationAxiom, SubAnnotationOf);
impl_from_for_variant!(AnnotationAxiom, AnnotationPropertyDomain);
impl_from_for_variant!(AnnotationAxiom, AnnotationPropertyRange);
impl_from_for_variant!(AnnotationAxiom, AnnotationAssertion);
impl_display_pretty!(
SubAnnotationOf(
@list axiom_annotations, sub_annotation_property, super_annotation_property
)
);
impl_has_annotations!(SubAnnotationOf, axiom_annotations);
impl SubAnnotationOf {
pub fn new(sub: AnnotationProperty, sup: AnnotationProperty) -> Self {
Self {
axiom_annotations: Default::default(),
sub_annotation_property: sub,
super_annotation_property: sup,
}
}
pub fn new_with_annotations(
ann: Vec<Annotation>,
sub: AnnotationProperty,
sup: AnnotationProperty,
) -> Self {
Self {
axiom_annotations: ann,
sub_annotation_property: sub,
super_annotation_property: sup,
}
}
pub fn sub_annotation_property(&self) -> &AnnotationProperty {
&self.sub_annotation_property
}
pub fn super_annotation_property(&self) -> &AnnotationProperty {
&self.super_annotation_property
}
}
impl_display_pretty!(
AnnotationPropertyDomain(@list axiom_annotations, annotation_property, domain)
);
impl_has_annotations!(AnnotationPropertyDomain, axiom_annotations);
impl AnnotationPropertyDomain {
pub fn new(ap: AnnotationProperty, domain: Iri) -> Self {
Self {
axiom_annotations: Default::default(),
annotation_property: ap,
domain,
}
}
pub fn new_with_annotations(ann: Vec<Annotation>, ap: AnnotationProperty, domain: Iri) -> Self {
Self {
axiom_annotations: ann,
annotation_property: ap,
domain,
}
}
pub fn annotation_property(&self) -> &AnnotationProperty {
&self.annotation_property
}
pub fn domain(&self) -> &Iri {
&self.domain
}
}
impl_display_pretty!(
AnnotationPropertyRange(@list axiom_annotations, annotation_property, range)
);
impl_has_annotations!(AnnotationPropertyRange, axiom_annotations);
impl AnnotationPropertyRange {
pub fn new(ap: AnnotationProperty, range: Iri) -> Self {
Self {
axiom_annotations: Default::default(),
annotation_property: ap,
range,
}
}
pub fn new_with_annotations(ann: Vec<Annotation>, ap: AnnotationProperty, range: Iri) -> Self {
Self {
axiom_annotations: ann,
annotation_property: ap,
range,
}
}
pub fn annotation_property(&self) -> &AnnotationProperty {
&self.annotation_property
}
pub fn range(&self) -> &Iri {
&self.range
}
}
impl_display_pretty!(
AnnotationAssertion(
@list axiom_annotations, annotation_property, annotation_subject, annotation_value
)
);
impl_has_annotations!(AnnotationAssertion, axiom_annotations);
impl AnnotationAssertion {
pub fn new(ap: AnnotationProperty, subject: AnnotationSubject, value: AnnotationValue) -> Self {
Self {
axiom_annotations: Default::default(),
annotation_property: ap,
annotation_subject: subject,
annotation_value: value,
}
}
pub fn new_with_annotations(
ann: Vec<Annotation>,
ap: AnnotationProperty,
subject: AnnotationSubject,
value: AnnotationValue,
) -> Self {
Self {
axiom_annotations: ann,
annotation_property: ap,
annotation_subject: subject,
annotation_value: value,
}
}
pub fn annotation_property(&self) -> &AnnotationProperty {
&self.annotation_property
}
pub fn annotation_subject(&self) -> &AnnotationSubject {
&self.annotation_subject
}
pub fn annotation_value(&self) -> &AnnotationValue {
&self.annotation_value
}
}
impl_display_pretty!(
AnnotationSubject enum Iri, AnonymousIndividual
);
impl_from_for_variant!(AnnotationSubject, Iri);
impl_from_for_variant!(AnnotationSubject, AnonymousIndividual);