Skip to main content

RdfStarParser

Trait RdfStarParser 

Source
pub trait RdfStarParser {
    // Required methods
    fn parse_embedded_triple(
        &mut self,
        input: &[u8],
    ) -> Result<(u64, [u64; 3]), RdfStarParseError>;
    fn parse_triple(
        &mut self,
        input: &[u8],
    ) -> Result<(u64, u64, u64), RdfStarParseError>;
    fn parse_quad(
        &mut self,
        input: &[u8],
    ) -> Result<(u64, u64, u64, u64), RdfStarParseError>;
    fn supports_quads(&self) -> bool;
    fn supports_named_graphs(&self) -> bool;
    fn format_name(&self) -> &'static str;
}
Expand description

Trait for RDF-Star parsers across multiple formats

All parsers must implement this trait to ensure consistent conversion from format-specific syntax to Virtual IDs.

Required Methods§

Source

fn parse_embedded_triple( &mut self, input: &[u8], ) -> Result<(u64, [u64; 3]), RdfStarParseError>

Parse an embedded triple from format-specific syntax

Returns (Virtual ID, [subject_id, predicate_id, object_id])

Source

fn parse_triple( &mut self, input: &[u8], ) -> Result<(u64, u64, u64), RdfStarParseError>

Parse a regular triple (subject, predicate, object)

Source

fn parse_quad( &mut self, input: &[u8], ) -> Result<(u64, u64, u64, u64), RdfStarParseError>

Parse a quad (subject, predicate, object, graph)

Returns None if the format doesn’t support quads

Source

fn supports_quads(&self) -> bool

Check if this parser supports quad formats (named graphs)

Source

fn supports_named_graphs(&self) -> bool

Check if this parser supports named graphs

Source

fn format_name(&self) -> &'static str

Get the format name for error reporting

Implementors§