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

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

public class Ontology
extends Document
implements Ontology

encapsulating the web ontology

See Also:
Serialized Form

Field Summary
protected  java.lang.String dbName
           
protected  Ontology memoryOnto
           
protected  int ontSeq
           
 
Fields inherited from class edu.lehigh.swat.hawk.storage.simpledb.Document
ancestors, model, stmt
 
Fields inherited from class edu.lehigh.swat.hawk.storage.simplememory.Document
assertions, comments, distinctSets, docId, imports, individuals, label, nameSpaces, sameSets, size, xmlBase
 
Fields inherited from interface edu.lehigh.swat.hawk.core.Ontology
ALLVALUERESTRICTION, ATOMICNODE, CARDINALITYRESTRICTION, COMPLEMENTOF, DISJOINTWITH, DOMAIN, EQUIVALENTCLASS, EQUIVALENTPROPERTY, HASVALUERESTRICTION, INTERSECTIONOF, INVERSEOF, ONEOF, RANGE, SOMEVALUERESTRICTION, SUBCLASSOF, SUBPROPERTYOF, UNIONOF
 
Constructor Summary
Ontology(Ontology mOnto)
          Constructor
 
Method Summary
 void addAllAxiomNodeRestrictions(java.util.Vector<AxiomNode> res)
           
 boolean addAnnotations(ObjectId sId, ObjectId oId, java.lang.String value)
          Add annotations.
 void addAssertedClass(ObjectId cid)
          Add an asserted class.
 void addAssertedProperty(ObjectId pid)
          Add an asserted property.
 void addAxiom(Axiom a)
          Axiom Design Methods
 void addAxiomByObject(ObjectId obj, Axiom a)
           
 void addAxiomBySubject(ObjectId sub, Axiom a)
           
 void addAxiomByType(java.lang.Integer type, Axiom a)
           
 void addAxiomNodeRestriction(AxiomNode res)
           
 void addCompatiblePriorOnts(DocId id)
          Add a priorVersion ontology which is backwardCompatibleWith.
 void addImportedAxiom(Axiom a)
           
 void addImportedClass(ObjectId cid, OntClass c)
          Add an imported class.
 void addImportedProperty(ObjectId pid, OntProperty p)
          Add an imported property.
 void addImports(DocId id)
          Add an imports statement.
 void addIndividual(Individual indiv)
          Add an individual.
 void addOntClass(OntClass c)
          add a class to this ontology
 void addPriorOnts(DocId id)
          Add a priorVersion ontology may be incompatibleWith.
 void addProperty(OntProperty prop)
          add a property to this ontology
 void addRestriction(PropertyRestriction p)
          add a property to this ontology
 boolean assertedClass(ObjectId cid)
          To tell if the ontology asserted specified class.
 boolean assertedProperty(ObjectId pid)
          To tell if the ontology asserted specified property.
 OntClass createClass()
          Create a Class object.
 OntProperty createProperty()
          Create a Property object.
 PropertyRestriction createRestriction()
          Create a PropertyRestriction object.
 void deleteCompatiblePriorOnts(DocId id)
          Delete a priorVersion ontology which is backwardCompatibleWith.
 void deleteOntClass(ObjectId id)
          delete the specified class
 void deletePriorOnts(DocId id)
          Delete a priorVersion ontology may be incompatibleWith.
 void deleteProperty(ObjectId id)
          delete a specified property
 void deleteRestriction(ObjectId id)
          delete a specified property
 void flush()
          Flush the axioms into database.
 void flushCyclicRules()
           
protected  void flushEquivals()
           
protected  void flushInverseOf()
          Flush owl:inverseOf into db view.
