public class PersistedAtomManager extends AtomManager
AtomManager
with a twist: this AtomManager will only return
RandomVariableAtoms
that were persisted in the Database
at instantiation.
All other types of Atoms are returned normally.
getAtom() is thread-safe.Modifier and Type | Class and Description |
---|---|
static class |
PersistedAtomManager.PersistedAccessException |
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_PREFIX
Prefix of property keys used by this class.
|
static boolean |
THROW_ACCESS_EXCEPTION_DEFAULT |
static String |
THROW_ACCESS_EXCEPTION_KEY
Whether or not to throw an exception on illegal access.
|
db, enableAccessExceptions
Constructor and Description |
---|
PersistedAtomManager(Database db) |
PersistedAtomManager(Database db,
boolean prebuiltCache)
Constructs a PersistedAtomManager with a built-in set of all the database's persisted RandomVariableAtoms.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addToPersistedCache(Set<RandomVariableAtom> atoms) |
void |
commitPersistedAtoms()
Commit all the atoms in this manager's persisted cache.
|
GroundAtom |
getAtom(Predicate predicate,
Constant... arguments)
Returns the GroundAtom for the given Predicate and GroundTerms.
|
int |
getPersistedCount() |
Iterable<RandomVariableAtom> |
getPersistedRVAtoms() |
void |
reportAccessException(RuntimeException ex,
GroundAtom offendingAtom)
Decide whether or not to throw an access exception.
|
enableAccessExceptions, executeGroundingQuery, executeQuery, getCachedRVACount, getDatabase, isClosed
public static final String CONFIG_PREFIX
public static final String THROW_ACCESS_EXCEPTION_KEY
public static final boolean THROW_ACCESS_EXCEPTION_DEFAULT
public PersistedAtomManager(Database db)
public PersistedAtomManager(Database db, boolean prebuiltCache)
prebuiltCache
- the database already has a populated atom cache, no need to build it again.public GroundAtom getAtom(Predicate predicate, Constant... arguments)
AtomManager
ReadableDatabase.getAtom(Predicate, Constant...)
to actually retrieve the GroundAtom.getAtom
in class AtomManager
predicate
- the Predicate of the Atomarguments
- the GroundTerms of the Atompublic void commitPersistedAtoms()
public int getPersistedCount()
public Iterable<RandomVariableAtom> getPersistedRVAtoms()
protected void addToPersistedCache(Set<RandomVariableAtom> atoms)
public void reportAccessException(RuntimeException ex, GroundAtom offendingAtom)
AtomManager
reportAccessException
in class AtomManager
Copyright © 2020 University of California, Santa Cruz. All rights reserved.