public class IVBindingSetEncoder extends Object implements IBindingSetEncoder, IBindingSetDecoder
IBindingSet
s whose IConstant
s are bound to IV
s.
Individual IV
s 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
IV s in the solution for which there are cached
BigdataValue s 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 IBindingSetDecoder
isValueCache
in interface IBindingSetEncoder
public byte[] encodeSolution(IBindingSet bset)
IBindingSetEncoder
encodeSolution
in interface IBindingSetEncoder
bset
- The solution to be encoded.public byte[] encodeSolution(IBindingSet bset, boolean updateCache)
IBindingSetEncoder
IV
[].
Note: The IVCache
associations may be buffered by this method.
Use IBindingSetEncoder.flush()
to vector any buffered associations.
encodeSolution
in interface IBindingSetEncoder
bset
- 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()
IBindingSetEncoder
IVCache
associations.flush
in interface IBindingSetEncoder
public IBindingSet decodeSolution(byte[] val, int off, int len, boolean resolveCachedValues)
IBindingSetDecoder
IBindingSet
.
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
IBindingSet
s 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 IBindingSetDecoder
val
- The encoded IV[].off
- The starting offset.len
- The #of bytes of data to be decoded.resolveCachedValues
- When true
, any decoded IV
s 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)
IV
s in the solution for which there are cached
BigdataValue
s to those values. This method may be used to resolve
IVCache
associations for IBindingSet
s 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 IBindingSetDecoder
bset
- A solution having IV
s which need to be reunited with
their cached BigdataValue
s.public void release()
IBindingSetEncoder
IVBindingSetEncoder
.release
in interface IBindingSetDecoder
release
in interface IBindingSetEncoder
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.