Algernon Software

org.algernon.kb.okbc.protege
Class AlgernonProtegeRelation

java.lang.Object
  extended byorg.jatha.dynatype.StandardLispValue
      extended byorg.algernon.kb.okbc.protege.AlgernonProtegeObject
          extended byorg.algernon.kb.okbc.protege.AlgernonProtegeFrame
              extended byorg.algernon.kb.okbc.protege.AlgernonProtegeRelation
All Implemented Interfaces:
AlgernonFrame, AlgernonObject, AlgernonRelation, Comparable, Displayable, LispValue

public class AlgernonProtegeRelation
extends AlgernonProtegeFrame
implements AlgernonRelation

This defines an Algernon relation in Protege. minCardinality and maxCardinality must be Integers. defaultValue and inverseRelation can be null.


Field Summary
 
Fields inherited from class org.algernon.kb.okbc.protege.AlgernonProtegeFrame
m_frame, m_kb
 
Fields inherited from class org.algernon.kb.okbc.protege.AlgernonProtegeObject
f_algy
 
Fields inherited from class org.jatha.dynatype.StandardLispValue
f_lisp
 
Constructor Summary
AlgernonProtegeRelation(AlgernonProtegeKB kb, Slot slot)
          Creates an AlgernonProtegeRelation from an already-existing slot.
AlgernonProtegeRelation(AlgernonProtegeKB kb, String name, Object range, Integer minCardinality, Integer maxCardinality, Object defaultValue, AlgernonRelation inverseRelation)
           
 
Method Summary
 List getArgumentTypes()
          Returns a list of the argument types for this relation.
 int getMaximumCardinality()
          Returns the maximum cardinality of this relation.
 int getMinimumCardinality()
          Returns the minimum cardinality of this relation.
protected  List processDomainAndRange(Collection domains, ValueType valueType, Collection specificType)
          Helper function to turn a set of Domains and a Range into the form needed by the AlgernonCompiler.
 boolean rangeIsSimpleType()
          Returns true if the range is a simple, that is, non-frame, type.
private  void setClassRange()
          This is only called when the range is :CLASS.
 void setDefaultValue(Object defaultValue)
          Sets the default value of a template slot.
 void setInverseRelation(AlgernonRelation inverseRelation)
          Sets the inverse relation of this relation.
 void setMaxCardinality(Integer maxCardinality)
          Sets the maximum cardinality of the Relation.
 void setMinCardinality(Integer minCardinality)
          Sets the minimum cardinality of the Relation.
 void setRange(AlgernonClass range)
          Sets the range of the relation.
 void setRange(LispValue range)
          Sets the range of a relation when it is a value type such as :INTEGER, instead of a class.
 void setRange(Object range)
          Sets the range of a relation when it is a value type such as :INTEGER, instead of a class.
 
Methods inherited from class org.algernon.kb.okbc.protege.AlgernonProtegeFrame
addRelationValue, deleteAllRelationValues, deleteRelationValue, deleteRelationValues, display, getDisplayName, getImplementation, getKB, getName, getOwnRelationValues, getParents, getPossibleRelationValues, getRelationValues, getRootClasses, getSuperclasses, hasParent, hasRootClass, hasSuperclass, setDisplayName, setName, toString
 
Methods inherited from class org.algernon.kb.okbc.protege.AlgernonProtegeObject
getAlgernon
 
Methods inherited from class org.jatha.dynatype.StandardLispValue
abs, acos, add, adjustSpecialCount, append, apply, apropos_print, asin, assoc, atan, atan2, atom, basic_atom, basic_bignump, basic_consp, basic_constantp, basic_floatp, basic_foreignp, basic_functionp, basic_integerp, basic_keywordp, basic_length, basic_listp, basic_macrop, basic_null, basic_numberp, basic_stringp, basic_symbolp, bignump, boundp, butlast, car, cdr, ceiling, characterp, clrhash, compareTo, concatenate, consp, constantp, contains, copy_list, copy, cos, cot, csc, degreesToRadians, divide, eighth, elt, elt, eq, eql, equal, equalNumeric, factorial, fboundp, fifth, first, floatp, floor, fourth, funcall, functionp, get_specialCount, gethash, gethash, getLisp, greaterThan, greaterThanOrEqual, hash_table_count, hash_table_rehash_size, hash_table_rehash_threshold, hash_table_size, hash_table_test, hashtablep, integerp, internal_getName, internal_prin1_as_cdr, internal_prin1, internal_princ_as_cdr, internal_princ, internal_print_as_cdr, internal_print, iterator, keywordp, last, length, lessThan, lessThanOrEqual, lisp_null, list, listp, max, member, min, multiply, nconc, negate, neql, ninth, nreverse, nstringCapitalize, nstringDowncase, nstringUpcase, numberp, pop, position, prin1, princ, print, push, radiansToDegrees, rassoc, reciprocal, remhash, remove, rest, reverse, rplaca, rplacd, sec, second, set_special, setf_gethash, setf_symbol_function, setf_symbol_plist, setf_symbol_value, setLisp, setPackage, setq, seventh, sin, sixth, specialP, sqrt, string, stringCapitalize, stringDowncase, stringEndsWith, stringEq, stringEqual, stringGreaterP, stringGreaterThan, stringGreaterThanOrEqual, stringLeftTrim, stringLeftTrim, stringLessP, stringLessThan, stringLessThanOrEqual, stringNeq, stringNotGreaterP, stringNotLessP, stringp, stringRightTrim, stringRightTrim, stringStartsWith, stringTrim, stringTrim, stringUpcase, subst, substring, substring, subtract, symbol_function, symbol_name, symbol_package, symbol_plist, symbol_value, symbolp, tan, tenth, third, toCollection, toJava, toJava, toString, toStringAsCdr_internal, toStringAsCdr, toStringShort, toStringShort, toStringSimple, type_of, typep, zerop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.algernon.kb.AlgernonFrame
addRelationValue, deleteAllRelationValues, deleteRelationValue, deleteRelationValues, getDisplayName, getImplementation, getKB, getName, getOwnRelationValues, getParents, getPossibleRelationValues, getRelationValues, getRootClasses, getSuperclasses, hasParent, hasRootClass, hasSuperclass, setDisplayName, setName
 
