com.bigdata.rdf.store
Class AbstractTripleStore

java.lang.Object
  extended by com.bigdata.relation.AbstractResource<IDatabase<AbstractTripleStore>>
      extended by com.bigdata.rdf.store.AbstractTripleStore
All Implemented Interfaces:
IRawTripleStore, IDatabase<AbstractTripleStore>, IMutableDatabase<AbstractTripleStore>, IMutableResource<IDatabase<AbstractTripleStore>>, ILocatableResource<IDatabase<AbstractTripleStore>>
Direct Known Subclasses:
AbstractLocalTripleStore, ScaleOutTripleStore

public abstract class AbstractTripleStore
extends AbstractResource<IDatabase<AbstractTripleStore>>
implements IRawTripleStore, IMutableDatabase<AbstractTripleStore>

Abstract base class that implements logic for the ITripleStore interface that is invariant across the choice of the backing store.

By default, this class supports RDFS inference plus optional support for owl:sameAs, owl:equivalentProperty, and owl:equivalentClass. The IRules are declarative, and it is easy to write new rules. Those IRules can be introduced using custom BaseClosure implementations. See AbstractTripleStore.Options.CLOSURE_CLASS.

Version:
$Id: AbstractTripleStore.java 6312 2012-05-03 09:06:37Z mrpersonick $
Author:
Bryan Thompson

Nested Class Summary
static interface AbstractTripleStore.Options
          Configuration options.
 
Field Summary
protected  boolean lexicon
          This is used to conditionally disable the lexicon support, principally in conjunction with a TempTripleStore.
 
Fields inherited from interface com.bigdata.rdf.store.IRawTripleStore
NULLSTR
 
Constructor Summary
protected AbstractTripleStore(IIndexManager indexManager, String namespace, Long timestamp, Properties properties)
          Ctor specified by DefaultResourceLocator.
 
Method Summary
 void __tearDownUnitTest()
          DO NOT INVOKE FROM APPLICATION CODE - this method deletes the KB instance and destroys the backing database instance.
 void abort()
          Clears hard references to any indices, relations, etc.
 void addNamespace(String namespace, String prefix)
          Defines a transient mapping from a URI to a namespace prefix that will be used for that URI by AbstractResource.toString().
 void addStatement(Resource s, URI p, Value o)
           
 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(AbstractTripleStore statementStore, boolean copyOnly, IChunkedOrderedIterator<ISPO> itr, IElementFilter<ISPO> filter)
          Add statements to the statementStore.
 long addStatements(IChunkedOrderedIterator<ISPO> itr, IElementFilter<ISPO> filter)
          Writes the statements onto the statement indices (batch, parallel, NO truth maintenance).
 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.
protected  void assertWritable()
           
 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.
 ISPO[] bulkCompleteStatements(ISPO[] stmts)
           
 IChunkedOrderedIterator<ISPO> bulkCompleteStatements(SPO[] stmts, int numStmts)
           
 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 clearNamespaces()
          Clears the namespace map.
 void close()
          Close the connection to the ITripleStore.
 long commit()
          Commit changes on the database.
 IChunkedOrderedIterator<ISPO> computeClosureForStatementIdentifiers(IChunkedOrderedIterator<ISPO> src)
          Return an iterator which will visit the closure of the statements visited by the source iterator plus any statements in the database made using a statement identifier found on any of the statements visited by the source iterator (only explicit statements have statement identifiers and then iff statementIdentifiers are enabled).
 long copyStatements(AbstractTripleStore dst, IElementFilter<ISPO> filter, boolean copyJustifications)
          Copies the statements from this store into the specified store using the same term identifiers (the lexicon is neither copied to nor asserted on the target).
 long copyStatements(AbstractTripleStore dst, IElementFilter<ISPO> filter, boolean copyJustifications, IChangeLog changeLog)
           
 void create()
          Create any logically contained resources (relations, indices).
 void destroy()
          Destroy any logically contained resources (relations, indices).
protected  Class determineAxiomClass()
           
protected  Class determineVocabularyClass()
           
 StringBuilder dumpStatements(IAccessPath<ISPO> accessPath)
          Dumps the access path, efficiently resolving term identifiers to terms.
 StringBuilder dumpStore()
          Utility method dumps the statements in the store using the SPO index (subject order).
 StringBuilder dumpStore(AbstractTripleStore resolveTerms, boolean explicit, boolean inferred, boolean axioms)
           
 StringBuilder dumpStore(AbstractTripleStore resolveTerms, boolean explicit, boolean inferred, boolean axioms, boolean justifications)
          Dumps the store in a human readable format (not suitable for interchange).
 StringBuilder dumpStore(AbstractTripleStore resolveTerms, boolean explicit, boolean inferred, boolean axioms, boolean justifications, IKeyOrder<ISPO> keyOrder)
          Dumps the store in a human readable format (not suitable for interchange).
 StringBuilder dumpStore(boolean explicit, boolean inferred, boolean axioms)
           
