public class RDBMSDataStore extends Object implements DataStore
DatabaseDriver
implementation.Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_PREFIX
Prefix of property keys used by this class.
|
static boolean |
USE_STRING_ID_DEFAULT
Default value for the USE_STRING_ID_KEY property.
|
Constructor and Description |
---|
RDBMSDataStore(DatabaseDriver dbDriver)
Returns an RDBMSDataStore that utilizes the connections returned by the
DatabaseDriver . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Releases all resources and locks obtained by this DataStore.
|
int |
deletePartition(Partition partition)
Deletes all
GroundAtoms persisted in a Partition. |
Connection |
getConnection() |
Database |
getDatabase(Partition write,
Partition... read)
Creates a Database that can read from and write to a
Partition and
optionally read from additional Partitions. |
Database |
getDatabase(Partition write,
Set<StandardPredicate> toClose,
Partition... read)
Creates a Database that can read from and write to a
Partition and
optionally read from additional Partitions. |
DatabaseDriver |
getDriver() |
Inserter |
getInserter(StandardPredicate predicate,
Partition partition)
Creates an Inserter for persisting new
GroundAtoms
in a Partition . |
DataStoreMetadata |
getMetadata() |
Partition |
getNewPartition()
Requests a new
Partition that is assigned an auto-generated name
and the next unused ID. |
Collection<Database> |
getOpenDatabases()
Get all the currenly open databases associated with this data store.
|
static Set<RDBMSDataStore> |
getOpenDataStores() |
Partition |
getPartition(String partitionName)
Gets a new
Partition of the DataStore with the given name. |
Set<Partition> |
getPartitions() |
PredicateInfo |
getPredicateInfo(Predicate predicate)
Helper method for getting a predicate handle
|
int |
getPredicateRowCount(StandardPredicate predicate) |
Set<StandardPredicate> |
getRegisteredPredicates()
Returns the set of StandardPredicates registered with this DataStore.
|
void |
indexPredicates() |
void |
registerPredicate(StandardPredicate predicate)
Registers a StandardPredicate so that
GroundAtoms of that
StandardPredicate can be persisted in this DataStore. |
void |
releasePartitions(RDBMSDatabase db) |
public static final String CONFIG_PREFIX
public static final boolean USE_STRING_ID_DEFAULT
public RDBMSDataStore(DatabaseDriver dbDriver)
DatabaseDriver
.public void registerPredicate(StandardPredicate predicate)
DataStore
GroundAtoms
of that
StandardPredicate can be persisted in this DataStore.
If GroundAtoms of a StandardPredicate were already persisted in this DataStore at initialization, that StandardPredicate is already registered.
registerPredicate
in interface DataStore
predicate
- the predicate to registerpublic Database getDatabase(Partition write, Partition... read)
DataStore
Partition
and
optionally read from additional Partitions.getDatabase
in interface DataStore
write
- the Partition to write to and read fromread
- additional Partitions to read frompublic Database getDatabase(Partition write, Set<StandardPredicate> toClose, Partition... read)
DataStore
Partition
and
optionally read from additional Partitions.
Additionally, defines a set of StandardPredicates as closed in the Database, meaning that all GroundAtoms of that Predicate are ObservedAtoms.
getDatabase
in interface DataStore
write
- the Partition to write to and read fromtoClose
- set of StandardPredicates to closeread
- additional Partitions to read frompublic void indexPredicates()
public Collection<Database> getOpenDatabases()
DataStore
getOpenDatabases
in interface DataStore
public Inserter getInserter(StandardPredicate predicate, Partition partition)
DataStore
GroundAtoms
in a Partition
.getInserter
in interface DataStore
predicate
- the Predicate of the Atoms to be insertedpartition
- the Partition into which Atoms will be insertedpublic Set<StandardPredicate> getRegisteredPredicates()
DataStore
getRegisteredPredicates
in interface DataStore
public int deletePartition(Partition partition)
DataStore
GroundAtoms
persisted in a Partition.deletePartition
in interface DataStore
partition
- the partition to deletepublic void close()
DataStore
public DataStoreMetadata getMetadata()
public void releasePartitions(RDBMSDatabase db)
public Partition getNewPartition()
DataStore
Partition
that is assigned an auto-generated name
and the next unused ID. This partition will remain in the datastore
metadata unless explicitly deleted.getNewPartition
in interface DataStore
public Partition getPartition(String partitionName)
DataStore
Partition
of the DataStore with the given name.
If the partition doesn't exist, a new one will be created and added to the DataStore
metadata.getPartition
in interface DataStore
partitionName
- a human-readable name for the partitionpublic Set<Partition> getPartitions()
getPartitions
in interface DataStore
Partitions
of this DataStorepublic int getPredicateRowCount(StandardPredicate predicate)
public DatabaseDriver getDriver()
public Connection getConnection()
public static Set<RDBMSDataStore> getOpenDataStores()
public PredicateInfo getPredicateInfo(Predicate predicate)
Copyright © 2018 University of California, Santa Cruz. All rights reserved.