Methods inherited from interface org.algernon.io.Displayable
display
 

Constructor Detail

AlgernonProtegeRelation

public AlgernonProtegeRelation(AlgernonProtegeKB kb,
                               String name,
                               Object range,
                               Integer minCardinality,
                               Integer maxCardinality,
                               Object defaultValue,
                               AlgernonRelation inverseRelation)
                        throws AlgernonDataException

AlgernonProtegeRelation

public AlgernonProtegeRelation(AlgernonProtegeKB kb,
                               Slot slot)
Creates an AlgernonProtegeRelation from an already-existing slot.

Parameters:
kb - The KB of the slot.
slot - The Slot around which an AlgernonProtegeRelation should be created.
Method Detail

setInverseRelation

public void setInverseRelation(AlgernonRelation inverseRelation)
Sets the inverse relation of this relation. If null, does nothing. Otherwise, it should already exist.

Specified by:
setInverseRelation in interface AlgernonRelation
Parameters:
inverseRelation -

setDefaultValue

public void setDefaultValue(Object defaultValue)
                     throws AlgernonDataException
Sets the default value of a template slot.

Specified by:
setDefaultValue in interface AlgernonRelation
Parameters:
defaultValue -
Throws:
AlgernonDataException

setMaxCardinality

public void setMaxCardinality(Integer maxCardinality)
Sets the maximum cardinality of the Relation.

Specified by:
setMaxCardinality in interface AlgernonRelation
Parameters:
maxCardinality -

setMinCardinality

public void setMinCardinality(Integer minCardinality)
Sets the minimum cardinality of the Relation.

Specified by:
setMinCardinality in interface AlgernonRelation
Parameters:
minCardinality -

setRange

public void setRange(Object range)
Sets the range of a relation when it is a value type such as :INTEGER, instead of a class.

Parameters:
range - the value type of the relation.

setClassRange

private void setClassRange()
This is only called when the range is :CLASS. It sets the allowedParents facet of the slot.


setRange

public void setRange(LispValue range)
Sets the range of a relation when it is a value type such as :INTEGER, instead of a class.

Specified by:
setRange in interface AlgernonRelation
Parameters:
range - the value type of the relation.

setRange

public void setRange(AlgernonClass range)
Sets the range of the relation.

Specified by:
setRange in interface AlgernonRelation
Parameters:
range - a Class which is the range of the relation.

getArgumentTypes

public List getArgumentTypes()
                      throws AlgernonDataException
Returns a list of the argument types for this relation. The length of the list is the number of parameters in the relation. The first item in the list a Set of the classes of frames in the domain of this relation. The next item(s) in the list are Sets containing the types of the values of the relation.

Specified by:
getArgumentTypes in interface AlgernonRelation
Throws:
AlgernonDataException

processDomainAndRange

protected List processDomainAndRange(Collection domains,
                                     ValueType valueType,
                                     Collection specificType)
                              throws AlgernonDataException
Helper function to turn a set of Domains and a Range into the form needed by the AlgernonCompiler.

Parameters:
domains - Collection of domains, as returned by Protege's slot.getTemplateSlotClses
valueType - A ValueType, as returned by Protege's slot.getValueType()
Returns:
List of (a) Domain Set, and (b) Range.
Throws:
AlgernonDataException

getMinimumCardinality

public int getMinimumCardinality()
Returns the minimum cardinality of this relation.

Specified by:
getMinimumCardinality in interface AlgernonRelation

getMaximumCardinality

public int getMaximumCardinality()
Returns the maximum cardinality of this relation.

Specified by:
getMaximumCardinality in interface AlgernonRelation

rangeIsSimpleType

public boolean rangeIsSimpleType()
Returns true if the range is a simple, that is, non-frame, type.

Specified by:
rangeIsSimpleType in interface AlgernonRelation

Algernon Software