Interface Specification for KPRepr


[Contents] [Prev] [Next]
Table of Contents

Overview

This interface contains specifications for the intermediate representation of a Knowbot Program. It allows clients to get, set, and delete KP metadata, program code, program state, and suitcase elements.

The original interface was based on MIME, which may explain some of the names. It has evolved away from MIME however mostly for performance reasons.

Imported Interfaces

This interface imports the following interfaces:

Type

This interface defines the following non-OBJECT types:

String
An alias for ilu.CString
Strings
An alias for SEQUENCE OF STRING
BinaryString
An alias for SEQUENCE OF BYTE
ContentHeader
A RECORD characterizing the header for a part. We expect the content header to include other metadata in future releases. If we didn't, we could just pass the type names and forget defining an entire record. This type has the following fields:
name
A String which is the name of the header.
type
A String which is the type of the header.

Exceptions

This interface defines the following exceptions:

PartNameError
No part matches the specified name.

Objects

This interface defines the following OBJECT types:

NamedPart
An interface for construction and manipulation of an individual representation part. This is a general container mechanism with strong roots in MIME. It is not specific to Knowbot Programs.

Representation
An interface for the representation of a Knowbot Program. Representation objects are mostly containers for NamedPart objects and are the data structure that represents a Knowbot Program while it exists at the current KOS.

NamedPart Objects

GetNames () : Strings
Return the list of all names in this part.

SetPart (name : String, header : ContentHeader, data : BinaryString)
Sets the header and data for the named part. Creates a new part if necessary.

GetPart (name : String, OUT hdr : ContentHeader, OUT data : BinaryString)
Get the content header and contents of a part, return through the output parameters hdr and data. Raise PartNameError if the part specified by name is not found.

DeletePart (name : String)
Delete the named part. Raise PartNameError if the part specified by name is not found.

SetInfo (name : String, info : ContentHeader)
Set the information object to info for the named object. Raise PartNameError if the part specified by name is not found.

SetData (name : String, buffer : BinaryString)
Set the body part of the named part to buffer. Raise PartNameError if the part specified by name is not found.

GetInfo (name : String) : ContentHeader
Return the information object for the specified part. Raise PartNameError if the part specified by name is not found.

GetData (name : String) : BinaryString
Return the body of the named part. Raise PartNameError if the part specified by name is not found.

Representation Object

GetMetadata () : Mapping.StringMap
Return the metadata dictionary as a string mapping.

GetCode () : NamedPart
Return the code part.

GetState () : NamedPart
Return the state part.

GetSuitecase () : NamedPart
Return the suitcase part.

FreezeDry () : BinaryString
Returns the KP as a freeze dried, transportable, opaque representation (Like Hans Solo in Return of the Jedi).

Marshal () : BinaryString
Returns the KP as a marshalled representation. This method is Python specific.

Pickle() : BinaryString
Returns the KP's as a pickled representation This method is Python specific.

Table of Contents

[Contents] [Prev] [Next]
Copyright © 1998 by the Corporation for National Research Initiatives.