com.bigdata.rdf.rio
Class AsynchronousStatementBufferFactory.AsynchronousStatementBufferImpl

java.lang.Object
  extended by com.bigdata.rdf.rio.AsynchronousStatementBufferFactory.AsynchronousStatementBufferImpl
Type Parameters:
S -
F -
All Implemented Interfaces:
IStatementBuffer<S>, IBuffer<S>
Enclosing class:
AsynchronousStatementBufferFactory<S extends BigdataStatement,R>

protected class AsynchronousStatementBufferFactory.AsynchronousStatementBufferImpl
extends Object
implements IStatementBuffer<S>

Inner class provides the statement buffer.

Author:
Bryan Thompson

Constructor Summary
protected AsynchronousStatementBufferFactory.AsynchronousStatementBufferImpl(R resource)
           
 
Method Summary
 void add(Resource s, URI p, Value o)
          Add an "explicit" statement to the buffer (flushes on overflow, no context).
 void add(Resource s, URI p, Value o, Resource c)
          Add an "explicit" statement to the buffer (flushes on overflow).
 void add(Resource s, URI p, Value o, Resource c, StatementEnum type)
          Add a statement to the buffer (core impl).
 void add(S e)
          Add a statement to the buffer.
 long flush()
          Note: this implementation always returns ZERO (0).
 AbstractTripleStore getDatabase()
          The database that will be used to resolve terms.
 R getDocumentIdentifier()
          Return the identifier for the document.
 AbstractTripleStore getStatementStore()
          Returns null.
 boolean isEmpty()
          True iff there are no elements in the buffer.
 void reset()
          Clears all buffered data, including the canonicalizing mapping for blank nodes and deferred provenance statements.
 void setBNodeMap(Map<String,BigdataBNode> bnodes)
          Set the canonicalizing map for blank nodes based on their ID.
 int size()
          The #of elements currently in the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsynchronousStatementBufferFactory.AsynchronousStatementBufferImpl

protected AsynchronousStatementBufferFactory.AsynchronousStatementBufferImpl(R resource)
Parameters:
resource - The document identifier.
Method Detail

getDatabase

public final AbstractTripleStore getDatabase()
Description copied from interface: IStatementBuffer
The database that will be used to resolve terms. When IStatementBuffer.getStatementStore() is null, statements will be written into this store as well.

Specified by:
getDatabase in interface IStatementBuffer<S extends BigdataStatement>

getStatementStore

public AbstractTripleStore getStatementStore()
Returns null.

Note: This implementation does not support the concept of a focusStore so it can not be used for truth maintenance.

Specified by:
getStatementStore in interface IStatementBuffer<S extends BigdataStatement>

isEmpty

public boolean isEmpty()
Description copied from interface: IBuffer
True iff there are no elements in the buffer.

Specified by:
isEmpty in interface IBuffer<S extends BigdataStatement>

size

public int size()
Description copied from interface: IBuffer
The #of elements currently in the buffer.

Specified by:
size in interface IBuffer<S extends BigdataStatement>

getDocumentIdentifier

public R getDocumentIdentifier()
Return the identifier for the document.


flush

public long flush()
Note: this implementation always returns ZERO (0).

Specified by:
flush in interface IBuffer<S extends BigdataStatement>
Returns:
The #of elements written on the backing IRelation. See IMutableRelation
See Also:
AsynchronousStatementBufferFactory.ParserTask

reset

public void reset()
Clears all buffered data, including the canonicalizing mapping for blank nodes and deferred provenance statements.

Specified by:
reset in interface IBuffer<S extends BigdataStatement>

setBNodeMap

public void setBNodeMap(Map<String,BigdataBNode> bnodes)
Description copied from interface: IStatementBuffer
Set the canonicalizing map for blank nodes based on their ID. This allows you to reuse the same map across multiple IStatementBuffer instances. For example, the BigdataSail does this so that the same bnode map is used throughout the life of a SailConnection. While RIO provides blank node correlation within a given source, it does NOT provide blank node correlation across sources. You need to use this method to do that.

Note: It is reasonable to expect that the bnodes map is used by concurrent threads. For this reason, the map SHOULD be thread-safe. This can be accomplished either using Collections.synchronizedMap(Map) or a ConcurrentHashMap. However, implementations MUST still be synchronized on the map reference across operations which conditionally insert into the map in order to make that update atomic and thread-safe. Otherwise a race condition exists for the conditional insert and different threads could get incoherent answers.

Specified by:
setBNodeMap in interface IStatementBuffer<S extends BigdataStatement>
Parameters:
bnodes - The blank nodes map.

add

public void add(Resource s,
                URI p,
                Value o)
Add an "explicit" statement to the buffer (flushes on overflow, no context).

Specified by:
add in interface IStatementBuffer<S extends BigdataStatement>
Parameters:
s -
p -
o -

add

public void add(Resource s,
                URI p,
                Value o,
                Resource c)
Add an "explicit" statement to the buffer (flushes on overflow).

Specified by:
add in interface IStatementBuffer<S extends BigdataStatement>
Parameters:
s -
p -
o -
c -

add

public void add(Resource s,
                URI p,
                Value o,
                Resource c,
                StatementEnum type)
Add a statement to the buffer (core impl).

Specified by:
add in interface IStatementBuffer<S extends BigdataStatement>
Parameters:
s - The subject.
p - The predicate.
o - The object.
c - The context (optional).
type - The statement type (optional).

add

public void add(S e)
Description copied from interface: IStatementBuffer
Add a statement to the buffer.

Specified by:
add in interface IStatementBuffer<S extends BigdataStatement>
Specified by:
add in interface IBuffer<S extends BigdataStatement>
Parameters:
e - The statement. If stmt implements BigdataStatement then the StatementEnum will be used (this makes it possible to load axioms into the database as axioms) but the term identifiers on the stmt's values will be ignored.


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