Object-Centric Event Log (OCEL) is a standard interchange format for object-centric event data with multiple case notions. This library aims to implement this standard in .NET with a high degree of type safety.
$ dotnet add package OCEL.CSharpObject-Centric Event Log (OCEL) is a standard interchange format for object-centric event data with multiple case notions [1]. This library aims to implement this standard in .NET with a high degree of type safety.
The OCEL standard is defined for both JSON and XML. Both include a validation schema that is used by the library to validate input.
An additional useful format is to store OCEL data in document databases such as MongoDB [2]. A very good alternative for .NET is LiteDB, which is an embedded NoSQL database that is similar to MongoDB. It allows writing to files directly and does not require a database server to use. Support for MongoDB will be evaluated in the future.
| Format | Status |
|---|---|
| JSON | Implemented |
| XML | Implemented |
| LiteDB | Implemented |
| MongoDB | TBD |
The library is written in F# and can be used directly by all .NET languages. For idiomatic usage in C#, a wrapper library is provided that mainly converts between appropriate types for the parsed logs.
Both libraries are available on NuGet:
| Library | NuGet Link |
|---|---|
| F# | https://www.nuget.org/packages/OCEL |
| C# | https://www.nuget.org/packages/OCEL.CSharp |
var json = File.ReadAllText("minimal.jsonocel");
var valid = OCEL.CSharp.OcelJson.Validate(json);
var (valid, errors) = OCEL.CSharp.OcelJson.ValidateWithErrorMessages(json);
var json = File.ReadAllText("minimal.jsonocel");
var xml = File.ReadAllText("minimal.xmlocel");
var fromJson = OCEL.CSharp.OcelJson.Deserialize(json);
var fromXml = OCEL.CSharp.OcelXml.Deserialize(xml);
var log = OCEL.CSharp.OcelJson.Deserialize(File.ReadAllText("minimal.jsonocel"));
var db = new LiteDatabase(":memory:");
OCEL.CSharp.OcelLiteDB.Serialize(db, log);
var serializedLog = OCEL.CSharp.OcelLiteDB.Deserialize(db);
var json = File.ReadAllText("minimal.jsonocel");
var parsed = OCEL.CSharp.OcelJson.Deserialize(json);
var xml = OCEL.CSharp.OcelXml.Serialize(parsed, OCEL.Types.Formatting.Indented);
[1] Farhang, A., Park, G. G., Berti, A., & Aalst, W. Van Der. (2020). OCEL Standard. http://ocel-standard.org/
[2] Berti, A., Ghahfarokhi, A. F., Park, G., & van der Aalst, W. M. P. (2021). A Scalable Database for the Storage of Object-Centric Event Logs. CEUR Workshop Proceedings, 3098, 19–20. https://arxiv.org/abs/2202.05639.