edu.lehigh.swat.hawk.storage.simplememory
Class Document

java.lang.Object
  extended by edu.lehigh.swat.hawk.storage.simplememory.Document
All Implemented Interfaces:
Document, java.io.Serializable
Direct Known Subclasses:
Document, Ontology

public class Document
extends java.lang.Object
implements Document, java.io.Serializable

A simple implementation of core.Document in memory.

See Also:
Serialized Form

Field Summary
protected  java.util.Vector assertions
           
protected  java.util.Vector comments
           
protected  java.util.Vector distinctSets
           
protected  DocId docId
           
protected  java.util.Vector imports
           
protected  java.util.Hashtable individuals
           
protected  java.lang.String label
           
protected  java.util.Map nameSpaces
           
protected  java.util.Vector sameSets
           
protected  int size
           
protected  java.lang.String xmlBase
           
 
Constructor Summary
Document()
          Constructor
 
Method Summary
 void addAssertion(ObjectId subject, ObjectId predicate, ObjectId object)
          Add an assertion to this document.
 void addDescription(java.lang.String s)
          Add a description.
 void addDistinctIndividualsSet(java.util.Collection dis)
          Add a set of distinct individuals' IDs
 void addImports(DocId id)
          Add an imports statement.
 void addIndividual(Individual indi)
          Add an individual.
 void addSameIndividualsSet(java.util.Collection dis)
          Add a set of equivalent individuals' IDs
 Individual createIndividual()
          Create a Individual object.
 void deleteAllIndividual()
          Delete all individuals.
 void deleteAssertion(Assertion a)
          Delete an assertion in this document.
 void deleteDescriprion(java.lang.String s)
          Delete a description.
 void deleteDistinctIndividualsSet(java.util.Collection dis)
          delete a set of distinct individuals' IDs
 void deleteImports(DocId id)
          Delete an imports statement.
 void deleteIndividual(Individual indi)
          Delete an individual.
 void deleteSameIndividualsSet(java.util.Collection dis)
          delete a set of equivalent individuals' IDs
 boolean equals(java.lang.Object o)
           
 void flush()
          Flush the document.
 Assertion[] getAllAssertions()
          Get all assertions.
 java.util.Iterator getAllDescriptions()
          Get all the descriptions.
 Individual[] getAllIndividuals()
          Get all the individuals.
 java.util.Iterator getAssertionIterator()
          Get the Iterator of all the assertions.
 java.util.Stack getDescendants()
          Get descendants.
 java.lang.String getDescription()
          Get the first description.
 java.util.Collection[] getDistinctIndividualsSets()
          get sets of distinct individuals' IDs
 DocId getID()
          get the ID of this document
 DocId[] getImports()
          Get the imports statements.
 Individual getIndividual(ObjectId id)
          Get an individual.
 java.util.Iterator getIndividualIterator()
          Get the Iterator of all the individuals.
 java.lang.String getLabel()
          Get the label.
 java.util.Map getNameSpaces()
          Get the nameSpaces of this document.
 java.util.Collection[] getSameIndividualsSets()
          get sets of equivalent individuals' IDs
 int getSize()
          Get the number of triples in this document.
 java.lang.String getXMLBase()
          Get the xml:Base of this document.
 void setDescendants(java.util.Stack des)
          Set descendants.
 void setID(DocId id)
          set the ID of this document
 void setLabel(java.lang.String s)
          Set the label.
 void setNameSpaces(java.util.Map ns)
          Set the nameSpaces of this document.
 void setSize(int s)
          Set the number of triples in this document.
 void setXMLBase(java.lang.String base)
          Set the xml:Base of this document.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

assertions

protected java.util.Vector assertions

imports

protected java.util.Vector imports

distinctSets

protected java.util.Vector distinctSets

sameSets

protected java.util.Vector sameSets

comments

protected java.util.Vector comments

individuals

protected java.util.Hashtable individuals

docId

protected DocId docId

nameSpaces

protected java.util.Map nameSpaces

xmlBase

protected java.lang.String xmlBase

label

protected java.lang.String label

size

protected int size
Constructor Detail

Document

public Document()
Constructor

Method Detail

addAssertion

public void addAssertion(ObjectId subject,
                         ObjectId predicate,
                         ObjectId object)
