sl
Class SL0Codec

java.lang.Object
  extended bysl.SL0Codec
All Implemented Interfaces:
Codec

public class SL0Codec
extends java.lang.Object
implements Codec

The codec class for the SL0 language. This class implements the Codec interface and allows converting back and forth between strings and frames, according to the SL0 grammar.

WARNING: When creating the Ontology, notice that this SL0Parser returns a Java object of type Long everytime it parses an integer, and it returns a Java object of type Double everytime it parses a float. Therefore, the slots of the frames in the ontology must be of type, respectively, Ontology.LONG_TYPE and Ontology.DOUBLE_TYPE, otherwise you get an IllegalArgumentException.

Notice also that the following convention is needed for all the frames representing actions: the name of the frame must be NAME_OF_ACTION_FRAME, and the name of the two slots representing actor and the action term must be, respectively, NAME_OF_ACTOR_SLOT and NAME_OF_ACTION_SLOT.

Version:
$Date: 2003/10/09 13:00:37 $ $Revision: 1.1.1.1 $
Author:
Giovanni Rimassa - Universita` di Parma

Field Summary
private  SL0Encoder encoder
           
static java.lang.String NAME
          A symbolic constant, containing the name of this language.
static java.lang.String NAME_OF_ACTION_FRAME
          Symbolic constant identifying a frame representing an action
static java.lang.String NAME_OF_ACTION_SLOT
          Symbolic constant identifying a slot representing an action
static java.lang.String NAME_OF_ACTOR_SLOT
          Symbolic constant identifying a slot representing an actor
private  SL0Parser parser
           
 
Constructor Summary
SL0Codec()
           
 
Method Summary
 java.util.List decode(java.lang.String s, Ontology o)
          Decodes a given String, according to the given Content Language and obtains a t-uple of Frame objects.
 java.lang.String encode(java.util.List v, Ontology o)
          Encodes a t-uple of Frame objects into a Java String, according to this Content Language and Ontology by looking up the given ontology for the role played by symbols (i.e. whether they are concepts, actions or predicates).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
A symbolic constant, containing the name of this language.

See Also:
Constant Field Values

NAME_OF_ACTION_FRAME

public static java.lang.String NAME_OF_ACTION_FRAME
Symbolic constant identifying a frame representing an action


NAME_OF_ACTOR_SLOT

public static java.lang.String NAME_OF_ACTOR_SLOT
Symbolic constant identifying a slot representing an actor


NAME_OF_ACTION_SLOT

public static java.lang.String NAME_OF_ACTION_SLOT
Symbolic constant identifying a slot representing an action


parser

private SL0Parser parser

encoder

private SL0Encoder encoder
Constructor Detail

SL0Codec

public SL0Codec()
Method Detail

encode

public java.lang.String encode(java.util.List v,
                               Ontology o)
Description copied from interface: Codec
Encodes a t-uple of Frame objects into a Java String, according to this Content Language and Ontology by looking up the given ontology for the role played by symbols (i.e. whether they are concepts, actions or predicates).

Specified by:
encode in interface Codec
Parameters:
o - The ontology to use to lookup the roles for the various symbols.
Returns:
A Java string, representing the given frame according to this content language.

decode

public java.util.List decode(java.lang.String s,
                             Ontology o)
                      throws CodecException
Description copied from interface: Codec
Decodes a given String, according to the given Content Language and obtains a t-uple of Frame objects. This method can use the given ontology to distinguish among the different kinds of roles a symbol can play (i.e. Concept vs. Action vs. Predicate).

Specified by:
decode in interface Codec
Parameters:
s - A string containing the representation of an ontological element, encoded according to this content language.
o - The ontology to use to lookup the roles for the various symbols.
Returns:
A List of frame, representing the given ontological elements.
Throws:
CodecException


Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.