ontocore-edit 0.26.2

Semantic transaction model for OntoCore ontology editing
Documentation
use ontocore_obo::OboPatchOp;
use ontocore_owl::PatchOp;
use serde::{Deserialize, Serialize};

/// A single semantic edit, represented as a format-specific patch op until
/// RDF/XML and OWL/XML adapters land (v0.21).
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(tag = "format", rename_all = "snake_case")]
pub enum SemanticChange {
    Turtle { change: PatchOp },
    Obo { change: OboPatchOp },
}

impl SemanticChange {
    pub fn turtle(change: PatchOp) -> Self {
        Self::Turtle { change }
    }

    pub fn obo(change: OboPatchOp) -> Self {
        Self::Obo { change }
    }

    pub fn is_turtle(&self) -> bool {
        matches!(self, Self::Turtle { .. })
    }

    pub fn is_obo(&self) -> bool {
        matches!(self, Self::Obo { .. })
    }
}