pub struct RdfDiff {
pub added: Vec<NTriple>,
pub removed: Vec<NTriple>,
}Expand description
The set difference between two RDF graphs
added contains triples present in after but not before;
removed contains triples present in before but not after.
Fields§
§added: Vec<NTriple>Triples that were added (present in after graph, absent from before)
removed: Vec<NTriple>Triples that were removed (present in before graph, absent from after)
Implementations§
Source§impl RdfDiff
impl RdfDiff
Sourcepub fn new(added: Vec<NTriple>, removed: Vec<NTriple>) -> Self
pub fn new(added: Vec<NTriple>, removed: Vec<NTriple>) -> Self
Construct a diff with given additions and removals
Sourcepub fn triple_count(&self) -> usize
pub fn triple_count(&self) -> usize
Total number of changed triples (additions + removals)
Sourcepub fn apply(&self, triples: &mut Vec<NTriple>)
pub fn apply(&self, triples: &mut Vec<NTriple>)
Apply this diff to a mutable graph in place.
Removed triples are deleted, then added triples are appended. The operation is idempotent: applying the same diff twice leaves the graph in the same state as applying it once.
Sourcepub fn invert(&self) -> Self
pub fn invert(&self) -> Self
Return the inverse diff (swap added and removed).
Applying the inverse of a diff to the “after” graph yields the “before” graph.
Sourcepub fn to_patch_format(&self) -> String
pub fn to_patch_format(&self) -> String
Serialise the diff to the simple patch format.
Each removed triple is emitted as a line starting with - followed
by an N-Triples representation; each added triple starts with + .
A comment header records the diff statistics.
Trait Implementations§
impl StructuralPartialEq for RdfDiff
Auto Trait Implementations§
impl Freeze for RdfDiff
impl RefUnwindSafe for RdfDiff
impl Send for RdfDiff
impl Sync for RdfDiff
impl Unpin for RdfDiff
impl UnsafeUnpin for RdfDiff
impl UnwindSafe for RdfDiff
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more