com.bigdata.rdf.store
Interface IRawTripleStore

All Known Implementing Classes:
AbstractLocalTripleStore, AbstractTripleStore, LocalTripleStore, ScaleOutTripleStore, TempTripleStore

public interface IRawTripleStore

Low-level API directly using long term identifiers rather than an RDF Value object model.

Version:
$Id: IRawTripleStore.java 4837 2011-07-05 13:31:31Z thompsonbry $
Author:
Bryan Thompson
TODO:
consider refactor making this the primary interface so that we can realize non-Sesame integrations by layering an appropriate interface over this one.

Field Summary
static String NULLSTR
          The constant NULL.
 
Method Summary
 void abort()
          Discard the write set.
 void addStatement(Resource s, URI p, Value o)
          Deprecated. by addStatement(Resource, URI, Value, Resource)
 void addStatement(Resource s, URI p, Value o, Resource c)
          Add a single StatementEnum.Explicit statement by lookup and/or insert into the various indices (non-batch api).
 long addStatements(IChunkedOrderedIterator<ISPO> itr, IElementFilter<ISPO> filter)
          Deprecated. by SPORelation.insert(IChunkedOrderedIterator)
 long addStatements(ISPO[] stmts, int numStmts)
          Writes the statements onto the statements indices (batch, parallel, NO truth maintenance).
 long addStatements(ISPO[] stmts, int numStmts, IElementFilter<ISPO> filter)
          Writes the statements onto the statement indices (batch, parallel, NO truth maintenance).
 IV addTerm(Value value)
          Add a term into the term:id index and the id:term index, returning the assigned term identifier (non-batch API).
 void addTerms(BigdataValue[] terms)
          Batch insert of terms into the database.
 BigdataStatement asStatement(ISPO spo)
          Convert an internal ISPO into a Sesame Statement.
 BigdataStatementIterator asStatementIterator(IChunkedOrderedIterator<ISPO> src)
          Wraps an IChunkedOrderedIterator as a BigdataStatementIterator.
 BigdataValue asValue(Value value)
          Converts a BigdataValue to a Sesame Value object.
 IChunkedOrderedIterator<ISPO> bulkCompleteStatements(IChunkedOrderedIterator<ISPO> itr)
          This method fills out the statement metadata (type and sid) for ISPOs that are present in the database.
 IChunkedOrderedIterator<ISPO> bulkFilterStatements(IChunkedOrderedIterator<ISPO> itr, boolean present)
          Efficiently filter the supplied set of SPO objects for whether they are "present" or "not present" in the database, depending on the value of the supplied boolean variable (batch api).
 IChunkedOrderedIterator<ISPO> bulkFilterStatements(ISPO[] stmts, int numStmts, boolean present)
          Filter the supplied set of ISPO objects for whether they are "present" or "not present" in the database, depending on the value of the supplied boolean variable (batch API).
 void close()
          Close the connection to the ITripleStore.
 long commit()
          Commit changes on the database.
 void destroy()
          Deletes all data for the ITripleStore.
 IAccessPath<ISPO> getAccessPath(IKeyOrder<ISPO> keyOrder)
          Deprecated. by SPORelation#getAccessPath(SPOKeyOrder, com.bigdata.relation.rule.IPredicate)
 IAccessPath<ISPO> getAccessPath(IV s, IV p, IV o)
          Deprecated. by SPORelation.getAccessPath(IV, IV, IV)
 IAccessPath<ISPO> getAccessPath(Resource s, URI p, Value o)
          Deprecated. by getAccessPath(Resource, URI, Value, Resource)
 IAccessPath<ISPO> getAccessPath(Resource s, URI p, Value o, Resource c)
          Returns an IAccessPath matching the triple pattern.
 long getBNodeCount()
          The #of BNodes in the lexicon (this is not specific to any named graph).
 DataLoader getDataLoader()
          Return a DataLoader singleton configured using the properties that were used to configure the database.
 InferenceEngine getInferenceEngine()
          Return an InferenceEngine singleton configured using the properties that were used to configure the database.
 IV getIV(Value value)
          Deprecated. This is only used by the unit tests. It is not efficient for scale-out.
 long getLiteralCount()
          The #of Literals in the lexicon (this is not specific to any named graph).
 long getNamedGraphCount()
          The #of named graphs.
 ISPO getStatement(IV s, IV p, IV o)
          Deprecated. does not support quads.
 ISPO getStatement(IV s, IV p, IV o, IV c)
          Return the statement from the database (fully bound s:p:o only).
 BigdataStatement getStatement(Resource s, URI p, Value o)
          Deprecated. by getStatement(Resource, URI, Value, Resource)
 BigdataStatement getStatement(Resource s, URI p, Value o, Resource c)
          Return the statement from the database matching the fully bound query.
 long getStatementCount()
          Deprecated. by getStatementCount(Resource, boolean)
 long getStatementCount(boolean exact)
          Deprecated. by getStatementCount(Resource, boolean)
 long getStatementCount(Resource c)
          Deprecated. by getStatementCount(Resource, boolean)
 long getStatementCount(Resource c, boolean exact)
          The #of triples in the named graph or in the database if no context is specified.
 BigdataStatementIterator getStatements(Resource s, URI p, Value o)
          Deprecated. by getStatements(Resource, URI, Value, Resource)
 BigdataStatementIterator getStatements(Resource s, URI p, Value o, Resource c)
          Return an iterator that will visit all BigdataStatements in the database matching the triple pattern.
 Value getTerm(IV iv)
          Return the RDF Value given an internal value (non-batch api).
 long getTermCount()
          The #of RDF Values in the lexicon (this is not specific to any named graph).
 long getURICount()
          The #of URIs in the lexicon (this is not specific to any named graph).
 boolean hasStatement(Resource s, URI p, Value o)
          Deprecated. by hasStatement(Resource, URI, Value, Resource)
 boolean hasStatement(Resource s, URI p, Value o, Resource c)
          Return true if the triple pattern matches any statements in the store (non-batch API).
 boolean isQuads()
          Return true iff this is a quad store.
 boolean isReadOnly()
          True iff the database view is read-only.
 long removeStatements(IChunkedOrderedIterator<ISPO> itr)
          Removes the statements from the statement indices (batch, parallel, NO truth maintenance).
 long removeStatements(ISPO[] stmts, int numStmts)
          Removes the statements from the statement indices (batch, parallel, NO truth maintenance).
 long removeStatements(Resource s, URI p, Value o)
          Deprecated. by removeStatements(Resource, URI, Value, Resource)
 long removeStatements(Resource s, URI p, Value o, Resource c)
          Unconditionally removes statement(s) matching the triple pattern (NO truth maintenance).
 String toString(IV iv)
          Externalizes a term using an abbreviated syntax.
 String toString(IV s, IV p, IV o)
          Deprecated. by toString(IV, IV, IV, IV)
 String toString(IV s, IV p, IV o, IV c)
          Externalizes a quad or a triple with a statement identifier using an abbreviated syntax.
 

