org.semwebcentral.sweetrules.infrastructure
Class AbstractSweetKBDescriptor

java.lang.Object
  extended byorg.semwebcentral.sweetrules.infrastructure.AbstractSweetKBDescriptor
All Implemented Interfaces:
java.lang.Cloneable, ISweetKBDescriptor
Direct Known Subclasses:
SweetFileKBDescriptor, SweetStringKBDescriptor, SweetURIKBDescriptor

public abstract class AbstractSweetKBDescriptor
extends java.lang.Object
implements ISweetKBDescriptor

Abstract class for a Knowledgebase descriptor

Author:
Shashidhara K Ganjugunte, Dr. Benjamin Grosof, Dr. Said Tabet, Chitravanu Neogy

Field Summary
protected  java.lang.String kbLocation
          String holding the location of the knowledge base
protected  ISweetKRDescriptor krDescriptor
          KR of the KB
 
Constructor Summary
AbstractSweetKBDescriptor(ISweetKRDescriptor descriptor)
          This constructor is mainly for the case of a String KB which does not have any location
AbstractSweetKBDescriptor(java.lang.String location, ISweetKRDescriptor descriptor)
          Constructor for the KB descriptor
 
Method Summary
 java.lang.Object clone()
          The clone method to clone this object
 boolean equals(java.lang.Object o)
          The equals method to compare 2 knowledge bases
protected  java.lang.String getKBLocation()
          Returns the location of the knowledge base
 ISweetKRDescriptor getKRDescriptor()
          Returns the KR descriptor corresponding to the KB described
static boolean haveSameLocation(ISweetKBDescriptor source1, ISweetKBDescriptor source2)
          A utility method to check if 2 KB sources have the same location Warning: This does not resolve the locations.
protected  void setKBLocation(java.lang.String location)
          Returns the location of the knowledge base
 void setKRDescriptor(ISweetKRDescriptor descriptor)
          Sets KR descriptor corresponding to the KB being described
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.semwebcentral.sweetrules.infrastructure.ISweetKBDescriptor
readData, writeData
 

Field Detail

kbLocation

protected java.lang.String kbLocation
String holding the location of the knowledge base


krDescriptor

protected ISweetKRDescriptor krDescriptor
KR of the KB

Constructor Detail

AbstractSweetKBDescriptor

public AbstractSweetKBDescriptor(java.lang.String location,
                                 ISweetKRDescriptor descriptor)
Constructor for the KB descriptor

Parameters:
location - The location of the knowledge base (full path)
descriptor - The KR descriptor of the KB

AbstractSweetKBDescriptor

public AbstractSweetKBDescriptor(ISweetKRDescriptor descriptor)
This constructor is mainly for the case of a String KB which does not have any location

Parameters:
descriptor - THe KR Descriptor
Method Detail

haveSameLocation

public static boolean haveSameLocation(ISweetKBDescriptor source1,
                                       ISweetKBDescriptor source2)
                                throws java.lang.IllegalArgumentException
A utility method to check if 2 KB sources have the same location Warning: This does not resolve the locations. The locations are just compared as strings

Parameters:
source1 - The first source i.e KB
source2 - The second source i.e KB
Returns:
true if both have the same location (i.e. same location name).
Throws:
java.lang.IllegalArgumentException - if either of the arguments is not an instance of AbstractSweetKBDescriptor

getKBLocation

protected java.lang.String getKBLocation()
Returns the location of the knowledge base

Returns:
The name of the knowledge base

setKBLocation

protected void setKBLocation(java.lang.String location)
Returns the location of the knowledge base

Parameters:
location - Location of the knowledge base

getKRDescriptor

public ISweetKRDescriptor getKRDescriptor()
Returns the KR descriptor corresponding to the KB described

Specified by:
getKRDescriptor in interface ISweetKBDescriptor
Returns:
The KR descriptor

setKRDescriptor

public void setKRDescriptor(ISweetKRDescriptor descriptor)
Sets KR descriptor corresponding to the KB being described

Specified by:
setKRDescriptor in interface ISweetKBDescriptor
Parameters:
descriptor - The KR descriptor of this KB

equals

public boolean equals(java.lang.Object o)
The equals method to compare 2 knowledge bases


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
The clone method to clone this object

Specified by:
clone in interface ISweetKBDescriptor
Returns:
The cloned object
Throws:
java.lang.CloneNotSupportedException - if an error occurs