com.bigdata.rdf.internal.encoder
Class IVSolutionSetDecoder

java.lang.Object
  extended by com.bigdata.rdf.internal.encoder.IVSolutionSetDecoder
All Implemented Interfaces:
IBindingSetDecoder

public class IVSolutionSetDecoder
extends Object
implements IBindingSetDecoder

Decoder for IVSolutionSetEncoder.

Version:
$Id: IVSolutionSetDecoder.java 6040 2012-02-18 01:09:14Z thompsonbry $
Author:
Bryan Thompson

Constructor Summary
IVSolutionSetDecoder()
           
 
Method Summary
 IBindingSet decodeSolution(byte[] data, int off, int len, boolean resolveCachedValues)
          Decode an IBindingSet.
 IBindingSet decodeSolution(DataInputBuffer in, boolean resolveCachedValues)
          Stream oriented decode.
 boolean isValueCache()
          Return true iff the IVCache associations are preserved by the encoder.
 void release()
          Release the state associated with the IVBindingSetDecoder.
 void resolveCachedValues(IBindingSet bset)
          Resolve any IVs in the solution for which there are cached BigdataValues to those values.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IVSolutionSetDecoder

public IVSolutionSetDecoder()
Method Detail

toString

public String toString()
Overrides:
toString in class Object

decodeSolution

public IBindingSet decodeSolution(byte[] data,
                                  int off,
                                  int len,
                                  boolean resolveCachedValues)
Decode an 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 IBindingSets can join. However, once we have a solution from a join, we may need to resolve the IVCache metadata for the joined solution.

Note: Solutions MUST be decoded in the encode order because the schema (the set of variables for which bindings have been observed) is assembled incrementally from the decoded solutions and the encoding is sensitive to the order in which the variables are first observed. Also, the presence of the version field in the first solution makes it impossible to re-process a stream of solutions with the same decoder.

Specified by:
decodeSolution in interface IBindingSetDecoder
Parameters:
data - 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.
Returns:
The decoded IBindingSet.
See Also:
IBindingSetDecoder.resolveCachedValues(IBindingSet)

decodeSolution

public IBindingSet decodeSolution(DataInputBuffer in,
                                  boolean resolveCachedValues)
Stream oriented decode.

Parameters:
in - The source data.
resolveCachedValues - true if IVCache associations should be resolved as the solutions are decoded.
Returns:
The next decoded solution.

resolveCachedValues

public void resolveCachedValues(IBindingSet bset)
Description copied from interface: IBindingSetDecoder
Resolve any 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.

Specified by:
resolveCachedValues in interface IBindingSetDecoder
Parameters:
bset - A solution having IVs which need to be reunited with their cached BigdataValues.

release

public void release()
Description copied from interface: IBindingSetDecoder
Release the state associated with the IVBindingSetDecoder.

Specified by:
release in interface IBindingSetDecoder

isValueCache

public boolean isValueCache()
Return true iff the IVCache associations are preserved by the encoder.

Always returns true.

Specified by:
isValueCache in interface IBindingSetDecoder


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.