#![warn(
clippy::doc_markdown,
missing_debug_implementations,
rust_2018_idioms,
missing_docs,
clippy::redundant_clone,
clippy::clone_on_copy
)]
#![doc = include_str!("../README.md")]
pub mod analysis;
pub mod conformance;
pub mod core;
pub mod discovery;
pub mod utils;
pub use core::io::{Exportable, Importable};
pub use core::{EventLog, PetriNet, OCEL};
pub use core::event_data::object_centric::{
appendable::AppendableOCEL,
ocel_json::import_ocel_json_into,
ocel_xml::xml_ocel_import::{import_ocel_xml_into, OCELImportOptions},
readable::{OCELLookup, ReadableOCEL},
};
pub use quick_xml::{Reader as XmlReader, Writer as XmlWriter};
pub mod bindings;
#[doc(hidden)]
pub mod test_utils {
use std::path::PathBuf;
use crate::OCEL;
#[allow(unused)]
pub fn get_test_data_path() -> PathBuf {
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("test_data")
}
#[allow(unused)]
pub fn sort_ocel_for_equality_compare(ocel: &mut OCEL) {
ocel.events
.sort_by(|x, y| (x.time, &x.id).cmp(&(y.time, &y.id)));
ocel.objects.sort_by(|x, y| x.id.cmp(&y.id));
ocel.event_types.sort_by(|x, y| x.name.cmp(&y.name));
ocel.object_types.sort_by(|x, y| x.name.cmp(&y.name));
for e in &mut ocel.events {
e.relationships
.sort_by(|x, y| (&x.object_id, &x.qualifier).cmp(&(&y.object_id, &y.qualifier)));
}
for o in &mut ocel.objects {
o.attributes
.sort_by(|x, y| (x.time, &x.name).cmp(&(y.time, &y.name)));
o.relationships
.sort_by(|x, y| (&x.object_id, &x.qualifier).cmp(&(&y.object_id, &y.qualifier)));
}
}
}
#[allow(missing_debug_implementations)]
pub enum XMLWriterWrapper<'a, W> {
Owned(quick_xml::Writer<W>),
Ref(&'a mut quick_xml::Writer<W>),
}
impl<'a, W> XMLWriterWrapper<'a, W> {
pub fn to_xml_writer(&'a mut self) -> &'a mut quick_xml::Writer<W> {
match self {
XMLWriterWrapper::Owned(w) => w,
XMLWriterWrapper::Ref(w) => w,
}
}
}
impl<W: std::io::Write> From<W> for XMLWriterWrapper<'_, W> {
fn from(w: W) -> Self {
Self::Owned(quick_xml::Writer::new(w))
}
}
impl<'a, W> From<&'a mut quick_xml::Writer<W>> for XMLWriterWrapper<'a, W> {
fn from(w: &'a mut quick_xml::Writer<W>) -> Self {
Self::Ref(w)
}
}