|
Algernon Software | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jatha.dynatype.StandardLispValue
org.algernon.kb.okbc.protege.AlgernonProtegeObject
org.algernon.kb.okbc.protege.AlgernonProtegeKB
Implements a Protege KB for Algernon. This interface adds just a few functions on top of the existing Protege interface.
| Field Summary | |
protected AlgernonProtegeRelation |
f_displayNameRelation
|
protected String |
f_displayNameRelationName
|
protected KnowledgeBase |
f_kb
|
protected URI |
f_projectURI
|
protected HashMap |
localCache
|
protected HashMap |
localDisplayNameCache
|
| Fields inherited from class org.algernon.kb.okbc.protege.AlgernonProtegeObject |
f_algy |
| Fields inherited from class org.jatha.dynatype.StandardLispValue |
f_lisp |
| Constructor Summary | |
AlgernonProtegeKB(Algernon algy)
Creates a new in-memory Protege project. |
|
AlgernonProtegeKB(Algernon algy,
KnowledgeBase kb)
Adds a kb that is already open. |
|
AlgernonProtegeKB(Algernon algy,
String projectFileName)
Opens the given Protege project file. |
|
| Method Summary | |
void |
addToCache(Object frameImplementation,
Object algernonFrame)
Adds a pairing of frames to the frame cache. |
void |
addToDisplayNameCache(String displayName,
AlgernonFrame frame)
Adds a mapping from a DisplayName to an AlgernonFrame to the display name frame cache. |
boolean |
canAssignToValueType(Object o,
LispValue vt)
Check if you can assign a Java Object o to a Protege slot having a ValueType vt |
void |
close()
Closes a KB. |
boolean |
containsClause(Clause clause,
int state)
State is Algernon.NEGATED or something else. |
Collection |
convertFromAlgernon(Collection coll)
Converts a collection of Algernon objects to a collection of Protege objects, if possible. |
Object |
convertFromAlgernon(Object obj)
Converts an Algernon object to a Protege object, if possible. |
Collection |
convertToAlgernon(Collection coll)
Converts a collection of Protege objects to a collection of Algernon objects, if possible. |
Object |
convertToAlgernon(Object obj)
Converts a Protege object to a ProtegeAlgernon object, if possible. |
AlgernonClass |
createClass(String frameName,
AlgernonClass superclass)
Creates a new frame in the storage. |
AlgernonClass |
createClass(String frameName,
AlgernonClass superclass,
AlgernonClass metaClass)
Creates a new frame in the storage. |
AlgernonFacet |
createFacet(String facetName)
Creates a new facet in the storage. |
AlgernonInstance |
createInstance(String frameName,
AlgernonClass theClass)
Creates a new instance in the storage. |
AlgernonRelation |
createRelation(String relationName,
LispValue domain,
LispValue range,
Integer minCardinality,
Integer maxCardinality,
Object defaultValue,
AlgernonRelation inverseRelation)
Helper method that creates a set around single domain and range to pass into the actual createRelation method. |
AlgernonRelation |
createRelation(String relationName,
Set domains,
Set ranges,
Integer minCardinality,
Integer maxCardinality,
Object defaultValue,
AlgernonRelation inverseRelation)
Creates a new relation in this KB. |
void |
deleteClass(AlgernonClass frame)
Deletes a frame and all of its relations from storage. |
void |
deleteClauses(Clause clause)
Deletes one or more clauses from the storage. |
void |
deleteClauses(Clause clause,
AlgernonFacet facet)
Deletes one or more clauses from the storage. |
void |
deleteFacet(AlgernonFacet frame)
Deletes a frame and all of its relations from storage. |
void |
deleteFrame(AlgernonFrame frame)
Deletes a frame and all of its relations from storage. |
void |
deleteInstance(AlgernonInstance frame)
Deletes a frame and all of its relations from storage. |
void |
deleteRelation(AlgernonRelation frame)
Deletes a relation from storage. |
Collection |
frameSearch(String searchString)
Performs a string search within the KB for frames whose name contains the given string. |
Collection |
frameSearch(String searchString,
String nameSlot)
Performs a string search within the KB for frames whose name contains the given string. |
Collection |
frameSearch(String searchString,
String nameSlot,
int limit)
Performs a string search within the KB for frames whose name contains the given string. |
boolean |
generalIsa(String child,
String parent)
Returns true if the first argument is an instance or subclass of the second argument in this KB. |
boolean |
generalNotIsa(String child,
String parent)
Returns true if the first argument is not an instance or subclass of the second argument this KB. |
LispValue |
getAllFrames()
Returns a collection of all frames in the KB. |
AlgernonRelation |
getDisplayNameRelation()
Get the actual DisplayName slot. |
String |
getDisplayNameRelationName()
Get the name of the DisplayName slot. |
AlgernonFrame |
getFrame(String name)
Returns a frame with the given name, if any exists. |
AlgernonProtegeObject |
getFromCache(Object frameImplementation)
Retrieves a Algernon-level frame or other value given a KBMS-level object as the key. |
AlgernonFrame |
getFromDisplayNameCache(String displayName)
Retrieves an Algernon frame from its display name. |
Object |
getImplementation()
Returns the KBMS-specific object implementing this interface. |
KnowledgeBase |
getKb()
|
String |
getName()
Returns the name of this KB as a string. |
AlgernonClass |
getRootClass()
Returns a the "first" root class in the KB. |
Collection |
getRootClasses()
Returns a Collection of the root classes of the KB. |
String |
getUserName()
Returns a String containing the name of the current user of this KB. |
LispValue |
getValueType(Object o)
Get the data type of the Java object passed in; we expect this to be Integer, Float, Boolean, Frame, etc., etc |
Collection |
getValueTypes()
Returns a collection of AlgernonValueTypes, listing all the value types the kb knows about |
boolean |
isClass(String frameName)
Returns the Class if the String is the name of a frame that is a class in the KB. |
boolean |
isClassToInstanceRelation(String relationName)
Returns true if the given string is the name of the relation/slot linking a class to its instance in this KB. |
boolean |
isDisjointRelation(String relationName)
Always returns false - Protege has no default disjoint relation. |
boolean |
isFacet(String frameName)
Returns true if the String is the name of a frame that is a facet in the KB. |
boolean |
isFrame(String frameName)
Returns the Frame if the String is the name of a frame in the KB. |
boolean |
isInstance(String frameName)
Returns the Instance if the String is the name of a frame that is an instance in the KB. |
boolean |
isInstanceToClassRelation(String relationName)
Returns true if the given string is the name of the relation/slot linking an instance to its class in this KB. |
boolean |
isNameRelation(String relationName)
Returns true if the string is the name of a NAME relation in this KB. |
boolean |
isRelation(String frameName)
Returns the Relation if the String is the name of a frame that is a relation in the KB. |
boolean |
isSimpleType(AlgernonFrame frame,
AlgernonRelation slot)
Determines if this slot takes an atomic data type value. |
boolean |
isSimpleType(AlgernonRelation relation)
Determines if this slot takes an atomic data type value |
static boolean |
isSimpleType(Frame frame,
Slot slot)
Checks the ValueType of slot AT THE CLASS--returns true if it's simple |
static boolean |
isSimpleType(Slot slot)
|
boolean |
isSubclassToSuperclassRelation(String relationName)
Returns true if the given string is the name of the relation/slot linking a frame to its name in any KB in the given AlgernonKBSet. |
boolean |
isSuperclassToSubclassRelation(String relationName)
Returns true if the given string is the name of the relation/slot linking a frame to its name in any KB in the given AlgernonKBSet. |
AlgernonFrame |
leastCommonSuperclass(AlgernonFrame frame1,
AlgernonFrame frame2)
Returns the most specialized common superclass of the two classes or instances. |
AlgernonClass |
lookupClass(String name)
Returns a class with the given name if it can find one in this KB. |
AlgernonFacet |
lookupFacet(String name)
Returns a frame with the given name if it can find one in this KB. |
AlgernonFrame |
lookupFrame(String name)
Returns a frame with the given name if it can find one in this KB. |
AlgernonInstance |
lookupInstance(String name)
Returns a frame with the given name if it can find one in this KB. |
AlgernonInstance |
lookupInstance(String javaClassName,
String name)
Returns a frame with the given name if it can find one in this KB. |
AlgernonInstance |
lookupInstance(String javaClassName,
String name,
String field)
Returns a frame with the given name if it can find one in this KB. |
AlgernonRelation |
lookupRelation(String name)
Returns a relation with the given name if it can find one in this KB. |
AlgernonRelation |
lookupRelation(String name,
Set classes)
Returns a relation with the given name, if any. |
private boolean |
myContains(Collection values,
LispValue value)
Needed because ArrayList.contains calls Object.equals() for some bizarre reason rather than LispValue.equals. |
protected KnowledgeBase |
openKB(String projectFile)
|
LispValue |
query(Clause clause)
Returns all of the values that match the given clause. |
LispValue |
query(Clause clause,
AlgernonFacet facet)
See the simpler form getValues. |
void |
removeFromCache(Object frameImplementation)
Removes a frame from the cache. |
void |
removeFromDisplayNameCache(String objectName)
Removes it from the display name cache. |
void |
reset()
Resets a KB. |
void |
save()
Saves the kb to a file. |
void |
setDisplayNameRelationName(String relationName)
Sets the name of the relation (slot) used for "pretty names", "common names", "display names" or whatever you want to call it. |
void |
setName(String newName)
Sets the name of the KB. |
LispValue |
store(Clause clause)
Asserts the given clause into the storage. |
LispValue |
store(Clause clause,
AlgernonFacet facet)
Asserts the given clause into the storage. |
boolean |
supportsNegatedClauses()
Returns true if this KB supports negated clauses. |
ValueType |
toValueType(Object range)
Range should be one of the ranges specified in the Algernon class, such as BOOLEAN_TYPE, STRING_TYPE, etc. |
ValueType |
valueOf(LispValue typeName)
Returns the Protege value type for the given named type |
Collection |
valueSearch(String searchString)
Performs a string search within the KB for slot values that contain the given string. |
Collection |
valueSearch(String searchString,
Collection frames,
Collection slots)
Performs a string search within the KB for slot values that contain the given string. |
Collection |
valueSearch(String searchString,
Collection frames,
Collection slots,
int limit)
Performs a string search within the KB for slot values that contain the given string. |
LispValue |
verify(Clause clause)
Verifies that the clause is in the KB. |
| Methods inherited from class org.algernon.kb.okbc.protege.AlgernonProtegeObject |
getAlgernon, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected KnowledgeBase f_kb
protected URI f_projectURI
protected String f_displayNameRelationName
protected AlgernonProtegeRelation f_displayNameRelation
protected HashMap localCache
protected HashMap localDisplayNameCache
| Constructor Detail |
public AlgernonProtegeKB(Algernon algy)
public AlgernonProtegeKB(Algernon algy,
String projectFileName)
throws AlgernonStorageException
public AlgernonProtegeKB(Algernon algy,
KnowledgeBase kb)
| Method Detail |
public Object getImplementation()
getImplementation in interface AlgernonKB
protected KnowledgeBase openKB(String projectFile)
throws AlgernonStorageException
AlgernonStorageExceptionpublic void close()
close in interface AlgernonKB
public void reset()
throws AlgernonStorageException
reset in interface AlgernonKBAlgernonStorageExceptionpublic LispValue getAllFrames()
getAllFrames in interface AlgernonKBpublic KnowledgeBase getKb()
public String getName()
getName in interface AlgernonKBgetName in class AlgernonProtegeObjectpublic void setName(String newName)
setName in interface AlgernonKB
public LispValue query(Clause clause)
throws AlgernonStorageException,
AlgernonException
query in interface AlgernonKBAlgernonStorageException
AlgernonExceptionClause
public LispValue query(Clause clause,
AlgernonFacet facet)
throws AlgernonStorageException,
AlgernonDataException
query in interface AlgernonKBAlgernonStorageException
AlgernonDataException
public Collection frameSearch(String searchString)
throws AlgernonStorageException
frameSearch in interface AlgernonKBsearchString - a string that must be contained in the value
AlgernonStorageExceptionvalueSearch(java.lang.String)
public Collection frameSearch(String searchString,
String nameSlot)
throws AlgernonStorageException
frameSearch in interface AlgernonKBsearchString - a string that must be contained in the valuenameSlot - an optional slot to be used as the search value. Enter null to use the default slot.
AlgernonStorageExceptionvalueSearch(java.lang.String)
public Collection frameSearch(String searchString,
String nameSlot,
int limit)
throws AlgernonStorageException
frameSearch in interface AlgernonKBsearchString - a string that must be contained in the valuenameSlot - an optional slot to be used as the search value. Enter null to use the default slot.limit - a limit on the number of frames to return. Use -1 for unlimited.
AlgernonStorageExceptionvalueSearch(java.lang.String)
public Collection valueSearch(String searchString)
throws AlgernonStorageException
valueSearch in interface AlgernonKBsearchString - a string that must be contained in the value
AlgernonStorageExceptionframeSearch(java.lang.String)
public Collection valueSearch(String searchString,
Collection frames,
Collection slots)
throws AlgernonStorageException
valueSearch in interface AlgernonKBsearchString - a string that must be contained in the valueframes - an optional Collection of frames or frame names to be searchedslots - an optional Collection of slots or slot names to be searched
AlgernonStorageExceptionframeSearch(java.lang.String)
public Collection valueSearch(String searchString,
Collection frames,
Collection slots,
int limit)
throws AlgernonStorageException
valueSearch in interface AlgernonKBsearchString - a string that must be contained in the valueframes - an optional Collection of frames or frame names to be searchedslots - an optional Collection of slots or slot names to be searchedlimit - a limit on the number of frames to return. Use -1 for unlimited.
AlgernonStorageExceptionframeSearch(java.lang.String)
public LispValue verify(Clause clause)
throws AlgernonStorageException,
AlgernonDataException
verify in interface AlgernonKBAlgernonStorageException
AlgernonDataException
private boolean myContains(Collection values,
LispValue value)
public AlgernonClass getRootClass()
getRootClass in interface AlgernonKBpublic Collection getRootClasses()
getRootClasses in interface AlgernonKBpublic String getUserName()
getUserName in interface AlgernonKB
public LispValue store(Clause clause)
throws AlgernonStorageException,
AlgernonDataException
store in interface AlgernonKBAlgernonStorageException
AlgernonDataException
public LispValue store(Clause clause,
AlgernonFacet facet)
throws AlgernonStorageException,
AlgernonDataException
NOT YET IMPLEMENTED.
store in interface AlgernonKBAlgernonStorageException
AlgernonDataException
public AlgernonClass createClass(String frameName,
AlgernonClass superclass)
throws AlgernonRuntimeException
createClass in interface AlgernonKBAlgernonRuntimeException
public AlgernonClass createClass(String frameName,
AlgernonClass superclass,
AlgernonClass metaClass)
throws AlgernonRuntimeException
createClass in interface AlgernonKBAlgernonRuntimeExceptionpublic AlgernonFacet createFacet(String facetName)
createFacet in interface AlgernonKB
public AlgernonInstance createInstance(String frameName,
AlgernonClass theClass)
createInstance in interface AlgernonKB
public AlgernonRelation createRelation(String relationName,
LispValue domain,
LispValue range,
Integer minCardinality,
Integer maxCardinality,
Object defaultValue,
AlgernonRelation inverseRelation)
throws AlgernonDataException
createRelation in interface AlgernonKBAlgernonDataException
public AlgernonRelation createRelation(String relationName,
Set domains,
Set ranges,
Integer minCardinality,
Integer maxCardinality,
Object defaultValue,
AlgernonRelation inverseRelation)
throws AlgernonDataException
createRelation in interface AlgernonKBAlgernonDataException
public void deleteClass(AlgernonClass frame)
throws AlgernonException
deleteClass in interface AlgernonKBAlgernonException
public void deleteFacet(AlgernonFacet frame)
throws AlgernonException
deleteFacet in interface AlgernonKBAlgernonException
public void deleteFrame(AlgernonFrame frame)
throws AlgernonException
deleteFrame in interface AlgernonKBAlgernonException
public void deleteInstance(AlgernonInstance frame)
throws AlgernonException
deleteInstance in interface AlgernonKBAlgernonException
public void deleteRelation(AlgernonRelation frame)
throws AlgernonException
deleteRelation in interface AlgernonKBAlgernonExceptionpublic void deleteClauses(Clause clause)
deleteClauses in interface AlgernonKB
public void deleteClauses(Clause clause,
AlgernonFacet facet)
deleteClauses in interface AlgernonKB
public boolean isClass(String frameName)
throws AlgernonDataException
isClass in interface AlgernonKBAlgernonDataException
public boolean isFacet(String frameName)
throws AlgernonDataException
isFacet in interface AlgernonKBAlgernonDataException
public boolean isInstance(String frameName)
throws AlgernonDataException
isInstance in interface AlgernonKBAlgernonDataException
public boolean isFrame(String frameName)
throws AlgernonDataException
isFrame in interface AlgernonKBAlgernonDataException
public boolean isRelation(String frameName)
throws AlgernonDataException
isRelation in interface AlgernonKBAlgernonDataExceptionpublic Collection convertToAlgernon(Collection coll)
convertToAlgernon in interface AlgernonKBpublic Object convertToAlgernon(Object obj)
convertToAlgernon in interface AlgernonKBpublic Collection convertFromAlgernon(Collection coll)
convertFromAlgernon in interface AlgernonKBpublic Object convertFromAlgernon(Object obj)
convertFromAlgernon in interface AlgernonKBpublic Collection getValueTypes()
public ValueType valueOf(LispValue typeName)
valueOf in interface AlgernonKBpublic LispValue getValueType(Object o)
getValueType in interface AlgernonKB
public boolean canAssignToValueType(Object o,
LispValue vt)
canAssignToValueType in interface AlgernonKBpublic static boolean isSimpleType(Slot slot)
public boolean isSimpleType(AlgernonRelation relation)
isSimpleType in interface AlgernonKB
public static boolean isSimpleType(Frame frame,
Slot slot)
public boolean isSimpleType(AlgernonFrame frame,
AlgernonRelation slot)
isSimpleType in interface AlgernonKBframe - ignoredslot - its implementation's value type is checked.
public void addToCache(Object frameImplementation,
Object algernonFrame)
frameImplementation - The KBMS-level (e.g. Protege) instancealgernonFrame - The Algernon equivalent.public AlgernonProtegeObject getFromCache(Object frameImplementation)
frameImplementation - The KBMS-level (e.g. Protege) instancepublic void removeFromCache(Object frameImplementation)
public void removeFromDisplayNameCache(String objectName)
objectName - public boolean isNameRelation(String relationName)
isNameRelation in interface AlgernonKBpublic boolean isInstanceToClassRelation(String relationName)
isInstanceToClassRelation in interface AlgernonKBpublic boolean isClassToInstanceRelation(String relationName)
isClassToInstanceRelation in interface AlgernonKBpublic boolean isSubclassToSuperclassRelation(String relationName)
isSubclassToSuperclassRelation in interface AlgernonKBpublic boolean isSuperclassToSubclassRelation(String relationName)
isSuperclassToSubclassRelation in interface AlgernonKBpublic boolean isDisjointRelation(String relationName)
isDisjointRelation in interface AlgernonKB
public boolean generalIsa(String child,
String parent)
throws AlgernonDataException
generalIsa in interface AlgernonKBAlgernonDataException
public boolean generalNotIsa(String child,
String parent)
generalNotIsa in interface AlgernonKB
public AlgernonClass lookupClass(String name)
throws AlgernonDataException
lookupClass in interface AlgernonKBAlgernonDataException
public AlgernonFacet lookupFacet(String name)
throws AlgernonDataException
lookupFacet in interface AlgernonKBAlgernonDataException
public AlgernonFrame lookupFrame(String name)
throws AlgernonDataException
lookupFrame in interface AlgernonKBAlgernonDataException
public AlgernonInstance lookupInstance(String name)
throws AlgernonDataException
lookupInstance in interface AlgernonKBAlgernonDataException
public AlgernonInstance lookupInstance(String javaClassName,
String name)
throws AlgernonDataException
lookupInstance in interface AlgernonKBAlgernonDataException
public AlgernonInstance lookupInstance(String javaClassName,
String name,
String field)
throws AlgernonDataException
lookupInstance in interface AlgernonKBAlgernonDataException
public AlgernonRelation lookupRelation(String name)
throws AlgernonDataException
lookupRelation in interface AlgernonKBAlgernonDataException
public AlgernonRelation lookupRelation(String name,
Set classes)
throws AlgernonDataException
AlgernonKB
lookupRelation in interface AlgernonKBAlgernonDataException
public AlgernonFrame getFrame(String name)
throws AlgernonDataException
getFrame in interface AlgernonKBAlgernonDataExceptionpublic AlgernonFrame getFromDisplayNameCache(String displayName)
displayName - The display name of a frame.AlgernonFrame,
AlgernonKB
public void addToDisplayNameCache(String displayName,
AlgernonFrame frame)
displayName - The display name of the frame.frame - The Algernon frame.AlgernonFrame,
AlgernonKBpublic String getDisplayNameRelationName()
getDisplayNameRelationName in interface AlgernonKB
public AlgernonRelation getDisplayNameRelation()
throws AlgernonDataException
getDisplayNameRelation in interface AlgernonKBAlgernonDataExceptionpublic void setDisplayNameRelationName(String relationName)
setDisplayNameRelationName in interface AlgernonKB
public void save()
throws AlgernonStorageException
save in interface AlgernonKBAlgernonStorageExceptionpublic boolean supportsNegatedClauses()
AlgernonKB
supportsNegatedClauses in interface AlgernonKB
public AlgernonFrame leastCommonSuperclass(AlgernonFrame frame1,
AlgernonFrame frame2)
leastCommonSuperclass in interface AlgernonKB
public boolean containsClause(Clause clause,
int state)
throws AlgernonDataException
containsClause in interface AlgernonKBclause - state - is Algernon.NEGATED or something else.
AlgernonDataExceptionpublic ValueType toValueType(Object range)
range -
|
Algernon Software | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||