static void fixPointStatementIdentifiers(AbstractTripleStore db, AbstractTripleStore tempStore)
          Computes the fixed point of those statements in the database which make assertions about statement identifiers in the tmp store.
 IAccessPath<ISPO> getAccessPath(IKeyOrder<ISPO> keyOrder)
          Return the IAccessPath for the specified IKeyOrder and a fully unbound triple pattern.
 IAccessPath<ISPO> getAccessPath(IKeyOrder<ISPO> keyOrder, IElementFilter<ISPO> filter)
           
 IAccessPath<ISPO> getAccessPath(IV s, IV p, IV o)
          Chooses and returns the best IAccessPath for the given triple pattern.
 IAccessPath<ISPO> getAccessPath(IV s, IV p, IV o, IElementFilter<ISPO> filter)
           
 IAccessPath<ISPO> getAccessPath(IV s, IV p, IV o, IV c)
           
 IAccessPath<ISPO> getAccessPath(IV s, IV p, IV o, IV c, IElementFilter<ISPO> filter)
           
 IAccessPath<ISPO> getAccessPath(IV s, IV p, IV o, IV c, RangeBOp range)
           
 IAccessPath<ISPO> getAccessPath(Resource s, URI p, Value o)
           
 IAccessPath<ISPO> getAccessPath(Resource s, URI p, Value o, IElementFilter<ISPO> filter)
           
 IAccessPath<ISPO> getAccessPath(Resource s, URI p, Value o, Resource c)
          Returns an IAccessPath matching the triple pattern.
 IAccessPath<ISPO> getAccessPath(Resource s, URI p, Value o, Resource c, IElementFilter<ISPO> filter, RangeBOp range)
           
 Axioms getAxioms()
          The configured axioms.
 long getBNodeCount()
          The #of BNodes in the lexicon (this is not specific to any named graph).
 BaseClosure getClosureInstance()
          Return an instance of the class that is used to compute the closure of the database.
 DataLoader getDataLoader()
          Return a DataLoader singleton configured using the properties that were used to configure the database.
 long getExplicitStatementCount(Resource c)
          The #of explicit statements in the database (exact count based on key-range scan).
 InferenceEngine getInferenceEngine()
          Return an InferenceEngine singleton configured using the properties that were used to configure the database.
 IV getIV(Value value)
          Deprecated. Not even the unit tests should be doing this.
 long getJustificationCount()
           
 LexiconRelation getLexiconRelation()
          The LexiconRelation handles all things related to the indices mapping RDF Values onto internal 64-bit term identifiers.
 long getLiteralCount()
          The #of Literals in the lexicon (this is not specific to any named graph).
protected  Program getMatchProgram(Literal[] lits, IConstant<IV>[] _preds, IV _cls)
          Generate a program from the possible completions of the literals.
 long getNamedGraphCount()
          The #of named graphs.
 String getNamespace(String prefix)
          Return the namespace for the given prefix.
 Map<String,String> getNamespaces()
          Return an unmodifiable view of the mapping from namespaces to namespace prefixes.
 int getSPOKeyArity()
          Indicate whether this is a triple or a quad store (3 is a triple store, 4 is a quad store).
 SPORelation getSPORelation()
          The SPORelation (triples and their access paths).
 ISPO getStatement(IV s, IV p, IV o)
           
 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)
           
 BigdataStatement getStatement(Resource s, URI p, Value o, Resource c)
          Return the statement from the database matching the fully bound query.
 BigdataStatement getStatement(Statement s)
           
 long getStatementCount()
          The #of triples in the store.
 long getStatementCount(boolean exact)
          The #of triples in the store.
 long getStatementCount(Resource c)
          The #of triples in the named graph, or in the database if c is not specified.
 long getStatementCount(Resource c, boolean exact)
          The #of triples in the named graph or in the database if no context is specified.
 boolean getStatementIdentifiers()
          When true the database will support statement identifiers.
 BigdataStatementIterator getStatements(Resource s, URI p, Value o)
           
 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.
 BigdataValue getTerm(IV iv)
          This method is extremely inefficient for scale-out as it does one RMI per request!
 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).
 BigdataValueFactory getValueFactory()
          The BigdataValueFactoryImpl for namespace of the LexiconRelation associated with this AbstractTripleStore.
 Vocabulary getVocabulary()
          Return the configured Vocabulary.
 boolean hasStatement(IV s, IV p, IV o)
          Deprecated. by hasStatement(IV, IV, IV, IV)
 boolean hasStatement(IV s, IV p, IV o, IV c)
          Return true if the statement pattern matches any statement(s) in the store (non-batch API).
 boolean hasStatement(Resource s, URI p, Value o)
          This method is extremely inefficient for scale-out as it does one RMI per request!
 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).
 AbstractTripleStore init()
          The default implementation only logs the event.
 boolean isAxiom(IV s, IV p, IV o)
          Return true iff the fully bound statement is an axiom.
abstract  boolean isConcurrent()
          Return true iff the store is safe for concurrent readers and writers.
 boolean isConstrainXXXCShards()
           
 boolean isInlineLiterals()
          Returns true when the database is in inline terms mode.
 boolean isJustify()
          True iff justification chains are being recorded for entailments and used to support truth maintenance.
 boolean isOpen()
           
 boolean isQuads()
          Return true iff this is a quad store.
 boolean isReadOnly()
          True iff the database view is read-only.
