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

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

public class Ontology
extends Document
implements Ontology

A simple implementation of core.ontology in memory.

See Also:
Serialized Form

Field Summary
 
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()
          Constructor
 
Method Summary
 void addAllAxiomNodeRestrictions(java.util.Vector<AxiomNode> res)
           
 boolean addAnnotations(ObjectId sId, ObjectId pId, 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 addImportedAxiomByObject(ObjectId obj, Axiom a)
           
 void addImportedAxiomBySubject(ObjectId sub, Axiom a)
           
 void addImportedAxiomByType(java.lang.Integer type, Axiom a)
           
 void addImportedClass(ObjectId cid, OntClass c)
          Add an imported class.
 void addImportedProperty(ObjectId pid, OntProperty p)
          Add an imported property.
 void addOntClass(OntClass c)
          add a class to this ontology
 void addPriorOnts(DocId id)
          Add a priorVersion ontology may be incompatibleWith.
 void addProperty(OntProperty p)
          add a property to this ontology
 void addRestriction(PropertyRestriction p)
          add a property to this ontology
 boolean allPrimitive(java.util.Vector<Atom> v1)
           
 boolean assertedClass(ObjectId cid)
          To tell if the ontology asserted specified class.
 boolean assertedProperty(ObjectId pid)
          To tell if the ontology asserted specified property.
 boolean compareConjuncts(java.util.Vector<Atom> c1, java.util.Vector<Atom> c2)
          Determine if c2 is subset of or equivalent to c1
 void convertAxiomsToRules()
           
 OntClass createClass()
          Create a Class object and set its ontology.
 OntProperty createProperty()
          Create a Property object and set its ontology.
 PropertyRestriction createRestriction()
          Create a PropertyRestriction object and set its ontology.
 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
protected  java.util.Vector<java.util.Vector<Atom>> expandAtom(Atom a)
           
 void expandRules()
           
 java.util.Vector<Annotation> getAllAnnotations()
          Get annotations by object ID.
 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 predicate 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()
           
 java.util.Hashtable<java.lang.String,java.util.Vector<java.util.Vector<Atom>>> getExpandedAtoms()
           
 OntClass getOntClass(ObjectId id)
          get the specified class
 OntObject getOntObject(ObjectId id)
          get the object (class/property) given the ID
 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 hasPredicate(java.util.Vector<Atom> v1, java.lang.String pred)
           
 boolean hasProperty(java.lang.String name)
          To see if ontology has the 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.
protected  boolean nodeToAtoms(AxiomNode node, HornRule rule, int var)
           
 void setVersion(java.lang.String ver)
          Set the version of this ontology.
 
Methods inherited from class edu.lehigh.swat.hawk.storage.simplememory.Document
addAssertion, addDescription, addDistinctIndividualsSet, addImports, addIndividual, addSameIndividualsSet, createIndividual, deleteAllIndividual, deleteAssertion, deleteDescriprion, deleteDistinctIndividualsSet, deleteImports, deleteIndividual, deleteSameIndividualsSet, equals, flush, getAllAssertions, getAllDescriptions, getAllIndividuals, getAssertionIterator, getDescendants, getDescription, getDistinctIndividualsSets, getID, getImports, getIndividual, getIndividualIterator, getLabel, getNameSpaces, getSameIndividualsSets, getSize, getXMLBase, setDescendants, setID, 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, addImports, addIndividual, addSameIndividualsSet, createIndividual, deleteAssertion, deleteDescriprion, deleteDistinctIndividualsSet, deleteImports, deleteIndividual, deleteSameIndividualsSet, flush, getAllAssertions, getAllDescriptions, getAllIndividuals, getAssertionIterator, getDescendants, getDescription, getDistinctIndividualsSets, getID, getImports, getIndividual, getIndividualIterator, getLabel, getNameSpaces, getSameIndividualsSets, getSize, getXMLBase, setDescendants, setID, setLabel, setNameSpaces, setSize, setXMLBase
 

Constructor Detail

Ontology

public Ontology()
Constructor

Method Detail

addAxiom

public void addAxiom(Axiom a)
Description copied from interface: Ontology
Axiom Design Methods

Specified by:
addAxiom in interface Ontology

getAllAxioms

public java.util.List<Axiom> getAllAxioms()
Specified by:
getAllAxioms 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

getAllAxiomsByObject

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

addAxiomBySubject

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

addAxiomByObject

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

addAxiomByType

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

getAxiomBySubject

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

getAxiomByObject

public java.util.List<Axiom> getAxiomByObject(ObjectId object)
Specified by:
getAxiomByObject 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

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

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


getOntObject

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

Specified by:
getOntObject in interface Ontology

getOntClass

public OntClass getOntClass(ObjectId id)
get the specified class

Specified by:
getOntClass 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

getClassIterator

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

Specified by:
getClassIterator in interface Ontology

addProperty

public void addProperty(OntProperty p)
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

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 and set its ontology.

Specified by:
createClass in interface Ontology

createProperty

public OntProperty createProperty()
Create a Property object and set its ontology.

Specified by:
createProperty in interface Ontology

createRestriction

public PropertyRestriction createRestriction()
Create a PropertyRestriction object and set its ontology.

Specified by:
createRestriction in interface Ontology

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)
To see if ontology has the property.

Specified by:
hasProperty in interface Ontology

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

getAllPlusImportedClasses

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

Specified by:
getAllPlusImportedClasses in interface Ontology

getAllPlusImportedProperties

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

Specified by:
getAllPlusImportedProperties in interface Ontology

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

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

addAnnotations

public boolean addAnnotations(ObjectId sId,
                              ObjectId pId,
                              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 predicate ID.

Specified by:
getAnnotationsByObject in interface Ontology

getAllAnnotations

public java.util.Vector<Annotation> getAllAnnotations()
Get annotations by object ID.

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

getAllPlusImportedAxiomsByType

public java.util.Hashtable<java.lang.Integer,java.util.Vector<Axiom>> getAllPlusImportedAxiomsByType()
Specified by:
getAllPlusImportedAxiomsByType 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

addImportedAxiomByObject

public void addImportedAxiomByObject(ObjectId obj,
                                     Axiom a)

addImportedAxiomByType

public void addImportedAxiomByType(java.lang.Integer type,
                                   Axiom a)

addImportedAxiomBySubject

public void addImportedAxiomBySubject(ObjectId sub,
                                      Axiom a)

convertAxiomsToRules

public void convertAxiomsToRules()

nodeToAtoms

protected boolean nodeToAtoms(AxiomNode node,
                              HornRule rule,
                              int var)

expandRules

public void expandRules()

expandAtom

protected java.util.Vector<java.util.Vector<Atom>> expandAtom(Atom a)

compareConjuncts

public boolean compareConjuncts(java.util.Vector<Atom> c1,
                                java.util.Vector<Atom> c2)
Determine if c2 is subset of or equivalent to c1

Parameters:
c1 - Vector
c2 - Vector
Returns:
boolean

hasPredicate

public boolean hasPredicate(java.util.Vector<Atom> v1,
                            java.lang.String pred)

allPrimitive

public boolean allPrimitive(java.util.Vector<Atom> v1)

getCyclicRules

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

getExpandedAtoms

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