TermEncoder

Trait TermEncoder 

Source
pub trait TermEncoder<TEncoding>:
    Debug
    + Sync
    + Send
where TEncoding: TermEncoding + ?Sized,
{ type Term<'data>; // Required methods fn encode_terms<'data>( terms: impl IntoIterator<Item = Result<Self::Term<'data>, ThinError>>, ) -> Result<<TEncoding as TermEncoding>::Array, DataFusionError>; fn encode_term( term: Result<Self::Term<'_>, ThinError>, ) -> Result<<TEncoding as TermEncoding>::Scalar, DataFusionError>; }
Expand description

Allows encoding an iterator of a type into an EncodingArray.

This allows users to encode values in an RDF term array. An encoder is specialized for one encoding and one value type (Self::Term). The value type may only represent a subset of all valid RDF terms (e.g., only Boolean values). However, it is recommended that there is one decoder per TermEncoding that allows users to encode all RDF terms.

§Performance

Using a TermDecoder for accessing the array, performing an operation on Self::Term, and then re-encoding the resulting value using a TermEncoder may incur a performance penalty. However, we hope that this impact can be mitigated by compiler optimizations. We have yet to benchmark this impact to make a founded recommendation of when to use decoders and encoders. Users are free to directly work on the Arrow arrays to side-step the typed Encoding/Decoding machinery.

Required Associated Types§

Source

type Term<'data>

The value type that is being encoded.

Required Methods§

Source

fn encode_terms<'data>( terms: impl IntoIterator<Item = Result<Self::Term<'data>, ThinError>>, ) -> Result<<TEncoding as TermEncoding>::Array, DataFusionError>

Allows encoding an iterator over RDF terms in an Arrow array.

Source

fn encode_term( term: Result<Self::Term<'_>, ThinError>, ) -> Result<<TEncoding as TermEncoding>::Scalar, DataFusionError>

Allows encoding a scalar RDF term in an Arrow scalar.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl TermEncoder<PlainTermEncoding> for BooleanPlainTermEncoder

Source§

type Term<'data> = Boolean

Source§

impl TermEncoder<PlainTermEncoding> for DefaultPlainTermEncoder

Source§

type Term<'data> = TermRef<'data>

Source§

impl TermEncoder<PlainTermEncoding> for SimpleLiteralRefPlainTermEncoder

Source§

type Term<'data> = SimpleLiteralRef<'data>

Source§

impl TermEncoder<PlainTermEncoding> for TypedValueRefPlainTermEncoder

Source§

type Term<'data> = TypedValueRef<'data>

Source§

impl TermEncoder<SortableTermEncoding> for TermRefSortableTermEncoder

Source§

type Term<'data> = TermRef<'data>

Source§

impl TermEncoder<SortableTermEncoding> for TypedValueRefSortableTermEncoder

Source§

type Term<'data> = TypedValueRef<'data>

Source§

impl TermEncoder<TypedValueEncoding> for BlankNodeRefTermValueEncoder

Source§

type Term<'data> = BlankNodeRef<'data>

Source§

impl TermEncoder<TypedValueEncoding> for BlankNodeTermValueEncoder

Source§

type Term<'data> = BlankNode

Source§

impl TermEncoder<TypedValueEncoding> for BooleanTermValueEncoder

Source§

type Term<'data> = Boolean

Source§

impl TermEncoder<TypedValueEncoding> for DateTimeTermValueEncoder

Source§

type Term<'data> = DateTime

Source§

impl TermEncoder<TypedValueEncoding> for DayTimeDurationTermValueEncoder

Source§

impl TermEncoder<TypedValueEncoding> for DecimalTermValueEncoder

Source§

type Term<'data> = Decimal

Source§

impl TermEncoder<TypedValueEncoding> for DefaultTypedValueEncoder

Source§

type Term<'data> = TypedValueRef<'data>

Source§

impl TermEncoder<TypedValueEncoding> for DoubleTermValueEncoder

Source§

type Term<'data> = Double

Source§

impl TermEncoder<TypedValueEncoding> for FloatTermValueEncoder

Source§

type Term<'data> = Float

Source§

impl TermEncoder<TypedValueEncoding> for IntTermValueEncoder

Source§

type Term<'data> = Int

Source§

impl TermEncoder<TypedValueEncoding> for IntegerTermValueEncoder

Source§

type Term<'data> = Integer

Source§

impl TermEncoder<TypedValueEncoding> for LiteralRefTermValueEncoder

Source§

type Term<'data> = LiteralRef<'data>

Source§

impl TermEncoder<TypedValueEncoding> for NamedNodeRefTermValueEncoder

Source§

type Term<'data> = NamedNodeRef<'data>

Source§

impl TermEncoder<TypedValueEncoding> for NamedNodeTermValueEncoder

Source§

type Term<'data> = NamedNode

Source§

impl TermEncoder<TypedValueEncoding> for NumericTypedValueEncoder

Source§

type Term<'data> = Numeric

Source§

impl TermEncoder<TypedValueEncoding> for OwnedStringLiteralTermValueEncoder

Source§

impl TermEncoder<TypedValueEncoding> for SimpleLiteralRefTermValueEncoder

Source§

type Term<'data> = SimpleLiteralRef<'data>

Source§

impl TermEncoder<TypedValueEncoding> for StringLiteralRefTermValueEncoder

Source§

type Term<'data> = StringLiteralRef<'data>

Source§

impl TermEncoder<TypedValueEncoding> for TermRefTypedValueEncoder

Source§

type Term<'data> = TermRef<'data>