pub trait WriteTx {
fn new_identifier(
&self,
prefix: Option<String>
) -> Result<Identifier, LigatureError>;
fn add_statement(
&self,
statement: &Statement
) -> Result<Statement, LigatureError>;
fn remove_statement(
&self,
persisted_statement: &Statement
) -> Result<bool, LigatureError>;
fn cancel(&self) -> Result<(), LigatureError>;
}
Expand description
Represents a WriteTx within the context of a Ligature instance and a single Dataset
Required methods
fn new_identifier(
&self,
prefix: Option<String>
) -> Result<Identifier, LigatureError>
fn new_identifier(
&self,
prefix: Option<String>
) -> Result<Identifier, LigatureError>
Creates a new, unique Entity within this Dataset with an optional prefix. This version of the function enforces that the new entity is unique in this Dataset.
fn add_statement(
&self,
statement: &Statement
) -> Result<Statement, LigatureError>
fn add_statement(
&self,
statement: &Statement
) -> Result<Statement, LigatureError>
Adds a given Statement to this Dataset. If the Statement already exists nothing happens (TODO maybe add it with a new context?). Note: Potentially could trigger a ValidationError
fn remove_statement(
&self,
persisted_statement: &Statement
) -> Result<bool, LigatureError>
fn remove_statement(
&self,
persisted_statement: &Statement
) -> Result<bool, LigatureError>
Removes a given Statement from this Dataset. If the Statement doesn’t exist nothing happens and returns Ok(false). This function returns Ok(true) only if the given Statement was found and removed. Note: Potentially could trigger a ValidationError.
fn cancel(&self) -> Result<(), LigatureError>
fn cancel(&self) -> Result<(), LigatureError>
Cancels this transaction so that none of the changes made so far will be stored. This also closes this transaction so no other methods can be called without returning a LigatureError.