pub struct MappingEngine {
pub skip_errors: bool,
}Expand description
Engine that executes MappingRules and produces RDF Triples
The engine is stateless and cheap to create. All configuration is carried by the rules themselves.
Fields§
§skip_errors: boolWhether to skip rows that produce errors instead of failing fast
Implementations§
Source§impl MappingEngine
impl MappingEngine
Sourcepub fn new_lenient() -> Self
pub fn new_lenient() -> Self
Create an engine that silently skips rows that produce mapping errors
Sourcepub fn execute(&self, rule: &MappingRule) -> MappingResult<Vec<Triple>>
pub fn execute(&self, rule: &MappingRule) -> MappingResult<Vec<Triple>>
Execute a single mapping rule and return all produced triples
Sourcepub fn execute_all(&self, rules: &[MappingRule]) -> MappingResult<Vec<Triple>>
pub fn execute_all(&self, rules: &[MappingRule]) -> MappingResult<Vec<Triple>>
Execute multiple rules and concatenate all produced triples
Sourcepub fn parse_csv(
content: &str,
delimiter: char,
) -> MappingResult<(Vec<String>, Vec<Row>)>
pub fn parse_csv( content: &str, delimiter: char, ) -> MappingResult<(Vec<String>, Vec<Row>)>
Parse CSV content into (headers, rows).
Handles:
- Configurable delimiter
- Double-quote escaping (
""inside a quoted field) - CRLF and LF line endings
- Quoted fields that span multiple lines
Sourcepub fn parse_json(
content: &str,
json_path: Option<&str>,
) -> MappingResult<Vec<Row>>
pub fn parse_json( content: &str, json_path: Option<&str>, ) -> MappingResult<Vec<Row>>
Parse JSON content into rows.
Behaviour:
- If
json_pathisNone, the root must be a JSON array of objects. - If
json_pathisSome("a.b.c"), the engine traverses object keysa→b→cand expects to find an array there. - Each array element must be a JSON object; its key-value pairs become the row fields (values are coerced to strings).
Trait Implementations§
Source§impl Clone for MappingEngine
impl Clone for MappingEngine
Source§fn clone(&self) -> MappingEngine
fn clone(&self) -> MappingEngine
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MappingEngine
impl Debug for MappingEngine
Source§impl Default for MappingEngine
impl Default for MappingEngine
Source§fn default() -> MappingEngine
fn default() -> MappingEngine
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MappingEngine
impl RefUnwindSafe for MappingEngine
impl Send for MappingEngine
impl Sync for MappingEngine
impl Unpin for MappingEngine
impl UnsafeUnpin for MappingEngine
impl UnwindSafe for MappingEngine
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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