    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class jtelos.cpp.cppKB

    java.lang.Object
       |
       +----jtelos.cpp.cppKB

public class cppKB
extends Object
implements KB

This class implements the interface KB. This interface is implemented with the use of native Java methods written in C++ which connect to the Techne Repository (in shared and/or dynamic library format, depending on platform).

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.

Instances of this class have methods for adding and removing propositions from themselves. Moreover, instances of this class provide methods for changing the relationships between the objects they contain. Finally instances of this class provide methods for retrieving all the propositions they contain.

Every instance of this class has access to unique cppOmegaIndividualClass objects of the following built-in Omega level individual classes:

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

Every instance of this class has access to unique cppOmegaAttributeClass objects of the following built-in Omega level attribute classes:

- `Attribute`
- `AttributeClass`
- `Single`

Every instance of this class has access to unique cppIndividual objects if the following built-in "level" classes:

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

Every instance of this class has access to unique cppIndividual objects of the following built-in "primitive" classes:

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

The above cppPropositions can be accessed through the querying methods `individual()` and `attribute()`, as appropriate.

This implementation does not define the Omega level attribute class `Necessary` and does not define any builtin "level" class at a higher level of instantiation than `M3Class`.

See Also:
  KB, Levels, Proposition, Attribute, Individual, OmegaClass

##

cppKB(String, String)
  This constructor creates a C++ Telos kb with name `name` and path `path`.

##

attribute(String)
  Searches for an attribute with the telosName `telosName` in the KB.
attributes()
  The attributes defined in this KB.
builtIns()
  The builtins defineed in this KB.
closeKB()
  This method closes the C++ mirror of this kb.
containsOnlyBuiltIns()
  Returns true if the KB contains only builtins.
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 the passed file of telos definitions.
fileUNTELL(String)
  This UNTELLs from the KB the contents of the passed file of telos definitions.
individual(String)
  Searches for an individual with identifier `identifier` in the KB.
individuals()
  The individuals defined in this KB.
isEmpty()
  This returns true iff the builtins have not been installed for this KB.
load(String)
  Loads a telos file (in either text or sexp format) into the KB.
name()
  The name of the KB.
newAttribute(Proposition, String[], String, PropositionOrPrimitive)
  This method creates and adds to the KB an attribute with declarer `declarer`, categories `categories`, 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 routine removes the passed individual 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 method is not implemented yet

##

cppKB

     public cppKB(String name,
                  String path)

  This constructor creates a C++ Telos kb with name `name` and path `path`. If the file `path` is nonempty, it is loaded into the kb. The contents of the file `path` must NOT have any syntax or semantic errors. The file `path` should be the file produced automatically by the C++ telos system when it closes the C++ mirror of this KB. Being automatically generated it should contain no semantic errors. Checksums could be implemented by the user of this class to ensure that the load file is not corrupted

##

closeKB

     public final void closeKB()

  This method closes the C++ mirror of this kb. This involves saving the contents and then freeing the memory used by the C++ kb object corresponding to this KB. Note that nativeCloseKB can throw a TelosException if it encounters an error.

name

     public String name()

  The name of the KB.

size

     public int size()

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

containsOnlyBuiltIns

     public boolean containsOnlyBuiltIns()

  Returns true if the KB contains only builtins.

isEmpty

     public 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. However, in this implementation the built-in propositions are created at the same time as the KB itself. Hence, this always returns false.

attributes

     public Attribute[] attributes()

  The attributes defined in this KB.

individuals

     public Individual[] individuals()

  The individuals defined in this KB.

builtIns

     public Proposition[] builtIns()

  The builtins defineed in this KB.

attribute

     public 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.

  It is assumed that the string `telosName` is syntactically correct (as it should be if it is produced automatically).

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

individual

     public Individual individual(String telosName)

  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:
    cppIndividual, cppProposition

newAttribute

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

  This method creates and adds to the KB an attribute with declarer `declarer`, categories `categories`, 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 TELLed into the KB. If no exceptions occur, the newly created attribute is returned.

  It is assumed that declarer and target are not null, and that categories is not an empty list. It is up to the caller to ensure this.

  See Also:
    NamedObject, cppAttribute, cppProposition, PropositionOrPrimitive

newIndividual

     public 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 TELLed into the KB. If no exceptions occur, the newly created individual is returned.

  See Also:
    NamedObject, cppIndividual, cppProposition, Levels

removeAndDeleteProposition

     public void removeAndDeleteProposition(Proposition prop)

  This routine removes the passed individual from the kb. It first checks that the individual requested to be deleted has no instances and has not already been deleted. In the former case a `InstancesExistException` is thrown while in the latter case a `DeletedObjectAccessedException` is thrown.

  See Also:
    InstancesExistException, DeletedObjectAccessedException

load

     public void load(String fileName)

  Loads a telos file (in either text or sexp format) into the KB.

save

     public void save()

  Saves the KB to disk.

RETELL

     public 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!). Syntax and semantic errors are reported by throwing a RetellException.

  See Also:
    TELL, UNTELL, fileRETELL, RetellException

fileRETELL

     public 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 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 untellInputFileName and tellInputFileName can be in either s-expression format or in "text" format (but not in both!). Syntax and semantic errors should be reported by throwing a RetellException.

  See Also:
    fileTELL, fileUNTELL, RETELL, RetellException

TELL

     public 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!). Syntax and semantic errors are reported by throwing a TellException.

  See Also:
    RETELL, UNTELL, fileTELL, TellException

fileTELL

     public void fileTELL(String tellInputFileName)

  This TELLs into the KB the contents of the passed file of telos definitions. These definitions can be in either s-expression format or in "text" format (but not both!). Syntax and semantic errors should be reported by throwing a TellException.

  See Also:
    fileRETELL, fileUNTELL, TELL, TellException

UNTELL

     public 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!). Syntax and semantic errors are reported by throwing an UntellException.

  See Also:
    RETELL, TELL, fileUNTELL, UntellException

fileUNTELL

     public void fileUNTELL(String untellInputFileName)

  This UNTELLs from the KB the contents of the passed file of telos definitions. These definitions can be in either s-expression format or in "text" format (but not both!). Syntax and semantic errors should be reported by throwing an UntellException.

  See Also:
    fileRETELL, fileTELL, UNTELL, UntellException

wipe

     public void wipe()

  This method is not implemented yet

    All Packages  Class Hierarchy  This Package  Previous  Next  Index