abstract  boolean isStable()
          True iff the backing store is stable (exists on disk somewhere and may be closed and re-opened).
 boolean isStatementIdentifiers()
          When true the database will support statement identifiers.
 ICloseableIterator<IBindingSet> match(Literal[] lits, URI[] preds, URI cls)
          Specialized IRule execution using the full text index to identify possible completions of the given literals for which there exists a subject s such that:
 IJoinNexusFactory newJoinNexusFactory(RuleContextEnum ruleContext, ActionEnum action, int solutionFlags, IElementFilter filter)
           
 IJoinNexusFactory newJoinNexusFactory(RuleContextEnum ruleContext, ActionEnum action, int solutionFlags, IElementFilter filter, boolean justify, boolean backchain, IEvaluationPlanFactory planFactory)
           
 IJoinNexusFactory newJoinNexusFactory(RuleContextEnum ruleContext, ActionEnum action, int solutionFlags, IElementFilter filter, boolean justify, boolean backchain, IEvaluationPlanFactory planFactory, Properties overrides)
           
 StringBuilder predicateUsage()
           
 StringBuilder predicateUsage(AbstractTripleStore resolveTerms)
          Dumps the #of statements using each predicate in the kb (tab delimited, unordered).
 Iterator<IRelation> relations()
          Visits the logically contained IRelation resources.
 String removeNamespace(String prefix)
          Removes the namespace associated with the prefix.
 long removeStatements(IChunkedOrderedIterator<ISPO> itr)
          Removes the statements from the statement indices (batch, parallel, NO truth maintenance).
 long removeStatements(IChunkedOrderedIterator<ISPO> itr, boolean computeClosureForStatementIdentifiers)
          This processes a chunk of SPOs at a time and then submits tasks to parallel threads to remove those statements from each of the statement indices.
 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)
           
 long removeStatements(Resource s, URI p, Value o, Resource c)
          Unconditionally removes statement(s) matching the triple pattern (NO truth maintenance).
protected  void shutdown()
          Default is a NOP - invoked by close() and __tearDownUnitTest()
 String toString(ISPO spo)
           
 String toString(IV iv)
          Externalizes a term using an abbreviated syntax.
 String toString(IV s, IV p, IV o)
          Externalizes a triple using an abbreviated syntax.
 String toString(IV s, IV p, IV o, IV c)
          Externalizes a quad or a triple with a statement identifier using an abbreviated syntax.
 
Methods inherited from class com.bigdata.relation.AbstractResource
acquireExclusiveLock, getBareProperties, getChunkCapacity, getChunkOfChunksCapacity, getChunkTimeout, getCommitTime, getContainer, getContainerNamespace, getExecutorService, getFullyBufferedReadThreshold, getIndexManager, getMaxParallelSubqueries, getNamespace, getProperties, getProperty, getProperty, getTimestamp, isForceSerialExecution, toString, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bigdata.relation.locator.ILocatableResource
getContainerNamespace, getNamespace, getTimestamp
 

Field Detail

lexicon

protected final boolean lexicon
This is used to conditionally disable the lexicon support, principally in conjunction with a TempTripleStore.

Constructor Detail

AbstractTripleStore

protected AbstractTripleStore(IIndexManager indexManager,
                              String namespace,
                              Long timestamp,
                              Properties properties)
Ctor specified by DefaultResourceLocator.

See Also:
AbstractTripleStore.Options
Method Detail

isJustify

public final boolean isJustify()
True iff justification chains are being recorded for entailments and used to support truth maintenance.

Note: This is the same value that is reported by SPORelation.justify.

See Also:
AbstractTripleStore.Options.JUSTIFY

getSPOKeyArity

public final int getSPOKeyArity()
Indicate whether this is a triple or a quad store (3 is a triple store, 4 is a quad store).

Returns:
The #of elements in the key for the SPORelation (3 or 4).

isQuads

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

See Also:
AbstractTripleStore.Options.QUADS

isStatementIdentifiers

public final boolean isStatementIdentifiers()
When true the database will support statement identifiers. A statement identifier is a unique 64-bit integer taken from the same space as the term identifiers and which uniquely identifiers a statement in the database regardless of the graph in which that statement appears. The purpose of statement identifiers is to allow statements about statements without recourse to RDF style reification.

See Also:
AbstractTripleStore.Options.STATEMENT_IDENTIFIERS

getClosureInstance

public BaseClosure getClosureInstance()
Return an instance of the class that is used to compute the closure of the database.


isAxiom

public boolean isAxiom(IV s,
                       IV p,
                       IV o)
Return true iff the fully bound statement is an axiom.

Parameters:
s - The internal value (IV) for the subject position.
p - The internal value (IV) for the predicate position.
o - The internal value (IV) for the object position.

getStatementIdentifiers

public boolean getStatementIdentifiers()
When true the database will support statement identifiers.

A statement identifier is a unique 64-bit integer taken from the same space as the term identifiers and which uniquely identifiers a statement in the database regardless of the graph in which that statement appears. The purpose of statement identifiers is to allow statements about statements without recourse to RDF style reification.

