|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.relation.AbstractResource<IDatabase<AbstractTripleStore>>
com.bigdata.rdf.store.AbstractTripleStore
public abstract class 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.
| 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 |
|---|
protected final boolean lexicon
TempTripleStore.
| Constructor Detail |
|---|
protected AbstractTripleStore(IIndexManager indexManager,
String namespace,
Long timestamp,
Properties properties)
DefaultResourceLocator.
AbstractTripleStore.Options| Method Detail |
|---|
public final boolean isJustify()
Note: This is the same value that is reported by SPORelation.justify.
AbstractTripleStore.Options.JUSTIFYpublic final int getSPOKeyArity()
SPORelation (3 or 4).public final boolean isQuads()
true iff this is a quad store.
AbstractTripleStore.Options.QUADSpublic final boolean isStatementIdentifiers()
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.
AbstractTripleStore.Options.STATEMENT_IDENTIFIERSpublic BaseClosure getClosureInstance()
public boolean isAxiom(IV s,
IV p,
IV o)
true iff the fully bound statement is an axiom.
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.public boolean getStatementIdentifiers()
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).
public boolean isInlineLiterals()
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.
public final boolean isConstrainXXXCShards()
AbstractTripleStore.Options.CONSTRAIN_XXXC_SHARDSpublic final BigdataValueFactory getValueFactory()
BigdataValueFactoryImpl for namespace of the
LexiconRelation associated with this AbstractTripleStore.
UnsupportedOperationException - if there is no associated lexicon.TempTripleStore to specify another db's lexicon?public Iterator<IRelation> relations()
IDatabaseIRelation resources.
relations in interface IDatabase<AbstractTripleStore>protected Class determineAxiomClass()
protected Class determineVocabularyClass()
public abstract boolean isConcurrent()
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.
public void __tearDownUnitTest()
public boolean isOpen()
public void close()
ITripleStore.
protected final void shutdown()
close() and
__tearDownUnitTest()
public abstract boolean isStable()
Note: This is mainly used by the test suites.
public boolean isReadOnly()
protected final void assertWritable()
public AbstractTripleStore init()
AbstractResource
init in interface ILocatableResource<IDatabase<AbstractTripleStore>>init in class AbstractResource<IDatabase<AbstractTripleStore>>public void create()
IMutableResourceILocatableResource.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.
create in interface IMutableResource<IDatabase<AbstractTripleStore>>create in class AbstractResource<IDatabase<AbstractTripleStore>>public void destroy()
IMutableResource
destroy in interface IMutableResource<IDatabase<AbstractTripleStore>>destroy in class AbstractResource<IDatabase<AbstractTripleStore>>public final Axioms getAxioms()
Properties. Otherwise it is
set by create().
IllegalStateException - if there is no lexicon.AbstractTripleStore.Options.LEXICON,
AbstractTripleStore.Options.AXIOMS_CLASSpublic final Vocabulary getVocabulary()
Vocabulary. This consists of
BigdataValues of interest that have been pre-evaluated against
the lexicon and are associated with their correct term identifiers.
IllegalStateException - if there is no lexicon.AbstractTripleStore.Options.LEXICON,
AbstractTripleStore.Options.VOCABULARY_CLASSpublic final SPORelation getSPORelation()
SPORelation (triples and their access paths).
public final LexiconRelation getLexiconRelation()
LexiconRelation handles all things related to the indices
mapping RDF Values onto internal 64-bit term identifiers.
public final long getNamedGraphCount()
public final long getStatementCount()
getStatementCount(boolean)public final long getStatementCount(boolean exact)
exact - When true the result will be an exact count,
which may require a full key-range scan of one of the
statement indices.
false and either transactions or key-range
partitioned indices are being used, then this will be an upper
bound.public final long getStatementCount(Resource c)
c - The context (optional).
public final long getStatementCount(Resource c,
boolean exact)
Core implementation.
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.
null. When exact is
false and either transactions or key-range
partitioned indices are being used, then this will be an upper
bound.public long getExplicitStatementCount(Resource c)
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.
c - The context (optional). When not given, the count is reported
across all named graphs.public void abort()
IllegalStateException - if the view is read only.public long commit()
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.
IllegalStateException - if the view is read only.public final long getJustificationCount()
public final long getTermCount()
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.
public final long getURICount()
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.
public final long getLiteralCount()
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.
public final long getBNodeCount()
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.
public IV addTerm(Value value)
IRawTripleStoreNote: This method delegates to the batch API, but it is extremely inefficient for scale-out as it does one RMI per request!
addTerm in interface IRawTripleStorevalue - The term.
public final BigdataValue getTerm(IV iv)
getTerm in interface IRawTripleStorenull if there is no term with
that internal value in the index.public final IV getIV(Value value)
getIV in interface IRawTripleStorevalue - Any Value reference (MAY be null).
public void addTerms(BigdataValue[] terms)
IRawTripleStore
addTerms in interface IRawTripleStoreterms - An array to be inserted.LexiconRelation.addTerms(BigdataValue[], int, boolean)public final InferenceEngine getInferenceEngine()
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.
DataLoader.Optionspublic final DataLoader getDataLoader()
DataLoader singleton configured using the properties
that were used to configure the database.
DataLoader.Options
public final void addStatement(Resource s,
URI p,
Value o)
public final void addStatement(Resource s,
URI p,
Value o,
Resource c)
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();
s - The subject (required).p - The predicate (required).o - The object (required).c - The context (required IFF a quad store and otherwise ignored).
public final ISPO getStatement(IV s,
IV p,
IV o)
getStatement in interface IRawTripleStore
public final ISPO getStatement(IV s,
IV p,
IV o,
IV c)
IRawTripleStore
Note: This may be used to examine the StatementEnum.
getStatement in interface IRawTripleStores - 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).
SPO for that statement, including its
StatementEnum -or- null iff the statement is
not in the database.
public final boolean hasStatement(IV s,
IV p,
IV o)
hasStatement(IV, IV, IV, IV)
Note: This method does not verify whether or not the statement is explicit.
s - p - o -
public final boolean hasStatement(IV s,
IV p,
IV o,
IV c)
Note: This method does not verify whether or not the statement is explicit.
s - p - o - c -
public final boolean hasStatement(Resource s,
URI p,
Value o)
public final boolean hasStatement(Resource s,
URI p,
Value o,
Resource c)
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)!
s - The subject (optional).p - The predicate (optional).o - The object (optional).c - The context (optional and ignored unless a quad store).
public final long removeStatements(Resource s,
URI p,
Value o)
public final long removeStatements(Resource s,
URI p,
Value o,
Resource c)
s - The subject (optional).p - The predicate (optional).o - The object (optional).c - The context (optional).
public final BigdataStatement getStatement(Statement s)
public final BigdataStatement getStatement(Resource s,
URI p,
Value o)
public final BigdataStatement getStatement(Resource s,
URI p,
Value o,
Resource c)
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.
s - The subject (required).p - The predicate (required).o - The object (required).c - The context (required iff a quad store and otherwise ignored).
null iff the triple is not
defined in the database.asValue(Value)
public final BigdataStatementIterator getStatements(Resource s,
URI p,
Value o)
public final BigdataStatementIterator getStatements(Resource s,
URI p,
Value o,
Resource c)
BigdataStatements in the
database matching the triple pattern.
s - The subject (optional).p - The predicate (optional).o - The object (optional).c - The context (optional and ignored unless a quad store).
public final BigdataValue asValue(Value value)
BigdataValue to a Sesame Value object.
value - Either a BigdataValue, a Sesame Value
object, or null.
Value object -or-
null iff value is null.public BigdataStatement asStatement(ISPO spo)
ISPO into a Sesame Statement.
Note: The object returned will be a BigdataStatement
spo - The ISPO.
Statement -or- null.public BigdataStatementIterator asStatementIterator(IChunkedOrderedIterator<ISPO> src)
IChunkedOrderedIterator as a
BigdataStatementIterator.
Note: The object visited will be BigdataStatementImpls.
src - An IChunkedOrderedIterator visiting SPOs
BigdataStatementIterator.IAccessPath,
getAccessPath(Resource, URI, Value)
public IAccessPath<ISPO> getAccessPath(Resource s,
URI p,
Value o)
public IAccessPath<ISPO> getAccessPath(Resource s,
URI p,
Value o,
IElementFilter<ISPO> filter)
public final IAccessPath<ISPO> getAccessPath(Resource s,
URI p,
Value o,
Resource c)
IAccessPath matching the triple pattern.
s - The subject (optional).p - The predicate (optional).o - The object (optional).c - The context (optional).
Values is not known to the
database this method will return an EmptyAccessPath.IAccessPath,
asStatementIterator(IChunkedOrderedIterator)
public final IAccessPath<ISPO> getAccessPath(Resource s,
URI p,
Value o,
Resource c,
IElementFilter<ISPO> filter,
RangeBOp range)
public final IAccessPath<ISPO> getAccessPath(IV s,
IV p,
IV o)
IRawTripleStoreIAccessPath for the given triple
pattern.
getAccessPath in interface IRawTripleStores - 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.
public final IAccessPath<ISPO> getAccessPath(IV s,
IV p,
IV o,
IElementFilter<ISPO> filter)
public final IAccessPath<ISPO> getAccessPath(IV s,
IV p,
IV o,
IV c)
public final IAccessPath<ISPO> getAccessPath(IV s,
IV p,
IV o,
IV c,
RangeBOp range)
public final IAccessPath<ISPO> getAccessPath(IV s,
IV p,
IV o,
IV c,
IElementFilter<ISPO> filter)
public final IAccessPath<ISPO> getAccessPath(IKeyOrder<ISPO> keyOrder)
IRawTripleStoreIAccessPath for the specified IKeyOrder and a
fully unbound triple pattern. This is generally used only when you want
to perform a IAccessPath#distinctTermScan().
getAccessPath in interface IRawTripleStore
public final IAccessPath<ISPO> getAccessPath(IKeyOrder<ISPO> keyOrder,
IElementFilter<ISPO> filter)
keyOrder - filter - The filter will be incorporated as a constraint on the
IPredicate for the IAccessPath and will be
evaluated close to the data.
public final void addNamespace(String namespace,
String prefix)
AbstractResource.toString().
namespace - prefix - public final Map<String,String> getNamespaces()
Note: this is NOT a persistent map. It is used by toString(IV)
when externalizing URIs.
public final String getNamespace(String prefix)
prefix - The prefix.
null if no namespace
was mapped to that prefix.public final String removeNamespace(String prefix)
prefix - The prefix.
null otherwise.public final void clearNamespaces()
public final String toString(IV s,
IV p,
IV o)
IRawTripleStore
toString in interface IRawTripleStore
public final String toString(IV s,
IV p,
IV o,
IV c)
IRawTripleStore
toString in interface IRawTripleStorepublic final String toString(ISPO spo)
public final String toString(IV iv)
IRawTripleStore
toString in interface IRawTripleStoreiv - The term identifier.
public final StringBuilder predicateUsage()
public final StringBuilder predicateUsage(AbstractTripleStore resolveTerms)
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).public final StringBuilder dumpStore()
public final StringBuilder dumpStore(boolean explicit,
boolean inferred,
boolean axioms)
public final StringBuilder dumpStore(AbstractTripleStore resolveTerms,
boolean explicit,
boolean inferred,
boolean axioms)
public final StringBuilder dumpStore(AbstractTripleStore resolveTerms,
boolean explicit,
boolean inferred,
boolean axioms,
boolean justifications)
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.
public StringBuilder dumpStore(AbstractTripleStore resolveTerms,
boolean explicit,
boolean inferred,
boolean axioms,
boolean justifications,
IKeyOrder<ISPO> keyOrder)
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.public StringBuilder dumpStatements(IAccessPath<ISPO> accessPath)
accessPath -
public long copyStatements(AbstractTripleStore dst,
IElementFilter<ISPO> filter,
boolean copyJustifications)
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.
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.
public long copyStatements(AbstractTripleStore dst,
IElementFilter<ISPO> filter,
boolean copyJustifications,
IChangeLog changeLog)
public IChunkedOrderedIterator<ISPO> bulkFilterStatements(ISPO[] stmts,
int numStmts,
boolean present)
IRawTripleStoreISPO objects for whether they are
"present" or "not present" in the database, depending on the value of the
supplied boolean variable (batch API).
bulkFilterStatements in interface IRawTripleStorestmts - the statements to testnumStmts - the number of statements to testpresent - if true, filter for statements that exist in the db, otherwise
filter for statements that do not exist
public IChunkedOrderedIterator<ISPO> bulkFilterStatements(IChunkedOrderedIterator<ISPO> itr,
boolean present)
IRawTripleStoreSPO objects for whether
they are "present" or "not present" in the database, depending on the
value of the supplied boolean variable (batch api).
bulkFilterStatements in interface IRawTripleStoreitr - an iterator over the set of statements to testpresent - if true, filter for statements that exist in the db, otherwise
filter for statements that do not exist
public IChunkedOrderedIterator<ISPO> bulkCompleteStatements(SPO[] stmts,
int numStmts)
public ISPO[] bulkCompleteStatements(ISPO[] stmts)
public IChunkedOrderedIterator<ISPO> bulkCompleteStatements(IChunkedOrderedIterator<ISPO> itr)
IRawTripleStoreISPOs that are present in the database. ISPOs not present
in the database are left as-is.
bulkCompleteStatements in interface IRawTripleStoreISPOs. Any
ISPOs that were not found will be present but their
statement metadata (type and sid) will be unchanged.
public long addStatements(ISPO[] stmts,
int numStmts)
IRawTripleStore
addStatements in interface IRawTripleStorestmts - The statements (sorted into IKeyOrder#SPO order as a
side-effect).numStmts - The #of entries in stmts that are valid.
public long addStatements(ISPO[] stmts,
int numStmts,
IElementFilter<ISPO> filter)
IRawTripleStore
addStatements in interface IRawTripleStorestmts - 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.
public long addStatements(IChunkedOrderedIterator<ISPO> itr,
IElementFilter<ISPO> filter)
IRawTripleStore
addStatements in interface IRawTripleStoreitr - 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.
public long addStatements(AbstractTripleStore statementStore,
boolean copyOnly,
IChunkedOrderedIterator<ISPO> itr,
IElementFilter<ISPO> filter)
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.
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.
public long removeStatements(ISPO[] stmts,
int numStmts)
IRawTripleStore
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.
removeStatements in interface IRawTripleStorepublic long removeStatements(IChunkedOrderedIterator<ISPO> itr)
IRawTripleStore
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.
removeStatements in interface IRawTripleStoreitr - The iterator
public long removeStatements(IChunkedOrderedIterator<ISPO> itr,
boolean computeClosureForStatementIdentifiers)
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.
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_IDENTIFIERSpublic IChunkedOrderedIterator<ISPO> computeClosureForStatementIdentifiers(IChunkedOrderedIterator<ISPO> src)
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.
src - The source iterator.
public static void fixPointStatementIdentifiers(AbstractTripleStore db,
AbstractTripleStore tempStore)
db - The database.tempStore - The temporary store.
public IJoinNexusFactory newJoinNexusFactory(RuleContextEnum ruleContext,
ActionEnum action,
int solutionFlags,
IElementFilter filter)
solutionFlags - See IJoinNexus.ELEMENT and friends.filter - Optional filter.
public IJoinNexusFactory newJoinNexusFactory(RuleContextEnum ruleContext,
ActionEnum action,
int solutionFlags,
IElementFilter filter,
boolean justify,
boolean backchain,
IEvaluationPlanFactory planFactory)
solutionFlags - See IJoinNexus.ELEMENT and friends.filter - Optional filter.
public IJoinNexusFactory newJoinNexusFactory(RuleContextEnum ruleContext,
ActionEnum action,
int solutionFlags,
IElementFilter filter,
boolean justify,
boolean backchain,
IEvaluationPlanFactory planFactory,
Properties overrides)
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.
public ICloseableIterator<IBindingSet> match(Literal[] lits,
URI[] preds,
URI cls)
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.
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.
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.
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.
protected Program getMatchProgram(Literal[] lits,
IConstant<IV>[] _preds,
IV _cls)
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.
ISolutions corresponding to the head of the
MatchRule.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||