protected  void flushSubs()
           
 java.util.Vector<Annotation> getAllAnnotations()
          Get all annotations.
 java.util.List<Axiom> getAllAxioms()
           
 java.util.Hashtable<ObjectId,java.util.Vector<Axiom>> getAllAxiomsByObject()
           
 java.util.Hashtable<ObjectId,java.util.Vector<Axiom>> getAllAxiomsBySubject()
           
 java.util.Hashtable<java.lang.Integer,java.util.Vector<Axiom>> getAllAxiomsByType()
           
 OntClass[] getAllClasses()
          get all the classes in this ontology
 java.util.List<Axiom> getAllPlusImportedAxioms()
           
 java.util.Hashtable<ObjectId,java.util.Vector<Axiom>> getAllPlusImportedAxiomsByObject()
           
 java.util.Hashtable<ObjectId,java.util.Vector<Axiom>> getAllPlusImportedAxiomsBySubject()
           
 java.util.Hashtable<java.lang.Integer,java.util.Vector<Axiom>> getAllPlusImportedAxiomsByType()
           
 OntClass[] getAllPlusImportedClasses()
          Get All the classes plus the imported Classes.
 OntProperty[] getAllPlusImportedProperties()
          Get All the classes plus the imported properties.
 OntProperty[] getAllProperties()
          get all the properties in this ontology
 PropertyRestriction[] getAllRestrictions()
          get all the properties in this ontology
 java.util.Vector<Annotation> getAnnotationsByObject(ObjectId pid)
          Get annotations by object ID.
 java.util.Vector<Annotation> getAnnotationsBySubject(ObjectId pid)
          Get annotations by subject ID.
 java.util.List<Axiom> getAxiomByObject(ObjectId object)
           
 java.util.List<Axiom> getAxiomBySubject(ObjectId subject)
           
 java.util.List<Axiom> getAxiomByType(java.lang.Integer type)
           
 java.util.Vector<AxiomNode> getAxiomNodeRestrictions()
           
 int getClassIndex(ObjectId cid)
          get the index number for a class
 java.util.Iterator getClassIterator()
          Get the Iterator of all the classes.
 DocId[] getCompatiblePriorOnts()
          Get the priorVersion ontologies which are backwardCompatibleWith
 java.util.Hashtable<java.lang.String,java.util.Vector<java.util.Vector<Atom>>> getCyclicRules()
          To see if ontology has imported the property.
 java.util.Hashtable<java.lang.String,java.util.Vector<java.util.Vector<Atom>>> getExpandedAtoms()
           
 DocId getID()
          get the ID of this document
 Ontology getMemOnto()
          Get the memory-based ontology object.
 OntClass getOntClass(ObjectId id)
          get the specified class
 OntObject getOntObject(ObjectId id)
          get the object (class/property) given the ID
 int getOntSeq()
          Get the document sequence number.
 DocId[] getPriorOnts()
          Get the priorVersion ontologies may be incompatibleWith
 OntProperty getProperty(ObjectId id)
          get the specified property
 int getPropertyIndex(ObjectId pid)
          get the index number for a property
 java.util.Iterator getPropertyIterator()
          Get the Iterator of all the properties.
 PropertyRestriction getRestriction(ObjectId id)
          get the specified property
 java.lang.String getVersion()
          get the version of this ontology
 boolean hasClass(java.lang.String name)
          To see if ontology has the class.
 boolean hasProperty(java.lang.String name)
          Get the imported property.
 boolean importedClass(ObjectId cid)
          To tell if the ontology imorted specified class.
 boolean importedProperty(ObjectId pid)
          To tell if the ontology imported specified property.
 void setID(DocId id)
          set the ID of this document
 void setOntSeq(int i)
          Set the document sequence number.
 void setVersion(java.lang.String ver)
          Set the version of this ontology.
 void updateView(Atom a, java.util.Vector<java.util.Vector<Atom>> DNF)
           
protected  java.util.Vector viewDefToTabNames(java.lang.String vdef)
          Get the table names in the view definition
 java.lang.String[] ViewForRestriction(ObjectId id)
          Get view definition for restriction.
 
Methods inherited from class edu.lehigh.swat.hawk.storage.simpledb.Document
createIndividual, deleteIndividual, getAncestors, getDocSeq, getModel, setDocSeq, setModel, setSQLStatement
 
