Package net.sf.tweety.arg.aspic.parser
Class AspicParser<T extends Invertable>
- java.lang.Object
-
- net.sf.tweety.commons.Parser<AspicArgumentationTheory<T>,Formula>
-
- net.sf.tweety.arg.aspic.parser.AspicParser<T>
-
- Type Parameters:
T- is the type of the language that the ASPIC theory's rules range over
public class AspicParser<T extends Invertable> extends Parser<AspicArgumentationTheory<T>,Formula>
Parses a Aspic Argumentation System out of an input text. Every line contains one of the following:
<order> ::= <identifier> ( '<' <identifier> )+
<ordinary premise> ::= '=>' '-'? <identifier>
<axiom> ::= '->' '-'? <identifier>
<defeasible rule> ::= ( <identifier> ':' )? <identifier> ( ',' <identifier> )* '=>' (-)? <identifier>
<static rule> ::= <identifier> ( ',' <identifier> )* '->' (-)? <identifier>- Author:
- Nils Geilen
-
-
Field Summary
Fields Modifier and Type Field Description private Parser<? extends BeliefBase,? extends Formula>formulaparserUsed to parse formulaeprivate RuleFormulaGenerator<T>rfgprivate java.lang.StringsymbolCommaprivate java.lang.StringsymbolDefeasibleprivate java.lang.StringsymbolStrict
-
Constructor Summary
Constructors Constructor Description AspicParser(Parser<? extends BeliefBase,? extends Formula> formulaparser, RuleFormulaGenerator<T> rfg)Constructs a new instance
-
Method Summary
Modifier and Type Method Description AspicArgumentationTheory<T>parseBeliefBase(java.io.Reader reader)Parses the given reader into a belief base of the given type.FormulaparseFormula(java.io.Reader reader)Parses the given reader into a formula of the given type.SimpleAspicOrder<T>parseSimpleOrder(java.lang.String line)Extracts and Constructs aSimpleAspicOrderout of a stringvoidsetSymbolComma(java.lang.String symbolComma)Sets a new symbol used for parsing parameter separatorsvoidsetSymbolDefeasible(java.lang.String symbolDefeasible)Sets a new symbol used for parsing defeasible function arrowsvoidsetSymbolStrict(java.lang.String symbolStrict)Sets a new symbol used for parsing strict function arrows-
Methods inherited from class net.sf.tweety.commons.Parser
isNumeric, parseBeliefBase, parseBeliefBaseFromFile, parseFormula, parseFormulaFromFile
-
-
-
-
Field Detail
-
formulaparser
private final Parser<? extends BeliefBase,? extends Formula> formulaparser
Used to parse formulae
-
rfg
private RuleFormulaGenerator<T extends Invertable> rfg
-
symbolStrict
private java.lang.String symbolStrict
-
symbolDefeasible
private java.lang.String symbolDefeasible
-
symbolComma
private java.lang.String symbolComma
-
-
Constructor Detail
-
AspicParser
public AspicParser(Parser<? extends BeliefBase,? extends Formula> formulaparser, RuleFormulaGenerator<T> rfg)
Constructs a new instance- Parameters:
formulaparser- parses the bodies and the heads of the ASPIC argumentation systems rulesrfg- a generator, that transforms InferenceRule<T> into T
-
-
Method Detail
-
setSymbolStrict
public void setSymbolStrict(java.lang.String symbolStrict)
Sets a new symbol used for parsing strict function arrows- Parameters:
symbolStrict- is the new symbol
-
setSymbolDefeasible
public void setSymbolDefeasible(java.lang.String symbolDefeasible)
Sets a new symbol used for parsing defeasible function arrows- Parameters:
symbolDefeasible- is the new symbol
-
setSymbolComma
public void setSymbolComma(java.lang.String symbolComma)
Sets a new symbol used for parsing parameter separators- Parameters:
symbolComma- is the new symbol
-
parseBeliefBase
public AspicArgumentationTheory<T> parseBeliefBase(java.io.Reader reader) throws java.io.IOException, ParserException
Description copied from class:ParserParses the given reader into a belief base of the given type.- Specified by:
parseBeliefBasein classParser<AspicArgumentationTheory<T extends Invertable>,Formula>- 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 Formula parseFormula(java.io.Reader reader) throws java.io.IOException, ParserException
Description copied from class:ParserParses the given reader into a formula of the given type.- Specified by:
parseFormulain classParser<AspicArgumentationTheory<T extends Invertable>,Formula>- Parameters:
reader- a reader- Returns:
- a formula
- Throws:
java.io.IOException- if some IO issue occurred.ParserException- some parsing exceptions may be added here.
-
parseSimpleOrder
public SimpleAspicOrder<T> parseSimpleOrder(java.lang.String line)
Extracts and Constructs aSimpleAspicOrderout of a string- Parameters:
line- the source string- Returns:
- the parsed order
-
-