Class CnfParser
java.lang.Object
org.tweetyproject.commons.Parser<DungTheory,Formula>
org.tweetyproject.arg.dung.parser.AbstractDungParser
org.tweetyproject.arg.dung.parser.CnfParser
Parses abstract argumentation frameworks in the CNF/Dimacs Format used for the
SAT solver competition (see also http://people.sc.fsu.edu/~jburkardt/data/cnf/cnf.html).
It is given by the following BNF (start symbol is S):
S ::== COMMENTS "\n" PROBLEM "\n" ATTACKS
COMMENTS ::== ("c" COMMENT "\n")*
PROBLEM ::== "p af " INT INT
ATTACKS ::== (INT " -" INT " 0\n")* where "COMMENT" represents any string, and INT is a positive natural number. Lines beginning with "c" are comment lines and are ignored by the parser. The line beginning with "p af" is the problem definition, it is followed by two positive integers where the first is the number of arguments and the second is the number of attacks in the given framework. After the problem definition there is one line for each attack. The first integer in these lines describe the attacker of the attack and the second the attacked (the attacked is also prefixed by a minus sign "-"). Each line of an attack ends with "0" and a line break.
S ::== COMMENTS "\n" PROBLEM "\n" ATTACKS
COMMENTS ::== ("c" COMMENT "\n")*
PROBLEM ::== "p af " INT INT
ATTACKS ::== (INT " -" INT " 0\n")* where "COMMENT" represents any string, and INT is a positive natural number. Lines beginning with "c" are comment lines and are ignored by the parser. The line beginning with "p af" is the problem definition, it is followed by two positive integers where the first is the number of arguments and the second is the number of attacks in the given framework. After the problem definition there is one line for each attack. The first integer in these lines describe the attacker of the attack and the second the attacked (the attacked is also prefixed by a minus sign "-"). Each line of an attack ends with "0" and a line break.
- Author:
- Matthias Thimm
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionParses the given file into an abstract argumentation frameworkMethods inherited from class org.tweetyproject.arg.dung.parser.AbstractDungParser
getParser, parseArgumentList, parseBeliefBase, parseBoolean, parseExtensionList, parseFormula, parseJavaStringRepresentation, parseLabeling, parseLabelingList
Methods inherited from class org.tweetyproject.commons.Parser
isNumeric, parseBeliefBase, parseBeliefBaseFromFile, parseFormula, parseFormulaFromFile, parseListOfBeliefBases, parseListOfBeliefBases, parseListOfBeliefBasesFromFile, parseListOfBeliefBasesFromFile
-
Constructor Details
-
CnfParser
public CnfParser()
-
-
Method Details
-
parse
Description copied from class:AbstractDungParser
Parses the given file into an abstract argumentation framework- Specified by:
parse
in classAbstractDungParser
- Parameters:
reader
- some reader- Returns:
- an abstract argumentation framework
- Throws:
IOException
- for all errors concerning file reading.
-