Package net.sf.tweety.logics.rcl.parser
Class RclParser
- java.lang.Object
-
- net.sf.tweety.commons.Parser<RclBeliefSet,RelationalConditional>
-
- net.sf.tweety.logics.rcl.parser.RclParser
-
public class RclParser extends Parser<RclBeliefSet,RelationalConditional>
This class implements a parser for relational conditional logic. The BNF for a conditional knowledge base is given by (starting symbol is KB)
KB ::== SORTSDEC PREDDECS (CONDITIONAL "\n")*
SORTSDEC ::== ( SORTNAME "=" "{" (CONSTANTNAME ("," CONSTANTNAME)*)? "}" "\n" )*
PREDDECS ::== ( "type" "(" PREDICATENAME "(" (SORTNAME ("," SORTNAME)*)? ")" ")" "\n" )*
CONDITIONAL ::== "(" FORMULA ")" "[" PROB "]" | "(" FORMULA "|" FORMULA ")"
FORMULA ::== ATOM | "(" FORMULA ")" | FORMULA "&&" FORMULA | FORMULA "||" FORMULA | "!" FORMULA | "+" | "-"
ATOM ::== PREDICATENAME "(" (TERM ("," TERM)*)? ")"
TERM ::== VARIABLENAME | CONSTANTNAME
where SORTNAME, PREDICATENAME, CONSTANTNAME, and VARIABLENAME are sequences of
symbols from {a,...,z,A,...,Z,0,...,9} with a letter at the beginning.- Author:
- Matthias Thimm
-
-
Constructor Summary
Constructors Constructor Description RclParser()
Creates a new RCL Parser
-
Method Summary
Modifier and Type Method Description FolSignature
getSignature()
Returns the signature of this parser.RclBeliefSet
parseBeliefBase(java.io.Reader reader)
Parses the given reader into a belief base of the given type.RelationalConditional
parseFormula(java.io.Reader reader)
Parses the given reader into a formula of the given type.-
Methods inherited from class net.sf.tweety.commons.Parser
isNumeric, parseBeliefBase, parseBeliefBaseFromFile, parseFormula, parseFormulaFromFile
-
-
-
-
Method Detail
-
parseBeliefBase
public RclBeliefSet parseBeliefBase(java.io.Reader reader) throws java.io.IOException, ParserException
Description copied from class:Parser
Parses the given reader into a belief base of the given type.- Specified by:
parseBeliefBase
in classParser<RclBeliefSet,RelationalConditional>
- Parameters:
reader
- a reader- Returns:
- a belief base
- Throws:
java.io.IOException
- if some IO issue occurred.ParserException
- some parsing exceptions may be added here.
-
parseFormula
public RelationalConditional parseFormula(java.io.Reader reader) throws java.io.IOException, ParserException
Description copied from class:Parser
Parses the given reader into a formula of the given type.- Specified by:
parseFormula
in classParser<RclBeliefSet,RelationalConditional>
- Parameters:
reader
- a reader- Returns:
- a formula
- Throws:
java.io.IOException
- if some IO issue occurred.ParserException
- some parsing exceptions may be added here.
-
getSignature
public FolSignature getSignature()
Returns the signature of this parser.- Returns:
- the signature of this parser.
-
-