Only explicit statements will have a statement identifier. Statements made about statements using their statement identifiers will automatically be retracted if a statement they describe is retracted (a micro form of truth maintenance that is always enabled when statement identifiers are enabled).


isInlineLiterals

public boolean isInlineLiterals()
Returns true when the database is in inline terms mode. In this mode, certain types of terms (numerics in particular) are inlined into the statement indices rather than being mapped to and from term identifiers in the lexicon.


isConstrainXXXCShards

public final boolean isConstrainXXXCShards()
See Also:
AbstractTripleStore.Options.CONSTRAIN_XXXC_SHARDS

getValueFactory

public final BigdataValueFactory getValueFactory()
The BigdataValueFactoryImpl for namespace of the LexiconRelation associated with this AbstractTripleStore.

Throws:
UnsupportedOperationException - if there is no associated lexicon.
TODO:
allow a TempTripleStore to specify another db's lexicon?

relations

public Iterator<IRelation> relations()
Description copied from interface: IDatabase
Visits the logically contained IRelation resources.

Specified by:
relations in interface IDatabase<AbstractTripleStore>

determineAxiomClass

protected Class determineAxiomClass()

determineVocabularyClass

protected Class determineVocabularyClass()

isConcurrent

public abstract boolean isConcurrent()
Return true iff the store is safe for concurrent readers and writers. This property depends on primarily on the concurrency control mechanisms (if any) that are used to prevent concurrent access to an unisolated index while a thread is writing on that index. Stores based on the IBigdataFederation automatically inherent the appropriate concurrency controls as would a store whose index access was intermediated by the executor service of an IConcurrencyManager.

Note: if isConcurrent() returns true then the database will provide concurrency control for write tasks submitted against the same index. However, concurrent writers are always supported on distinct indices and concurrent readers on an index are always supported IF there is no concurrent writer on the index. If isConcurrent() is false then you need to avoid submitting a write task concurrently with ANY other task for the same index (concurrent reads or concurrent writes will both cause problems with a write task in the absence of concurrency controls).

The main place where this is an issue is rule execution, where the entailments are being written back onto the database while reads are proceeding concurrently. The new rule execution layer finesses this by have a read view and a write view, so an IProgram will read from an historical state and write on the ITx.UNISOLATED indices. This also works for closure - each round of closure updates the read-behind point so that all writes from the last round become visible during the next round.

Note that closure must read against a stable state of the database and that concurrent writes on the database NOT related to the closure operation are disallowed. With these guidelines, you can force the application to use a single thread for all mutation operations on the AbstractTripleStore (readers from historical states may be concurrent) and concurrency problems will not arise.


__tearDownUnitTest

public void __tearDownUnitTest()
DO NOT INVOKE FROM APPLICATION CODE - this method deletes the KB instance and destroys the backing database instance. It is used to help tear down unit tests.


isOpen

public boolean isOpen()

close

public void close()
Close the connection to the ITripleStore.


shutdown

protected final void shutdown()
Default is a NOP - invoked by close() and __tearDownUnitTest()


isStable

public abstract boolean isStable()
True iff the backing store is stable (exists on disk somewhere and may be closed and re-opened).

Note: This is mainly used by the test suites.


isReadOnly

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


assertWritable

protected final void assertWritable()

init

public AbstractTripleStore init()
Description copied from class: AbstractResource
The default implementation only logs the event.

Specified by:
init in interface ILocatableResource<IDatabase<AbstractTripleStore>>
Overrides:
init in class AbstractResource<IDatabase<AbstractTripleStore>>

create

public void create()
Description copied from interface: IMutableResource
Create any logically contained resources (relations, indices). There is no presumption that ILocatableResource.init() is suitable for invocation from IMutableResource.create(). Instead, you are responsible for invoking ILocatableResource.init() from this method IFF it is appropriate to reuse its initialization logic.

Specified by:
create in interface IMutableResource<IDatabase<AbstractTripleStore>>
Overrides:
create in class AbstractResource<IDatabase<AbstractTripleStore>>

destroy

public void destroy()
Description copied from interface: IMutableResource
Destroy any logically contained resources (relations, indices).

Specified by:
destroy in interface IMutableResource<IDatabase<AbstractTripleStore>>
Overrides:
destroy in class AbstractResource<IDatabase<AbstractTripleStore>>

getAxioms

public final Axioms getAxioms()
The configured axioms. This is stored in the global row store and set automatically if it is found in the Properties. Otherwise it is set by create().

Throws:
IllegalStateException - if there is no lexicon.
See Also:
AbstractTripleStore.Options.LEXICON, AbstractTripleStore.Options.AXIOMS_CLASS

getVocabulary

public final Vocabulary getVocabulary()
Return the configured Vocabulary. This consists of BigdataValues of interest that have been pre-evaluated against the lexicon and are associated with their correct term identifiers.

Returns:
The predefined vocabulary.
Throws:
IllegalStateException - if there is no lexicon.
See Also:
AbstractTripleStore.Options.LEXICON, AbstractTripleStore.Options.VOCABULARY_CLASS

getSPORelation

public final SPORelation getSPORelation()
The SPORelation (triples and their access paths).


getLexiconRelation

