public abstract class ObjectMgrModel extends Object implements IObjectManager
IObjectManager implementations. This class handles
IObjectManager protocol for maintaining an transaction edit list.
Concrete implementations need to provide for communication with the database
(either remote or embedded) and the DESCRIBE (aka Object) cache.| Modifier and Type | Field and Description |
|---|---|
protected int |
m_maxDirtyListSize
Default to maximum dirty list size to lock out any incremental flushing.
|
protected BigdataValueFactory |
m_valueFactory |
| Constructor and Description |
|---|
ObjectMgrModel(String endpoint,
BigdataValueFactory valueFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
addToDirtyList(GPO gpo)
GPOs are added to the dirty list when initially modified.
|
int |
beginNativeTransaction()
Increments the native transaction counter.
|
<T> T |
bestEffortIntern(T t)
Make a best effort attempt to use the
Resource associated with an
IGPO in the running object table |
void |
clearCache() |
void |
close()
Close the object manager, which terminates its connection with the
backing store.
|
int |
commitNativeTransaction(int expectedCounter)
The native transaction is committed when the counter reaches
zero.
|
IGPO |
createGPO()
The ObjectManager is able to assign automatic ids for a new object.
|
String |
encode(org.openrdf.model.Resource v)
Encode a URL, Literal, or blank node for inclusion in a SPARQL query to
be sent to the remote service.
|
protected abstract void |
flushStatements(List<org.openrdf.model.Statement> insertList,
List<org.openrdf.model.Statement> removeList)
Flush statements to be inserted and removed to the backing store..
|
IGPO |
getDefaultNameMgr() |
int |
getDirtyObjectCount() |
IGPO |
getGPO(org.openrdf.model.Resource id)
Return a canonical
IGPO for the Resource (canonical
within the scope of this object manager) and never null. |
IGPO |
getGPO(org.openrdf.model.Statement stmt)
FIXME This is using the
String representation of the
Statement as the blank node ID. |
Iterator<WeakReference<IGPO>> |
getGPOs()
An iterator that visits the weak reference values in the running object
table.
|
UUID |
getID() |
Iterator<org.openrdf.model.URI> |
getNames()
Return the list of names that have been used to save references.
|
int |
getNativeTransactionCounter()
The current value of the native transaction counter.
|
BigdataValueFactory |
getValueFactory()
The value factory for the KB instance associated with this object manager
view.
|
protected Map<org.openrdf.model.Resource,IGPO> |
initGPO(GPO gpo,
ICloseableIterator<org.openrdf.model.Statement> stmts)
Initialize one or more
IGPOs from a collection of statements. |
Map<org.openrdf.model.Resource,IGPO> |
initGPOs(ICloseableIterator<org.openrdf.model.Statement> itr)
Partially materialize
IGPOs from a stream of Statements. |
BigdataURI |
internKey(org.openrdf.model.URI aKey)
Intern a predicate (internal API).
|
void |
materialize(IGPO gpo)
Ensure Statements are materialized for gpo's Resource:
DESCRIBE ?s. |
protected void |
materializeWithDescribe(IGPO gpo) |
protected void |
materializeWithSelect(IGPO gpo) |
org.openrdf.model.Value |
recall(org.openrdf.model.URI key)
Deprecated.
|
IGPO |
recallAsGPO(org.openrdf.model.URI key)
Deprecated.
|
void |
remove(IGPO gpo)
Remove all assertions involving the specified object.
|
void |
rollbackNativeTransaction()
Rollback all changes since the last time the native
transaction counter was zero.
|
void |
save(org.openrdf.model.URI key,
org.openrdf.model.Value value)
Deprecated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitevaluate, evaluateGraph, execute, isPersistentprotected final BigdataValueFactory m_valueFactory
protected int m_maxDirtyListSize
Note: Incremental eviction breaks the ACID contract for updates. Thus, the dirty list should not be limited in capacity.
public ObjectMgrModel(String endpoint, BigdataValueFactory valueFactory)
endpoint - The SPARQL endpoint that can be used to communicate with the
database.valueFactory - The value factory.public IGPO getDefaultNameMgr()
public UUID getID()
getID in interface IObjectManagerpublic final BigdataValueFactory getValueFactory()
IObjectManagergetValueFactory in interface IObjectManagerpublic BigdataURI internKey(org.openrdf.model.URI aKey)
==) for URIs within the scope of a
given object manager.key - The predicate.public <T> T bestEffortIntern(T t)
Resource associated with an
IGPO in the running object tablet - Some identifier.IGPO remains pinned in the running object table.public void addToDirtyList(GPO gpo)
Note: We can not do incremental eviction unless we are holding open a connection to the database that will isolate those edits. This could be done in principle with either full read/write transactions or with the unisolated connection (if embedded) but we do not yet support remove create/run/commit for full read/write transactions in the NSS REST API. The problem with holding the unisolated connection across incremental updates is that it will lock out any other updates against the backing store for the life cycle of the object manager.
public int getDirtyObjectCount()
protected abstract void flushStatements(List<org.openrdf.model.Statement> insertList, List<org.openrdf.model.Statement> removeList)
insertList - The list of statements to be added.removeList - The list of statements to be removed.public IGPO getGPO(org.openrdf.model.Resource id)
IObjectManagerIGPO for the Resource (canonical
within the scope of this object manager) and never null.getGPO in interface IObjectManagerid - The Resource.IGPO.IGPO.getId()public IGPO getGPO(org.openrdf.model.Statement stmt)
String representation of the
Statement as the blank node ID. It needs to work with the stable
IVs as assigned by the lexicon. However, we need to ensure that
the IVs are being reported through to the object manager in the
various interchange formats that it uses and work through how we will
provide that information in the SELECT query as well as CONSTRUCT and
DESCRIBE (basically, we need to conneg for a MIME Type that supports it).getGPO in interface IObjectManagerpublic Iterator<WeakReference<IGPO>> getGPOs()
IObjectManagerIGPO to be visited. That would allow us to eliminate the
WeakReference from this method signature.getGPOs in interface IObjectManagerpublic void materialize(IGPO gpo)
IObjectManagerDESCRIBE ?s.materialize in interface IObjectManagerprotected void materializeWithDescribe(IGPO gpo)
protected void materializeWithSelect(IGPO gpo)
public Map<org.openrdf.model.Resource,IGPO> initGPOs(ICloseableIterator<org.openrdf.model.Statement> itr)
IObjectManagerIGPOs from a stream of Statements.initGPOs in interface IObjectManageritr - The Statements.IGPOs from being finalized before the caller has a chance
to do something with them.protected Map<org.openrdf.model.Resource,IGPO> initGPO(GPO gpo, ICloseableIterator<org.openrdf.model.Statement> stmts)
IGPOs from a collection of statements.gpo - The gpo (optional). When given, only the specified
IGPO will be initialized. When not provided, all
Resources in the subject and object position of the
visited Statements will be resolved to IGPOs
and the corresponding properties and/or links initialized from
the Statements.stmts - The statements.IGPOs from being finalized before the caller has a chance
to do something with them.public int beginNativeTransaction()
INativeTransactionbeginNativeTransaction in interface INativeTransactionpublic int commitNativeTransaction(int expectedCounter)
INativeTransactionINativeTransaction.beginNativeTransaction() and throws an exception if
expectedCounter is not equal to the internal counter.
This provides an eager search for un-matched native transactions.commitNativeTransaction in interface INativeTransactionpublic int getNativeTransactionCounter()
INativeTransactiongetNativeTransactionCounter in interface INativeTransactionpublic void rollbackNativeTransaction()
INativeTransactionrollbackNativeTransaction in interface INativeTransactionpublic IGPO createGPO()
IObjectManagercreateGPO in interface IObjectManagerpublic final void remove(IGPO gpo)
IObjectManagerremove in interface IObjectManager@Deprecated public void save(org.openrdf.model.URI key, org.openrdf.model.Value value)
save in interface IObjectManager@Deprecated public org.openrdf.model.Value recall(org.openrdf.model.URI key)
recall in interface IObjectManager@Deprecated public IGPO recallAsGPO(org.openrdf.model.URI key)
recallAsGPO in interface IObjectManagerpublic Iterator<org.openrdf.model.URI> getNames()
getNames in interface IObjectManagerpublic void close()
IObjectManagerclose in interface IObjectManagerpublic final void clearCache()
public String encode(org.openrdf.model.Resource v)
v - The resource.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.