edu.cs.ai.kreator.models
Class KnowledgebaseParser

java.lang.Object
  extended by edu.cs.ai.kreator.models.KnowledgebaseParser
All Implemented Interfaces:
ModelComponent

public abstract class KnowledgebaseParser
extends java.lang.Object
implements ModelComponent

This abstract class models a knowledge base parser, i.e. a structure that is capable of reading the model of a knowledge base from a file or string in some specific syntax.

Author:
Matthias Thimmm, Marc Finthammer

Constructor Summary
KnowledgebaseParser()
           
 
Method Summary
abstract  java.lang.String getAcronymForIcons()
          Returns the acronym (max. 3 letters) for this parser's files that are used for icons in the GUI.
static java.util.List<KnowledgebaseParser> getAllParser()
          This method returns a comprehensive list of all parser currently available in the system.
static java.util.List<java.lang.String> getAllSupportedFileExtensions()
          Returns a list of all file extensions that are supported by some knowledge base parser.
abstract  java.awt.Color getColorForIcons()
          Returns the color for this parser's files that are used for icons in the GUI.
static KnowledgebaseParser getParserFor(java.lang.String fileextension)
          Returns an appropriate parser for a file with the given file extension.
abstract  java.lang.String getSupportedFileExtension()
          Returns the file extension of the files this parser parses (without the dot).
static boolean isSupported(java.lang.String fileextension)
          Checks whether the given file extension is supported by any knowledge base parser.
 Knowledgebase parse(java.io.File kbaseFile)
          Parses the given file into a knowledge base.
abstract  Knowledgebase parse(java.lang.String kbaseString)
          Parses the given string into a knowledge base.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.cs.ai.kreator.models.ModelComponent
getDescription, getId, getSupportedKnowledgeBaseClass
 

Constructor Detail

KnowledgebaseParser

public KnowledgebaseParser()
Method Detail

isSupported

public static boolean isSupported(java.lang.String fileextension)
Checks whether the given file extension is supported by any knowledge base parser.

Parameters:
fileextension - a string representing a file extension.
Returns:
"true" if there is a parser for the given file extension.

getParserFor

public static KnowledgebaseParser getParserFor(java.lang.String fileextension)
Returns an appropriate parser for a file with the given file extension.

Parameters:
fileextension - a string representing a file extension.
Returns:
a knowledge base parser for files with the given file extension.

getAllParser

public static java.util.List<KnowledgebaseParser> getAllParser()
This method returns a comprehensive list of all parser currently available in the system.

Returns:
a comprehensive list of all parser currently available in the system.

getAllSupportedFileExtensions

public static java.util.List<java.lang.String> getAllSupportedFileExtensions()
Returns a list of all file extensions that are supported by some knowledge base parser.

Returns:
a list of file extensions

parse

public Knowledgebase parse(java.io.File kbaseFile)
                    throws java.io.IOException,
                           ParsingException
Parses the given file into a knowledge base.

Parameters:
file - a file.
Returns:
a knowledge base.
Throws:
java.io.IOException
ParsingException

parse

public abstract Knowledgebase parse(java.lang.String kbaseString)
                             throws java.io.IOException,
                                    ParsingException
Parses the given string into a knowledge base.

Parameters:
s - a string.
Returns:
a knowledge base.
Throws:
java.io.IOException
ParsingException

getSupportedFileExtension

public abstract java.lang.String getSupportedFileExtension()
Returns the file extension of the files this parser parses (without the dot).

Returns:
the file extension of the files this parser parses (without the dot).

getAcronymForIcons

public abstract java.lang.String getAcronymForIcons()
Returns the acronym (max. 3 letters) for this parser's files that are used for icons in the GUI.

Returns:
the acronym (max. 3 letters) for this parser's files that are used for icons in the GUI.

getColorForIcons

public abstract java.awt.Color getColorForIcons()
Returns the color for this parser's files that are used for icons in the GUI.

Returns:
the color for this parser's files that are used for icons in the GUI.