Database schema used by RdfSchemaRepository (table names
correspond with constants in class TableNames):

Note: the not null restriction where indicated as 'not null*' does not
apply to databases that convert empty string to null values (e.g. Oracle).
These databases are assumed to be able to handle uniqueness constraints
on columns containing null values. Other databases (e.g. DB2) require the
not null constraint to be able to apply a uniqueness constraint on a
column.

==========================================================================
RdfSource tables

REP_INFO_TABLE
infokey		varchar255	not null, primary key
infovalue	varchar255	not null

NAMESPACES_TABLE
id		integer		not null, primary key
prefix		varchar16	not null*, unique
name		clob
userDefined	boolean		not null
export		boolean		not null

RESOURCES_TABLE
id		integer		not null, primary key
namespace	integer		not null
localname	varchar255	not null*
-->	unique(namespace, localname)

LITERALS_TABLE
id		integer		not null, primary key
datatype	integer		not null
language	varchar16
labelKey	char16		not null
label		clob		not null*
--> index(labelKey)

TRIPLES_TABLE
id		integer		not null
subject		integer		not null
predicate	integer		not null
object		integer		not null
explicit	boolean		not null
--> unique(subject, predicate, object)
--> index(object)
--> index(predicate)
--> index(object)

========================================================================
RdfSchemaSource tables

CLASS_TABLE
id		integer		not null, primary key

PROPERTY_TABLE
id		integer		not null, primary key

SUBCLASSOF_TABLE
sub		integer		not null
super		integer		not null
--> primary key(sub, super)
--> index(super)

DIRECT_SUBCLASSOF_TABLE
sub		integer		not null
super		integer		not null
--> primary key(sub, super)
--> index(super)

SUBPROPERTYOF_TABLE
sub		integer		not null
super		integer		not null
--> primary key(sub, super)
--> index(super)

DIRECT_SUBPROPERTYOF_TABLE
sub		integer		not null
super		integer		not null
--> primary key(sub, super)
--> index(super)

INSTANCEOF_TABLE
inst		integer		not null
class		integer		not null
--> primary key(inst, class)
--> index(class)

PROPER_INSTANCEOF_TABLE
inst		integer		not null
class		integer		not null
--> primary key(inst, class)
--> index(class)

DOMAIN_TABLE
property	integer		not null
class		integer		not null
--> primary key(property, class)
--> index(class)

RANGE_TABLE
property	integer		not null
class		integer		not null
--> primary key(property, class)
--> index(class)

========================================================================
Inferencing and truth maintenance tables

DEPEND_TABLE
id		integer		not null
dep1		integer		not null
dep2		integer		not null
--> index(id, dep1, dep2)
--> index(dep1, dep2)

========================================================================
Tables used during transactions

Note: these tables are only in use during transactions and are therefore
empty most of the time.

RAW_TRIPLES_TABLE
id		integer		not null
subjNs		integer		not null
subjLname	varchar(255)	not null*
predNs		integer		not null
predLname	varchar(255)	not null*
objNs		integer		not null
objLname	varchar(255)	not null*
objLang		varchar(16)
objLabelKey	char(16)
objLabel	clob

ADDED_TRIPLES_TABLE
id		integer		not null
subject		integer		not null
predicate	integer		not null
object		integer		not null
explicit	boolean		not null

NEW_TRIPLES_TABLE
id		integer		not null
subject		integer		not null
predicate	integer		not null
object		integer		not null
explicit	boolean		not null

EXPIRED_TRIPLES_TABLE
id		integer		not null

GROUNDED_TRIPLES_TABLE
id		integer		not null, primary key

NEW_GROUNDED_TRIPLES_TABLE
id		integer		not null, primary key

ALL_NEW_TRIPLES_TABLE
id		integer		not null
subject		integer		not null
predicate	integer		not null
object		integer		not null
explicit	boolean		not null
--> unique(subject, predicate, object)

INFERRED_TABLE
id		integer		not null
subject		integer		not null
predicate	integer		not null
object		integer		not null
explicit	boolean		not null

ALL_INFERRED_TABLE
id		integer		not null
subject		integer		not null
predicate	integer		not null
object		integer		not null
explicit	boolean		not null

