pub trait EncodePlugin: Send + Sync {
// Required methods
fn datatypes(&self) -> &[NamedNode];
fn encode_literal(
&self,
literal: &Literal,
) -> (EncodedTerm, Vec<(StrHash, Vec<u8>)>);
fn decode_literal(
&self,
term: &EncodedTerm,
payload: Option<&[u8]>,
) -> Option<String>;
}Expand description
Datatype-owner hook: encode + decode user literals of claimed IRIs.
Required Methods§
Sourcefn datatypes(&self) -> &[NamedNode]
fn datatypes(&self) -> &[NamedNode]
Datatype IRIs this plugin owns. Two plugins claiming one IRI is a startup error.
Sourcefn encode_literal(
&self,
literal: &Literal,
) -> (EncodedTerm, Vec<(StrHash, Vec<u8>)>)
fn encode_literal( &self, literal: &Literal, ) -> (EncodedTerm, Vec<(StrHash, Vec<u8>)>)
Parse / transform / mint a native term, or return a hashed typed literal on failure. Query constants never create index entries, so this hook remains total even when the same literal would be a hard error on the stored-geometry write path.
The second component carries the content-addressed payload entries
(blob_id → payload bytes) the encode computed while minting
(canonical CRS84 EWKB for geometries). Query constants are not
store data, so these pairs are the ONLY copy of the payload: the
seeding predicate installs them in the query-local blob map under
the blob id, where runtime payload fetches (the geo relate loop)
read them instead of miss-firing a registry RPC for a blob the
store has never seen. Empty for inline terms (points) and for the
hashed typed-literal fallback.
Sourcefn decode_literal(
&self,
term: &EncodedTerm,
payload: Option<&[u8]>,
) -> Option<String>
fn decode_literal( &self, term: &EncodedTerm, payload: Option<&[u8]>, ) -> Option<String>
Render the lexical form of a native term this plugin minted.
payload carries the blob bytes for blob-backed terms
(EncodedTerm::LiteralGeometry / EncodedTerm::BlobLiteral);
compute fetched them before calling. Inline terms (points) get
None. Returns None when the term is not this plugin’s.