Class RclParser
java.lang.Object
org.tweetyproject.commons.Parser<RclBeliefSet,RelationalConditional>
org.tweetyproject.logics.rcl.parser.RclParser
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.
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
-
Method Summary
Modifier and TypeMethodDescriptionReturns the signature of this parser.parseBeliefBase
(Reader reader) Parses the given reader into a belief base of the given type.parseFormula
(Reader reader) Parses the given reader into a formula of the given type.Methods inherited from class org.tweetyproject.commons.Parser
isNumeric, parseBeliefBase, parseBeliefBaseFromFile, parseFormula, parseFormulaFromFile, parseListOfBeliefBases, parseListOfBeliefBases, parseListOfBeliefBasesFromFile, parseListOfBeliefBasesFromFile
-
Constructor Details
-
RclParser
public RclParser()Creates a new RCL Parser
-
-
Method Details
-
parseBeliefBase
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:
IOException
- if some IO issue occurred.ParserException
- some parsing exceptions may be added here.
-
parseFormula
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:
IOException
- if some IO issue occurred.ParserException
- some parsing exceptions may be added here.
-
getSignature
Returns the signature of this parser.- Returns:
- the signature of this parser.
-