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§
Sourcefn serialize_embedded_triple(
&self,
virtual_id: u64,
components: &[u64; 3],
) -> Result<Vec<u8>, RdfStarSerializeError>
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)
Sourcefn serialize_triple(
&self,
subject: u64,
predicate: u64,
object: u64,
) -> Result<Vec<u8>, RdfStarSerializeError>
fn serialize_triple( &self, subject: u64, predicate: u64, object: u64, ) -> Result<Vec<u8>, RdfStarSerializeError>
Serialize a regular triple
Sourcefn serialize_quad(
&self,
subject: u64,
predicate: u64,
object: u64,
graph: u64,
) -> Result<Vec<u8>, RdfStarSerializeError>
fn serialize_quad( &self, subject: u64, predicate: u64, object: u64, graph: u64, ) -> Result<Vec<u8>, RdfStarSerializeError>
Serialize a quad (subject, predicate, object, graph)
Sourcefn supports_quads(&self) -> bool
fn supports_quads(&self) -> bool
Check if this serializer supports quad formats
Sourcefn format_name(&self) -> &'static str
fn format_name(&self) -> &'static str
Get the format name for error reporting