public final LexiconRelation getLexiconRelation()
The LexiconRelation handles all things related to the indices mapping RDF Values onto internal 64-bit term identifiers.


getNamedGraphCount

public final long getNamedGraphCount()
The #of named graphs.


getStatementCount

public final long getStatementCount()
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

public final long getStatementCount(boolean exact)
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

public final long getStatementCount(Resource c)
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

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

Core implementation.

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.

getExplicitStatementCount

public long getExplicitStatementCount(Resource c)
The #of explicit statements in the database (exact count based on key-range scan).

Note: In order to get the #of explicit statements in the repository we have to actually do a range scan and figure out for each statement whether or not it is explicit.

Parameters:
c - The context (optional). When not given, the count is reported across all named graphs.

abort

public void abort()
Clears hard references to any indices, relations, etc. MUST be extended to discard write sets for impls with live indices.

Throws:
IllegalStateException - if the view is read only.

commit

public 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).

Note: This method MUST be extended to perform commit for implementations with live indices.

Returns:
commit time if store supports commit timestamps
Throws:
IllegalStateException - if the view is read only.

getJustificationCount

public final long getJustificationCount()

getTermCount

public final 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

public final 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

public final 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

public final 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.

Note: Will always return zero (0) if is false.


addTerm

public IV addTerm(Value value)
Description copied from interface: IRawTripleStore
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!

Specified by:
addTerm in interface IRawTripleStore
Parameters:
value - The term.
Returns:
The assigned internal value.

getTerm

public final BigdataValue getTerm(IV iv)
This method is extremely inefficient for scale-out as it does one RMI per request!

Specified by:
getTerm in interface IRawTripleStore
Returns:
the RDF value or null if there is no term with that internal value in the index.

getIV

public final IV getIV(Value value)
Deprecated. Not even the unit tests should be doing this.

WARNING DO NOT USE OUTSIDE OF THE UNIT TESTS: This method is extremely inefficient for scale-out as it does one RMI per request!

Specified by:
getIV in interface IRawTripleStore
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.

addTerms

public void addTerms(BigdataValue[] terms)
Description copied from interface: IRawTripleStore
Batch insert of terms into the database. The internal values are set on the terms as a side-effect.

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

getInferenceEngine

public final 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

getDataLoader

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

See Also:
DataLoader.Options

addStatement

public final void addStatement(Resource s,
                               URI p,
                               Value o)

addStatement

public final 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).

getStatement

public final ISPO getStatement(IV s,
                               IV p,
                               IV o)
Specified by:
getStatement in interface IRawTripleStore

getStatement

public final ISPO getStatement(IV s,
                               IV p,
                               IV o,
                               IV c)
Description copied from interface: IRawTripleStore
Return the statement from the database (fully bound s:p:o only).

Note: This may be used to examine the StatementEnum.

Specified by:
getStatement in interface IRawTripleStore
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.

hasStatement

public final boolean hasStatement(IV s,
                                  IV p,
                                  IV o)
Deprecated. by hasStatement(IV, IV, IV, IV)

Return true if the triple pattern matches any statement(s) in the store (non-batch API).

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

Parameters:
s -
p -
o -

hasStatement

public final boolean hasStatement(IV s,
                                  IV p,
                                  IV o,
                                  IV c)
Return true if the statement pattern matches any statement(s) in the store (non-batch API).

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

Parameters:
s -
p -
o -
c -

hasStatement

public final boolean hasStatement(Resource s,
                                  URI p,
                                  Value o)
This method is extremely inefficient for scale-out as it does one RMI per request!


hasStatement

public final 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.

This method is extremely inefficient for scale-out as it does multiple RMIs per request (one for each Value and one or more for the statement indices)!

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

removeStatements

public final long removeStatements(Resource s,
                                   URI p,
                                   Value o)

removeStatements

public final 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.

getStatement

public final BigdataStatement getStatement(Statement s)

getStatement

public final BigdataStatement getStatement(Resource s,
                                           URI p,
                                           Value o)

getStatement

public final 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)

getStatements

public final BigdataStatementIterator getStatements(Resource s,
                                                    URI p,
                                                    Value o)

getStatements

public final 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.

asValue

public final 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.

asStatement

public 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.

asStatementIterator

public 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)

getAccessPath

public IAccessPath<ISPO> getAccessPath(Resource s,
                                       URI p,
                                       Value o)

getAccessPath

public IAccessPath<ISPO> getAccessPath(Resource s,
                                       URI p,
                                       Value o,
                                       IElementFilter<ISPO> filter)

getAccessPath

public final 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

public final IAccessPath<ISPO> getAccessPath(Resource s,
                                             URI p,
                                             Value o,
                                             Resource c,
                                             IElementFilter<ISPO> filter,
                                             RangeBOp range)

getAccessPath

public final IAccessPath<ISPO> getAccessPath(IV s,
                                             IV p,
                                             IV o)
Description copied from interface: IRawTripleStore
Chooses and returns the best IAccessPath for the given triple pattern.

Specified by:
getAccessPath in interface IRawTripleStore
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