Methods inherited from class edu.lehigh.swat.hawk.storage.simplememory.Document
addAssertion, addDescription, addDistinctIndividualsSet, addSameIndividualsSet, deleteAllIndividual, deleteAssertion, deleteDescriprion, deleteDistinctIndividualsSet, deleteImports, deleteSameIndividualsSet, equals, getAllAssertions, getAllDescriptions, getAllIndividuals, getAssertionIterator, getDescendants, getDescription, getDistinctIndividualsSets, getImports, getIndividual, getIndividualIterator, getLabel, getNameSpaces, getSameIndividualsSets, getSize, getXMLBase, setDescendants, setLabel, setNameSpaces, setSize, setXMLBase
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.lehigh.swat.hawk.core.Document
addAssertion, addDescription, addDistinctIndividualsSet, addSameIndividualsSet, createIndividual, deleteAssertion, deleteDescriprion, deleteDistinctIndividualsSet, deleteImports, deleteIndividual, deleteSameIndividualsSet, getAllAssertions, getAllDescriptions, getAllIndividuals, getAssertionIterator, getDescendants, getDescription, getDistinctIndividualsSets, getImports, getIndividual, getIndividualIterator, getLabel, getNameSpaces, getSameIndividualsSets, getSize, getXMLBase, setDescendants, setLabel, setNameSpaces, setSize, setXMLBase
 

Field Detail

ontSeq

protected int ontSeq

memoryOnto

protected Ontology memoryOnto

dbName

protected java.lang.String dbName
Constructor Detail

Ontology

public Ontology(Ontology mOnto)
Constructor

Method Detail

addAxiom

public void addAxiom(Axiom a)
Axiom Design Methods

Specified by:
addAxiom in interface Ontology

addAxiomByObject

public void addAxiomByObject(ObjectId obj,
                             Axiom a)
Specified by:
addAxiomByObject in interface Ontology

addAxiomBySubject

public void addAxiomBySubject(ObjectId sub,
                              Axiom a)
Specified by:
addAxiomBySubject in interface Ontology

addAxiomByType

public void addAxiomByType(java.lang.Integer type,
                           Axiom a)
Specified by:
addAxiomByType in interface Ontology

addAxiomNodeRestriction

public void addAxiomNodeRestriction(AxiomNode res)
Specified by:
addAxiomNodeRestriction in interface Ontology

addAllAxiomNodeRestrictions

public void addAllAxiomNodeRestrictions(java.util.Vector<AxiomNode> res)
Specified by:
addAllAxiomNodeRestrictions in interface Ontology

getAllAxioms

public java.util.List<Axiom> getAllAxioms()
Specified by:
getAllAxioms in interface Ontology

getAllAxiomsByObject

public java.util.Hashtable<ObjectId,java.util.Vector<Axiom>> getAllAxiomsByObject()
Specified by:
getAllAxiomsByObject in interface Ontology

getAllAxiomsBySubject

public java.util.Hashtable<ObjectId,java.util.Vector<Axiom>> getAllAxiomsBySubject()
Specified by:
getAllAxiomsBySubject in interface Ontology

getAllAxiomsByType

public java.util.Hashtable<java.lang.Integer,java.util.Vector<Axiom>> getAllAxiomsByType()
Specified by:
getAllAxiomsByType in interface Ontology

getAxiomByObject

public java.util.List<Axiom> getAxiomByObject(ObjectId object)
Specified by:
getAxiomByObject in interface Ontology

getAxiomBySubject

public java.util.List<Axiom> getAxiomBySubject(ObjectId subject)
Specified by:
getAxiomBySubject in interface Ontology

getAxiomByType

public java.util.List<Axiom> getAxiomByType(java.lang.Integer type)
Specified by:
getAxiomByType in interface Ontology

getAxiomNodeRestrictions

public java.util.Vector<AxiomNode> getAxiomNodeRestrictions()
Specified by:
getAxiomNodeRestrictions in interface Ontology

getMemOnto

public Ontology getMemOnto()
Get the memory-based ontology object.


getID

public DocId getID()
get the ID of this document

Specified by:
getID in interface Document
Overrides:
getID in class Document

setID

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

Specified by:
setID in interface Document
Overrides:
setID in class Document

addImports

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

Specified by:
addImports in interface Document
Overrides:
addImports in class Document

addOntClass

public void addOntClass(OntClass c)
add a class to this ontology

Specified by:
addOntClass in interface Ontology

getClassIndex

public int getClassIndex(ObjectId cid)
get the index number for a class


getOntClass

public OntClass getOntClass(ObjectId id)
get the specified class

Specified by:
getOntClass in interface Ontology

getOntObject

public OntObject getOntObject(ObjectId id)
get the object (class/property) given the ID

Specified by:
getOntObject in interface Ontology

deleteOntClass

public void deleteOntClass(ObjectId id)
delete the specified class

