1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
#![warn(
clippy::doc_markdown,
missing_debug_implementations,
rust_2018_idioms,
missing_docs
)]
#![doc = include_str!("../README.md")]
///
/// Event Logs (traditional [`EventLog`] and Object-Centric [`OCEL`])
///
pub mod event_log {
/// Activity projection of event logs
pub mod activity_projection;
/// Constants
pub mod constants;
/// [`EventLog`] struct and sub-structs
pub mod event_log_struct;
/// XES Export
pub mod export_xes;
/// XES Import
pub mod import_xes;
/// Streaming XES Import
pub mod stream_xes;
///
/// OCEL2.0 (Object-Centric Event Logs)
///
pub mod ocel {
/// [`OCEL`] struct and sub-structs
pub mod ocel_struct;
#[allow(clippy::single_match)]
/// Parser for the OCEL2 XML format
pub mod xml_ocel_import;
}
pub use event_log_struct::{
Attribute, AttributeAddable, AttributeValue, Attributes, Event, EventLog, Trace,
};
#[cfg(test)]
mod tests;
}
///
/// Petri nets
///
pub mod petri_net {
/// [`PetriNet`] struct
pub mod petri_net_struct;
/// Export [`PetriNet`] to `.pnml`
pub mod pnml;
}
#[doc(inline)]
pub use event_log::ocel;
#[doc(inline)]
pub use alphappp::full::alphappp_discover_petri_net;
#[doc(inline)]
pub use event_log::import_xes::import_xes_file;
#[doc(inline)]
pub use event_log::import_xes::import_xes_slice;
#[doc(inline)]
pub use event_log::stream_xes::stream_xes_from_path;
#[doc(inline)]
pub use event_log::stream_xes::stream_xes_slice;
#[doc(inline)]
pub use event_log::stream_xes::stream_xes_slice_gz;
#[doc(inline)]
pub use event_log::stream_xes::stream_xes_file;
#[doc(inline)]
pub use event_log::stream_xes::stream_xes_file_gz;
#[doc(inline)]
pub use event_log::export_xes::export_xes_trace_stream_to_file;
#[doc(inline)]
pub use event_log::export_xes::export_xes_event_log_to_file_path;
#[doc(inline)]
pub use event_log::stream_xes::StreamingXESParser;
#[doc(inline)]
pub use event_log::import_xes::XESImportOptions;
#[doc(inline)]
pub use event_log::event_log_struct::EventLog;
#[doc(inline)]
pub use event_log::ocel::ocel_struct::OCEL;
#[doc(inline)]
pub use event_log::ocel::xml_ocel_import::import_ocel_xml;
#[doc(inline)]
pub use event_log::ocel::xml_ocel_import::import_ocel_xml_file;
#[doc(inline)]
pub use event_log::ocel::xml_ocel_import::import_ocel_xml_slice;
#[doc(inline)]
pub use petri_net::petri_net_struct::PetriNet;
#[doc(inline)]
pub use event_log::activity_projection::EventLogActivityProjection;
///
/// Module for the Alpha+++ Process Discovery algorithm
///
pub mod alphappp {
/// Automatic determining algorithm parameters for Alpha+++
pub mod auto_parameters;
/// Alpha+++ Place Candidate Building
pub mod candidate_building;
/// Alpha+++ Place Candidate Pruning
pub mod candidate_pruning;
/// Full Alpha+++ Discovery algorithm
pub mod full;
/// Event Log Repair (Adding artificial activities)
pub mod log_repair;
}
///
/// Serialize a [`PetriNet`] as a JSON [`String`]
///
pub fn petrinet_to_json(net: &PetriNet) -> String {
serde_json::to_string(net).unwrap()
}
///
/// Deserialize a [`PetriNet`] from a JSON [`String`]
///
pub fn json_to_petrinet(net_json: &str) -> PetriNet {
serde_json::from_str(net_json).unwrap()
}
///
/// Serialize [`OCEL`] as a JSON [`String`]
///
/// [`serde_json`] can also be used to convert [`OCEL`] to other targets (e.g., `serde_json::to_writer`)
///
pub fn ocel_to_json(ocel: &OCEL) -> String {
serde_json::to_string(ocel).unwrap()
}
///
/// Import [`OCEL`] from a JSON [`String`]
///
/// [`serde_json`] can also be used to import [`OCEL`] from other targets (e.g., `serde_json::from_reader`)
///
pub fn json_to_ocel(ocel_json: &str) -> OCEL {
serde_json::from_str(ocel_json).unwrap()
}
// pub fn export_log<P: AsRef<Path>>(path: P, log: &EventLog) {
// let file = File::create(path).unwrap();
// let writer = BufWriter::new(file);
// serde_json::to_writer(writer, log).unwrap();
// }
// pub fn export_log_to_string(log: &EventLog) -> String {
// serde_json::to_string(log).unwrap()
// }
// pub fn export_log_to_byte_vec(log: &EventLog) -> Vec<u8> {
// serde_json::to_vec(log).unwrap()
// }
// pub fn import_log<P: AsRef<Path>>(path: P) -> EventLog {
// let file = File::open(path).unwrap();
// let reader = BufReader::new(file);
// let log: EventLog = serde_json::from_reader(reader).unwrap();
// return log;
// }
// pub fn import_log_from_byte_array(bytes: &[u8]) -> EventLog {
// let log: EventLog = serde_json::from_slice(&bytes).unwrap();
// return log;
// }
// pub fn import_log_from_str(json: String) -> EventLog {
// serde_json::from_str(&json).unwrap()
// }