edu.lehigh.swat.hawk.storage.simpledb
Class DatabaseStorage

java.lang.Object
  extended by edu.lehigh.swat.hawk.storage.StorageModel
      extended by edu.lehigh.swat.hawk.storage.PersistentStorageModel
          extended by edu.lehigh.swat.hawk.storage.simpledb.DatabaseStorage
All Implemented Interfaces:
QueryableStorageModel
Direct Known Subclasses:
DldbStorage

public class DatabaseStorage
extends PersistentStorageModel
implements QueryableStorageModel


Field Summary
protected  java.util.Hashtable knownDocs
           
protected  java.util.Hashtable knownOntos
           
protected  java.util.Hashtable knownUrls
           
protected  int maxUrlNum
           
protected  int ontSeqNum
           
protected  java.util.Hashtable propertyTypes
           
protected  int sourceSeqNum
           
protected  java.sql.Statement stmt
           
 
Constructor Summary
DatabaseStorage(java.lang.String DBName)
          Constructor.
 
Method Summary
 void addDocument(Document d)
          Add a document to this model.
 void close()
          Close the database connection.
 Document createDocument()
          Create an Document object.
 void createKb()
          Initialize the database.
 Ontology createOntology()
          Create an Ontology object.
 int decideCommitOnto(Document doc, ObjectId id)
          Decide which ontology would commit to giving the resource doc and objectId.
 void forcedExit()
          Forced exit.
 java.lang.String getDBName()
          Get the database name.
 Document getDocument(java.lang.String url)
          Get the specified document.
 java.util.Iterator getDocumentIterator()
          Get all the documents in the model.
 java.util.Hashtable getKnownOntologies()
          retrieval ontologies already exist in database
 java.util.Hashtable getKnownUrls()
          Retrieval Urls already exist in database
 int getOntSeq(java.lang.String ns)
          Get the sequence number for giving ontology.
 java.util.Hashtable getPropertyTypes()
          Get the types of properties.
 java.lang.String getQueryOntology()
          Get the query ontology.
 int getSeqNum(DocId did)
          Get the sequence number for giving Document
 void getSourceNum()
          Get the maximum source sequence number in the databade.
 java.lang.String getTableName(ObjectId id)
          Get the table name for giving id.
protected  int getUrlIndex(java.lang.String url)
          Get the index for given uri.
 java.lang.String getViewDefinition(java.lang.String vName)
          Get sql definition for giving view name.
 ResultSet issueQuery(Query qry)
          Execute query and return results.
 void open()
          Open a connection to the database.
 void setImplictImports(boolean imp)
          Set whether or not include implictly imported documents.
 void setQueryOntology(java.lang.String uri)
          Set the query ontology.
 void updateDocument(Document d)
          Update a document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ontSeqNum

protected int ontSeqNum

sourceSeqNum

protected int sourceSeqNum

maxUrlNum

protected int maxUrlNum

knownOntos

protected java.util.Hashtable knownOntos

knownDocs

protected java.util.Hashtable knownDocs

knownUrls

protected java.util.Hashtable knownUrls

propertyTypes

protected java.util.Hashtable propertyTypes

stmt

protected java.sql.Statement stmt
Constructor Detail

DatabaseStorage

public DatabaseStorage(java.lang.String DBName)
Constructor.

Parameters:
DBName -
Method Detail

open

public void open()
Open a connection to the database.

Specified by:
open in class PersistentStorageModel

close

public void close()
Close the database connection.

Specified by:
close in class PersistentStorageModel

addDocument

public void addDocument(Document d)
Add a document to this model.

Specified by:
addDocument in class StorageModel

getDocument

public Document getDocument(java.lang.String url)
Get the specified document.

Specified by:
getDocument in class StorageModel

updateDocument

public void updateDocument(Document d)
Update a document.

Specified by:
updateDocument in class StorageModel

getDocumentIterator

public java.util.Iterator getDocumentIterator()
Get all the documents in the model.

Specified by:
getDocumentIterator in class StorageModel

setImplictImports

public void setImplictImports(boolean imp)
Set whether or not include implictly imported documents.

Specified by:
setImplictImports in class StorageModel

createOntology

public Ontology createOntology()
Create an Ontology object.

Specified by:
createOntology in class StorageModel

createDocument

public Document createDocument()
Create an Document object.

Specified by:
createDocument in class StorageModel

getKnownOntologies

public java.util.Hashtable getKnownOntologies()
retrieval ontologies already exist in database


getSourceNum

public void getSourceNum()
Get the maximum source sequence number in the databade.


createKb

public void createKb()
Initialize the database. Create the index tables and utility tables.


getTableName

public java.lang.String getTableName(ObjectId id)
Get the table name for giving id.


getKnownUrls

public java.util.Hashtable getKnownUrls()
Retrieval Urls already exist in database


getUrlIndex

protected int getUrlIndex(java.lang.String url)
Get the index for given uri.


getSeqNum

public int getSeqNum(DocId did)
Get the sequence number for giving Document

Specified by:
getSeqNum in class StorageModel

getViewDefinition

public java.lang.String getViewDefinition(java.lang.String vName)
Get sql definition for giving view name.


getOntSeq

public int getOntSeq(java.lang.String ns)
Get the sequence number for giving ontology.


forcedExit

public void forcedExit()
Forced exit.


issueQuery

public ResultSet issueQuery(Query qry)
Execute query and return results.

Specified by:
issueQuery in interface QueryableStorageModel

getPropertyTypes

public java.util.Hashtable getPropertyTypes()
Get the types of properties.


decideCommitOnto

public int decideCommitOnto(Document doc,
                            ObjectId id)
Decide which ontology would commit to giving the resource doc and objectId.


setQueryOntology

public void setQueryOntology(java.lang.String uri)
Set the query ontology.


getQueryOntology

public java.lang.String getQueryOntology()
Get the query ontology.


getDBName

public java.lang.String getDBName()
Get the database name.