    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Interface jtelos.KB

public interface KB
extends Levels

This interface models a Telos KB. A Telos KB consists of the built-in Telos objects and their associations, as well as propositions corresponding to any object definitions processed by the system. This interface provides methods for adding and removing propositions to the KB. Moreover, this interface provides methods for changing the relationships between objects in the KB. Finally this interface provides methods for retrieving all the propositions in the KB.

Every Telos KB contains the following built-in Omega level individual classes:

- `Proposition`
- `Class`
- `Individual`
- `IndividualClass`
- `OmegaClass`

Every Telos KB contains the following built-in Omega level attribute classes:

- `Attribute`
- `AttributeClass`

Every Telos KB contains the following built-in "level" classes:

- `Token`
- `SClass`
- `M1Class`
- `M2Class`
- `M3Class`

Every Telos KB contains the following built-in "primitive" classes:

- `Integer`
- `String`
- `Real`

All of the above mentioned classes are referred to as "builtin" propositions in this API. They are called "builtin" since all instances of a KB necessarily define and contain them. The associations that must be made between builtins and between the builtins and propositions defined by users of a KB are specified in the Telos formalization. The associations required for the Omega classes are summerized in the documentation accompanying the interfaces OmegaClass, OmegaIndividualClass, OmegaAttributeClass and PrimitiveType. All implementations of this interface must contain unique references to Proposition objects representing each of the above builtin propositions. These Proposition references to the builtin propositions would be obtainable through the querying methods `individual()` and `attribute()` provided in this interface.

Some implementations of KB may in addition contain the following "builtins": The Omega level attribute classes `Single` and `Necessary` as well as the classes `M4Class`, `M5Class`, `M6Class`, etc.

This interface contains methods to add and remove propositions from a KB. Note that none of the built-in propositions can be removed from a KB.

##

attribute(String)
  Searches for an attribute with the telosName `telosName` in the KB.
attributes()
  This returns all the attributes defined in the KB.
builtIns()
  This returns all the built-in Telos propositions defined in the KB.
closeKB()
  This method is used by some implementations to free all the resources the implementation of the KB is using.
containsOnlyBuiltIns()
  Returns true iff the KB contains only the built-in propositions.
fileRETELL(String, String)
  This UNTELLs from the KB the contents of the file `untellInputFileName` of definitions and then TELLs into the KB the contents the file `tellInputFileName` of definitions.
fileTELL(String)
  This TELLs into the KB the contents of file `tellInputFileName` of Telos definitions.
fileUNTELL(String)
  This UNTELLs from the KB the contents of the passed file `untellInputFileName` of Telos definitions.
individual(String)
  Searches for an individual with identifier `identifier` in the KB.
individuals()
  This returns all the individuals defined in the KB.
isEmpty()
  This returns true iff the builtins have not been installed for this KB.
load(String)
  Loads a Telos file (in text format or s-expression format) into the KB.
name()
  Returns the name of the KB.
newAttribute(Proposition, String[], String, PropositionOrPrimitive)
  This method creates and adds to the KB an attribute with declarer `declarer`, categories `categorie`, label `label` and target `target`.
newIndividual(String, int)
  This method creates and adds to the KB an individual with name `identifier` at the level `level`.
removeAndDeleteProposition(Proposition)
  This removes the passed proposition from the KB.
RETELL(String, String)
  This UNTELLs from the KB the string of definitions in `untellInput` and then TELLs into the KB the string of definitions in `tellInput`.
save()
  Saves the KB to disk.
size()
  Returns the number of propositions in the KB (including the built-in Telos propositions).
TELL(String)
  This TELLs into the KB the string of passed definitions.
UNTELL(String)
  This UNTELLs from the KB the string of passed definitions.
wipe()
  This removes all propositions from the kb excepting the built-in propositions.

##

name

     public abstract String name()

  Returns the name of the KB.

size

     public abstract int size()

  Returns the number of propositions in the KB (including the built-in Telos propositions).

containsOnlyBuiltIns

     public abstract boolean containsOnlyBuiltIns()

  Returns true iff the KB contains only the built-in propositions.

isEmpty

     public abstract boolean isEmpty()

  This returns true iff the builtins have not been installed for this KB. In some implementations, during the initialization of the KB, there may be points where a KB has been created but the built-in propositions for that KB have not been installed yet. This method returns true when this is the case. No implementation should allow transactions with a KB that does not have the builtin classes already installed

attributes

     public abstract Attribute[] attributes()

  This returns all the attributes defined in the KB.

  See Also:
    Attribute, Proposition

individuals

     public abstract Individual[] individuals()

  This returns all the individuals defined in the KB.

  See Also:
    Individual, Proposition

builtIns

     public abstract Proposition[] builtIns()

  This returns all the built-in Telos propositions defined in the KB.

  See Also:
    OmegaClass, Proposition

attribute

     public abstract Attribute attribute(String telosName)

  Searches for an attribute with the telosName `telosName` in the KB. If the method finds an attribute with telosName `telosName` in the KB, it returns it; otherwise, it throws an AttributeNotInKBException exception. See the method `telosName()` in the interface `NamedObject` for a description of the naming conventions for attributes.

  Throws: AttributeNotInKBException
    when there is no attribute in the KB whose telosName matches `telosName`.
  See Also:
    Attribute, Proposition, telosName