Specified by:
deleteOntClass in interface Ontology

getAllClasses

public OntClass[] getAllClasses()
get all the classes in this ontology

Specified by:
getAllClasses in interface Ontology

getAllPlusImportedClasses

public OntClass[] getAllPlusImportedClasses()
Get All the classes plus the imported Classes.

Specified by:
getAllPlusImportedClasses in interface Ontology

getClassIterator

public java.util.Iterator getClassIterator()
Get the Iterator of all the classes.

Specified by:
getClassIterator in interface Ontology

addProperty

public void addProperty(OntProperty prop)
add a property to this ontology

Specified by:
addProperty in interface Ontology

getPropertyIndex

public int getPropertyIndex(ObjectId pid)
get the index number for a property


getProperty

public OntProperty getProperty(ObjectId id)
get the specified property

Specified by:
getProperty in interface Ontology

deleteProperty

public void deleteProperty(ObjectId id)
delete a specified property

Specified by:
deleteProperty in interface Ontology

getAllProperties

public OntProperty[] getAllProperties()
get all the properties in this ontology

Specified by:
getAllProperties in interface Ontology

getAllPlusImportedProperties

public OntProperty[] getAllPlusImportedProperties()
Get All the classes plus the imported properties.

Specified by:
getAllPlusImportedProperties in interface Ontology

getPropertyIterator

public java.util.Iterator getPropertyIterator()
Get the Iterator of all the properties.

Specified by:
getPropertyIterator in interface Ontology

addRestriction

public void addRestriction(PropertyRestriction p)
add a property to this ontology

Specified by:
addRestriction in interface Ontology

getRestriction

public PropertyRestriction getRestriction(ObjectId id)
get the specified property

Specified by:
getRestriction in interface Ontology

deleteRestriction

public void deleteRestriction(ObjectId id)
delete a specified property

Specified by:
deleteRestriction in interface Ontology

getAllRestrictions

public PropertyRestriction[] getAllRestrictions()
get all the properties in this ontology

Specified by:
getAllRestrictions in interface Ontology

getCompatiblePriorOnts

public DocId[] getCompatiblePriorOnts()
Get the priorVersion ontologies which are backwardCompatibleWith

Specified by:
getCompatiblePriorOnts in interface Ontology

addCompatiblePriorOnts

public void addCompatiblePriorOnts(DocId id)
Add a priorVersion ontology which is backwardCompatibleWith.

Specified by:
addCompatiblePriorOnts in interface Ontology

deleteCompatiblePriorOnts

public void deleteCompatiblePriorOnts(DocId id)
Delete a priorVersion ontology which is backwardCompatibleWith.

Specified by:
deleteCompatiblePriorOnts in interface Ontology

getPriorOnts

public DocId[] getPriorOnts()
Get the priorVersion ontologies may be incompatibleWith

Specified by:
getPriorOnts in interface Ontology

addPriorOnts

public void addPriorOnts(DocId id)
Add a priorVersion ontology may be incompatibleWith.

Specified by:
addPriorOnts in interface Ontology

deletePriorOnts

public void deletePriorOnts(DocId id)
Delete a priorVersion ontology may be incompatibleWith.

Specified by:
deletePriorOnts in interface Ontology

getVersion

public java.lang.String getVersion()
get the version of this ontology

Specified by:
getVersion in interface Ontology

setVersion

public void setVersion(java.lang.String ver)
Set the version of this ontology.

Specified by:
setVersion in interface Ontology

createClass

public OntClass createClass()
Create a Class object.

Specified by:
createClass in interface Ontology

createProperty

public OntProperty createProperty()
Create a Property object.

Specified by:
createProperty in interface Ontology

createRestriction

public PropertyRestriction createRestriction()
Create a PropertyRestriction object.

Specified by:
createRestriction in interface Ontology

flush

public void flush()
Flush the axioms into database.

Specified by:
flush in interface Document
Overrides:
flush in class Document

flushSubs

protected void flushSubs()

flushEquivals

protected void flushEquivals()

flushInverseOf

protected void flushInverseOf()
Flush owl:inverseOf into db view.


addImportedClass

public void addImportedClass(ObjectId cid,
                             OntClass c)
Add an imported class.

Specified by:
addImportedClass in interface Ontology