public final IAccessPath<ISPO> getAccessPath(IV s,
                                             IV p,
                                             IV o,
                                             IElementFilter<ISPO> filter)

getAccessPath

public final IAccessPath<ISPO> getAccessPath(IV s,
                                             IV p,
                                             IV o,
                                             IV c)

getAccessPath

public final IAccessPath<ISPO> getAccessPath(IV s,
                                             IV p,
                                             IV o,
                                             IV c,
                                             RangeBOp range)

getAccessPath

public final IAccessPath<ISPO> getAccessPath(IV s,
                                             IV p,
                                             IV o,
                                             IV c,
                                             IElementFilter<ISPO> filter)

getAccessPath

public final IAccessPath<ISPO> getAccessPath(IKeyOrder<ISPO> keyOrder)
Description copied from interface: IRawTripleStore
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().

Specified by:
getAccessPath in interface IRawTripleStore

getAccessPath

public final IAccessPath<ISPO> getAccessPath(IKeyOrder<ISPO> keyOrder,
                                             IElementFilter<ISPO> filter)
Parameters:
keyOrder -
filter - The filter will be incorporated as a constraint on the IPredicate for the IAccessPath and will be evaluated close to the data.
Returns:

addNamespace

public final void addNamespace(String namespace,
                               String prefix)
Defines a transient mapping from a URI to a namespace prefix that will be used for that URI by AbstractResource.toString().

Parameters:
namespace -
prefix -

getNamespaces

public final Map<String,String> getNamespaces()
Return an unmodifiable view of the mapping from namespaces to namespace prefixes.

Note: this is NOT a persistent map. It is used by toString(IV) when externalizing URIs.


getNamespace

public final String getNamespace(String prefix)
Return the namespace for the given prefix.

Parameters:
prefix - The prefix.
Returns:
The associated namespace -or- null if no namespace was mapped to that prefix.

removeNamespace

public final String removeNamespace(String prefix)
Removes the namespace associated with the prefix.

Parameters:
prefix - The prefix.
Returns:
The namespace associated with that prefic (if any) and null otherwise.

clearNamespaces

public final void clearNamespaces()
Clears the namespace map.


toString

public final String toString(IV s,
                             IV p,
                             IV o)
Description copied from interface: IRawTripleStore
Externalizes a triple using an abbreviated syntax.

Specified by:
toString in interface IRawTripleStore

toString

public final String toString(IV s,
                             IV p,
                             IV o,
                             IV c)
Description copied from interface: IRawTripleStore
Externalizes a quad or a triple with a statement identifier using an abbreviated syntax.

Specified by:
toString in interface IRawTripleStore

toString

public final String toString(ISPO spo)

toString

public final String toString(IV iv)
Description copied from interface: IRawTripleStore
Externalizes a term using an abbreviated syntax.

Specified by:
toString in interface IRawTripleStore
Parameters:
iv - The term identifier.
Returns:
A representation of the term.

predicateUsage

public final StringBuilder predicateUsage()

predicateUsage

public final StringBuilder predicateUsage(AbstractTripleStore resolveTerms)
Dumps the #of statements using each predicate in the kb (tab delimited, unordered).

Parameters:
resolveTerms - Used to resolve term identifiers to terms (you can use this to dump a TempTripleStore that is using the term dictionary of the main database).

dumpStore

public final StringBuilder dumpStore()
Utility method dumps the statements in the store using the SPO index (subject order).


dumpStore

public final StringBuilder dumpStore(boolean explicit,
                                     boolean inferred,
                                     boolean axioms)

dumpStore

public final StringBuilder dumpStore(AbstractTripleStore resolveTerms,
                                     boolean explicit,
                                     boolean inferred,
                                     boolean axioms)

dumpStore

public final StringBuilder dumpStore(AbstractTripleStore resolveTerms,
                                     boolean explicit,
                                     boolean inferred,
                                     boolean axioms,
                                     boolean justifications)
Dumps the store in a human readable format (not suitable for interchange).

Parameters:
resolveTerms - Used to resolve term identifiers to terms (you can use this to dump a TempTripleStore that is using the term dictionary of the main database).
explicit - Show statements marked as explicit.
inferred - Show statements marked inferred.
axioms - Show statements marked as axioms.
justifications - Dump the justifications index also.

dumpStore

public StringBuilder dumpStore(AbstractTripleStore resolveTerms,
                               boolean explicit,
                               boolean inferred,
                               boolean axioms,
                               boolean justifications,
                               IKeyOrder<ISPO> keyOrder)
Dumps the store in a human readable format (not suitable for interchange).

Parameters:
resolveTerms - Used to resolve term identifiers to terms (you can use this to dump a TempTripleStore that is using the term dictionary of the main database).
explicit - Show statements marked as explicit.
inferred - Show statements marked inferred.
axioms - Show statements marked as axioms.
justifications - Dump the justifications index also.
keyOrder - The access path to use.

dumpStatements

public StringBuilder dumpStatements(IAccessPath<ISPO> accessPath)
Dumps the access path, efficiently resolving term identifiers to terms.

Parameters:
accessPath -

copyStatements

public long copyStatements(AbstractTripleStore dst,
                           IElementFilter<ISPO> filter,
                           boolean copyJustifications)
