#![deny(missing_docs)]
use hashbag::HashBag;
use std::collections::{BTreeMap, BTreeSet};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq, Deserialize, Serialize, Hash)]
pub struct Element(pub String);
#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq, Deserialize, Serialize, Hash)]
pub enum Entry {
Role {
first: Element,
second: Element,
role: Element,
},
Extends {
element: Element,
concept: Element,
},
NotExtends {
element: Element,
concept: Element,
},
}
pub struct LigatureError(pub String);
pub trait Ligature {
fn collections(&self) -> Result<Vec<Element>, LigatureError>;
fn add_collection(&mut self, collection: Element) -> Result<(), LigatureError>;
fn remove_collection(&mut self, collection: Element) -> Result<(), LigatureError>;
fn entries(&self, collection: Element) -> Result<BTreeSet<Entry>, LigatureError>;
fn add_entries(&mut self, collection: Element, entries: &mut BTreeSet<Entry>) -> Result<(), LigatureError>;
fn remove_entries(
&mut self,
collection: Element,
entries: &mut BTreeSet<Entry>,
) -> Result<(), LigatureError>;
fn query(
&self,
collection: Element,
pattern: BTreeSet<Entry>,
) -> Result<HashBag<BTreeMap<String, String>>, LigatureError>;
}