addImportedProperty

public void addImportedProperty(ObjectId pid,
                                OntProperty p)
Add an imported property.

Specified by:
addImportedProperty in interface Ontology

addIndividual

public void addIndividual(Individual indiv)
Add an individual.

Specified by:
addIndividual in interface Document
Overrides:
addIndividual in class Document

hasClass

public boolean hasClass(java.lang.String name)
To see if ontology has the class.

Specified by:
hasClass in interface Ontology

hasProperty

public boolean hasProperty(java.lang.String name)
Get the imported property.

Specified by:
hasProperty in interface Ontology

assertedClass

public boolean assertedClass(ObjectId cid)
To tell if the ontology asserted specified class.

Specified by:
assertedClass in interface Ontology

assertedProperty

public boolean assertedProperty(ObjectId pid)
To tell if the ontology asserted specified property.

Specified by:
assertedProperty in interface Ontology

addAssertedClass

public void addAssertedClass(ObjectId cid)
Add an asserted class.

Specified by:
addAssertedClass in interface Ontology

addAssertedProperty

public void addAssertedProperty(ObjectId pid)
Add an asserted property.

Specified by:
addAssertedProperty in interface Ontology

viewDefToTabNames

protected java.util.Vector viewDefToTabNames(java.lang.String vdef)
Get the table names in the view definition


setOntSeq

public void setOntSeq(int i)
Set the document sequence number.


getOntSeq

public int getOntSeq()
Get the document sequence number.


importedClass

public boolean importedClass(ObjectId cid)
To tell if the ontology imorted specified class.

Specified by:
importedClass in interface Ontology

importedProperty

public boolean importedProperty(ObjectId pid)
To tell if the ontology imported specified property.

Specified by:
importedProperty in interface Ontology

ViewForRestriction

public java.lang.String[] ViewForRestriction(ObjectId id)
Get view definition for restriction.

Parameters:
id - ObjectId
Returns:
String[] the first string is the view definition, the second one is for MySQL only.

flushCyclicRules

public void flushCyclicRules()

updateView

public void updateView(Atom a,
                       java.util.Vector<java.util.Vector<Atom>> DNF)

addAnnotations

public boolean addAnnotations(ObjectId sId,
                              ObjectId oId,
                              java.lang.String value)
Add annotations.

Specified by:
addAnnotations in interface Ontology

getAnnotationsBySubject

public java.util.Vector<Annotation> getAnnotationsBySubject(ObjectId pid)
Get annotations by subject ID.

Specified by:
getAnnotationsBySubject in interface Ontology

getAnnotationsByObject

public java.util.Vector<Annotation> getAnnotationsByObject(ObjectId pid)
Get annotations by object ID.

Specified by:
getAnnotationsByObject in interface Ontology

getAllAnnotations

public java.util.Vector<Annotation> getAllAnnotations()
Get all annotations.

Specified by:
getAllAnnotations in interface Ontology

addImportedAxiom

public void addImportedAxiom(Axiom a)
Specified by:
addImportedAxiom in interface Ontology

getAllPlusImportedAxioms

public java.util.List<Axiom> getAllPlusImportedAxioms()
Specified by:
getAllPlusImportedAxioms in interface Ontology

getAllPlusImportedAxiomsByObject

public java.util.Hashtable<ObjectId,java.util.Vector<Axiom>> getAllPlusImportedAxiomsByObject()
Specified by:
getAllPlusImportedAxiomsByObject in interface Ontology

getAllPlusImportedAxiomsBySubject

public java.util.Hashtable<ObjectId,java.util.Vector<Axiom>> getAllPlusImportedAxiomsBySubject()
Specified by:
getAllPlusImportedAxiomsBySubject in interface Ontology

getAllPlusImportedAxiomsByType

public java.util.Hashtable<java.lang.Integer,java.util.Vector<Axiom>> getAllPlusImportedAxiomsByType()
Specified by:
getAllPlusImportedAxiomsByType in interface Ontology

getCyclicRules

public java.util.Hashtable<java.lang.String,java.util.Vector<java.util.Vector<Atom>>> getCyclicRules()
To see if ontology has imported the property.


getExpandedAtoms

public java.util.Hashtable<java.lang.String,java.util.Vector<java.util.Vector<Atom>>> getExpandedAtoms()