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:

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

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

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

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

Constructor Index

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

Method Index

 o attribute(String)
Searches for an attribute with the telosName telosName in the KB.
 o attributes()
The attributes defined in this KB.
 o builtIns()
The builtins defineed in this KB.
 o closeKB()
This method closes the C++ mirror of this kb.
 o containsOnlyBuiltIns()
Returns true if the KB contains only builtins.
 o deleted()
Returns true iff the C++ mirror of the kb has been deleted.
 o 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.
 o fileTELL(String)
This TELLs into the KB the contents of the passed file of telos definitions.
 o fileUNTELL(String)
This UNTELLs from the KB the contents of the passed file of telos definitions.
 o individual(String)
Searches for an individual with identifier identifier in the KB.
 o individuals()
The individuals defined in this KB.
 o isEmpty()
This returns true iff the builtins have not been installed for this KB.
 o load(String)
Loads a telos file (in either text or sexp format) into the KB.
 o name()
The name of the KB.
 o 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.
 o newIndividual(String, int)
This method creates and adds to the KB an individual with name identifier at the level level.
 o removeAndDeleteProposition(Proposition)
This routine removes the passed individual from the kb.
 o 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.
 o save()
Saves the KB to disk.
 o size()
Returns the number of propositions in the KB (including the built-in Telos propositions).
 o TELL(String)
This TELLs into the KB the string of passed definitions.
 o UNTELL(String)
This UNTELLs from the KB the string of passed definitions.
 o wipe()
This method is not implemented yet

Constructors

 o 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

Methods

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

 o name
 public String name()
The name of the KB.

 o size
 public int size()
Returns the number of propositions in the KB (including the built-in Telos propositions).

 o deleted
 public final boolean deleted()
Returns true iff the C++ mirror of the kb has been deleted.

 o containsOnlyBuiltIns
 public boolean containsOnlyBuiltIns()
Returns true if the KB contains only builtins.

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

 o attributes
 public Attribute[] attributes()
The attributes defined in this KB.

 o individuals
 public Individual[] individuals()
The individuals defined in this KB.

 o builtIns
 public Proposition[] builtIns()
The builtins defineed in this KB.

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

Throws: TellException
if any semantic errors occur while trying to create the new attribute.
See Also:
NamedObject, cppAttribute, cppProposition, PropositionOrPrimitive
 o 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
 o 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.

Throws: InstancesExistException
if prop has any Telos instances.
Throws: DeletedObjectAccessedException
if prop has already removed and deleted from the KB.
 o load
 public void load(String fileName)
Loads a telos file (in either text or sexp format) into the KB.

Throws: TellException
if any syntax or semantic errors occur while parsing the input file and/or if the KB is inconsistent after doing the load.
 o save
 public void save()
Saves the KB to disk.

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

Throws: RetellException
if any syntax or semantic errors occur while parsing the input strings and/or if the KB is inconsistent after executing the RETELL.
See Also:
TELL, UNTELL, fileRETELL
 o 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.

Throws: RetellException
if any syntax or semantic errors occur while parsing the input files and/or if the KB is inconsistent after executing the RETELL.
See Also:
fileTELL, fileUNTELL, RETELL
 o 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.

Throws: TellException
if any syntax or semantic errors occur while parsing the input string and/or if the KB is inconsistent after executing the TELL.
See Also:
RETELL, UNTELL, fileTELL
 o 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.

Throws: TellException
if any syntax or semantic errors occur while parsing the input file and/or if the KB is inconsistent after executing the TELL.
See Also:
fileRETELL, fileUNTELL, TELL
 o 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.

Throws: UntellException
if any syntax or semantic errors occur while parsing the input string and/or if the KB is inconsistent after executing the UNTELL.
See Also:
RETELL, TELL, fileUNTELL
 o 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.

Throws: UntellException
if any syntax or semantic errors occur while parsing the input file and/or if the KB is inconsistent after executing the UNTELL.
See Also:
fileRETELL, fileTELL, UNTELL
 o wipe
 public void wipe()
This method is not implemented yet


All Packages  Class Hierarchy  This Package  Previous  Next  Index