Copies the statements from this store into the specified store using the same term identifiers (the lexicon is neither copied to nor asserted on the target).

Note: This method MUST NOT be used unless it is known in advance that the statements in this store use term identifiers that are consistent with (term for term identical to) those in the destination store. If statement identifiers are enabled, then they MUST be enabled for both stores (statement identifiers are assigned by, and stored in, the foward lexicon and replicated into the statement indices).

Note: The statements in this store are NOT removed.

Parameters:
dst - The persistent database (destination).
filter - An optional filter to be applied. Statements in this matching the filter will NOT be copied.
copyJustifications - When true, the justifications will be copied as well.
Returns:
The #of statements inserted into dst (the count only reports those statements that were not already in the main store).
TODO:
method signature could be changed to accept the source access path for the read and then just write on the database

copyStatements

public long copyStatements(AbstractTripleStore dst,
                           IElementFilter<ISPO> filter,
                           boolean copyJustifications,
                           IChangeLog changeLog)

bulkFilterStatements

public IChunkedOrderedIterator<ISPO> bulkFilterStatements(ISPO[] stmts,
                                                          int numStmts,
                                                          boolean present)
Description copied from interface: IRawTripleStore
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).

Specified by:
bulkFilterStatements in interface IRawTripleStore
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

public IChunkedOrderedIterator<ISPO> bulkFilterStatements(IChunkedOrderedIterator<ISPO> itr,
                                                          boolean present)
Description copied from interface: IRawTripleStore
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).

Specified by:
bulkFilterStatements in interface IRawTripleStore
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

public IChunkedOrderedIterator<ISPO> bulkCompleteStatements(SPO[] stmts,
                                                            int numStmts)

bulkCompleteStatements

public ISPO[] bulkCompleteStatements(ISPO[] stmts)

bulkCompleteStatements

public IChunkedOrderedIterator<ISPO> bulkCompleteStatements(IChunkedOrderedIterator<ISPO> itr)
Description copied from interface: IRawTripleStore
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.

Specified by:
bulkCompleteStatements in interface IRawTripleStore
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.

addStatements

public long addStatements(ISPO[] stmts,
                          int numStmts)
Description copied from interface: IRawTripleStore
Writes the statements onto the statements indices (batch, parallel, NO truth maintenance).

Specified by:
addStatements in interface IRawTripleStore
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

public long addStatements(ISPO[] stmts,
                          int numStmts,
                          IElementFilter<ISPO> filter)
Description copied from interface: IRawTripleStore
Writes the statements onto the statement indices (batch, parallel, NO truth maintenance).

Specified by:
addStatements in interface IRawTripleStore
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

public long addStatements(IChunkedOrderedIterator<ISPO> itr,
                          IElementFilter<ISPO> filter)
Description copied from interface: IRawTripleStore
Writes the statements onto the statement indices (batch, parallel, NO truth maintenance).

Specified by:
addStatements in interface IRawTripleStore
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).

addStatements

public long addStatements(AbstractTripleStore statementStore,
                          boolean copyOnly,
                          IChunkedOrderedIterator<ISPO> itr,
                          IElementFilter<ISPO> filter)
Add statements to the statementStore.

Note: If AbstractTripleStore.Options.STATEMENT_IDENTIFIERS was specified, then statement identifiers are assigned using the lexicon associated with this database. This is done in a preprocessing stage for each "chunk" reported by the source itr. This step sets the statement identifier on the SPO so that it is present when we write on the statement indices.

Parameters:
statementStore - Either this database or the focusStore (the latter option is used only during truth maintenance).
copyOnly - When true, it is assumed that the SPOs are being copied from another store using a consistent lexicon (or onto a store that uses the same lexicon). The flag only has an effect when statement identifiers are enabled, since it is then presumed that SPO.getStatementIdentifier() will return a pre-assigned statement identifier and that we do NOT need to invoke #addStatementIdentifiers(SPO[], int). This is only an optimization - the value false is always safe for this flag, but it will do some extra work in the case described here. See StatementWriter, which uses this flag and copyStatements(AbstractTripleStore, IElementFilter, boolean) which always specifies true for this flag.
itr - The source from which the SPOs are read.
filter - An optional filter.
Returns:
The mutation count, which is 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

public long removeStatements(ISPO[] stmts,
                             int numStmts)
Description copied from interface: IRawTripleStore
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.

Specified by:
removeStatements in interface IRawTripleStore
Returns:
The #of statements that were removed from the indices.

removeStatements

public long removeStatements(IChunkedOrderedIterator<ISPO> itr)
Description copied from interface: IRawTripleStore
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.

Specified by:
removeStatements in interface IRawTripleStore
Parameters:
itr - The iterator
Returns:
The #of statements that were removed from the indices.

removeStatements

public long removeStatements(IChunkedOrderedIterator<ISPO> itr,
                             boolean computeClosureForStatementIdentifiers)
This processes a chunk of SPOs at a time and then submits tasks to parallel threads to remove those statements from each of the statement indices. This continues until all statements visited by the iterator have been removed.

Note: If justifications are being used to support truth maintenance, then all justifications for the removed statements are also removed.

