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.
|
protected Set<RandomVariableAtom> |
persistedCache
The set of all persisted RandomVariableAtoms at the time of this AtomManager's
instantiation.
|
static boolean |
THROW_ACCESS_EXCEPTION_DEFAULT |
static String |
THROW_ACCESS_EXCEPTION_KEY
Whether or not to throw an exception on illegal access.
|
db
Constructor and Description |
---|
PersistedAtomManager(Database db)
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.
|
Set<RandomVariableAtom> |
getPersistedRVAtoms() |
executeGroundingQuery, executeQuery, getDatabase, isClosed
public static final String CONFIG_PREFIX
public static final String THROW_ACCESS_EXCEPTION_KEY
public static final boolean THROW_ACCESS_EXCEPTION_DEFAULT
protected final Set<RandomVariableAtom> persistedCache
public PersistedAtomManager(Database db)
db
- the Database to query for all getAtom() calls.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 Set<RandomVariableAtom> getPersistedRVAtoms()
protected void addToPersistedCache(Set<RandomVariableAtom> atoms)
Copyright © 2018 University of California, Santa Cruz. All rights reserved.