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
IGPO s from a collection of statements. |
Map<org.openrdf.model.Resource,IGPO> |
initGPOs(ICloseableIterator<org.openrdf.model.Statement> itr)
Partially materialize
IGPO s from a stream of Statement s. |
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, wait
evaluate, evaluateGraph, execute, isPersistent
protected 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 IObjectManager
public final BigdataValueFactory getValueFactory()
IObjectManager
getValueFactory
in interface IObjectManager
public 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)
IObjectManager
IGPO
for the Resource
(canonical
within the scope of this object manager) and never null
.getGPO
in interface IObjectManager
id
- 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
IV
s as assigned by the lexicon. However, we need to ensure that
the IV
s 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 IObjectManager
public Iterator<WeakReference<IGPO>> getGPOs()
IObjectManager
IGPO
to be visited. That would allow us to eliminate the
WeakReference
from this method signature.getGPOs
in interface IObjectManager
public void materialize(IGPO gpo)
IObjectManager
DESCRIBE ?s
.materialize
in interface IObjectManager
protected void materializeWithDescribe(IGPO gpo)
protected void materializeWithSelect(IGPO gpo)
public Map<org.openrdf.model.Resource,IGPO> initGPOs(ICloseableIterator<org.openrdf.model.Statement> itr)
IObjectManager
IGPO
s from a stream of Statement
s.initGPOs
in interface IObjectManager
itr
- The Statement
s.IGPO
s 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)
IGPO
s from a collection of statements.gpo
- The gpo (optional). When given, only the specified
IGPO
will be initialized. When not provided, all
Resource
s in the subject and object position of the
visited Statement
s will be resolved to IGPO
s
and the corresponding properties and/or links initialized from
the Statement
s.stmts
- The statements.IGPO
s from being finalized before the caller has a chance
to do something with them.public int beginNativeTransaction()
INativeTransaction
beginNativeTransaction
in interface INativeTransaction
public int commitNativeTransaction(int expectedCounter)
INativeTransaction
INativeTransaction.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 INativeTransaction
public int getNativeTransactionCounter()
INativeTransaction
getNativeTransactionCounter
in interface INativeTransaction
public void rollbackNativeTransaction()
INativeTransaction
rollbackNativeTransaction
in interface INativeTransaction
public IGPO createGPO()
IObjectManager
createGPO
in interface IObjectManager
public final void remove(IGPO gpo)
IObjectManager
remove
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 IObjectManager
public Iterator<org.openrdf.model.URI> getNames()
getNames
in interface IObjectManager
public void close()
IObjectManager
close
in interface IObjectManager
public final void clearCache()
public String encode(org.openrdf.model.Resource v)
v
- The resource.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.