Add an assertion to this document. (use individuals' properties as back-end)

Specified by:
addAssertion in interface Document

deleteAssertion

public void deleteAssertion(Assertion a)
Delete an assertion in this document. (use individuals' properties as back-end)

Specified by:
deleteAssertion in interface Document

getAllAssertions

public Assertion[] getAllAssertions()
Get all assertions. (use individuals' properties as back-end)

Specified by:
getAllAssertions in interface Document

getAssertionIterator

public java.util.Iterator getAssertionIterator()
Get the Iterator of all the assertions.

Specified by:
getAssertionIterator in interface Document

getImports

public DocId[] getImports()
Get the imports statements.

Specified by:
getImports in interface Document

addImports

public void addImports(DocId id)
Add an imports statement.

Specified by:
addImports in interface Document

deleteImports

public void deleteImports(DocId id)
Delete an imports statement.

Specified by:
deleteImports in interface Document

getID

public DocId getID()
get the ID of this document

Specified by:
getID in interface Document

setID

public void setID(DocId id)
set the ID of this document

Specified by:
setID in interface Document

addDistinctIndividualsSet

public void addDistinctIndividualsSet(java.util.Collection dis)
Add a set of distinct individuals' IDs

Specified by:
addDistinctIndividualsSet in interface Document

deleteDistinctIndividualsSet

public void deleteDistinctIndividualsSet(java.util.Collection dis)
delete a set of distinct individuals' IDs

Specified by:
deleteDistinctIndividualsSet in interface Document

getDistinctIndividualsSets

public java.util.Collection[] getDistinctIndividualsSets()
get sets of distinct individuals' IDs

Specified by:
getDistinctIndividualsSets in interface Document

addSameIndividualsSet

public void addSameIndividualsSet(java.util.Collection dis)
Add a set of equivalent individuals' IDs

Specified by:
addSameIndividualsSet in interface Document

deleteSameIndividualsSet

public void deleteSameIndividualsSet(java.util.Collection dis)
delete a set of equivalent individuals' IDs

Specified by:
deleteSameIndividualsSet in interface Document

getSameIndividualsSets

public java.util.Collection[] getSameIndividualsSets()
get sets of equivalent individuals' IDs

Specified by:
getSameIndividualsSets in interface Document

createIndividual

public Individual createIndividual()
Create a Individual object.

Specified by:
createIndividual in interface Document

addIndividual

public void addIndividual(Individual indi)
Add an individual.

Specified by:
addIndividual in interface Document

deleteIndividual

public void deleteIndividual(Individual indi)
Delete an individual.

Specified by:
deleteIndividual in interface Document

deleteAllIndividual

public void deleteAllIndividual()
Delete all individuals. Note: not in core yet. zhp2: for ontology's use.


getIndividual

public Individual getIndividual(ObjectId id)
Get an individual.

Specified by:
getIndividual in interface Document

getAllIndividuals

public Individual[] getAllIndividuals()
Get all the individuals.

Specified by:
getAllIndividuals in interface Document

getIndividualIterator

public java.util.Iterator getIndividualIterator()
Get the Iterator of all the individuals.

Specified by:
getIndividualIterator in interface Document

setNameSpaces

public void setNameSpaces(java.util.Map ns)
Set the nameSpaces of this document.

Specified by:
setNameSpaces in interface Document

getNameSpaces

public java.util.Map getNameSpaces()
Get the nameSpaces of this document.

Specified by:
getNameSpaces in interface Document

setXMLBase

public void setXMLBase(java.lang.String base)
Set the xml:Base of this document.

Specified by:
setXMLBase in interface Document

getXMLBase

public java.lang.String getXMLBase()
Get the xml:Base of this document.

Specified by:
getXMLBase in interface Document

addDescription

public void addDescription(java.lang.String s)
Add a description.

Specified by:
addDescription in interface Document

deleteDescriprion

public void deleteDescriprion(java.lang.String s)
Delete a description.

Specified by:
deleteDescriprion in interface Document

getDescription

public java.lang.String getDescription()
Get the first description.

Specified by:
getDescription in interface Document

getAllDescriptions

public java.util.Iterator getAllDescriptions()
Get all the descriptions.

Specified by:
getAllDescriptions in interface Document

setLabel

public void setLabel(java.lang.String s)
Set the label.

Specified by:
setLabel in interface Document

getLabel

public java.lang.String getLabel()
Get the label.

Specified by:
getLabel in interface Document

setDescendants

public void setDescendants(java.util.Stack des)
Set descendants.

Specified by:
setDescendants in interface Document

getDescendants

public java.util.Stack getDescendants()
Get descendants.

Specified by:
getDescendants in interface Document

getSize

public int getSize()
Get the number of triples in this document.

Specified by:
getSize in interface Document

setSize

public void setSize(int s)
Set the number of triples in this document.

Specified by:
setSize in interface Document

flush

public void flush()
Flush the document. Do nothing for memory model.

Specified by:
flush in interface Document

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object