Package org.tweetyproject.causal.parser
Class CausalParser
java.lang.Object
org.tweetyproject.commons.Parser<CausalKnowledgeBase,PlFormula>
org.tweetyproject.causal.parser.CausalParser
Parser for
CausalKnowledgeBase and observation as consumed by AbstractCausalReasoner.
A causal knowledge base can be parsed with parseBeliefBase(Reader).
Observations can be parsed with Parser.parseListOfFormulae(String, String).- Author:
- Lars Bengel, Oleksandr Dzhychko
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionparseBeliefBase(Reader reader) Parses data from the reader into aCausalKnowledgeBase.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, parseListOfFormulae
-
Constructor Details
-
CausalParser
public CausalParser()
-
-
Method Details
-
parseBeliefBase
Parses data from the reader into aCausalKnowledgeBase. Each line must contain either assumptions or are an equation. Assumptions and equations are defined as following:
equation ::= formula '<=>' formula
assumptions ::= '{' assumption (',' assumption)* '}'
assumption ::= formula
formula ::= a propositional formula as parsable byParser.parseFormula(String)- Specified by:
parseBeliefBasein classParser<CausalKnowledgeBase,PlFormula> - Parameters:
reader- a reader- Returns:
- the parsed causal knowledge base
- Throws:
IOException- if some IO issue occurred.ParserException- some parsing exceptions may be added here.
-
parseFormula
Description copied from class:ParserParses the given reader into a formula of the given type.- Specified by:
parseFormulain classParser<CausalKnowledgeBase,PlFormula> - Parameters:
reader- a reader- Returns:
- a formula
- Throws:
IOException- if some IO issue occurred.ParserException- some parsing exceptions may be added here.
-