Field Detail

NULLSTR

static final String NULLSTR
The constant NULL.

See Also:
Constant Field Values
Method Detail

addTerm

IV addTerm(Value value)
Add a term into the term:id index and the id:term index, returning the assigned term identifier (non-batch API).

Note: This method delegates to the batch API, but it is extremely inefficient for scale-out as it does one RMI per request!

Parameters:
value - The term.
Returns:
The assigned internal value.

addTerms

void addTerms(BigdataValue[] terms)
Batch insert of terms into the database. The internal values are set on the terms as a side-effect.

Parameters:
terms - An array to be inserted.
See Also:
LexiconRelation.addTerms(BigdataValue[], int, boolean)

getTerm

Value getTerm(IV iv)
Return the RDF Value given an internal value (non-batch api).

Returns:
the RDF value or null if there is no term with that internal value in the index.

getIV

IV getIV(Value value)
Deprecated. This is only used by the unit tests. It is not efficient for scale-out.

Return the pre-assigned internal value for the value (non-batch API).

Parameters:
value - Any Value reference (MAY be null).
Returns:
The pre-assigned internal value -or- null iff the term is not known to the database.

getAccessPath

IAccessPath<ISPO> getAccessPath(IV s,
                                IV p,
                                IV o)
Deprecated. by SPORelation.getAccessPath(IV, IV, IV)

Chooses and returns the best IAccessPath for the given triple pattern.

Parameters:
s - The internal value for the subject -or- null.
p - The internal value for the predicate -or- null.
o - The internal value for the object -or- null.

getAccessPath

IAccessPath<ISPO> getAccessPath(IKeyOrder<ISPO> keyOrder)
Deprecated. by SPORelation#getAccessPath(SPOKeyOrder, com.bigdata.relation.rule.IPredicate)

Return the IAccessPath for the specified IKeyOrder and a fully unbound triple pattern. This is generally used only when you want to perform a IAccessPath#distinctTermScan().


getStatement