Parameters:
itr - An iterator visiting SPOs to be removed from the database.
computeClosureForStatementIdentifiers - When false the caller asserts that they have pre-computed the closure of the statements that assert metadata about statement identifiers to be deleted. When true this method will compute that closure on behalf of the caller with the effect that any statements made about statements to be removed are also removed. This option has no effect when statementIdentifiers are not enabled. See AbstractTripleStore.Options.STATEMENT_IDENTIFIERS
TODO:
If you are using statement identifiers but you are NOT using truth maintenance then this method does NOT guarantee consistency when removing statements in the face of concurrent writers on the statement indices. The problem is that we collect the statement identifiers in one unisolated operation, then collect the statements that use those statement identifiers two other operations, and finally we remove those statements. In order to be consistent you need to obtain an exclusive lock (which is difficult to do with distributed clients) or be encompassed by a transaction. (This is the same constraint that applies when truth maintenance is enabled since you have to serialize incremental TM operations anyway.)

computeClosureForStatementIdentifiers

public IChunkedOrderedIterator<ISPO> computeClosureForStatementIdentifiers(IChunkedOrderedIterator<ISPO> src)
Return an iterator which will visit the closure of the statements visited by the source iterator plus any statements in the database made using a statement identifier found on any of the statements visited by the source iterator (only explicit statements have statement identifiers and then iff statementIdentifiers are enabled).

Note: This uses a TempTripleStore which is iteratively populated until a fix point is obtained. The TempTripleStore is released when the returned iterator is closed or when it is finalized.

Parameters:
src - The source iterator.

fixPointStatementIdentifiers

public static void fixPointStatementIdentifiers(AbstractTripleStore db,
                                                AbstractTripleStore tempStore)
Computes the fixed point of those statements in the database which make assertions about statement identifiers in the tmp store.

Parameters:
db - The database.
tempStore - The temporary store.

newJoinNexusFactory

public IJoinNexusFactory newJoinNexusFactory(RuleContextEnum ruleContext,
                                             ActionEnum action,
                                             int solutionFlags,
                                             IElementFilter filter)
Parameters:
solutionFlags - See IJoinNexus.ELEMENT and friends.
filter - Optional filter.
Returns:

newJoinNexusFactory

public IJoinNexusFactory newJoinNexusFactory(RuleContextEnum ruleContext,
                                             ActionEnum action,
                                             int solutionFlags,
                                             IElementFilter filter,
                                             boolean justify,
                                             boolean backchain,
                                             IEvaluationPlanFactory planFactory)
Parameters:
solutionFlags - See IJoinNexus.ELEMENT and friends.
filter - Optional filter.
Returns:

newJoinNexusFactory

public IJoinNexusFactory newJoinNexusFactory(RuleContextEnum ruleContext,
                                             ActionEnum action,
                                             int solutionFlags,
                                             IElementFilter filter,
                                             boolean justify,
                                             boolean backchain,
                                             IEvaluationPlanFactory planFactory,
                                             Properties overrides)
Parameters:
solutionFlags - See IJoinNexus.ELEMENT and friends.
filter - Optional filter.
overrides - Optional overrides of the properties controlling the rule execution layer. When given, the property values will override those inherited from AbstractResource.
Returns:

match

public ICloseableIterator<IBindingSet> match(Literal[] lits,
                                             URI[] preds,
                                             URI cls)
Specialized IRule execution using the full text index to identify possible completions of the given literals for which there exists a subject s such that:
 SELECT ?s, ?t, ?lit
     (?lit completionOf, lits)
 AND (?s ?p ?lit)
 AND (?s rdf:type ?t)
 AND (?t rdfs:subClassOf cls)
 WHERE
     p IN {preds}
 
Note: The JOIN runs asynchronously.

Parameters:
lits - One or more literals. The completions of these literals will be discovered using the FullTextIndex. (A completion is any literal having one of the given literals as a prefix and includes an exact match on the litteral as a degenerate case.)
preds - One or more predicates that link the subjects of interest to the completions of the given literals. Typically this array will include rdf:label.
cls - All subjects visited by the iterator will be instances of this class.
Returns:
An ICloseableIterator visiting IBindingSets. Each IBindingSet will have bound BigdataValues for s, t, p, and lit where those variables are defined per the pseudo-code JOIN above.
Throws:
InterruptedException - if the operation is interrupted. FIXME quads : Modify match() to allow an optional context argument. When present, the match would be restricted to the specified context.

getMatchProgram

protected Program getMatchProgram(Literal[] lits,
                                  IConstant<IV>[] _preds,
                                  IV _cls)
Generate a program from the possible completions of the literals.

Parameters:
lits - One or more literals. The completions of these literals will be discovered using the FullTextIndex. (A completion is any literal having one of the given literals as a prefix and includes an exact match on the litteral as a degenerate case.)
_preds - One or more term identifiers for predicates that link the subjects of interest to the completions of the given literals. Typically this array will include the term identifier for rdf:label.
_cls - All subjects visited by the iterator will be instances of the class assigned this term identifier.
Returns:
A generated program. When run as a query, the program will produce ISolutions corresponding to the head of the MatchRule.


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