Skip to main content

RdfStarSerializer

Trait RdfStarSerializer 

Source
pub trait RdfStarSerializer {
    // Required methods
    fn serialize_embedded_triple(
        &self,
        virtual_id: u64,
        components: &[u64; 3],
    ) -> Result<Vec<u8>, RdfStarSerializeError>;
    fn serialize_triple(
        &self,
        subject: u64,
        predicate: u64,
        object: u64,
    ) -> Result<Vec<u8>, RdfStarSerializeError>;
    fn serialize_quad(
        &self,
        subject: u64,
        predicate: u64,
        object: u64,
        graph: u64,
    ) -> Result<Vec<u8>, RdfStarSerializeError>;
    fn supports_quads(&self) -> bool;
    fn format_name(&self) -> &'static str;
}
Expand description

Trait for RDF-Star serializers across multiple formats

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

Required Methods§

Source

fn serialize_embedded_triple( &self, virtual_id: u64, components: &[u64; 3], ) -> Result<Vec<u8>, RdfStarSerializeError>

Serialize a Virtual ID back to format-specific embedded triple syntax

Takes the Virtual ID and its component IDs (retrieved from lexicon)

Source

fn serialize_triple( &self, subject: u64, predicate: u64, object: u64, ) -> Result<Vec<u8>, RdfStarSerializeError>

Serialize a regular triple

Source

fn serialize_quad( &self, subject: u64, predicate: u64, object: u64, graph: u64, ) -> Result<Vec<u8>, RdfStarSerializeError>

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

Source

fn supports_quads(&self) -> bool

Check if this serializer supports quad formats

Source

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

Get the format name for error reporting

Implementors§