ISPO getStatement(IV s,
                  IV p,
                  IV o,
                  IV c)
Return the statement from the database (fully bound s:p:o only).

Note: This may be used to examine the StatementEnum.

Parameters:
s - The internal value (IV) for the subject.
p - The internal value (IV) for the predicate.
o - The internal value (IV) for the object.
c - The internal value (IV) for the context (required for quads and ignored for triples).
Returns:
The SPO for that statement, including its StatementEnum -or- null iff the statement is not in the database.
Throws:
IllegalArgumentException - if the s, p, or o is null.
IllegalArgumentException - if the c is null and isQuads() would return true.

getStatement

ISPO getStatement(IV s,
                  IV p,
                  IV o)
Deprecated. does not support quads.


addStatements

long addStatements(ISPO[] stmts,
                   int numStmts)
Writes the statements onto the statements indices (batch, parallel, NO truth maintenance).

Parameters:
stmts - The statements (sorted into IKeyOrder#SPO order as a side-effect).
numStmts - The #of entries in stmts that are valid.
Returns:
The #of statements that were written on the indices (a statement that was previously an axiom or inferred and that is converted to an explicit statement by this method will be reported in this count as well as any statement that was not pre-existing in the database).

addStatements

long addStatements(ISPO[] stmts,
                   int numStmts,
                   IElementFilter<ISPO> filter)
Writes the statements onto the statement indices (batch, parallel, NO truth maintenance).

Parameters:
stmts - The statements.
numStmts - The #of entries in stmts that are valid.
filter - Optional statement filter. Statements matching the filter are NOT added to the database.
Returns:
The #of statements that were written on the indices (a statement that was previously an axiom or inferred and that is converted to an explicit statement by this method will be reported in this count as well as any statement that was not pre-existing in the database).

addStatements

long addStatements(IChunkedOrderedIterator<ISPO> itr,
                   IElementFilter<ISPO> filter)
Deprecated. by SPORelation.insert(IChunkedOrderedIterator)

Writes the statements onto the statement indices (batch, parallel, NO truth maintenance).

Parameters:
itr - An iterator visiting the statements to be added.
filter - Optional statement filter. Statements matching the filter are NOT added to the database. The iterator is closed by this operation.
Returns:
The #of statements that were written on the indices (a statement that was previously an axiom or inferred and that is converted to an explicit statement by this method will be reported in this count as well as any statement that was not pre-existing in the database).

removeStatements

long removeStatements(ISPO[] stmts,
                      int numStmts)
Removes the statements from the statement indices (batch, parallel, NO truth maintenance).

Note: The StatementEnum on the SPOs is ignored by this method. It will delete all statements having the same bindings regardless of whether they are inferred, explicit, or axioms.

Parameters:
itr - The iterator
Returns:
The #of statements that were removed from the indices.

removeStatements

long removeStatements(IChunkedOrderedIterator<ISPO> itr)
Removes the statements from the statement indices (batch, parallel, NO truth maintenance).

Note: The StatementEnum on the SPOs is ignored by this method. It will delete all statements having the same bindings regardless of whether they are inferred, explicit, or axioms.

Parameters:
itr - The iterator
Returns:
The #of statements that were removed from the indices.

bulkFilterStatements

IChunkedOrderedIterator<ISPO> bulkFilterStatements(ISPO[] stmts,
                                                   int numStmts,
                                                   boolean present)
Filter the supplied set of ISPO objects for whether they are "present" or "not present" in the database, depending on the value of the supplied boolean variable (batch API).

Parameters:
stmts - the statements to test
numStmts - the number of statements to test
present - if true, filter for statements that exist in the db, otherwise filter for statements that do not exist
Returns:
an iteration over the filtered set of statements

bulkFilterStatements

IChunkedOrderedIterator<ISPO> bulkFilterStatements(IChunkedOrderedIterator<ISPO> itr,
                                                   boolean present)
Efficiently filter the supplied set of SPO objects for whether they are "present" or "not present" in the database, depending on the value of the supplied boolean variable (batch api).

Parameters:
itr - an iterator over the set of statements to test
present - if true, filter for statements that exist in the db, otherwise filter for statements that do not exist
Returns:
an iteration over the filtered set of statements

bulkCompleteStatements

IChunkedOrderedIterator<ISPO> bulkCompleteStatements(IChunkedOrderedIterator<ISPO> itr)
This method fills out the statement metadata (type and sid) for ISPOs that are present in the database. ISPOs not present in the database are left as-is.

Returns:
An iterator visiting the completed ISPOs. Any ISPOs that were not found will be present but their statement metadata (type and sid) will be unchanged.

toString

String toString(IV s,
                IV p,
                IV o,
                IV c)
Externalizes a quad or a triple with a statement identifier using an abbreviated syntax.


toString

String toString(IV s,
                IV p,
                IV o)
Deprecated. by toString(IV, IV, IV, IV)

Externalizes a triple using an abbreviated syntax.


toString

String toString(IV iv)
Externalizes a term using an abbreviated syntax.

Parameters:
iv - The term identifier.
Returns:
A representation of the term.

getNamedGraphCount

long getNamedGraphCount()
The #of named graphs.

Throws:
UnsupportedOperationException - unless this is a quad store.

getStatementCount

long getStatementCount(Resource c)
Deprecated. by getStatementCount(Resource, boolean)

The #of triples in the named graph, or in the database if c is not specified.

Parameters:
c - The context (optional).
Returns:
The #of triples in the named graph or in the database.

getStatementCount

long getStatementCount()
Deprecated. by getStatementCount(Resource, boolean)

The #of triples in the store.

Returns:
The #of statements in the database. When either transactions or key-range partitioned indices are being used, then this will be an upper bound.
See Also:
getStatementCount(boolean)

getStatementCount

long getStatementCount(boolean exact)
Deprecated. by getStatementCount(Resource, boolean)

The #of triples in the store.

Parameters:
exact - When true the result will be an exact count, which may require a full key-range scan of one of the statement indices.
Returns:
The #of statements in the database. When exact is false and either transactions or key-range partitioned indices are being used, then this will be an upper bound.

getStatementCount

long getStatementCount(Resource c,
                       boolean exact)
The #of triples in the named graph or in the database if no context is specified.

Parameters:
c - The context (optional).
exact - When true the result will be an exact count, which may require a full key-range scan of one of the statement indices.
Returns:
The #of statements in the named graph or in the database if c is null. When exact is false and either transactions or key-range partitioned indices are being used, then this will be an upper bound.

getTermCount

long getTermCount()
The #of RDF Values in the lexicon (this is not specific to any named graph).

This may be an estimate when using partitioned indices.

Many RDF Values are inlined into the statement indices. Inlined values are not be reported by this method.


getURICount

long getURICount()
The #of URIs in the lexicon (this is not specific to any named graph).

This may be an estimate when using partitioned indices.

Many RDF Values are inlined into the statement indices. Inlined values are not be reported by this method.


getLiteralCount

long getLiteralCount()
The #of Literals in the lexicon (this is not specific to any named graph).

This may be an estimate when using partitioned indices.

Many RDF Values are inlined into the statement indices. Inlined values are not be reported by this method.


getBNodeCount

long getBNodeCount()
The #of BNodes in the lexicon (this is not specific to any named graph).

This may be an estimate when using partitioned indices.

This will always return ZERO (0) if AbstractTripleStore.Options.STORE_BLANK_NODES is false since there will not be any blank nodes in the lexicon.

Many RDF Values are inlined into the statement indices. Inlined values are not be reported by this method.


addStatement

void addStatement(Resource s,
                  URI p,
                  Value o,
                  Resource c)
Add a single StatementEnum.Explicit statement by lookup and/or insert into the various indices (non-batch api).

Note: The non-batch API is horridly inefficient and can not be used to co-reference blank nodes. The batch load API for Sesame Value objects is:

 
  StatementBuffer buffer = new StatementBuffer(store, ...);
  
  buffer.add( s, p, o );
  ...
  
  buffer.flush();
 
 

Parameters:
s - The subject (required).
p - The predicate (required).
o - The object (required).
c - The context (required IFF a quad store and otherwise ignored).

addStatement

void addStatement(Resource s,
                  URI p,
                  Value o)
Deprecated. by addStatement(Resource, URI, Value, Resource)


hasStatement

boolean hasStatement(Resource s,
                     URI p,
                     Value o,
                     Resource c)
Return true if the triple pattern matches any statements in the store (non-batch API).

Note: This does not verify whether or not the statement is explicit.

Parameters:
s - The subject (optional).
p - The predicate (optional).
o - The object (optional).
c - The context (optional and ignored unless a quad store).

hasStatement

boolean hasStatement(Resource s,
                     URI p,
                     Value o)
Deprecated. by hasStatement(Resource, URI, Value, Resource)


getStatement

BigdataStatement getStatement(Resource s,
                              URI p,
                              Value o,
                              Resource c)
Return the statement from the database matching the fully bound query.

Note: If the parameters are from an AbstractTripleStore using a different lexicon then you MUST either BigdataValue.clearInternalValue() or create a new Value object which either is not aware of the term identifier or does not have its term identifier set in order to avoid lookup using the term identifier rather than indirecting through the lexicon.

Parameters:
s - The subject (required).
p - The predicate (required).
o - The object (required).
c - The context (required iff a quad store and otherwise ignored).
Returns:
The statement -or- null iff the triple is not defined in the database.
See Also:
asValue(Value)

getStatement

BigdataStatement getStatement(Resource s,
                              URI p,
                              Value o)
Deprecated. by getStatement(Resource, URI, Value, Resource)


getStatements

BigdataStatementIterator getStatements(Resource s,
                                       URI p,
                                       Value o,
                                       Resource c)
Return an iterator that will visit all BigdataStatements in the database matching the triple pattern.

Parameters:
s - The subject (optional).
p - The predicate (optional).
o - The object (optional).
c - The context (optional and ignored unless a quad store).
Returns:
The iterator.

getStatements

BigdataStatementIterator getStatements(Resource s,
                                       URI p,
                                       Value o)
Deprecated. by getStatements(Resource, URI, Value, Resource)


asValue

BigdataValue asValue(Value value)
Converts a BigdataValue to a Sesame Value object.

Parameters:
value - Either a BigdataValue, a Sesame Value object, or null.
Returns:
A corresponding Sesame Value object -or- null iff value is null.

removeStatements

long removeStatements(Resource s,
                      URI p,
                      Value o,
                      Resource c)
Unconditionally removes statement(s) matching the triple pattern (NO truth maintenance).

Parameters:
s - The subject (optional).
p - The predicate (optional).
o - The object (optional).
c - The context (optional).
Returns:
The #of statements removed.

removeStatements

long removeStatements(Resource s,
                      URI p,
                      Value o)
Deprecated. by removeStatements(Resource, URI, Value, Resource)


getAccessPath

IAccessPath<ISPO> getAccessPath(Resource s,
                                URI p,
                                Value o,
                                Resource c)
Returns an IAccessPath matching the triple pattern.

Parameters:
s - The subject (optional).
p - The predicate (optional).
o - The object (optional).
c - The context (optional).
Returns:
The object that may be used to read efficiently on the indices for that triple pattern. In the special case where any of the given Values is not known to the database this method will return an EmptyAccessPath.
See Also:
IAccessPath, asStatementIterator(IChunkedOrderedIterator)

getAccessPath

IAccessPath<ISPO> getAccessPath(Resource s,
                                URI p,
                                Value o)
Deprecated. by getAccessPath(Resource, URI, Value, Resource)


asStatementIterator

BigdataStatementIterator asStatementIterator(IChunkedOrderedIterator<ISPO> src)
Wraps an IChunkedOrderedIterator as a BigdataStatementIterator.

Note: The object visited will be BigdataStatementImpls.

Parameters:
src - An IChunkedOrderedIterator visiting SPOs
Returns:
The BigdataStatementIterator.
See Also:
IAccessPath, getAccessPath(Resource, URI, Value)

asStatement

BigdataStatement asStatement(ISPO spo)
Convert an internal ISPO into a Sesame Statement.

Note: The object returned will be a BigdataStatement

Parameters:
spo - The ISPO.
Returns:
The Sesame Statement -or- null.

getDataLoader

DataLoader getDataLoader()
Return a DataLoader singleton configured using the properties that were used to configure the database.

See Also:
DataLoader.Options

getInferenceEngine

InferenceEngine getInferenceEngine()
Return an InferenceEngine singleton configured using the properties that were used to configure the database.

Note: The first time this object is requested it will attempt to write the axioms on the database.

See Also:
DataLoader.Options

abort

void abort()
Discard the write set.

Note: The semantics of this operation depend on whether the database is embedded (discards the write set), temporary (ignored since the store is not restart safe), or a federation (ignored since unisolated writes on the federation are atomic and auto-committed).


commit

long commit()
Commit changes on the database.

Note: The semantics of this operation depend on whether the database is embedded (does a commit), temporary (ignored), or a federation (ignored since unisolated writes on the federation are atomic and auto-committed).

Returns:
commit time if store supports commit timestamps

destroy

void destroy()
Deletes all data for the ITripleStore.


close

void close()
Close the connection to the ITripleStore.


isReadOnly

boolean isReadOnly()
True iff the database view is read-only.


isQuads

boolean isQuads()
Return true iff this is a quad store.



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