public class IVBindingSetEncoder extends Object implements IBindingSetEncoder, IBindingSetDecoder
IBindingSets whose IConstants are bound to IVs.
Individual IVs may be associated with a cached RDF Value.
As a contract, the class provides guarantees that the representation of a
given binding set is always the same. This makes it possible to use an
HTree based DistinctFilter over encoded binding sets.
Note: This implementation does NOT maintain the IVCache associations.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
filter
true iff this is in support of a DISTINCT filter. |
protected BigdataValueFactory |
vf
Value factory
|
| Constructor and Description |
|---|
IVBindingSetEncoder(BigdataValueFactory vf,
boolean filter) |
| Modifier and Type | Method and Description |
|---|---|
IBindingSet |
decodeSolution(byte[] val,
int off,
int len,
boolean resolveCachedValues)
Decode an
IBindingSet. |
byte[] |
encodeSolution(IBindingSet bset)
|
byte[] |
encodeSolution(IBindingSet bset,
boolean updateCache)
Encode the solution as an
IV[]. |
void |
flush()
Flush any updates.
|
boolean |
isValueCache()
Return
true iff the IVCache associations are
preserved by the encoder. |
void |
release()
Release the state associated with the
IVBindingSetEncoder. |
void |
resolveCachedValues(IBindingSet bset)
Resolve any
IVs in the solution for which there are cached
BigdataValues to those values. |
protected final BigdataValueFactory vf
protected final boolean filter
true iff this is in support of a DISTINCT filter.
Note: we do not maintain the #ivCacheSchema for a DISTINCT filter
since the original solutions flow through the filter.
public IVBindingSetEncoder(BigdataValueFactory vf, boolean filter)
store - the backing storefilter - true iff this is in support of a DISTINCT filter.
Note: we do not maintain the #ivCacheSchema for a
DISTINCT filter since the original solutions flow through the
filter.
public boolean isValueCache()
true iff the IVCache associations are
preserved by the encoder.
This implementation does not maintain the IVCache associations.
isValueCache in interface IBindingSetDecoderisValueCache in interface IBindingSetEncoderpublic byte[] encodeSolution(IBindingSet bset)
IBindingSetEncoderencodeSolution in interface IBindingSetEncoderbset - The solution to be encoded.public byte[] encodeSolution(IBindingSet bset, boolean updateCache)
IBindingSetEncoderIV[].
Note: The IVCache associations may be buffered by this method.
Use IBindingSetEncoder.flush() to vector any buffered associations.
encodeSolution in interface IBindingSetEncoderbset - The solution to be encoded.updateCache - When true, updates are accumulated for the
IV to BigdataValue cache. You must still use
IBindingSetEncoder.flush() to vector the accumulated updates.
If you are only generating the encoding in order to resolve a
key in a hash index, then you would use false
since you do not need to maintain the IVCache
association for the given IBindingSet.
public void flush()
IBindingSetEncoderIVCache associations.flush in interface IBindingSetEncoderpublic IBindingSet decodeSolution(byte[] val, int off, int len, boolean resolveCachedValues)
IBindingSetDecoderIBindingSet.
The resolution step can be deferred when the decoded IBindingSet
does not require the resolved IVCache associations. For example,
we do not need the IVCache association in order to decide if two
IBindingSets can join. However, once we have a solution from a
join, we may need to resolve the IVCache metadata for the joined
solution.
decodeSolution in interface IBindingSetDecoderval - The encoded IV[].off - The starting offset.len - The #of bytes of data to be decoded.resolveCachedValues - When true, any decoded IVs will have
their IVCache association resolved before the
IBindingSet is returned to the caller. When
false, the resolution step is not performed.IBindingSet.IBindingSetDecoder.resolveCachedValues(IBindingSet)public void resolveCachedValues(IBindingSet bset)
IVs in the solution for which there are cached
BigdataValues to those values. This method may be used to resolve
IVCache associations for IBindingSets NOT produced by
IBindingSetDecoder.decodeSolution(byte[], int, int, boolean). For example, when
joining a decoded solution with another solution, the resolution step may
be deferred until we know whether or not the join was successful.
Note: This implementation is a NOP as the IVCache association
is NOT maintained by this class.
resolveCachedValues in interface IBindingSetDecoderbset - A solution having IVs which need to be reunited with
their cached BigdataValues.public void release()
IBindingSetEncoderIVBindingSetEncoder.release in interface IBindingSetDecoderrelease in interface IBindingSetEncoderCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.