public class DB extends Parser
Constructor and Description |
---|
DB(java.lang.String name,
DBSchema schema)
Create a prolog database with a given name that instantiates db schema
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsTable(java.lang.String tableName)
Returns true if there is a table with tableName in the database
|
static void |
dbCheck(java.lang.String pathName)
asserts that a file pathName ends in ".pl";
Error is thrown otherwise
|
java.lang.String |
getFullName()
the full name of a database is "databaseName"."schemaName"."pl"; this is
the assumed or standard name for a prolog database file.
|
java.lang.String |
getName()
returns the name of this database
|
DBSchema |
getSchema()
returns DBSchema that this database instantiates
|
java.lang.String |
getSchemaName()
returns name of DB schema that this database instantiates.
|
SubTableSchema |
getSubTableSchema(TableSchema ts)
returns subtable declaration for a given table schema ts;
if no such declaration exists, null is returned; this declaration
lists the subtables of the given table.
|
java.util.List<SubTableSchema> |
getSubTableSchemas()
returns a list of subtable declarations for this database's schema.
|
Table |
getTable(java.lang.String tableName)
returns the Table object for the table with name tableName;
null is returned if table does not exist
|
Table |
getTableEH(java.lang.String tableName)
error handler of getTable(String); return the Table object for the table
with name tableName; Error is thrown if no such table exists.
|
java.util.Collection<Table> |
getTables()
returns a collection of tables that define this database
|
TableSchema |
getTableSchema(java.lang.String name)
returns the TableSchema of the table with given name; null if table is
not found
|
TableSchema |
getTableSchemaEH(java.lang.String name)
returns the TableSchema of the table with given name; Error
is thrown otherwise
|
void |
print(java.io.PrintStream out)
print in standard way the contents of a Prolog database to PrintStream out
|
static DB |
readDataBase(java.io.File infile)
reads and parses a prolog database from File infile.
|
static DB |
readDataBase(java.io.File infile,
java.io.PrintStream out)
reads and parses a prolog database from given string filename.
|
static DB |
readDataBase(java.lang.String localFileName)
reads and parses a prolog database from given string filename.
|
void |
rename(java.lang.String name)
assigns a new name to this database
|
parseDBaseDecl, parseSubTableDecl, parseTableDecl, parseTableDecl, parseTupleDecl
public DB(java.lang.String name, DBSchema schema)
name
- of the databaseschema
- of the databasepublic java.lang.String getSchemaName()
public DBSchema getSchema()
public java.util.List<SubTableSchema> getSubTableSchemas()
public SubTableSchema getSubTableSchema(TableSchema ts)
ts
- -- table schema for which subtable declaration is to be returnedpublic java.util.Collection<Table> getTables()
public TableSchema getTableSchema(java.lang.String name)
name
- name of desired tablepublic TableSchema getTableSchemaEH(java.lang.String name)
name
- name of desired tablepublic java.lang.String getName()
public java.lang.String getFullName()
public boolean containsTable(java.lang.String tableName)
tableName
- of tablepublic static DB readDataBase(java.io.File infile)
infile
- the File of the Prolog databasepublic static DB readDataBase(java.lang.String localFileName)
localFileName
- is the name of the file of the Prolog databasepublic static DB readDataBase(java.io.File infile, java.io.PrintStream out)
infile
- is the File of the Prolog databaseout
- is the PrintStream (e.g., System.out) to report errors.public void rename(java.lang.String name)
name
- new namepublic static void dbCheck(java.lang.String pathName)
pathName
- -- filename to verifypublic Table getTable(java.lang.String tableName)
tableName
- -- name of table to returnpublic Table getTableEH(java.lang.String tableName)
tableName
- -- name of table to returnpublic void print(java.io.PrintStream out)
out
- destination of printing