individual

     public abstract Individual individual(String identifier)

  Searches for an individual with identifier `identifier` in the KB. If the method finds an individual with the given information in the KB, it returns it; otherwise, it throws an IndividualNotInKBException exception.

  Throws: IndividualNotInKBException
    when there is no individual in the KB with identifier `identifier`.
  See Also:
    Individual, Proposition

newAttribute

     public abstract Attribute newAttribute(Proposition declarer,
                                            String categories[],
                                            String label,
                                            PropositionOrPrimitive target)

  This method creates and adds to the KB an attribute with declarer `declarer`, categories `categorie`, label `label` and target `target`. Note that the passed information to this method maps, via the procedure outlined in `NamedObject`, to a unique attribute `telosName`; conversely, an attribute `telosName` uniquely specifies the declarer, categories, label and target of an attribute.

  As in `newIndividual()`, if there is an attribute with the same telosName already in the KB, the already created attribute is returned. Otherwise an attribute with the passed declarer, categories, label and target is created and added into the KB. In an implementation with semantic checking, the attribute should only be created and installed after ensuring that no semantic errors would result by taking such actions.

  See Also:
    NamedObject, Attribute, Proposition, PropositionOrPrimitive, directAttributes, referencedBy

newIndividual

     public abstract Individual newIndividual(String identifier,
                                              int level)

  This method creates and adds to the KB an individual with name `identifier` at the level `level`. As in `newAttribute(...)`, if there is an individual with the same `identifier` already in the KB, the already created individual is returned. Otherwise an individual with the passed identifier and level is created and added to the KB. An implementation with semantic checking should only create and add the individual to the KB if no semantic errors would occur by taking such actions.

  See Also:
    NamedObject, Individual, Proposition, Levels

removeAndDeleteProposition

     public abstract void removeAndDeleteProposition(Proposition prop)

  This removes the passed proposition from the KB. Some implementations may implement Telos semantic checking in which case the proposition should only be removed if the underlying Telos semantics are not violated.

  See Also:
    newIndividual, newAttribute, Proposition, Individual, Attribute

load

     public abstract void load(String fileName)

  Loads a Telos file (in text format or s-expression format) into the KB. Some implementations may choose to parse files in only one of the above two formats.

save

     public abstract void save()

  Saves the KB to disk.

closeKB

     public abstract void closeKB()

  This method is used by some implementations to free all the resources the implementation of the KB is using.

wipe

     public abstract void wipe()

  This removes all propositions from the kb excepting the built-in propositions.

RETELL

     public abstract void RETELL(String untellInput,
                                 String tellInput)

  This UNTELLs from the KB the string of definitions in `untellInput` and then TELLs into the KB the string of definitions in `tellInput`. Note that semantic checking is done only after both the UNTELL and the TELL has been done, i.e., not once after the UNTELL and again after the TELL. This is the difference between using UNTELL and then TELL instead of RETELL.

  The definitions in `untellInput` and `tellInput` can be in either s-expression format or in "text" format (but not in both!). In an implementation that does syntactic and semantic checking, syntactic and semantic errors should be reported by throwing a `RetellException`.

  See Also:
    TELL, UNTELL, fileRETELL, RetellException

fileRETELL

     public abstract void fileRETELL(String untellInputFileName,
                                     String tellInputFileName)

  This UNTELLs from the KB the contents of the file `untellInputFileName` of definitions and then TELLs into the KB the contents the file `tellInputFileName` of definitions. Note that semantic checking is done only after both the UNTELL and the TELL have been done, i.e., not once after the UNTELL and again after the TELL. This is the difference between using UNTELL and then TELL instead of RETELL.

  The definitions in `untellInputFileName` and `tellInputFileName` can be in either s-expression format or in "text" format (but not in both!). In an implementation that does syntactic and semantic checking, syntactic and semantic errors should be reported by throwing a RetellException.

  See Also:
    fileTELL, fileUNTELL, RETELL, RetellException

TELL

     public abstract void TELL(String tellInput)

  This TELLs into the KB the string of passed definitions. These definitions can be in either s-expression format or in "text" format (but not both!). In an implementation that does syntactic and semantic checking, syntactic and semantic errors should be reported by throwing a `TellException`.

  See Also:
    RETELL, UNTELL, fileTELL, TellException

fileTELL

     public abstract void fileTELL(String tellInputFileName)

  This TELLs into the KB the contents of file `tellInputFileName` of Telos definitions. These definitions can be in either s-expression format or in "text" format (but not both!). In an implementation that does syntactic and semantic checking, syntactic and semantic errors should be reported by throwing a TellException.

  See Also:
    fileRETELL, fileUNTELL, TELL, TellException

UNTELL

     public abstract void UNTELL(String untellInput)

  This UNTELLs from the KB the string of passed definitions. These definitions can be in either s-expression format or in "text" format (but not both!). In an implementation that does syntactic and semantic checking, syntactic and semantic errors should be reported by throwing an `UntellException`.

  See Also:
    RETELL, TELL, fileUNTELL, UntellException

fileUNTELL

     public abstract void fileUNTELL(String untellInputFileName)

  This UNTELLs from the KB the contents of the passed file `untellInputFileName` of Telos definitions. These definitions can be in either s-expression format or in "text" format (but not both!). In an implementation that does syntactic and semantic checking, syntactic and semantic errors should be reported by throwing an UntellException.

  See Also:
    fileRETELL, fileTELL, UNTELL, UntellException

    All Packages  Class Hierarchy  This Package  Previous  Next  Index